]> 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    * 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    * Tree item for the selected item in the tree.
156    */
157   wxTreeItemId actualTreeItem;
158   /**
159    * Description panel for a selected project item
160    */
161   wxPanel* panel_Properties;
162   /**
163    * Main actions for an open project
164    */
165   wxPanel* panel_ProjectActions;
166
167   //Model
168   /**
169    * Application model. It holds the open project model.
170    */
171   modelCDMMain* model;
172
173   /**
174    * Help enabled
175    */
176   bool help;
177
178   //events
179 protected:
180   //File
181   /**
182    * New project handler. Launches a new project dialog and creates a project model if the project is correctly created.
183    * @param event The event object that triggers the handler.
184    */
185   void OnMenuNewProject(wxCommandEvent& event);
186   /**
187    * Open project handler. Launches a directory dialog and creates a project model if the project is correctly opened.
188    * @param event The event object that triggers the handler.
189    */
190   void OnMenuOpenProject(wxCommandEvent& event);
191   /**
192    * Close project handler. Remove the project from the model and restarts the user interface.
193    * @param event The event object that triggers the handler.
194    */
195   void OnMenuCloseProject(wxCommandEvent& event);
196   /**
197    * Unimplemented optional method handler. It should export the project structure in XML format.
198    * @param event The event object that triggers the handler.
199    */
200   void OnMenuExportHierarchy(wxCommandEvent& event);
201   /**
202    * Exit handler. It closes any open project and quits the application.
203    * @param event The event object that triggers the handler.
204    */
205   void OnMenuExit(wxCommandEvent& event);
206
207   //Edit
208   /**
209    * Refresh project handler. Refreshes the project structure.
210    * @param event The event object that triggers the handler.
211    */
212   void OnMenuRefreshProject(wxCommandEvent& event);
213   /**
214    * Open the settings dialog.
215    * @param event The event object that triggers the handler.
216    */
217   void OnMenuSettings(wxCommandEvent& event);
218
219   //Tools
220   /**
221    * Launches the BBTK Graphical Editor, also known as BBEditor.
222    * @param event The event object that triggers the handler.
223    */
224   void OnMenuBBTKGraphicalEditor(wxCommandEvent& event);
225   /**
226    * Launches the Minitools application alse known as creaTools
227    * @param event The event object that triggers the handler.
228    */
229   void OnMenuMiniTools(wxCommandEvent& event);
230   /**
231    * Launches the system default code editor.
232    * Linux: gedit
233    * Mac:
234    * Windows:
235    * @param event The event object that triggers the handler.
236    */
237   void OnMenuCodeEditor(wxCommandEvent& event);
238   /**
239    * Launches the system command line interpreter (CLI).
240    * Linux: gnome-terminal
241    * Mac:
242    * Windows:
243    * @param event The event object that triggers the handler.
244    */
245   void OnMenuCommandLine(wxCommandEvent& event);
246
247   //Help
248   /**
249    * Enables/Disables the help option.
250    * @param event The event object that triggers the handler.
251    */
252   void OnMenuToggleHelp(wxCommandEvent& event);
253   /**
254    * Open the default web browser and redirects to the CreaTools Documentation page.
255    * @param event The event object that triggers the handler.
256    */
257   void OnMenuHelp(wxCommandEvent& event);
258   /**
259    * Open the default web browser and redirects to the Crea Bug Tracking page.
260    * @param event The event object that triggers the handler.
261    */
262   void OnMenuReportBug(wxCommandEvent& event);
263   /**
264    * Shows the about dialog of creaDevManager
265    * @param event The event object that triggers the handler.
266    */
267   void OnMenuAboutCreaDevManager(wxCommandEvent& event);
268   /**
269    * Open the default web browser and redirects to the Creatis page.
270    * @param event The event object that triggers the handler.
271    */
272   void OnMenuAboutCreatis(wxCommandEvent& event);
273
274   //Tree
275   /**
276    * Handles the propertiesPanel change when there is a change in the selection on the Project Tree.
277    * @param event The event object that triggers the handler.
278    */
279   void OnTreeSelectionChanged(wxTreeEvent& event);
280
281   //PropertiesPanel
282   /**
283    *Handles the propertiesPanel change when the event wxEVT_DISPLAY_CHANGED is triggered.
284    * @param event The event object that triggers the handler.
285    */
286   void OnChangeView(wxCommandEvent& event);
287
288   //Element higlighted
289   /**
290    * Handles the change of the style of an element in the tree when buttons are hovered.
291    * @param event The event object that triggers the handler.
292    */
293   void OnElementSelected(wxCommandEvent& event);
294   /**
295    * Handles the change of the style of an element in the tree when buttons finish hover.
296    * @param event The event object that triggers the handler.
297    */
298   void OnElementDeselected(wxCommandEvent& event);
299
300   //Enable/Disable help
301   /**
302    * Handles the change of the state of the help option when it's triggered by another class.
303    * @param event The event object that triggers the handler.
304    */
305   void OnDisableHelp(wxCommandEvent& event);
306 };
307
308 #endif