28#include <wx/dcclient.h>
29#include <wx/dcmemory.h>
31#include <wx/renderer.h>
32#include <wx/settings.h>
33#include <wx/version.h>
37 const wxPoint& aPos,
const wxSize& aSize ) :
38 wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL, wxS(
"DropDownButton" ) ),
44 if( aSize == wxDefaultSize )
46 wxSize
defaultSize = wxButton::GetDefaultSize( aParent );
47 wxSize textSize = GetTextExtent(
m_label );
83 aSize.GetHeight() ) );
170 aEvent.GetPosition( &x, &y );
174 wxEvtHandler* pEventHandler = GetEventHandler();
175 wxASSERT( pEventHandler );
177 pEventHandler->CallAfter(
180 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
181 evt.SetEventObject(
this );
182 GetEventHandler()->ProcessEvent( evt );
198 aEvent.GetPosition( &x, &y );
206 wxSize size = GetSize();
209 position.y = size.GetHeight();
210 PopupMenu(
m_pMenu, position );
228 wxPaintDC dc(
this );
229 wxSize size = GetSize();
233 auto drawBackground =
242 wxColor fg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
243 wxColor bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
250 bg = bg.ChangeLightness(
m_bIsEnable ? 130 : 120 );
256 bg = bg.ChangeLightness(
m_bIsEnable ? 200 : 160 );
258 fg = fg.ChangeLightness( 180 );
262 dc.DrawRoundedRectangle( aRect, aRect.height / 4.0 );
271 r1.height = size.GetHeight();
275 drawBackground( r1 );
281 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton );
284 SetForegroundColour(
m_bIsEnable ? wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT )
285 : wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
290 wxSize bmpSize =
m_bitmap.GetDefaultSize();
292 wxSize bmpSize =
m_bitmap.GetPreferredBitmapSizeFor(
this );
294 wxBitmap bmp =
m_bitmap.GetBitmapFor(
this );
295 wxMemoryDC mdc( bmp );
297 r1.x = ( width - bmpSize.GetWidth() ) / 2;
302 r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2;
304 dc.Blit( wxPoint( r1.x, r1.y ), bmpSize, &mdc, wxPoint( 0, 0 ), wxCOPY, true );
308 r1.y += ( ( size.GetHeight() - GetCharHeight() ) / 2 ) - 1;
309 dc.DrawLabel(
m_label, r1, wxALIGN_CENTER_HORIZONTAL );
317 r2.height = size.GetHeight();
321 drawBackground( r2 );
324 wxRendererNative::Get().DrawPushButton(
this, dc, r2,
m_stateMenu );
327 wxRendererNative::Get().DrawDropArrow(
this, dc, r2,
m_stateMenu );
static const wxSize defaultSize(FRAME_T aFrameType, wxWindow *aWindow)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...