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 (C) 2019-2022 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, 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/statbmp.h>
29#include <wx/bmpbndl.h>
30#include <wx/panel.h>
31
32#include <gal/color4d.h>
33
34class wxStaticBitmap;
35
36wxDECLARE_EVENT( TOGGLE_CHANGED, wxCommandEvent );
37
44class BITMAP_TOGGLE : public wxPanel
45{
46public:
48
49 BITMAP_TOGGLE( wxWindow* aParent, wxWindowID aId, const wxBitmapBundle& aCheckedBitmap,
50 const wxBitmapBundle& aUncheckedBitmap, bool aChecked = false );
51
53 void SetValue( bool aValue );
54
56 bool GetValue() const { return m_checked; }
57
62 void SetWindowID( wxWindowID aId )
63 {
64 SetId( aId );
65 m_bitmap->SetId( aId );
66 }
67
68private:
70
71 wxStaticBitmap* m_bitmap;
72 wxBitmapBundle m_unchecked_bitmap;
73 wxBitmapBundle m_checked_bitmap;
74
75 wxLongLong m_debounce; // Timestamp for debouncing events
76};
77
78#endif
wxDECLARE_EVENT(TOGGLE_CHANGED, wxCommandEvent)
A checkbox control except with custom bitmaps for the checked and unchecked states.
Definition: bitmap_toggle.h:45
wxLongLong m_debounce
Definition: bitmap_toggle.h:75
wxStaticBitmap * m_bitmap
Definition: bitmap_toggle.h:71
wxBitmapBundle m_unchecked_bitmap
Definition: bitmap_toggle.h:72
void SetValue(bool aValue)
Read the checkbox state.
wxBitmapBundle m_checked_bitmap
Definition: bitmap_toggle.h:73
void SetWindowID(wxWindowID aId)
Updates the window ID of this control and its children.
Definition: bitmap_toggle.h:62
bool GetValue() const
Definition: bitmap_toggle.h:56