Computer Assisted Medical Intervention Tool Kit  version 5.2
 
Loading...
Searching...
No Matches
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-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, 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 PropertyObject;
49class ViewerDockStyle;
50
181class CAMITK_API Viewer : public QObject {
182 Q_OBJECT
183
184public:
185
191
193
194
195 Viewer(QString name, ViewerType type = EMBEDDED);
196
198 virtual ~Viewer() override;
199
201 QString getName() const {
202 return name;
203 };
204
206 QString getDescription() const {
207 return description;
208 };
209
211 void setType(ViewerType);
212
214 ViewerType getType();
215
221 virtual bool setDockWidget(QDockWidget*);
222
225 virtual QDockWidget* getDockWidget();
226
231 virtual bool setEmbedder(QLayout*);
232
235 virtual QLayout* getEmbedder();
236
238 virtual void refresh(Viewer* whoIsAsking = nullptr) = 0;
239
242 return nullptr;
243 };
244
246 virtual QMenu* getMenu() {
247 return nullptr;
248 };
249
251 virtual QToolBar* getToolBar() {
252 return nullptr;
253 };
254
256 virtual void setVisible(bool);
257
261 virtual void setToolBarVisibility(bool);
262
264 virtual bool getToolBarVisibility();
265
267 virtual QPixmap getIcon();
268
270
279 CAMITK_API_DEPRECATED("Please use getComponentClassNames() instead") QStringList getComponents();
283 QStringList getComponentClassNames();
284
285signals:
286
288 void selectionChanged();
289
290protected:
295 virtual QWidget* getWidget() = 0;
296
301 void selectionChanged(ComponentList& compSet);
302
304 void selectionChanged(Component* comp);
305
307 void clearSelection();
308
310 void setIcon(QPixmap icon);
311
313
322 CAMITK_API_DEPRECATED("Please use setComponentClassNames() instead") void setComponents(QStringList);
326 void setComponentClassNames(QStringList);
327
329 void setDescription(QString);
330
331private:
333 QString name;
334
336 QString description;
337
339 bool toolbarVisibility;
340
342 QPixmap icon;
343
345 ViewerDockStyle* dockWidgetStyle;
346
348 QStringList componentClassNames;
349
351 ViewerType type;
352
354 QDockWidget* dockWidget;
355
357 QLayout* embedder;
358};
359
360}
361
362#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:303
This class describes a property object.
Definition PropertyObject.h:72
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:181
virtual QToolBar * getToolBar()
get the viewer toolbar (returns nullptr by default, i.e. there are no default toolbar)
Definition Viewer.h:251
virtual PropertyObject * getPropertyObject()
get the viewer property object (returns nullptr by default, i.e. there are no property to edit)
Definition Viewer.h:241
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
QString getDescription() const
get the name of the viewer
Definition Viewer.h:206
virtual QMenu * getMenu()
get the viewer menu (returns nullptr by default, i.e. there are no default edit menu)
Definition Viewer.h:246
Q_ENUM(ViewerType) Viewer(QString name
default constructor
ViewerType
describes where this viewer should appear
Definition Viewer.h:187
@ EMBEDDED
this viewer is meant to be embedded inside a layout (of another viewer or widget),...
Definition Viewer.h:188
@ DOCKED
this viewer is meant to be docked, use dockIn() to get the dock widget
Definition Viewer.h:189
Definition Action.cpp:36