]> Creatis software - crea.git/blob - lib/creaDevManagerLib/wxCDMMainFrame.h
Feature #1711 CreaDevManager application implementation
[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    * Recently opened projects menu
130    */
131   wxMenu* menu_Recent;
132   /**
133    * File menu
134    */
135   wxMenu* menu_File;
136   /**
137    * Edit menu
138    */
139   wxMenu* menu_Edit;
140   /**
141    * Tools menu
142    */
143   wxMenu* menu_Tools;
144   /**
145    * Help menu
146    */
147   wxMenu* menu_Help;
148
149   //Controls
150   /**
151    * Floating panel manager
152    */
153   wxAuiManager auiManager;
154   /**
155    * Tree control for an open project
156    */
157   wxCDMProjectsTreeCtrl* tree_Projects;
158   /**
159    * Tree item for the selected item in the tree.
160    */
161   wxTreeItemId actualTreeItem;
162   /**
163    * Description panel for a selected project item
164    */
165   wxPanel* panel_Properties;
166   /**
167    * Main actions for an open project
168    */
169   wxPanel* panel_ProjectActions;
170
171   //Model
172   /**
173    * Application model. It holds the open project model.
174    */
175   modelCDMMain* model;
176
177   /**
178    * Help enabled
179    */
180   bool help;
181
182   //events
183 protected:
184
185   /**
186    * Starts when the menu bar is opened.
187    * @param event The event object that triggers the handler.
188    */
189   void OnMenuBarOpen(wxMenuEvent& event);
190
191   //File
192   /**
193    * New project handler. Launches a new project dialog and creates a project model if the project is correctly created.
194    * @param event The event object that triggers the handler.
195    */
196   void OnMenuNewProject(wxCommandEvent& event);
197   /**
198    * Open project handler. Launches a directory dialog and creates a project model if the project is correctly opened.
199    * @param event The event object that triggers the handler.
200    */
201   void OnMenuOpenProject(wxCommandEvent& event);
202   /**
203    * Open recent project handler. Creates a project model if the project is correctly opened given its path.
204    * @param event The event object that triggers the handler.
205    */
206   void OnMenuOpenRecent(wxCommandEvent& event);
207   /**
208    * Close project handler. Remove the project from the model and restarts the user interface.
209    * @param event The event object that triggers the handler.
210    */
211   void OnMenuCloseProject(wxCommandEvent& event);
212   /**
213    * Unimplemented optional method handler. It should export the project structure in XML format.
214    * @param event The event object that triggers the handler.
215    */
216   void OnMenuExportHierarchy(wxCommandEvent& event);
217   /**
218    * Exit handler. It closes any open project and quits the application.
219    * @param event The event object that triggers the handler.
220    */
221   void OnMenuExit(wxCommandEvent& event);
222
223   //Edit
224   /**
225    * Refresh project handler. Refreshes the project structure.
226    * @param event The event object that triggers the handler.
227    */
228   void OnMenuRefreshProject(wxCommandEvent& event);
229   /**
230    * Open the settings dialog.
231    * @param event The event object that triggers the handler.
232    */
233   void OnMenuSettings(wxCommandEvent& event);
234
235   //Tools
236   /**
237    * Launches the BBTK Graphical Editor, also known as BBEditor.
238    * @param event The event object that triggers the handler.
239    */
240   void OnMenuBBTKGraphicalEditor(wxCommandEvent& event);
241   /**
242    * Launches the Minitools application alse known as creaTools
243    * @param event The event object that triggers the handler.
244    */
245   void OnMenuMiniTools(wxCommandEvent& event);
246   /**
247    * Launches the system default code editor.
248    * Linux: gedit
249    * Mac:
250    * Windows:
251    * @param event The event object that triggers the handler.
252    */
253   void OnMenuCodeEditor(wxCommandEvent& event);
254   /**
255    * Launches the system command line interpreter (CLI).
256    * Linux: gnome-terminal
257    * Mac:
258    * Windows:
259    * @param event The event object that triggers the handler.
260    */
261   void OnMenuCommandLine(wxCommandEvent& event);
262
263   //Help
264   /**
265    * Enables/Disables the help option.
266    * @param event The event object that triggers the handler.
267    */
268   void OnMenuToggleHelp(wxCommandEvent& event);
269   /**
270    * Open the road map for crea projects.
271    * @param event The event object that triggers the handler.
272    */
273   void OnMenuShowProjectMap(wxCommandEvent& event);
274   /**
275    * Open the default web browser and redirects to the CreaTools Documentation page.
276    * @param event The event object that triggers the handler.
277    */
278   void OnMenuHelp(wxCommandEvent& event);
279   /**
280    * Open the default web browser and redirects to the Crea Bug Tracking page.
281    * @param event The event object that triggers the handler.
282    */
283   void OnMenuReportBug(wxCommandEvent& event);
284   /**
285    * Shows the about dialog of creaDevManager
286    * @param event The event object that triggers the handler.
287    */
288   void OnMenuAboutCreaDevManager(wxCommandEvent& event);
289   /**
290    * Open the default web browser and redirects to the Creatis page.
291    * @param event The event object that triggers the handler.
292    */
293   void OnMenuAboutCreatis(wxCommandEvent& event);
294
295   //Tree
296   /**
297    * Handles the propertiesPanel change when there is a change in the selection on the Project Tree.
298    * @param event The event object that triggers the handler.
299    */
300   void OnTreeSelectionChanged(wxTreeEvent& event);
301
302   //PropertiesPanel
303   /**
304    *Handles the propertiesPanel change when the event wxEVT_DISPLAY_CHANGED is triggered.
305    * @param event The event object that triggers the handler.
306    */
307   void OnChangeView(wxCommandEvent& event);
308
309   //Element higlighted
310   /**
311    * Handles the change of the style of an element in the tree when buttons are hovered.
312    * @param event The event object that triggers the handler.
313    */
314   void OnElementSelected(wxCommandEvent& event);
315   /**
316    * Handles the change of the style of an element in the tree when buttons finish hover.
317    * @param event The event object that triggers the handler.
318    */
319   void OnElementDeselected(wxCommandEvent& event);
320
321   //Enable/Disable help
322   /**
323    * Handles the change of the state of the help option when it's triggered by another class.
324    * @param event The event object that triggers the handler.
325    */
326   void OnDisableHelp(wxCommandEvent& event);
327 };
328
329 #endif