Antares Simulator
Power System Simulator
sets.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_WINDOWS_SETS_H__
22 #define __ANTARES_APPLICATION_WINDOWS_SETS_H__
23 
24 #include <ui/common/component/panel.h>
25 #include <wx/richtext/richtextctrl.h>
26 #include <wx/richtext/richtextstyles.h>
27 
28 namespace Antares::Window
29 {
33 class Sets final: public Antares::Component::Panel, public Yuni::IEventObserver<Sets>
34 {
35 public:
36  enum IDs
37  {
38  mnIDUserNotes = wxID_HIGHEST + 1,
39  };
40 
44  static Yuni::Event<void(Sets* sender)> OnChanged;
45 
46 public:
47  // \name Constructors & Destructor
49 
52  Sets(wxWindow* parent, uint margin = 18);
54  virtual ~Sets();
56 
60  void saveToStudy();
61 
65  void loadFromStudy();
66 
70  void connectToNotification();
71 
76 
77 private:
78  void onNewSet(void*);
79 
80  void onCaption(void*);
81  void onFilter(void*);
82  void onOutput(void*);
83  void onComments(void*);
84 
85  void onAdd(void*);
86  void onRemove(void*);
87 
88  void onCheck(void*);
89 
90  void onUserNotesCharacter(wxRichTextEvent& evt);
91  void onUserNotesStyleChanged(wxRichTextEvent& evt);
92 
93  void onSetsModified(Sets* sender);
94 
95  void notifyChanges();
96 
97  void onStudyClosed();
98 
106  bool initializeTemporaryFile();
107 
108 private:
110  wxRichTextCtrl* pRichEdit;
111  wxRichTextStyleSheet* pStyleSheet;
112  uint pLocalRevision;
113  uint pUpdatesToSkip;
114 
121  YString pTempFile;
122 
123  // Event Table
124  DECLARE_EVENT_TABLE()
125 
126 }; // class Sets
127 
128 } // namespace Antares::Window
129 
130 #endif // __ANTARES_APPLICATION_WINDOWS_SETS_H__
Panel implementation.
Definition: panel.h:34
Save As Dialog
Definition: sets.h:34
void saveToStudy()
Save the sets to the study.
Definition: sets.cpp:576
virtual ~Sets()
Destructor.
Definition: sets.cpp:144
Sets(wxWindow *parent, uint margin=18)
Constructor with a parent window and a study.
Definition: sets.cpp:59
void disconnectFromNotification()
Disconnect from the notifications of the sets updates.
Definition: sets.cpp:527
void loadFromStudy()
Load the sets from the study.
Definition: sets.cpp:532
static Yuni::Event< void(Sets *sender)> OnChanged
Event triggered when the sets are changed.
Definition: sets.h:44
void connectToNotification()
Connect to the notification of sets updates.
Definition: sets.cpp:521