Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Explorer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
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 EXPLORER_H
28 #define EXPLORER_H
29 
30 // -- Core stuff
31 #include "Viewer.h"
32 
33 // -- QT stuff
34 #include <QTreeWidget>
35 #include <QTreeWidgetItem>
36 
37 namespace camitk
38 {
39 // -- Core stuff classes
40 class InterfaceNode;
41 class Component;
42 class ExplorerItem;
43 class Explorer;
44 
54 class CAMITK_API Explorer : public Viewer {
55  Q_OBJECT
56 
57 public:
60 
62  Explorer();
63 
65  ~Explorer();
66 
68  static Explorer* getInstance();
70 
73  virtual unsigned int numberOfViewedComponent();
76 
78  virtual void refresh(Viewer *whoIsAsking=NULL);
79 
81  virtual QWidget * getWidget(QWidget * parent);
82 
84  virtual QMenu * getMenu();
85 
87  virtual QWidget* getPreferenceWidget(QWidget * parent);
88 
96  virtual void refreshInterfaceNode(Component * comp);
98 
99 public slots :
100 
102  void renameItem();
103 
104 private slots :
105 
107  void selectionChanged();
108 
110  void doubleClicked(QTreeWidgetItem *, int);
111 
113  void rightButtonPressed(const QPoint &);
114 
115 private:
116 
120  QMap<QTreeWidgetItem*, Component *> itemComponentMap;
121 
123  QMap<Component*, QTreeWidgetItem*> itemCompMap;
124 
126  QTreeWidgetItem* getItem(Component *);
128 
132  QTreeWidgetItem* getNewItem(QTreeWidgetItem* parent, Component *);
133 
135  QTreeWidgetItem* add(QTreeWidgetItem*, Component *);
136 
140  void add(Component * comp);
141 
143  void remove(QTreeWidgetItem*);
144 
148  void remove(Component *comp);
149 
150 
152  QTreeWidget *explorerTree;
154 
158  QMenu* explorerMenu;
159 
161  QAction * editRename;
163 };
164 
165 }
166 
167 
168 #endif