]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMMainFrame.h
5c440cc23914b0387010e7171655a7994d612579
[crea.git] / lib / creaDevManagerLib / wxCDMMainFrame.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Sant�)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 #
10 #  This software is governed by the CeCILL-B license under French law and 
11 #  abiding by the rules of distribution of free software. You can  use, 
12 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
13 #  license as circulated by CEA, CNRS and INRIA at the following URL 
14 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
15 #  or in the file LICENSE.txt.
16 #
17 #  As a counterpart to the access to the source code and  rights to copy,
18 #  modify and redistribute granted by the license, users are provided only
19 #  with a limited warranty  and the software's author,  the holder of the
20 #  economic rights,  and the successive licensors  have only  limited
21 #  liability. 
22 #
23 #  The fact that you are presently reading this means that you have had
24 #  knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ 
26 */ 
27
28
29 #ifndef WXCDMMAINFRAME_H_INCLUDED
30 #define WXCDMMAINFRAME_H_INCLUDED
31
32 #include <creaWx.h>
33 #include <wx/aui/aui.h>
34 #include <wx/treectrl.h>
35 #include "wxCDMProjectsTreeCtrl.h"
36 #include "modelCDMMain.h"
37
38 /**
39  * Main Frame Class.
40  * This class is the main class of the application. It starts the other classes and windows as well as it holds a reference to the application model.
41  */
42 class wxCDMMainFrame:public wxFrame
43 {
44   DECLARE_EVENT_TABLE()
45
46 public:
47   /**
48    * Constructor receiving common parameter for frame construction.
49    * @param parent The parent window of the wxCDMMainFrame object.
50    * @param id The id of the Frame, by default wxID_ANY.
51    * @param caption Frame caption. Usually shown on the top of the window. It's by default "CREATIS CreaDevManager".
52    * @param pos Position of the application, by default wxDefaultPosition.
53    * @param size Size of the application, by default wxDefaultSize.
54    * @param style Style of the application, by default wxDEFAULT_FRAME_STYLE.
55    */
56   wxCDMMainFrame(
57       wxWindow* parent,
58       wxWindowID id = wxID_ANY,
59       const wxString& caption = wxT("CREATIS CreaDevManager"),
60       const wxPoint& pos = wxDefaultPosition,
61       const wxSize& size = wxDefaultSize,
62       long style = wxDEFAULT_FRAME_STYLE
63   );
64
65   /**
66    * Destructor.
67    */
68   ~wxCDMMainFrame();
69
70   /**
71    * Create Method.
72    * Actually creates the frame and creates the controls inside the application.
73    * @param parent The parent window of the wxCDMMainFrame object.
74    * @param id The id of the Frame, by default wxID_ANY.
75    * @param caption Frame caption. Usually shown on the top of the window. It's by default "CREATIS CreaDevManager".
76    * @param pos Position of the application, by default wxDefaultPosition.
77    * @param size Size of the application, by default wxDefaultSize.
78    * @param style Style of the application, by default wxDEFAULT_FRAME_STYLE.
79    * @return True if the creation process went well.
80    */
81   bool Create(
82       wxWindow* parent,
83       wxWindowID id = wxID_ANY,
84       const wxString& caption = wxT("CREATIS CreaDevManager"),
85       const wxPoint& pos = wxDefaultPosition,
86       const wxSize& size = wxDefaultSize,
87       long style = wxDEFAULT_FRAME_STYLE
88   );
89
90   /**
91    * Retreives the application model.
92    * @return Model of the application.
93    */
94   modelCDMMain* GetModel() const;
95
96   /**
97    * Returns the properties panel. where the selection description is shown.
98    * @return the description panel of the project component chosen by the user.
99    */
100   wxPanel* GetPropertiesPanel() const;
101
102   /**
103    * Checks if the help is enabled.
104    * @return true if the help is enabled.
105    */
106   bool isHelp() const;
107
108   /**
109    * Refresh the project structure by comparing the existing model with the corresponding files in the hard drive.
110    */
111   void RefreshProject();
112
113 protected:
114
115   /**
116    * Creates the menu bar and binds the corresponding event handler to each menu.
117    */
118   void CreateMenus();
119
120   /**
121    * Create the user interface containing a wxCDMMainDescriptionPanel and a wxCDMProjectsTreeCtrl.
122    */
123   void CreateControls();
124
125 private:
126
127   //Menus
128   /**
129    * File menu
130    */
131   wxMenu* menu_File;
132   /**
133    * Edit menu
134    */
135   wxMenu* menu_Edit;
136   /**
137    * Tools menu
138    */
139   wxMenu* menu_Tools;
140   /**
141    * Help menu
142    */
143   wxMenu* menu_Help;
144
145   //Controls
146   /**
147    * Floating panel manager
148    */
149   wxAuiManager auiManager;
150   /**
151    * Tree control for an open project
152    */
153   wxCDMProjectsTreeCtrl* tree_Projects;
154   /**
155    * Description panel for a selected project item
156    */
157   wxPanel* panel_Properties;
158   /**
159    * Main actions for an open project
160    */
161   wxPanel* panel_ProjectActions;
162
163   //Model
164   /**
165    * Application model. It holds the open project model.
166    */
167   modelCDMMain* model;
168
169   /**
170    * Help enabled
171    */
172   bool help;
173
174   //events
175 protected:
176   //File
177   /**
178    * New project handler. Launches a new project dialog and creates a project model if the project is correctly created.
179    * @param event The event object that triggers the handler.
180    */
181   void OnMenuNewProject(wxCommandEvent& event);
182   /**
183    * Open project handler. Launches a directory dialog and creates a project model if the project is correctly opened.
184    * @param event The event object that triggers the handler.
185    */
186   void OnMenuOpenProject(wxCommandEvent& event);
187   /**
188    * Close project handler. Remove the project from the model and restarts the user interface.
189    * @param event The event object that triggers the handler.
190    */
191   void OnMenuCloseProject(wxCommandEvent& event);
192   /**
193    * Unimplemented optional method handler. It should export the project structure in XML format.
194    * @param event The event object that triggers the handler.
195    */
196   void OnMenuExportHierarchy(wxCommandEvent& event);
197   /**
198    * Exit handler. It closes any open project and quits the application.
199    * @param event The event object that triggers the handler.
200    */
201   void OnMenuExit(wxCommandEvent& event);
202
203   //Edit
204   /**
205    * Refresh project handler. Refreshes the project structure.
206    * @param event The event object that triggers the handler.
207    */
208   void OnMenuRefreshProject(wxCommandEvent& event);
209
210   //Tools
211   /**
212    * Launches the BBTK Graphical Editor, also known as BBEditor.
213    * @param event The event object that triggers the handler.
214    */
215   void OnMenuBBTKGraphicalEditor(wxCommandEvent& event);
216   /**
217    * Launches the Minitools application alse known as creaTools
218    * @param event The event object that triggers the handler.
219    */
220   void OnMenuMiniTools(wxCommandEvent& event);
221   /**
222    * Launches the system default code editor.
223    * Linux: gedit
224    * Mac:
225    * Windows:
226    * @param event The event object that triggers the handler.
227    */
228   void OnMenuCodeEditor(wxCommandEvent& event);
229   /**
230    * Launches the system command line interpreter (CLI).
231    * Linux: gnome-terminal
232    * Mac:
233    * Windows:
234    * @param event The event object that triggers the handler.
235    */
236   void OnMenuCommandLine(wxCommandEvent& event);
237
238   //Help
239   /**
240    * Enables/Disables the help option.
241    * @param event The event object that triggers the handler.
242    */
243   void OnMenuToggleHelp(wxCommandEvent& event);
244   /**
245    * Open the default web browser and redirects to the CreaTools Documentation page.
246    * @param event The event object that triggers the handler.
247    */
248   void OnMenuHelp(wxCommandEvent& event);
249   /**
250    * Open the default web browser and redirects to the Crea Bug Tracking page.
251    * @param event The event object that triggers the handler.
252    */
253   void OnMenuReportBug(wxCommandEvent& event);
254   /**
255    * Shows the about dialog of creaDevManager
256    * @param event The event object that triggers the handler.
257    */
258   void OnMenuAboutCreaDevManager(wxCommandEvent& event);
259   /**
260    * Open the default web browser and redirects to the Creatis page.
261    * @param event The event object that triggers the handler.
262    */
263   void OnMenuAboutCreatis(wxCommandEvent& event);
264
265   //Tree
266   /**
267    * Handles the propertiesPanel change when there is a change in the selection on the Project Tree.
268    * @param event The event object that triggers the handler.
269    */
270   void OnTreeSelectionChanged(wxTreeEvent& event);
271
272   //PropertiesPanel
273   /**
274    *Handles the propertiesPanel change when the event wxEVT_DISPLAY_CHANGED is triggered.
275    * @param event The event object that triggers the handler.
276    */
277   void OnChangeView(wxCommandEvent& event);
278
279   //Element higlighted
280   /**
281    * Handles the change of the style of an element in the tree when buttons are hovered.
282    * @param event The event object that triggers the handler.
283    */
284   void OnElementSelected(wxCommandEvent& event);
285   /**
286    * Handles the change of the style of an element in the tree when buttons finish hover.
287    * @param event The event object that triggers the handler.
288    */
289   void OnElementDeselected(wxCommandEvent& event);
290
291   //Enable/Disable help
292   /**
293    * Handles the change of the state of the help option when it's triggered by another class.
294    * @param event The event object that triggers the handler.
295    */
296   void OnDisableHelp(wxCommandEvent& event);
297 };
298
299 #endif