31 const wxSize& aSize,
int aStyles ) :
32 wxPanel( aParent, aId, aPos, aSize, aStyles ),
53 else if( aNumber == 0 )
116#define BADGE_FONTWEIGHT wxFONTWEIGHT_NORMAL
117#define PLATFORM_FUDGE_X 0.92
118#define PLATFORM_FUDGE_Y 1.6
122#define BADGE_FONTWEIGHT wxFONTWEIGHT_BOLD
123#define PLATFORM_FUDGE_X 1.0
124#define PLATFORM_FUDGE_Y 1.0
128#define BADGE_FONTWEIGHT wxFONTWEIGHT_BOLD
129#define PLATFORM_FUDGE_X 1.0
130#define PLATFORM_FUDGE_Y 1.0
135 wxClientDC dc(
this );
138 int len =
test.length();
143 test.Pad( len,
'9' );
148 dc.SetFont( wxFont(
m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
149 wxSize size = dc.GetTextExtent(
test );
151 size.y *= PLATFORM_FUDGE_Y;
152 size.x = std::max<int>( size.x * PLATFORM_FUDGE_X, size.y );
162 wxSize clientSize = GetSize();
163 wxPaintDC dc(
this );
168 dc.SetBackground( *wxTRANSPARENT_BRUSH );
177 wxRect rect( wxPoint( 0, 0 ), clientSize - wxSize( 1, 1 ) );
179 brush.SetStyle( wxBRUSHSTYLE_SOLID );
181 dc.SetBrush( brush );
183 dc.DrawRoundedRectangle( rect, rect.height / 2 );
191 dc.SetFont( wxFont(
m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
193 dc.DrawLabel(
text, wxRect( wxPoint( 0, 0 ), clientSize ), 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.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.