Computer Assited Medical Intervention Tool Kit  version 5.0
Viewer.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 #ifndef VIEWER_H
27 #define VIEWER_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 
32 // -- QT stuff
33 #include <QObject>
34 #include <QPixmap>
35 
36 // -- QT stuff classes
37 class QToolBar;
38 class QMenu;
39 class QPixMap;
40 class QWidget;
41 class QDockWidget;
42 class QLayout;
43 
44 namespace camitk {
45 class Component;
46 class ViewerExtension;
47 class Property;
48 class ViewerDockStyle;
49 
180 class CAMITK_API Viewer : public QObject {
181  Q_OBJECT
182 
183 public:
184 
186  enum ViewerType {
189  };
190 
191  Q_ENUM(ViewerType)
192 
193 
194  Viewer(QString name, ViewerType type = EMBEDDED);
195 
197  virtual ~Viewer() override;
198 
200  QString getName() const {
201  return name;
202  };
203 
205  QString getDescription() const {
206  return description;
207  };
208 
210  void setType(ViewerType);
211 
213  ViewerType getType();
214 
220  bool setDockWidget(QDockWidget*);
221 
224  QDockWidget* getDockWidget();
225 
230  bool setEmbedder(QLayout*);
231 
234  QLayout* getEmbedder();
235 
237  virtual void refresh(Viewer* whoIsAsking = nullptr) = 0;
238 
240  virtual QObject* getPropertyObject() {
241  return nullptr;
242  };
243 
245  virtual QMenu* getMenu() {
246  return nullptr;
247  };
248 
250  virtual QToolBar* getToolBar() {
251  return nullptr;
252  };
253 
255  void setVisible(bool);
256 
260  void setToolBarVisibility(bool);
261 
263  bool getToolBarVisibility();
264 
266  virtual QPixmap getIcon();
267 
270  QStringList getComponents();
271 
272 signals:
273 
275  void selectionChanged();
276 
277 protected:
282  virtual QWidget* getWidget() = 0;
283 
288  void selectionChanged(ComponentList& compSet);
289 
291  void selectionChanged(Component* comp);
292 
294  void clearSelection();
295 
297  void setIcon(QPixmap icon);
298 
301  void setComponents(QStringList);
302 
304  void setDescription(QString);
305 
306 private:
308  QString name;
309 
311  QString description;
312 
315 
317  QPixmap icon;
318 
321 
323  QStringList components;
324 
326  ViewerType type;
327 
329  QDockWidget* dockWidget;
330 
332  QLayout* embedder;
333 };
334 
335 }
336 
337 #endif // VIEWER_H
camitk::Viewer::ViewerType
ViewerType
Definition: Viewer.h:186
CamiTKAPI.h
camitk::Viewer::DOCKED
@ DOCKED
this viewer is meant to be docked, use dockIn() to get the dock widget
Definition: Viewer.h:188
camitk::Viewer::icon
QPixmap icon
the Viewer pixmap icon
Definition: Viewer.h:317
Log.h
camitk::Viewer::EMBEDDED
@ EMBEDDED
this viewer is meant to be embedded inside a layout (of another viewer or widget),...
Definition: Viewer.h:187
CAMITK_ERROR
#define CAMITK_ERROR(MSG)
Log for error verbosity (the minimum verbosity) Will always appear.
Definition: Log.h:276
camitk::Viewer::dockWidgetStyle
ViewerDockStyle * dockWidgetStyle
the style for the dock widget
Definition: Viewer.h:320
camitk::Component::setSelected
virtual void setSelected(const bool b, const bool recursive=true)
Update the selection flag.
Definition: sdk/libraries/core/component/Component.cpp:445
description
const char * description
Definition: applications/cepgenerator/main.cpp:38
camitk::Viewer::embedder
QLayout * embedder
if layout is of type EMBEDDED, this is the layout where the viewer's widget is embedded in
Definition: Viewer.h:332
camitk::Viewer::getMenu
virtual QMenu * getMenu()
get the viewer menu (returns nullptr by default, i.e. there are no default edit menu)
Definition: Viewer.h:245
camitk::Viewer::name
QString name
current viewer's name
Definition: Viewer.h:308
camitk::Viewer::dockWidget
QDockWidget * dockWidget
if layout is of type DOCKED, then this is the widget where the viewer's widget is docked
Definition: Viewer.h:329
camitk::Viewer::components
QStringList components
list of Component class name managed by this viewer
Definition: Viewer.h:323
camitk::ComponentList
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127
camitk::ViewerDockStyle
a specific style made for QDockWidget that adds an icon to the dock widget title
Definition: ViewerDockStyle.h:69
MainWindow.h
Component
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
camitk::Viewer
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
camitk::setObjectName
setObjectName("RendererWidget")
Viewer.h
camitk::Viewer::getDescription
QString getDescription() const
get the name of the viewer
Definition: Viewer.h:205
camitk::Viewer::getPropertyObject
virtual QObject * getPropertyObject()
get the viewer property object (returns nullptr by default, i.e. there are no property to edit)
Definition: Viewer.h:240
ViewerDockStyle.h
camitk::refresh
void refresh()
refresh the display
camitk::Viewer::toolbarVisibility
bool toolbarVisibility
the current toolbar visibility
Definition: Viewer.h:314
camitk::Viewer::getToolBar
virtual QToolBar * getToolBar()
get the viewer toolbar (returns nullptr by default, i.e. there are no default toolbar)
Definition: Viewer.h:250
camitk::Viewer::description
QString description
description of the viewer
Definition: Viewer.h:311
camitk::Component
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:302
Application.h
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:49
camitk
Definition: Action.cpp:35