KiCad PCB EDA Suite
|
A simple UI element that puts a number on top of a colored rounded rectangle with a fill color that shows the severity of the reports the number is counting (e.g. More...
#include <number_badge.h>
Public Member Functions | |
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 | UpdateNumber (int aNumber, SEVERITY aSeverity) |
Update the number displayed on the badge. | |
void | SetMaximumNumber (int aMax) |
Set the maximum number to be shown on the badge. | |
void | SetTextSize (int aSize) |
Set the text size to use on the badge. | |
Protected Member Functions | |
void | computeSize () |
Helper function to compute the size of the badge. | |
void | onPaint (wxPaintEvent &aEvt) |
Handler that actually paints the badge and the text. | |
Protected Attributes | |
int | m_textSize |
int | m_maxNumber |
int | m_currentNumber |
bool | m_showBadge |
wxColour | m_badgeColour |
wxColour | m_textColour |
A simple UI element that puts a number on top of a colored rounded rectangle with a fill color that shows the severity of the reports the number is counting (e.g.
green, yellow, red). This badge will also automatically truncate the displayed number to the set maximum and display "+" at the end to represent it is truncated.
Definition at line 39 of file number_badge.h.
NUMBER_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.
Definition at line 30 of file number_badge.cpp.
References computeSize(), and onPaint().
|
protected |
Helper function to compute the size of the badge.
Definition at line 125 of file number_badge.cpp.
References BADGE_FONTWEIGHT, m_currentNumber, m_maxNumber, m_textSize, PLATFORM_FUDGE_X, and PLATFORM_FUDGE_Y.
Referenced by NUMBER_BADGE(), SetTextSize(), and UpdateNumber().
|
protected |
Handler that actually paints the badge and the text.
Definition at line 151 of file number_badge.cpp.
References BADGE_FONTWEIGHT, m_badgeColour, m_currentNumber, m_maxNumber, m_showBadge, m_textColour, m_textSize, and text.
Referenced by NUMBER_BADGE().
void NUMBER_BADGE::SetMaximumNumber | ( | int | aMax | ) |
Set the maximum number to be shown on the badge.
Any numbers greater than this will be displayed as the maximum number followed by "+".
aMax | is the maximum number |
Definition at line 100 of file number_badge.cpp.
References m_maxNumber.
Referenced by DIALOG_ERC::DIALOG_ERC(), DIALOG_DRC::updateDisplayedCounts(), and DIALOG_FOOTPRINT_CHECKER::updateDisplayedCounts().
void NUMBER_BADGE::SetTextSize | ( | int | aSize | ) |
Set the text size to use on the badge.
aSize | is the text size (in pt) to use on the badge |
Definition at line 106 of file number_badge.cpp.
References computeSize(), and m_textSize.
void NUMBER_BADGE::UpdateNumber | ( | int | aNumber, |
SEVERITY | aSeverity | ||
) |
Update the number displayed on the badge.
Severity to badge color mapping:
aNumber | is the new number to display. |
aSeverity | is the new severity of the badge. |
Definition at line 43 of file number_badge.cpp.
References computeSize(), GREEN, KIPLATFORM::UI::IsDarkTheme(), m_badgeColour, m_currentNumber, m_showBadge, m_textColour, Refresh(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_EXCLUSION, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, and KIGFX::COLOR4D::ToColour().
Referenced by WX_HTML_REPORT_PANEL::updateBadges(), DIALOG_ERC::updateDisplayedCounts(), DIALOG_DRC::updateDisplayedCounts(), and DIALOG_FOOTPRINT_CHECKER::updateDisplayedCounts().
|
protected |
Definition at line 94 of file number_badge.h.
Referenced by onPaint(), and UpdateNumber().
|
protected |
Definition at line 92 of file number_badge.h.
Referenced by computeSize(), onPaint(), and UpdateNumber().
|
protected |
Definition at line 90 of file number_badge.h.
Referenced by computeSize(), onPaint(), and SetMaximumNumber().
|
protected |
Definition at line 93 of file number_badge.h.
Referenced by onPaint(), and UpdateNumber().
|
protected |
Definition at line 95 of file number_badge.h.
Referenced by onPaint(), and UpdateNumber().
|
protected |
Definition at line 89 of file number_badge.h.
Referenced by computeSize(), onPaint(), and SetTextSize().