Computer Assited Medical Intervention Tool Kit  version 4.0
MainWindow.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef MAINWINDOW_H
28 #define MAINWINDOW_H
29 
30 // -- Core stuff
31 #include "CamiTKAPI.h"
32 #include "ConsoleStream.h"
33 
34 // -- QT stuff
35 #include <QMainWindow>
36 #include <QApplication>
37 #include <QDir>
38 #include <QTextEdit>
39 #include <QProgressBar>
40 #include <QStatusBar>
41 
42 
43 namespace camitk {
44 
45 // -- Core stuff classes
46 class Component;
47 class Viewer;
48 
62 class CAMITK_API MainWindow : public QMainWindow {
63  Q_OBJECT
64 
65 public:
66 
69 
75  MainWindow(QString title);
76 
78  virtual ~MainWindow();
79 
83  virtual void aboutToShow();
84 
86 
89 
96  void setWindowSubtitle(QString);
97 
99  QProgressBar * getProgressBar();
100 
102  void showStatusBar(bool);
103 
105  virtual void redirectToConsole(bool);
106 
108  void showConsole(bool);
110 
113 
114 
115 
117  virtual void showViewer(Viewer *, bool);
118 
123  virtual void addDockViewer(Qt::DockWidgetArea, Viewer*);
124 
126  void refreshViewers();
127 
132  virtual void setCentralViewer(Viewer*);
133 
138  virtual const Viewer & getCentralViewer() const;
140 
142 
150  virtual bool addViewer(Viewer*);
152 
153 
154 public slots:
155 
157  virtual void refresh();
160 
162  void show();
164 
165 
166 protected:
167 
169  virtual void closeEvent ( QCloseEvent *);
170 
172  QList<Viewer *> viewers;
175 
177  QMap<Viewer*, QDockWidget*> dockWidgetMap;
178 
180  virtual void initSettings();
182 
184  void dragEnterEvent(QDragEnterEvent *event);
185 
187  void dragMoveEvent(QDragMoveEvent* event);
188 
190  void dragLeaveEvent(QDragLeaveEvent* event);
191 
193  void dropEvent(QDropEvent *event);
194 
201  bool removeViewer(Viewer* viewer);
202 
208 
209 
210 private:
211 
214 
217 
219  QProgressBar *myProgressBar;
220 
222  QDialog *consoleWindow;
223 
226 
228  QString mainTitle;
229 };
230 }
231 
232 
233 #endif // MAINWINDOW_H
Viewer is an abstract viewer.
Definition: Viewer.h:55
This Class is the base class for your application.
Definition: MainWindow.h:62
Definition: Action.cpp:40
QDialog * consoleWindow
console to display all messages
Definition: MainWindow.h:222
#define CAMITK_API
Definition: CamiTKAPI.h:49
QProgressBar * myProgressBar
the progress bar (access through setProgress() method)
Definition: MainWindow.h:219
Provides a console windows, within the CamiTK application.
Definition: ConsoleStream.h:71
Viewer * centralViewer
The actual central Viewer.
Definition: MainWindow.h:207
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
ConsoleStream cout
the output stream for the application console
Definition: MainWindow.h:213
QMap< Viewer *, QDockWidget * > dockWidgetMap
the map that gives the corresponding QDockWidget for a given Viewer
Definition: MainWindow.h:177
ConsoleStream cerr
the error stream for the application console
Definition: MainWindow.h:216
QString mainTitle
the main part of the title
Definition: MainWindow.h:228
QTextEdit * consoleWindowTextEdit
the QTextEdit part of the console dialog
Definition: MainWindow.h:225