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 (C) 2024 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#pragma once
25
26#include <memory>
27#include <variant>
28
29#include <dialog_shim.h>
30
31class EDA_DRAW_FRAME;
32class UNIT_BINDER;
33
41{
42public:
44 {
45 long long int m_default;
46 };
47
48 struct CHECKBOX
49 {
51 };
52
59 using TYPE = std::variant<UNIT_BOUND, CHECKBOX>;
60
61 struct ENTRY
62 {
63 wxString m_label;
65 wxString m_tooltip;
66 };
67
71 using RESULT = std::variant<long long int, bool>;
72
80 WX_MULTI_ENTRY_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aCaption,
81 std::vector<ENTRY> aEntries );
82
89 std::vector<RESULT> GetValues() const;
90
91private:
92 std::vector<ENTRY> m_entries;
93
94 std::vector<wxWindow*> m_controls;
95 std::vector<std::unique_ptr<UNIT_BINDER>> m_unit_binders;
96};
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:88
The base class for create windows for drawing purpose.
A dialog like WX_UNIT_ENTRY_DIALOG, but with multiple entries.
std::vector< std::unique_ptr< UNIT_BINDER > > m_unit_binders
std::variant< UNIT_BOUND, CHECKBOX > TYPE
The type of the entry value.
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