Antares Simulator
Power System Simulator
saveas.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_SAVEAS_H__
22 #define __ANTARES_APPLICATION_WINDOWS_SAVEAS_H__
23 
24 #include <antares/study/study.h>
25 #include "../application/study.h"
26 
27 #include <wx/sizer.h>
28 #include <wx/textctrl.h>
29 #include <wx/checkbox.h>
30 #include <wx/collpane.h>
31 #include <wx/dialog.h>
32 #include <wx/textctrl.h>
33 #include <wx/collpane.h>
34 #include <wx/valtext.h>
35 
36 namespace Antares::Window
37 {
41 class SaveAs final: public wxDialog
42 {
43 public:
51  static SaveResult Execute(wxFrame* parent, Data::Study::Ptr study);
52 
53 public:
54  enum
55  {
56  mnIDCollapsePanel = wxID_HIGHEST + 1,
57  mnIDEditStudyName,
58  mnIDEditStudyFolderName,
59  mnIDBrowse,
60  };
61 
62 public:
63  // \name Constructors & Destructor
65 
68  explicit SaveAs(wxFrame* parent);
72  SaveAs(wxFrame* parent, Data::Study::Ptr study);
74  virtual ~SaveAs();
76 
78 
79  Data::Study::Ptr study();
82  const Data::Study::Ptr study() const;
84 
88  SaveResult result() const;
89 
90 private:
92  void internalCreateComponents();
93 
94  void onCollapsePanel(wxCollapsiblePaneEvent& evt);
95  void onStudyNameChanged(wxCommandEvent& evt);
96  void onStudyFolderNameChanged(wxCommandEvent& evt);
97  void onBrowse(wxCommandEvent& evt);
98 
100  void onCancel(void*);
102  void onSave(void*);
103 
104  void propCaption(const wxString& text, bool bold = false);
105  wxTextCtrl* propEdit(const wxString& defaultValue = wxString(), int id = wxID_ANY);
106  wxWindow* propEdit(wxWindow* control);
107  wxTextCtrl* propEdit(const wxString& defaultValue,
108  const wxTextValidator& validator,
109  int id = wxID_ANY);
110 
111 private:
113  Data::Study::Ptr pStudy;
115  wxFlexGridSizer* pGridSizer;
117  wxWindow* pParentProperties;
119  wxTextCtrl* pStudyName;
121  wxTextCtrl* pStudyFolderName;
123  wxTextCtrl* pFolder;
125  bool pCustomFolderName;
126 
128  wxCheckBox* pCopyOutput;
130  wxCheckBox* pCopyUserData;
132  wxCheckBox* pCopyLogs;
134  SaveResult pResult;
135  // Event Table
136  DECLARE_EVENT_TABLE()
137 
138 }; // class SaveAs
139 
140 } // namespace Antares::Window
141 
142 #include "saveas.hxx"
143 
144 #endif // __ANTARES_APPLICATION_WINDOWS_SAVEAS_H__
Save As Dialog
Definition: saveas.h:42
Data::Study::Ptr study()
Get the attached study.
Definition: saveas.hxx:26
SaveResult result() const
Get if the study has been saved.
Definition: saveas.hxx:36
SaveAs(wxFrame *parent)
Constructor with a parent window and a study.
Definition: saveas.cpp:104
virtual ~SaveAs()
Destructor.
Definition: saveas.cpp:148
static SaveResult Execute(wxFrame *parent, Data::Study::Ptr study)
Execute the SaveAs dialog and save the given study accordingly.
Definition: saveas.cpp:96