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,
39 wxS(
"DropDownButton" ) ),
45 if( aSize == wxDefaultSize )
47 wxSize
defaultSize = wxButton::GetDefaultSize( aParent );
48 wxSize textSize = GetTextExtent(
m_label );
84 aSize.GetHeight() ) );
171 aEvent.GetPosition( &x, &y );
175 wxEvtHandler* pEventHandler = GetEventHandler();
176 wxASSERT( pEventHandler );
178 pEventHandler->CallAfter(
181 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
182 evt.SetEventObject(
this );
183 GetEventHandler()->ProcessEvent( evt );
199 aEvent.GetPosition( &x, &y );
207 wxSize size = GetSize();
210 position.y = size.GetHeight();
211 PopupMenu(
m_pMenu, position );
229 wxPaintDC dc(
this );
230 wxSize size = GetSize();
234 auto drawBackground =
243 wxColor fg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
244 wxColor bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
251 bg = bg.ChangeLightness(
m_bIsEnable ? 130 : 120 );
257 bg = bg.ChangeLightness(
m_bIsEnable ? 200 : 160 );
259 fg = fg.ChangeLightness( 180 );
263 dc.DrawRoundedRectangle( aRect, aRect.height / 4.0 );
272 r1.height = size.GetHeight();
276 drawBackground( r1 );
283 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton );
286 SetForegroundColour(
m_bIsEnable ? wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT )
287 : wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
292 wxSize bmpSize =
m_bitmap.GetDefaultSize();
294 wxSize bmpSize =
m_bitmap.GetPreferredBitmapSizeFor(
this );
296 wxBitmap bmp =
m_bitmap.GetBitmapFor(
this );
297 wxMemoryDC mdc( bmp );
299 r1.x = ( width - bmpSize.GetWidth() ) / 2;
304 r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2;
306 dc.Blit( wxPoint( r1.x, r1.y ), bmpSize, &mdc, wxPoint( 0, 0 ), wxCOPY, true );
310 r1.y += ( ( size.GetHeight() - GetCharHeight() ) / 2 ) - 1;
311 dc.DrawLabel(
m_label, r1, wxALIGN_CENTER_HORIZONTAL );
319 r2.height = size.GetHeight();
323 drawBackground( r2 );
326 wxRendererNative::Get().DrawPushButton(
this, dc, r2,
m_stateMenu );
329 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...