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 (C) 2020 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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef NUMBER_BADGE_H_
25#define NUMBER_BADGE_H_
26
27#include <widgets/ui_common.h>
28#include <wx/dcclient.h>
29#include <wx/panel.h>
30#include <kicommon.h>
31
32
39class KICOMMON_API NUMBER_BADGE : public wxPanel
40{
41public:
45 NUMBER_BADGE( wxWindow* aParent, wxWindowID aId, const wxPoint& aPos,
46 const wxSize& aSize, int aStyles );
47
61 void UpdateNumber( int aNumber, SEVERITY aSeverity );
62
69 void SetMaximumNumber( int aMax );
70
76 void SetTextSize( int aSize );
77
78protected:
82 void computeSize();
83
87 void onPaint( wxPaintEvent& aEvt );
88
89 int m_textSize; // The text size to use
90 int m_maxNumber; // The maximum number allowed to be shown on the badge
91
92 int m_currentNumber; // The current number to display
93 bool m_showBadge; // If true, displays the actual badge otherwise it is invisible
94 wxColour m_badgeColour; // The color of the badge
95 wxColour m_textColour; // The color of the text on the badge
96};
97
98#endif
A simple UI element that puts a number on top of a colored rounded rectangle with a fill color that s...
Definition: number_badge.h:40
wxColour m_badgeColour
Definition: number_badge.h:94
int m_currentNumber
Definition: number_badge.h:92
wxColour m_textColour
Definition: number_badge.h:95
bool m_showBadge
Definition: number_badge.h:93
#define KICOMMON_API
Definition: kicommon.h:28
SEVERITY
Functions to provide common constants and other functions to assist in making a consistent UI.