31 const wxSize& aSize,
int aStyles ) :
32 wxPanel( aParent, aId, aPos, aSize, aStyles ),
53 else if( aNumber == 0 )
115 #define BADGE_FONTWEIGHT wxFONTWEIGHT_NORMAL 116 #define PLATFORM_FUDGE_X 0.8 117 #define PLATFORM_FUDGE_Y 1.6 121 #define BADGE_FONTWEIGHT wxFONTWEIGHT_BOLD 122 #define PLATFORM_FUDGE_X 1.0 123 #define PLATFORM_FUDGE_Y 1.0 127 #define BADGE_FONTWEIGHT wxFONTWEIGHT_BOLD 128 #define PLATFORM_FUDGE_X 1.0 129 #define PLATFORM_FUDGE_Y 1.0 134 wxClientDC dc(
this );
137 int len =
test.length();
142 test.Pad( len,
'9' );
145 dc.SetFont( wxFont(
m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
146 wxSize size = dc.GetTextExtent(
test );
148 size.y *= PLATFORM_FUDGE_Y;
149 size.x = std::max<int>( size.x * PLATFORM_FUDGE_X, size.y );
159 wxSize clientSize = GetSize();
160 wxPaintDC dc(
this );
165 dc.SetBackground( *wxTRANSPARENT_BRUSH );
174 wxRect rect( wxPoint( 0, 0 ), clientSize - wxSize( 1, 1 ) );
176 brush.SetStyle( wxBRUSHSTYLE_SOLID );
178 dc.SetBrush( brush );
180 dc.DrawRoundedRectangle( rect, rect.height / 2 );
188 dc.SetFont( wxFont(
m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
190 dc.DrawLabel( text, wxRect( wxPoint( 0, 0 ), clientSize ), wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL );
void computeSize()
Helper function to compute the size of the badge.
void onPaint(wxPaintEvent &aEvt)
Handler that actually paints the badge and the text.
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
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 SetTextSize(int aSize)
Set the text size to use on the badge.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void SetMaximumNumber(int aMax)
Set the maximum number to be shown on the badge.
A color representation with 4 components: red, green, blue, alpha.