KiCad PCB EDA Suite
Loading...
Searching...
No Matches
bitmap_toggle.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 * @author Jon Evans <[email protected]>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef _BITMAP_TOGGLE_H
22#define _BITMAP_TOGGLE_H
23
24#include <wx/statbmp.h>
25#include <wx/bmpbndl.h>
26#include <wx/panel.h>
27
28#include <gal/color4d.h>
29
30class wxStaticBitmap;
31
32wxDECLARE_EVENT( TOGGLE_CHANGED, wxCommandEvent );
33
39
40class BITMAP_TOGGLE : public wxPanel
41{
42public:
44
45 BITMAP_TOGGLE( wxWindow* aParent, wxWindowID aId, const wxBitmapBundle& aCheckedBitmap,
46 const wxBitmapBundle& aUncheckedBitmap, bool aChecked = false );
47
49 void SetValue( bool aValue );
50
52 bool GetValue() const { return m_checked; }
53
59 void SetWindowID( wxWindowID aId )
60 {
61 SetId( aId );
62 m_bitmap->SetId( aId );
63 }
64
65private:
67
68 wxStaticBitmap* m_bitmap;
69 wxBitmapBundle m_unchecked_bitmap;
70 wxBitmapBundle m_checked_bitmap;
71
72 wxLongLong m_debounce;
73};
74
75#endif
wxDECLARE_EVENT(TOGGLE_CHANGED, wxCommandEvent)
wxLongLong m_debounce
Timestamp for debouncing events.
wxStaticBitmap * m_bitmap
wxBitmapBundle m_unchecked_bitmap
void SetValue(bool aValue)
Set the checkbox state.
wxBitmapBundle m_checked_bitmap
void SetWindowID(wxWindowID aId)
Update the window ID of this control and its children.
bool GetValue() const
Read the checkbox state.