KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_multi_unit_entry.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 <memory>
23#include <variant>
24
25#include <dialog_shim.h>
26
27class EDA_DRAW_FRAME;
28class UNIT_BINDER;
29
37{
38public:
40 {
41 long long int m_default;
42 };
43
44 struct CHECKBOX
45 {
47 };
48
55 using TYPE = std::variant<UNIT_BOUND, CHECKBOX>;
56
57 struct ENTRY
58 {
59 wxString m_label;
61 wxString m_tooltip;
62 };
63
67 using RESULT = std::variant<long long int, bool>;
68
76 WX_MULTI_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption, std::vector<ENTRY> aEntries );
77
84 std::vector<RESULT> GetValues() const;
85
86private:
87 std::vector<ENTRY> m_entries;
88
89 std::vector<wxWindow*> m_controls;
90 std::vector<std::unique_ptr<UNIT_BINDER>> m_unit_binders;
91};
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
The base class for create windows for drawing purpose.
std::vector< std::unique_ptr< UNIT_BINDER > > m_unit_binders
std::variant< UNIT_BOUND, CHECKBOX > TYPE
The type of the entry value.
WX_MULTI_ENTRY_DIALOG(EDA_DRAW_FRAME *aParent, const wxString &aCaption, std::vector< ENTRY > aEntries)
Create a multi-entry dialog.
std::vector< RESULT > GetValues() const
Returns the values in the order they were added.
std::variant< long long int, bool > RESULT
Corresponding result type for each entry type.
std::vector< ENTRY > m_entries
std::vector< wxWindow * > m_controls
bool m_default
TYPE m_value
wxString m_label
wxString m_tooltip
long long int m_default