Fraxinus  17.12-rc2
An IGT application
cxBrowserWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 #ifndef CXBROWSERWIDGET_H_
33 #define CXBROWSERWIDGET_H_
34 
35 #include "cxBaseWidget.h"
36 #include "cxForwardDeclarations.h"
37 #include "cxPopupToolbarWidget.h"
38 #include "cxXmlOptionItem.h"
39 #include "cxControllableSplitter.h"
41 
42 class QTreeWidget;
43 class QVBoxLayout;
44 class QTreeWidgetItem;
45 class QTreeView;
46 class QSplitter;
47 class QLineEdit;
48 
49 namespace cx
50 {
51 
52 class PopupToolbarWidget;
53 class TreeItemModel;
54 class EraseDataToolButton;
55 typedef boost::shared_ptr<class TreeNode> TreeNodePtr;
56 typedef boost::shared_ptr<class TreeRepository> TreeRepositoryPtr;
57 
58 
69 class BrowserWidget : public BaseWidget
70 {
71  Q_OBJECT
72 
73 public:
74  BrowserWidget(QWidget* parent, VisServicesPtr services);
76 
77 protected slots:
78  void resetView(); // called when tree is reset
79 
80 protected:
82  QPointer<QTreeView> mTreeView;
83 
84 protected:
85  virtual void prePaintEvent();
86 
87 private:
88  void createGUI();
89  void onPopup();
90  void onCurrentItemChanged();
91  void createButtonWidget(QWidget* widget);
92  XmlOptionItem getShowToolbarOption();
93  void expandDefault(QModelIndex index);
94  void updateNodeName();
95  void eraseCurrentNode();
96  void onLoaded();
97  void onNodeCollapsed(const QModelIndex & index);
98  void onNodeExpanded(const QModelIndex & index);
99  void expandRestore(QModelIndex index);
100  bool setCurrentNode(QString uid, QModelIndex index);
101 
102  VisServicesPtr mServices;
103  ControllableSplitter* mSplitter;
104  QPointer<ReplacableContentWidget> mPropertiesWidget;
105  PopupToolbarWidget* mPopupWidget;
106  XmlOptionFile mOptions;
107  QLineEdit* mName;
108  EraseDataToolButton* mRemoveButton;
109 
110  StringPropertyPtr mFilterSelector;
111  QList<QString> mExpanded;
112  QString mActiveNodeUid;
113 };
114 }//end namespace cx
115 
116 #endif /* CXBROWSERWIDGET_H_ */
TreeItemModel * mModel
boost::shared_ptr< class TreeRepository > TreeRepositoryPtr
boost::shared_ptr< TreeNode > TreeNodePtr
BrowserWidget(QWidget *parent, VisServicesPtr services)
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:61
Shows a treestructure containing the loaded images, meshes and tools.
Helper class for storing one string value in an xml document.
virtual void prePaintEvent()
boost::shared_ptr< class StringProperty > StringPropertyPtr
QPointer< QTreeView > mTreeView
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:109
Helper class for xml files used to store ssc/cx data.
Namespace for all CustusX production code.