Antares Simulator
Power System Simulator
message.h
1 /*
2  * Copyright 2007-2025, 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 
28 namespace Antares::Window
29 {
57 class Message final: public wxDialog
58 {
59 public:
61  {
63  btnStartID = 100000,
89  btnQuit
90  };
91 
93  using ItemList = std::vector<Component::Spotlight::IItem::Ptr>;
94 
95 public:
97 
98 
101  Message(wxWindow* parent,
102  const wxString& title,
103  const wxString& subtitle = wxEmptyString,
104  const wxString& msg = wxEmptyString,
105  const char* icon = "images/misc/book.png");
107  virtual ~Message();
109 
111 
112 
121  void add(const wxString& caption,
122  DefaultButtonType value,
123  bool defaultButton = false,
124  int space = 3);
125 
133  void add(DefaultButtonType btn, bool defaultButton = false, int space = 3);
135 
137 
138 
141  void add(Component::Spotlight::IItem::Ptr item);
145  void appendError(const AnyString& text);
149  void appendWarning(const AnyString& text);
150 
152  Message& operator+=(Component::Spotlight::IItem::Ptr item);
154 
156 
157 
160  uint showModal();
161 
165  void showModalAsync();
167 
169 
170 
176  void recommendedWidth(uint w);
178 
179 private:
181  void onButtonClick(DefaultButtonType userdata);
182  //
183  void prepareShowModal();
184 
185 private:
187  wxPanel* pPanel;
189  wxBoxSizer* pPanelSizer;
191  ItemList pItemList;
193  Component::Spotlight* pSpotlight;
195  wxSizer* pListSizer;
197  DefaultButtonType pReturnStatus;
199  uint pRecommendedWidth;
201  wxPanel* pSpace;
202 
203 }; // class Message
204 
205 } // namespace Antares::Window
206 
207 #include "message.hxx"
208 
209 #endif // __ANTARES_APPLICATION_MESSAGE_H__
Definition: spotlight.h:38
Standard message Box for Antares.
Definition: message.h:58
std::vector< Component::Spotlight::IItem::Ptr > ItemList
Array of items.
Definition: message.h:93
void add(const wxString &caption, DefaultButtonType value, bool defaultButton=false, int space=3)
Add a new custom button.
Definition: message.cpp:199
void appendError(const AnyString &text)
Add an error.
Definition: message.cpp:304
uint showModal()
Display the message box.
Definition: message.cpp:295
void appendWarning(const AnyString &text)
Add a warning.
Definition: message.cpp:312
void showModalAsync()
Display the message box (async)
Definition: message.cpp:221
void recommendedWidth(uint w)
Set the recommended width of the dialog box.
Definition: message.hxx:85
Message & operator+=(Component::Spotlight::IItem::Ptr item)
Definition: message.hxx:79
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:87
virtual ~Message()
Destructor.
Definition: message.cpp:183
DefaultButtonType
Definition: message.h:61
@ btnSaveChanges
Standard button: Save changes.
Definition: message.h:77
@ btnQuit
Standard button: quit.
Definition: message.h:89
@ btnNo
Standard button: No.
Definition: message.h:69
@ btnYes
Standard button: Yes.
Definition: message.h:67
@ btnSaveAs
Standard button: Save as...
Definition: message.h:81
@ btnRetry
Standard button: retry.
Definition: message.h:71
@ btnViewResults
Standard button: view simulation results.
Definition: message.h:87
@ btnOk
Standard button: Ok.
Definition: message.h:65
@ btnCancel
Standard button: Cancel.
Definition: message.h:79
@ btnDiscard
Standard button: Discard.
Definition: message.h:73
@ btnUpgrade
Standard button: Upgrade.
Definition: message.h:83
@ btnQuitWithoutSaving
Quit without saving.
Definition: message.h:75
@ btnContinue
Standard button: continue.
Definition: message.h:85
@ btnStartID
constant
Definition: message.h:63