22#include <fmt/format.h>
27 const wxSize& aSize,
int aStyles ) :
28 wxPanel( aParent, aId, aPos, aSize, aStyles ),
49 else if( aNumber == 0 )
111#if defined( __WXMAC__ )
112#define BADGE_FONTWEIGHT wxFONTWEIGHT_NORMAL
113#define PLATFORM_FUDGE_X 0.92
114#define PLATFORM_FUDGE_Y 1.6
116#define BADGE_FONTWEIGHT wxFONTWEIGHT_BOLD
117#define PLATFORM_FUDGE_X 1.0
118#define PLATFORM_FUDGE_Y 1.0
124 wxClientDC dc(
this );
127 int len =
test.length();
132 test.Pad( len,
'9' );
138 wxSize size = dc.GetTextExtent(
test );
151 wxSize clientSize = GetSize();
152 wxPaintDC dc(
this );
157 dc.SetBackground( *wxTRANSPARENT_BRUSH );
166 wxRect rect( wxPoint( 0, 0 ), clientSize - wxSize( 1, 1 ) );
168 brush.SetStyle( wxBRUSHSTYLE_SOLID );
170 dc.SetBrush( brush );
172 dc.DrawRoundedRectangle( rect, rect.height / 2 );
182 dc.DrawLabel(
text, wxRect( wxPoint( 0, 0 ), clientSize ),
183 wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL );
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
void SetMaximumNumber(int aMax)
Set the maximum number to be shown on the badge.
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
void computeSize()
Helper function to compute the size of the badge.
void SetTextSize(int aSize)
Set the text size to use on the badge.
NUMBER_BADGE(wxWindow *aParent, wxWindowID aId, const wxPoint &aPos, const wxSize &aSize, int aStyles)
Create a number badge with 10pt font and a maximum number of 1000.
void onPaint(wxPaintEvent &aEvt)
Handler that actually paints the badge and the text.