KiCad PCB EDA Suite
Loading...
Searching...
No Matches
indicator_icon.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, 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 ROW_INDICATOR__H_
25#define ROW_INDICATOR__H_
26
27#include <wx/statbmp.h>
28#include <wx/panel.h>
29
30class wxStaticBitmap;
31
35class INDICATOR_ICON : public wxPanel
36{
37public:
38
45 using ICON_ID = int;
46
51 {
52 public:
53
54 virtual ~ICON_PROVIDER() {};
55
61 virtual const wxBitmap& GetIndicatorIcon( ICON_ID aIconId ) const = 0;
62 };
63
70 static ICON_PROVIDER& GetDefaultRowIconProvider( bool aAlternative );
71
80 INDICATOR_ICON( wxWindow* aParent, ICON_PROVIDER& aIconProvider,
81 ICON_ID aInitialIcon, int aID );
82
88 void SetIndicatorState( ICON_ID aIconId );
89
90
95
101 void SetWindowID( wxWindowID aId )
102 {
103 SetId( aId );
104 m_bitmap->SetId( aId );
105 }
106
107private:
108
111
113 wxStaticBitmap* m_bitmap;
114
117};
118
119
124{
125public:
126
128 enum STATE
129 {
135 };
136
141 ROW_ICON_PROVIDER( int aSizeDIP, wxWindow* aWindow );
142
144 const wxBitmap& GetIndicatorIcon( INDICATOR_ICON::ICON_ID aIconId ) const override;
145
146private:
151 wxBitmap m_dotBitmap;
152};
153
154
155#endif // ROW_INDICATOR__H_
A simple object that can provide fixed bitmaps for use as row indicators.
virtual const wxBitmap & GetIndicatorIcon(ICON_ID aIconId) const =0
Get a reference to the row icon in the given mode.
Represent a row indicator icon for use in places like the layer widget.
ICON_PROVIDER & m_iconProvider
Object that delivers icons for the indicator (currently uses a default implementation).
int ICON_ID
An id that refers to a certain icon state.
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
static ICON_PROVIDER & GetDefaultRowIconProvider(bool aAlternative)
Accessor for the default icon providers, which take true and false for IDs, meaning on/off.
void SetWindowID(wxWindowID aId)
Update the window ID of this control and its children.
ICON_ID m_currentId
Is the icon currently "on".
wxStaticBitmap * m_bitmap
Handle on the bitmap widget.
ICON_ID GetIndicatorState() const
Icon provider for the "standard" row indicators, for example in layer selection lists.
const wxBitmap & GetIndicatorIcon(INDICATOR_ICON::ICON_ID aIconId) const override
Get a reference to the row icon in the given mode.
wxBitmap m_rightArrowBitmap
STATE
State constants to select the right icons.
@ UP
Row above design alpha.
@ DIMMED
Row "dimmed".
@ DOWN
Row below design alpha.
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
wxBitmap m_upArrowBitmap
wxBitmap m_downArrowBitmap