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#pragma once
25
26#include <wx/statbmp.h>
27#include <wx/panel.h>
28
29class wxStaticBitmap;
30
34class INDICATOR_ICON : public wxPanel
35{
36public:
42 using ICON_ID = int;
43
48 {
49 public:
50 virtual ~ICON_PROVIDER() {};
51
57 virtual const wxBitmap& GetIndicatorIcon( ICON_ID aIconId ) const = 0;
58 };
59
66 INDICATOR_ICON( wxWindow* aParent, ICON_PROVIDER& aIconProvider, ICON_ID aInitialIcon, int aID );
67
73 void SetIndicatorState( ICON_ID aIconId );
74
80 void SetWindowID( wxWindowID aId )
81 {
82 SetId( aId );
83 m_bitmap->SetId( aId );
84 }
85
86private:
88 wxStaticBitmap* m_bitmap;
90};
91
92
97{
98public:
99
111
112 ROW_ICON_PROVIDER( int aSizeDIP, wxWindow* aWindow );
113
115 const wxBitmap& GetIndicatorIcon( INDICATOR_ICON::ICON_ID aIconId ) const override;
116
117private:
122 wxBitmap m_dotBitmap;
123 wxBitmap m_openBitmap;
125};
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.
ICON_PROVIDER & m_iconProvider
int ICON_ID
An id that refers to a certain icon state.
INDICATOR_ICON(wxWindow *aParent, ICON_PROVIDER &aIconProvider, ICON_ID aInitialIcon, int aID)
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
void SetWindowID(wxWindowID aId)
Update the window ID of this control and its children.
ICON_ID m_currentId
Handle on the bitmap widget.
wxStaticBitmap * m_bitmap
Object that delivers icons for the indicator.
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.
@ OPEN
Tree control open.
@ CLOSED
Tree control closed.
@ DIMMED
Row "dimmed".
@ DOWN
Row below design alpha.
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
ROW_ICON_PROVIDER(int aSizeDIP, wxWindow *aWindow)