Computer Assisted Medical Intervention Tool Kit version 6.0
 
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-2025 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#include <QUuid>
36
37// -- QT stuff classes
38class QToolBar;
39class QMenu;
40class QPixMap;
41class QWidget;
42class QDockWidget;
43class QLayout;
44
45namespace camitk {
46class Component;
47class ViewerExtension;
48class Property;
49class PropertyObject;
50class ViewerDockStyle;
51
182class CAMITK_API Viewer : public QObject {
183 Q_OBJECT
184
185public:
186
192
194
195
196 Viewer(QString name, ViewerType type = EMBEDDED);
197
199 virtual ~Viewer() override;
200
202 QString getName() const {
203 return name;
204 };
205
207 void setDescription(QString);
208
210 QString getDescription() const {
211 return description;
212 };
213
215 bool setUuid(QUuid id) {
216 if (uuid.isNull()) {
217 uuid = id;
218 return true;
219 }
220 else {
221 return false;
222 }
223 }
224
226 QUuid getUuid() const {
227 return uuid;
228 }
229
231 void setType(ViewerType);
232
234 ViewerType getType() const;
235
241 virtual bool setDockWidget(QDockWidget*);
242
245 virtual QDockWidget* getDockWidget() const;
246
251 virtual bool setEmbedder(QLayout*);
252
255 virtual QLayout* getEmbedder() const;
256
258 virtual void refresh(Viewer* whoIsAsking = nullptr) = 0;
259
262 return nullptr;
263 };
264
266 virtual QMenu* getMenu() {
267 return nullptr;
268 };
269
271 virtual QToolBar* getToolBar() {
272 return nullptr;
273 };
274
276 virtual void setVisible(bool);
277
281 virtual void setToolBarVisibility(bool);
282
284 virtual bool getToolBarVisibility() const;
285
287 virtual QPixmap getIcon() const;
288
291 QStringList getComponentClassNames() const;
292
293signals:
294
297
298protected:
303 virtual QWidget* getWidget() = 0;
304
309 void selectionChanged(ComponentList& compSet);
310
312 void selectionChanged(Component* comp);
313
315 void clearSelection();
316
318 void setIcon(QPixmap icon);
319
322 void setComponentClassNames(QStringList);
323
324private:
326 QString name;
327
329 QString description;
330
332 bool toolbarVisibility;
333
335 QPixmap icon;
336
338 ViewerDockStyle* dockWidgetStyle;
339
341 QStringList componentClassNames;
342
344 ViewerType type;
345
347 QDockWidget* dockWidget;
348
350 QLayout* embedder;
351
353 QUuid uuid;
354};
355
356}
357
358#endif // VIEWER_H
#define CAMITK_API
Definition CamiTKAPI.h:66
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:304
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:182
virtual QToolBar * getToolBar()
get the viewer toolbar (returns nullptr by default, i.e. there are no default toolbar)
Definition Viewer.h:271
QUuid getUuid() const
get the Uuid of this viewer
Definition Viewer.h:226
virtual PropertyObject * getPropertyObject()
get the viewer property object (returns nullptr by default, i.e. there are no property to edit)
Definition Viewer.h:261
virtual QWidget * getWidget()=0
get the viewer widget.
virtual void refresh(Viewer *whoIsAsking=nullptr)=0
refresh the view (can be interesting to know which other viewer is calling this)
bool setUuid(QUuid id)
set the Uuid of this viewer
Definition Viewer.h:215
QString getDescription() const
get the name of the viewer
Definition Viewer.h:210
virtual QMenu * getMenu()
get the viewer menu (returns nullptr by default, i.e. there are no default edit menu)
Definition Viewer.h:266
Q_ENUM(ViewerType) Viewer(QString name
default constructor
void selectionChanged()
this signal is emitted when the current selection was changed by the viewer
ViewerType
describes where this viewer should appear
Definition Viewer.h:188
@ EMBEDDED
this viewer is meant to be embedded inside a layout (of another viewer or widget),...
Definition Viewer.h:189
@ DOCKED
this viewer is meant to be docked, use dockIn() to get the dock widget
Definition Viewer.h:190
Definition Action.cpp:40