Antares Simulator
Power System Simulator
performer.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_EXT_SOURCE_PERFORMER_H__
22 #define __ANTARES_APPLICATION_EXT_SOURCE_PERFORMER_H__
23 
24 #include <antares/study/study.h>
25 #include <yuni/thread/thread.h>
26 #include <wx/timer.h>
27 #include <wx/dialog.h>
28 #include <action/action.h>
29 #include "../components/progressbar.h"
30 #include <atomic>
31 #include <mutex>
32 
33 namespace Antares::Window
34 {
35 class PerformerDialog: public wxDialog
36 {
37 public:
39 
40 
43  PerformerDialog(wxWindow* parent,
44  const Antares::Action::Context::Ptr& context,
45  const Antares::Action::IAction::Ptr& root);
46 
48  virtual ~PerformerDialog();
50 
55 
60 
61  void notifyHasBeenModified();
62 
63  void notifyProgression(int progress, int max);
64 
65  void updateGUI();
66 
67 private:
69  void onCancel(void*);
70 
71  void delegateUserInfo(const Yuni::String& text);
72 
73  void closeWindow();
74 
75 private:
77  bool pHasBeenModified;
78 
80  Antares::Action::Context::Ptr pContext;
84  Component::ProgressBar* pGauge;
86  wxButton* pBtnCancel;
87 
88  wxStaticText* pLblMessage;
89 
90  Yuni::String pNextMessage;
91 
92  wxTimer* pTimer;
93 
94  Yuni::Thread::IThread* pThread;
95  std::mutex pMutex;
96  std::atomic<int> pGUINeedRefresh;
97  std::atomic<int> pProgression;
98  std::atomic<int> pProgressionMax;
99 
100 }; // class PerformerDialog
101 
102 } // namespace Antares::Window
103 
104 #endif // __ANTARES_APPLICATION_EXT_SOURCE_PERFORMER_H__
AncestorType::Ptr Ptr
The most suitable smart ptr for the class.
Definition: action.h:41
A simple panel with a caption.
Definition: progressbar.h:32
Definition: performer.h:36
void closeThenOpenActionsDialog()
Open the actions dialog.
Definition: performer.cpp:303
virtual ~PerformerDialog()
Destructor.
Definition: performer.cpp:287
void askForClosingTheWindow()
Close the window.
Definition: performer.cpp:400
PerformerDialog(wxWindow *parent, const Antares::Action::Context::Ptr &context, const Antares::Action::IAction::Ptr &root)
Default Constructor.
Definition: performer.cpp:173