Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
50 class CAMITK_API Explorer : public Viewer {
51  Q_OBJECT
52 
53  public:
56 
57 
58  Explorer();
59 
61  ~Explorer();
63 
66 
67 
68  virtual unsigned int numberOfViewedComponent();
69 
71  virtual void refresh(Viewer *whoIsAsking=NULL);
72 
74  virtual QWidget * getWidget(QWidget * parent);
75 
77  virtual QMenu * getMenu();
78 
80  virtual QWidget* getPreferenceWidget(QWidget * parent);
81 
89  virtual void refreshInterfaceNode(Component * comp);
90 
92 
93  public slots :
94 
96  void renameItem();
97 
98  private slots :
99 
101  void selectionChanged();
102 
104  void doubleClicked(QTreeWidgetItem *, int);
105 
107  void rightButtonPressed(const QPoint &);
108 
109  private:
110 
114  QMap<QTreeWidgetItem*, Component *> itemComponentMap;
115 
117  QMap<Component*, QTreeWidgetItem*> itemCompMap;
118 
120  QTreeWidgetItem* getItem(Component *);
122 
126  QTreeWidgetItem* getNewItem(QTreeWidgetItem* parent, Component *);
127 
129  QTreeWidgetItem* add(QTreeWidgetItem*, Component *);
130 
134  void add(Component * comp);
135 
137  void remove(QTreeWidgetItem*);
138 
142  void remove(Component *comp);
143 
144 
146  QTreeWidget *explorerTree;
148 
152  QMenu* explorerMenu;
153 
155  QAction * editRename;
157 };
158 
159 }
160 
161 
162 #endif