KiCad PCB EDA Suite
Loading...
Searching...
No Matches
button_row_panel.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) 1992-2018 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 SIMPLE_BUTTON_PANEL_H
25
#define SIMPLE_BUTTON_PANEL_H
26
27
#include "wx/panel.h"
28
29
#include <vector>
30
#include <functional>
31
32
33
// Forward defs for private-only classes
34
class
wxBoxSizer;
35
36
40
class
BUTTON_ROW_PANEL
:
public
wxPanel
41
{
42
public
:
43
48
using
BTN_CALLBACK
= std::function< void( wxCommandEvent& ) >;
49
53
struct
BTN_DEF
54
{
59
wxWindowID
m_id
;
60
64
wxString
m_text
;
65
69
wxString
m_tooltip
;
70
75
BTN_CALLBACK
m_callback
;
76
};
77
81
using
BTN_DEF_LIST
= std::vector<BTN_DEF>;
82
89
BUTTON_ROW_PANEL
( wxWindow* aWindow,
90
const
BTN_DEF_LIST
& aLeftBtns,
91
const
BTN_DEF_LIST
& aRightBtns );
92
93
private
:
94
102
void
addButtons
(
bool
aLeft,
const
BTN_DEF_LIST
& aDefs );
103
104
wxBoxSizer*
m_sizer
;
105
};
106
107
#endif
// SIMPLE_BUTTON_PANEL_H
BUTTON_ROW_PANEL
A panel that contains buttons, arranged on the left and/or right sides.
Definition:
button_row_panel.h:41
BUTTON_ROW_PANEL::m_sizer
wxBoxSizer * m_sizer
Definition:
button_row_panel.h:104
BUTTON_ROW_PANEL::BTN_CALLBACK
std::function< void(wxCommandEvent &) > BTN_CALLBACK
Callback function definition.
Definition:
button_row_panel.h:48
BUTTON_ROW_PANEL::addButtons
void addButtons(bool aLeft, const BTN_DEF_LIST &aDefs)
Add a set of buttons to one side of the panel.
Definition:
button_row_panel.cpp:50
BUTTON_ROW_PANEL::BTN_DEF_LIST
std::vector< BTN_DEF > BTN_DEF_LIST
A list of BTN_DEFs, used to group buttons into the left/right groups.
Definition:
button_row_panel.h:81
BUTTON_ROW_PANEL::BTN_DEF
The information needed to instantiate a button on a BUTTON_ROW_PANEL.
Definition:
button_row_panel.h:54
BUTTON_ROW_PANEL::BTN_DEF::m_tooltip
wxString m_tooltip
Button tooltip text - empty string for no tooltip.
Definition:
button_row_panel.h:69
BUTTON_ROW_PANEL::BTN_DEF::m_id
wxWindowID m_id
The button ID.
Definition:
button_row_panel.h:59
BUTTON_ROW_PANEL::BTN_DEF::m_text
wxString m_text
The button display text.
Definition:
button_row_panel.h:64
BUTTON_ROW_PANEL::BTN_DEF::m_callback
BTN_CALLBACK m_callback
The callback fired when the button is clicked.
Definition:
button_row_panel.h:75
src
include
widgets
button_row_panel.h
Generated on Fri Nov 22 2024 00:04:54 for KiCad PCB EDA Suite by
1.9.6