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 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, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "wx/panel.h"
23
24#include <vector>
25#include <functional>
26
27
28// Forward defs for private-only classes
29class wxBoxSizer;
30
31
35class BUTTON_ROW_PANEL: public wxPanel
36{
37public:
38
43 using BTN_CALLBACK = std::function< void( wxCommandEvent& ) >;
44
48 struct BTN_DEF
49 {
54 wxWindowID m_id;
55
59 wxString m_text;
60
64 wxString m_tooltip;
65
71 };
72
76 using BTN_DEF_LIST = std::vector<BTN_DEF>;
77
84 BUTTON_ROW_PANEL( wxWindow* aWindow, const BTN_DEF_LIST& aLeftBtns, const BTN_DEF_LIST& aRightBtns );
85
86private:
94 void addButtons( bool aLeft, const BTN_DEF_LIST& aDefs );
95
96private:
97 wxBoxSizer* m_sizer;
98};
wxBoxSizer * m_sizer
std::function< void(wxCommandEvent &) > BTN_CALLBACK
Callback function definition.
BUTTON_ROW_PANEL(wxWindow *aWindow, const BTN_DEF_LIST &aLeftBtns, const BTN_DEF_LIST &aRightBtns)
Construct a SIMPLE_BUTTON_PANEL with a set of buttons on each side.
void addButtons(bool aLeft, const BTN_DEF_LIST &aDefs)
Add a set of buttons to one side of the panel.
std::vector< BTN_DEF > BTN_DEF_LIST
A list of BTN_DEFs, used to group buttons into the left/right groups.
The information needed to instantiate a button on a BUTTON_ROW_PANEL.
wxString m_tooltip
Button tooltip text - empty string for no tooltip.
wxWindowID m_id
The button ID.
wxString m_text
The button display text.
BTN_CALLBACK m_callback
The callback fired when the button is clicked.