KiCad PCB EDA Suite
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 (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
5  * @author Jon Evans <jon@craftyjon.com>
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, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef _BITMAP_TOGGLE_H
26 #define _BITMAP_TOGGLE_H
27 
28 #include <wx/wx.h>
29 
30 #include <gal/color4d.h>
31 
32 
33 wxDECLARE_EVENT( TOGGLE_CHANGED, wxCommandEvent );
34 
41 class BITMAP_TOGGLE : public wxPanel
42 {
43 public:
45 
46  BITMAP_TOGGLE( wxWindow *aParent, wxWindowID aId, const wxBitmap& aCheckedBitmap,
47  const wxBitmap& aUncheckedBitmap, bool aChecked = false );
48 
50  void SetValue( bool aValue );
51 
53  bool GetValue() const { return m_checked; }
54 
55 private:
56  bool m_checked;
57 
58  wxStaticBitmap* m_bitmap;
59 
62 
64  wxBitmap m_checked_bitmap;
65 };
66 
67 #endif
wxDECLARE_EVENT(TOGGLE_CHANGED, wxCommandEvent)
void SetValue(bool aValue)
Set the checkbox state
A checkbox control except with custom bitmaps for the checked and unchecked states.
Definition: bitmap_toggle.h:41
wxStaticBitmap * m_bitmap
Definition: bitmap_toggle.h:58
wxBitmap m_checked_bitmap
Bitmap to display in checked state
Definition: bitmap_toggle.h:64
wxBitmap m_unchecked_bitmap
Bitmap to display in unchecked state
Definition: bitmap_toggle.h:61
bool GetValue() const
Read the checkbox state
Definition: bitmap_toggle.h:53