OpenCPN Partial API docs
Loading...
Searching...
No Matches
dialog_alert.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_ALERT_H
21#define DIALOG_ALERT_H
22
23#include <string>
24
25#include "dialog_base.h"
26#include "dialog_footer.h"
27
32public:
37 virtual void OnConfirm(const bool result) = 0;
38};
39
46class AlertDialog : public BaseDialog {
47private:
48 std::string m_action; // confirmation button label
49
50public:
51 AlertDialog(wxWindow* parent, const std::string& title,
52 const std::string& action);
54
60
65 void SetMessage(const std::string& msg);
66
71 static int GetConfirmation(wxWindow* parent, const std::string& title,
72 const std::string& action, const std::string& msg);
73
74private:
75 IAlertConfirmation* m_listener;
76 void OnCancel(wxCommandEvent& event);
77 void OnConfirm(wxCommandEvent& event);
78};
79
80#endif // DIALOG_ALERT_H
A modal message dialog with a cancel and confirmation button.
void SetListener(IAlertConfirmation *listener)
Listen for response.
void SetMessage(const std::string &msg)
Set alert message.
static int GetConfirmation(wxWindow *parent, const std::string &title, const std::string &action, const std::string &msg)
Helper that returns the dialog response.
Dialog layout with content sizer.
Definition dialog_base.h:31
Alert confirmation listener interface.
virtual void OnConfirm(const bool result)=0
Handle confirmation response.