26#include <wx/dcclient.h>
27#include <wx/renderer.h>
28#include <wx/settings.h>
30#define wxCONTROL_SEPARATOR wxCONTROL_SPECIAL
34 const wxSize& aSize,
int aStyles ) :
35 wxPanel( aParent, aId, aPos, aSize, aStyles ),
53 const wxPoint& aPos,
const wxSize& aSize,
int aStyles ) :
54 wxPanel( aParent, aId, aPos, aSize, aStyles ),
100 return wxSize( FromDIP(
m_dipSize.x +
m_padding * 2 ), wxButton::GetDefaultSize().y );
111 InvalidateBestSize();
146 if(
hasFlag( wxCONTROL_CURRENT | wxCONTROL_PRESSED ) )
148 clearFlag( wxCONTROL_CURRENT | wxCONTROL_PRESSED );
158 if( !
hasFlag( wxCONTROL_CURRENT ) )
170 if(
hasFlag( wxCONTROL_FOCUSED | wxCONTROL_CURRENT | wxCONTROL_PRESSED | wxCONTROL_SELECTED ) )
172 clearFlag( wxCONTROL_FOCUSED | wxCONTROL_CURRENT | wxCONTROL_PRESSED | wxCONTROL_SELECTED );
182 if( !
hasFlag( wxCONTROL_CHECKABLE ) )
184 if( !
hasFlag( wxCONTROL_FOCUSED ) )
199 if( !
hasFlag( wxCONTROL_DISABLED )
202 GetEventHandler()->CallAfter( [
this]()
204 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
205 evt.SetEventObject(
this );
206 GetEventHandler()->ProcessEvent( evt );
219 if(
hasFlag( wxCONTROL_CHECKABLE ) )
225 GetEventHandler()->CallAfter(
228 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
229 evt.SetEventObject(
this );
231 GetEventHandler()->ProcessEvent( evt );
238 GetEventHandler()->CallAfter(
241 wxCommandEvent evt( wxEVT_BUTTON, GetId() );
242 evt.SetEventObject(
this );
244 GetEventHandler()->ProcessEvent( evt );
269 wxColor highlightColor = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
272 wxRect
rect( wxPoint( 0, 0 ), GetSize() );
273 wxPaintDC
dc(
this );
277 dc.SetPen( wxPen( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) ) );
278 dc.DrawLine( wxPoint( GetSize().x / 2, 0 ), wxPoint( GetSize().x / 2, GetSize().y ) );
283 if( !
hasFlag( wxCONTROL_DISABLED ) )
285 if(
hasFlag( wxCONTROL_PRESSED ) )
287 dc.SetPen( wxPen( highlightColor ) );
288 dc.SetBrush( wxBrush( highlightColor.ChangeLightness( darkMode ? 20 : 150 ) ) );
291 else if(
hasFlag( wxCONTROL_CURRENT | wxCONTROL_FOCUSED ) )
293 dc.SetPen( wxPen( highlightColor ) );
294 dc.SetBrush( wxBrush( highlightColor.ChangeLightness( darkMode ? 40 : 170 ) ) );
297 if(
hasFlag( wxCONTROL_CHECKED ) )
298 dc.SetBrush( wxBrush( highlightColor.ChangeLightness( darkMode ? 50 : 180 ) ) );
302 else if(
hasFlag( wxCONTROL_CHECKED ) )
304 dc.SetPen( wxPen( highlightColor ) );
305 dc.SetBrush( wxBrush( highlightColor.ChangeLightness( darkMode ? 40 : 170 ) ) );
318 bmpImg = bmp.GetBitmap( ToPhys( FromDIP(
m_dipSize ) ) );
319 bmSize = bmpImg.GetLogicalSize();
324 drawBmpPos.x = (
rect.width - bmSize.x ) / 2;
325 drawBmpPos.y = (
rect.height - bmSize.y ) / 2;
330 dc.DrawBitmap( bmpImg, drawBmpPos,
true );
337 wxSize text_padding( 2, 1 );
342 wxSize box_size =
dc.GetTextExtent(
m_badgeText ) + text_padding;
343 wxSize box_offset = box_size;
350 dc.DrawRoundedRectangle(
rect.GetRightBottom() - box_offset, box_size, -0.25 );
353 dc.DrawText(
m_badgeText,
rect.GetRightBottom() - box_offset + ( text_padding / 2 ) );
361 if( aEnable !=
hasFlag( wxCONTROL_DISABLED ) )
364 wxPanel::Enable( aEnable );
366 if( aEnable &&
hasFlag( wxCONTROL_DISABLED ) )
372 if( !aEnable && !
hasFlag( wxCONTROL_DISABLED ) )
384 setFlag( wxCONTROL_CHECKABLE );
390 setFlag( wxCONTROL_CHECKABLE );
405 wxASSERT_MSG(
hasFlag( wxCONTROL_CHECKABLE ), wxS(
"Button is not a checkButton." ) );
407 if( aCheck && !
hasFlag( wxCONTROL_CHECKED ) )
413 if( !aCheck &&
hasFlag( wxCONTROL_CHECKED ) )
423 wxASSERT_MSG(
hasFlag( wxCONTROL_CHECKABLE ), wxS(
"Button is not a checkButton." ) );
425 return hasFlag( wxCONTROL_CHECKED );
DATABASE_CONNECTION dc(odbcBackend(cs))
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)