33 const wxPoint& aPos,
const wxSize& aSize ) :
34 wxPanel( aParent, aId, aPos, aSize, wxBORDER_NONE | wxTAB_TRAVERSAL,
35 wxS(
"DropDownButton" ) ),
41 if( aSize == wxDefaultSize )
43 wxSize
defaultSize = wxButton::GetDefaultSize( aParent );
44 wxSize textSize = GetTextExtent(
m_label );
167 aEvent.GetPosition( &x, &y );
171 wxEvtHandler* pEventHandler = GetEventHandler();
172 wxASSERT( pEventHandler );
174 pEventHandler->CallAfter(
177 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
178 evt.SetEventObject(
this );
179 GetEventHandler()->ProcessEvent( evt );
225 wxPaintDC dc(
this );
226 wxSize size = GetSize();
230 auto drawBackground =
239 wxColor fg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
240 wxColor bg = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
244 bg = bg.ChangeLightness(
m_bIsEnable ? 130 : 120 );
250 bg = bg.ChangeLightness(
m_bIsEnable ? 200 : 160 );
252 fg = fg.ChangeLightness( 180 );
256 dc.DrawRoundedRectangle( aRect, aRect.height / 4.0 );
265 r1.height = size.GetHeight();
269 drawBackground( r1 );
276 wxRendererNative::Get().DrawPushButton(
this, dc, r1,
m_stateButton );
279 SetForegroundColour(
m_bIsEnable ? wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT )
280 : wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
285 wxSize bmpSize =
m_bitmap.GetDefaultSize();
287 wxSize bmpSize =
m_bitmap.GetPreferredBitmapSizeFor(
this );
289 wxBitmap bmp =
m_bitmap.GetBitmapFor(
this );
290 wxMemoryDC mdc( bmp );
292 r1.x = ( width - bmpSize.GetWidth() ) / 2;
297 r1.y += ( size.GetHeight() - bmpSize.GetHeight() ) / 2;
299 dc.Blit( wxPoint( r1.x, r1.y ), bmpSize, &mdc, wxPoint( 0, 0 ), wxCOPY,
true );
303 r1.y += ( ( size.GetHeight() - GetCharHeight() ) / 2 ) - 1;
304 dc.DrawLabel(
m_label, r1, wxALIGN_CENTER_HORIZONTAL );
312 r2.height = size.GetHeight();
316 drawBackground( r2 );
319 wxRendererNative::Get().DrawPushButton(
this, dc, r2,
m_stateMenu );
322 wxRendererNative::Get().DrawDropArrow(
this, dc, r2,
m_stateMenu );