28#include <wx/dcclient.h>
30#include <wx/renderer.h>
31#include <wx/settings.h>
32#include <wx/version.h>
37 const wxBitmap& aDummyBitmap,
const wxPoint& aPos,
38 const wxSize& aSize,
int aStyle ) :
39 wxPanel( aParent, aId, aPos, aSize, aStyle, wxS(
"StdBitmapButton" ) )
41 if( aSize == wxDefaultSize )
43 wxSize
defaultSize = wxButton::GetDefaultSize( aParent );
54 Bind( wxEVT_SYS_COLOUR_CHANGED,
76 wxSize size =
m_bitmap.GetDefaultSize();
78 wxSize size =
m_bitmap.GetPreferredBitmapSizeFor(
this );
81 SetMinSize( wxSize( size.GetWidth() + 8, size.GetHeight() + 8 ) );
127 wxEvtHandler* pEventHandler = GetEventHandler();
128 wxASSERT( pEventHandler );
130 pEventHandler->CallAfter(
133 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
134 evt.SetEventObject(
this );
135 GetEventHandler()->ProcessEvent( evt );
153 wxPaintDC dc(
this );
154 wxSize size = GetSize();
157 auto drawBackground =
166 wxColor fg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
167 wxColor bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
174 bg = bg.ChangeLightness(
m_bIsEnable ? 130 : 120 );
180 bg = bg.ChangeLightness(
m_bIsEnable ? 200 : 160 );
182 fg = fg.ChangeLightness( 180 );
186 dc.DrawRoundedRectangle( aRect, aRect.height / 4.0 );
193 r1.width = size.GetWidth();
194 r1.height = size.GetHeight();
198 drawBackground( r1 );
204 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton );
210 wxSize bmpSize =
m_bitmap.GetDefaultSize();
212 wxSize bmpSize =
m_bitmap.GetPreferredBitmapSizeFor(
this );
215 r1.x = ( size.GetWidth() - bmpSize.GetWidth() ) / 2;
220 r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2;
222 wxBitmap bm =
m_bitmap.GetBitmapFor(
this );
225 bm.ConvertToDisabled();
227 dc.DrawBitmap( bm, r1.x, r1.y,
true );
static const wxSize defaultSize(FRAME_T aFrameType)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...