Computer Assisted Medical Intervention Tool Kit  version 5.1
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-2023 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
37class QToolBar;
38class QMenu;
39class QPixMap;
40class QWidget;
41class QDockWidget;
42class QLayout;
43
44namespace camitk {
45class Component;
46class ViewerExtension;
47class Property;
48class ViewerDockStyle;
49
180class CAMITK_API Viewer : public QObject {
181 Q_OBJECT
182
183public:
184
189 };
190
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
269
278 CAMITK_API_DEPRECATED("Please use getComponentClassNames() instead") QStringList getComponents();
282 QStringList getComponentClassNames();
283
284signals:
285
287 void selectionChanged();
288
289protected:
294 virtual QWidget* getWidget() = 0;
295
300 void selectionChanged(ComponentList& compSet);
301
303 void selectionChanged(Component* comp);
304
306 void clearSelection();
307
309 void setIcon(QPixmap icon);
310
312
321 CAMITK_API_DEPRECATED("Please use setComponentClassNames() instead") void setComponents(QStringList);
325 void setComponentClassNames(QStringList);
326
328 void setDescription(QString);
329
330private:
332 QString name;
333
335 QString description;
336
338 bool toolbarVisibility;
339
341 QPixmap icon;
342
344 ViewerDockStyle* dockWidgetStyle;
345
347 QStringList componentClassNames;
348
350 ViewerType type;
351
353 QDockWidget* dockWidget;
354
356 QLayout* embedder;
357};
358
359}
360
361#endif // VIEWER_H
#define CAMITK_API_DEPRECATED(X)
Definition: CamiTKAPI.h:94
#define CAMITK_API
Definition: CamiTKAPI.h:49
const char * description
Definition: applications/cepgenerator/main.cpp:38
A component is something that composed something and could also be a part of something.
Definition: modeling/libraries/pml/Component.h:48
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:302
a specific style made for QDockWidget that adds an icon to the dock widget title
Definition: ViewerDockStyle.h:46
Viewer is an abstract class that is the base class for all viewers.
Definition: Viewer.h:180
virtual QToolBar * getToolBar()
get the viewer toolbar (returns nullptr by default, i.e. there are no default toolbar)
Definition: Viewer.h:250
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
virtual QObject * getPropertyObject()
get the viewer property object (returns nullptr by default, i.e. there are no property to edit)
Definition: Viewer.h:240
QString getDescription() const
get the name of the viewer
Definition: Viewer.h:205
virtual QMenu * getMenu()
get the viewer menu (returns nullptr by default, i.e. there are no default edit menu)
Definition: Viewer.h:245
Q_ENUM(ViewerType) Viewer(QString name
default constructor
ViewerType
describes where this viewer should appear
Definition: Viewer.h:186
@ EMBEDDED
this viewer is meant to be embedded inside a layout (of another viewer or widget),...
Definition: Viewer.h:187
@ DOCKED
this viewer is meant to be docked, use dockIn() to get the dock widget
Definition: Viewer.h:188
Definition: Action.cpp:35
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127