KiCad PCB EDA Suite
Loading...
Searching...
No Matches
number_badge.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef NUMBER_BADGE_H_
21#define NUMBER_BADGE_H_
22
23#include <widgets/ui_common.h>
24#include <wx/dcclient.h>
25#include <wx/panel.h>
26#include <kicommon.h>
27
28
35class KICOMMON_API NUMBER_BADGE : public wxPanel
36{
37public:
41 NUMBER_BADGE( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos,
42 const wxSize& aSize, int aStyles );
43
57 void UpdateNumber( int aNumber, SEVERITY aSeverity );
58
65 void SetMaximumNumber( int aMax );
66
72 void SetTextSize( int aSize );
73
74protected:
78 void computeSize();
79
83 void onPaint( wxPaintEvent& aEvt );
84
85 int m_textSize; // The text size to use
86 int m_maxNumber; // The maximum number allowed to be shown on the badge
87
88 int m_currentNumber; // The current number to display
89 bool m_showBadge; // If true, displays the actual badge otherwise it is invisible
90 wxColour m_badgeColour; // The color of the badge
91 wxColour m_textColour; // The color of the text on the badge
92};
93
94#endif
void SetMaximumNumber(int aMax)
Set the maximum number to be shown on the badge.
wxColour m_badgeColour
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.
wxColour m_textColour
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.
#define KICOMMON_API
Definition kicommon.h:27
SEVERITY
Functions to provide common constants and other functions to assist in making a consistent UI.