Fraxinus  17.12-rc2
An IGT application
cxTreeNodeImpl.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 CXTREENODEIMPL_H
33 #define CXTREENODEIMPL_H
34 
35 #include "cxTreeNode.h"
37 #include <QVariant>
38 
39 namespace cx
40 {
41 
42 class TreeNode;
43 typedef boost::weak_ptr<TreeNode> TreeNodeWeakPtr;
44 typedef boost::shared_ptr<TreeNode> TreeNodePtr;
45 
46 
47 class TreeNodeImpl : public TreeNode
48 {
49  Q_OBJECT
50 public:
52  virtual ~TreeNodeImpl() {}
53  virtual std::vector<TreeNodePtr> getChildren() const;
54  virtual bool isVisibleNode() const;
55 
56  virtual void activate() {}
57  virtual QVariant getViewGroupVisibility(int index) const { return QVariant(); }
58  virtual void setViewGroupVisibility(int index, bool value) {}
59  virtual QVariant getColor() const { return QVariant(); }
60  virtual bool useColoredName() const { return false; }
61  virtual QVariant getFont() const { return QVariant(); }
62  virtual boost::shared_ptr<QWidget> createPropertiesWidget() const { return boost::shared_ptr<QWidget>(); }
63  virtual bool isDefaultExpanded() const { return true; }
64 
65  virtual bool isRemovable() const { return false; }
66  virtual void remove() { }
67 
68  virtual std::vector<TreeNodePtr> getVisibleChildren() const;
69  virtual TreeNodePtr getVisibleParent() const;
70 
71 protected:
74 
76  const TreeRepositoryPtr repo() const;
77 
78  QIcon addBackgroundColorToIcon(QIcon input, QColor color) const;
79 };
80 
81 } // namespace cx
82 
83 #endif // CXTREENODEIMPL_H
boost::shared_ptr< class TreeRepository > TreeRepositoryPtr
virtual QVariant getColor() const
boost::shared_ptr< TreeNode > TreeNodePtr
VisServicesPtr getServices() const
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:61
virtual QVariant getViewGroupVisibility(int index) const
virtual bool isVisibleNode() const
TreeNodeImpl(TreeRepositoryWeakPtr repo)
virtual QVariant getFont() const
virtual bool isRemovable() const
boost::weak_ptr< class TreeRepository > TreeRepositoryWeakPtr
Definition: cxTreeNode.h:51
TreeRepositoryPtr repo()
virtual bool isDefaultExpanded() const
virtual std::vector< TreeNodePtr > getVisibleChildren() const
virtual bool useColoredName() const
virtual boost::shared_ptr< QWidget > createPropertiesWidget() const
TreeRepositoryWeakPtr mRepository
boost::weak_ptr< TreeNode > TreeNodeWeakPtr
virtual void activate()
QIcon addBackgroundColorToIcon(QIcon input, QColor color) const
virtual void setViewGroupVisibility(int index, bool value)
virtual TreeNodePtr getVisibleParent() const
virtual ~TreeNodeImpl()
virtual std::vector< TreeNodePtr > getChildren() const
Namespace for all CustusX production code.