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 );
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 );
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 );
248 bg = bg.ChangeLightness(
m_bIsEnable ? 130 : 120 );
254 bg = bg.ChangeLightness(
m_bIsEnable ? 200 : 160 );
256 fg = fg.ChangeLightness( 180 );
260 dc.DrawRoundedRectangle( aRect, aRect.height / 4.0 );
269 r1.height = size.GetHeight();
273 drawBackground( r1 );
280 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton );
283 SetForegroundColour(
m_bIsEnable ? wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT )
284 : wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
289 wxSize bmpSize =
m_bitmap.GetDefaultSize();
291 wxSize bmpSize =
m_bitmap.GetPreferredBitmapSizeFor(
this );
293 wxBitmap bmp =
m_bitmap.GetBitmapFor(
this );
294 wxMemoryDC mdc( bmp );
296 r1.x = ( width - bmpSize.GetWidth() ) / 2;
301 r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2;
303 dc.Blit( wxPoint( r1.x, r1.y ), bmpSize, &mdc, wxPoint( 0, 0 ), wxCOPY,
true );
307 r1.y += ( ( size.GetHeight() - GetCharHeight() ) / 2 ) - 1;
308 dc.DrawLabel(
m_label, r1, wxALIGN_CENTER_HORIZONTAL );
316 r2.height = size.GetHeight();
320 drawBackground( r2 );
323 wxRendererNative::Get().DrawPushButton(
this, dc, r2,
m_stateMenu );
326 wxRendererNative::Get().DrawDropArrow(
this, dc, r2,
m_stateMenu );