OpenCPN Partial API docs
Loading...
Searching...
No Matches
dialog_input.h
1/***************************************************************************
2 * Copyright (C) 2025 by NoCodeHummel *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************
19 */
20#ifndef DIALOG_INPUT_H
21#define DIALOG_INPUT_H
22
23#include <set>
24#include <wx/panel.h>
25
26#include "dialog_alert.h"
27#include "field_switch.h"
28#include "ui_utils.h"
29
33class InputDialog : public AlertDialog {
34public:
35 InputDialog(wxWindow* parent, const std::string& title,
36 const std::string& action = _("Continue").ToStdString());
37
45 SwitchField* AddSelection(int key, const std::string& label, bool value);
46
55 template <typename T>
56 void AddSelection(const std::set<int>& options, T option,
57 const std::string& label) {
58 bool value = options.empty() || GUI::HasKey(options, option);
59 AddSelection(static_cast<int>(option), label, value);
60 };
61
66 void GetSelected(std::set<int>& options);
67
68private:
69 wxPanel* m_grid;
70};
71
72#endif // DIALOG_INPUT_H
A modal message dialog with confirmation button and cancel button.
Input dialog with panel and flex grid sizer.
void GetSelected(std::set< int > &options)
Return active switch keys.
void AddSelection(const std::set< int > &options, T option, const std::string &label)
Create selection switch for options.
SwitchField * AddSelection(int key, const std::string &label, bool value)
Add key selection switch.
Switch field contains switch button with label to be included in a two column form sizer.
bool HasKey(const std::set< int > &set, T key)
Check if a key exists in a set.
Definition ui_utils.h:60
GUI library utils and events.