Computer Assited Medical Intervention Tool Kit  version 5.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-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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 #include <QStackedLayout>
42 
43 namespace camitk {
44 
45 // -- Core stuff classes
46 class Component;
47 class Viewer;
48 
66 class CAMITK_API MainWindow : public QMainWindow {
67  Q_OBJECT
68 
69 public:
70 
73 
79  MainWindow(QString title);
80 
82  ~MainWindow() override;
83 
87  virtual void aboutToShow();
88 
90 
93 
95  QString getName() const;
96 
104  void setWindowSubtitle(QString);
105 
107  QProgressBar* getProgressBar();
108 
110  void showStatusBar(bool);
111 
113  virtual void redirectToConsole(bool);
114 
116  void showConsole(bool);
117 
119  bool getConsoleVisibility();
121 
124 
126 
133  CAMITK_API_DEPRECATED("This method is now called showDockViewer(..)") virtual void showViewer(Viewer*, bool);
136 
138  virtual void showDockViewer(Viewer*, bool);
139 
148  virtual void addDockViewer(Qt::DockWidgetArea, Viewer*);
149 
151  void refreshViewers();
152 
163  virtual void setCentralViewer(Viewer*);
164 
168  virtual Viewer* getCentralViewer() const;
169 
173  virtual void showViewerToolbar(Viewer* theViewer, bool visible);
175 
176 public slots:
177 
179  virtual void refresh();
182 
184  void show();
186 
187 
188 protected:
189 
191  void closeEvent(QCloseEvent*) override;
192 
194  QList<Viewer*> viewers;
197 
199  QMap<Viewer*, QDockWidget*> dockWidgetMap;
200 
202  virtual void initSettings();
204 
206  void dragEnterEvent(QDragEnterEvent* event) override;
207 
209  void dragMoveEvent(QDragMoveEvent* event) override;
210 
212  void dragLeaveEvent(QDragLeaveEvent* event) override;
213 
215  void dropEvent(QDropEvent* event) override;
216 
218 
231  CAMITK_API_DEPRECATED("Removing viewers can be harmful. Central viewer is now simply hidden, therefore there is no need to remove it.") bool removeViewer(Viewer* viewer);
233 
238  Viewer* centralViewer;
239 
240 
241 private:
242 
249  virtual bool addViewer(Viewer*);
250 
252  ConsoleStream cout;
253 
255  ConsoleStream cerr;
256 
258  QProgressBar* myProgressBar;
259 
261  QDockWidget* consoleWindow;
262 
264  QTextEdit* consoleWindowTextEdit;
265 
267  QString mainTitle;
268 
271  QStackedLayout* centralLayout;
272 
273 };
274 }
275 
276 
277 #endif // MAINWINDOW_H
ConsoleStream.h
CamiTKAPI.h
MainWindow
Definition: canvas_typed/mainwindow.h:69
Component
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
camitk::refresh
void refresh()
refresh the display
CAMITK_API_DEPRECATED
#define CAMITK_API_DEPRECATED(X)
Definition: CamiTKAPI.h:94
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:49
camitk
Definition: Action.cpp:35