Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
message.h
1/*
2** Copyright 2007-2024, RTE (https://www.rte-france.com)
3** See AUTHORS.txt
4** SPDX-License-Identifier: MPL-2.0
5** This file is part of Antares-Simulator,
6** Adequacy and Performance assessment for interconnected energy networks.
7**
8** Antares_Simulator is free software: you can redistribute it and/or modify
9** it under the terms of the Mozilla Public Licence 2.0 as published by
10** the Mozilla Foundation, either version 2 of the License, or
11** (at your option) any later version.
12**
13** Antares_Simulator is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16** Mozilla Public Licence 2.0 for more details.
17**
18** You should have received a copy of the Mozilla Public Licence 2.0
19** along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20*/
21#ifndef __ANTARES_APPLICATION_MESSAGE_H__
22#define __ANTARES_APPLICATION_MESSAGE_H__
23
24#include <yuni/thread/thread.h>
25#include <wx/dialog.h>
26#include <ui/common/component/spotlight.h>
27
28namespace Antares
29{
30namespace Window
31{
59class Message final : public wxDialog
60{
61public:
94 using ItemList = std::vector<Component::Spotlight::IItem::Ptr>;
95
96public:
98
99
102 Message(wxWindow* parent,
103 const wxString& title,
104 const wxString& subtitle = wxEmptyString,
105 const wxString& msg = wxEmptyString,
106 const char* icon = "images/misc/book.png");
108 virtual ~Message();
110
112
113
122 void add(const wxString& caption,
123 DefaultButtonType value,
124 bool defaultButton = false,
125 int space = 3);
126
134 void add(DefaultButtonType btn, bool defaultButton = false, int space = 3);
136
138
139
146 void appendError(const AnyString& text);
150 void appendWarning(const AnyString& text);
151
155
157
158
161 uint showModal();
162
166 void showModalAsync();
168
170
171
177 void recommendedWidth(uint w);
179
180private:
182 void onButtonClick(DefaultButtonType userdata);
183 //
184 void prepareShowModal();
185
186private:
188 wxPanel* pPanel;
190 wxBoxSizer* pPanelSizer;
192 ItemList pItemList;
194 Component::Spotlight* pSpotlight;
196 wxSizer* pListSizer;
198 DefaultButtonType pReturnStatus;
200 uint pRecommendedWidth;
202 wxPanel* pSpace;
203
204}; // class Message
205
206} // namespace Window
207} // namespace Antares
208
209#include "message.hxx"
210
211#endif // __ANTARES_APPLICATION_MESSAGE_H__
std::shared_ptr< IItem > Ptr
Ptr.
Definition spotlight.h:31
Definition spotlight.h:40
Standard message Box for Antares.
Definition message.h:60
std::vector< Component::Spotlight::IItem::Ptr > ItemList
Array of items.
Definition message.h:94
void add(const wxString &caption, DefaultButtonType value, bool defaultButton=false, int space=3)
Add a new custom button.
Definition message.cpp:188
void appendError(const AnyString &text)
Add an error.
Definition message.cpp:279
uint showModal()
Display the message box.
Definition message.cpp:270
void appendWarning(const AnyString &text)
Add a warning.
Definition message.cpp:287
void showModalAsync()
Display the message box (async)
Definition message.cpp:210
void recommendedWidth(uint w)
Set the recommended width of the dialog box.
Definition message.hxx:87
Message & operator+=(Component::Spotlight::IItem::Ptr item)
Definition message.hxx:81
Message(wxWindow *parent, const wxString &title, const wxString &subtitle=wxEmptyString, const wxString &msg=wxEmptyString, const char *icon="images/misc/book.png")
Default Constructor.
Definition message.cpp:84
virtual ~Message()
Destructor.
Definition message.cpp:174
DefaultButtonType
Definition message.h:63
@ btnSaveChanges
Standard button: Save changes.
Definition message.h:79
@ btnQuit
Standard button: quit.
Definition message.h:91
@ btnNo
Standard button: No.
Definition message.h:71
@ btnYes
Standard button: Yes.
Definition message.h:69
@ btnSaveAs
Standard button: Save as...
Definition message.h:83
@ btnRetry
Standard button: retry.
Definition message.h:73
@ btnViewResults
Standard button: view simulation results.
Definition message.h:89
@ btnOk
Standard button: Ok.
Definition message.h:67
@ btnCancel
Standard button: Cancel.
Definition message.h:81
@ btnDiscard
Standard button: Discard.
Definition message.h:75
@ btnUpgrade
Standard button: Upgrade.
Definition message.h:85
@ btnQuitWithoutSaving
Quit without saving.
Definition message.h:77
@ btnContinue
Standard button: continue.
Definition message.h:87
@ btnStartID
constant
Definition message.h:65