1 //---------------------------------------------------------------------------
2 // $RCSfile: TreeMultiItemBase.h,v $
\r
3 // $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemBase.h,v $
\r
5 // $Date: 2008/03/28 13:42:18 $
\r
6 //---------------------------------------------------------------------------
7 // Author: Jorgen Bodde
8 // Copyright: (c) Jorgen Bodde
9 // License: wxWidgets License
10 //---------------------------------------------------------------------------
12 #ifndef __TREEMULTIITEMBASE_HPP_
13 #define __TREEMULTIITEMBASE_HPP_
16 #pragma interface "TreeMultiItemBase.cpp"
23 // forward definitions
24 class TreeMultiItemRoot;
25 class TreeMultiItemWindow;
26 class TreeMultiItemNode;
28 class TreeMultiItemBase
31 TreeMultiItemBase(TreeMultiItemNode *parent);
33 /** Name property of this item, useful for assigning / coupling
34 external variable reference to this item. It is not mandatory */
37 /** Flag to indicate that this node is visible or not. The Node can be
38 temporarily excluded by flagging it. This has also consequences for all
39 the children of this node (if any) */
42 /** Type of instanced class */
45 /** Calculated X, Y position */
48 /** Calculated width, height */
52 /** Checkbox flag (draw one or not) */
55 /** Internal draw state. This is a unintelligent state, and should be
56 updated when this node has some checked and some unchecked children
57 then this should become a tri-stated item */
62 virtual ~TreeMultiItemBase();
66 int GetType() const { return _type; };
67 TreeMultiItemNode *GetParent() const { return _parent; };
69 /** Get name of this node */
70 wxString GetName() const {
73 /** Set name of the item */
74 void SetName(wxString const& NewName)
76 this->_name = NewName;
79 /** returns the instance pointer if the current node is
80 a TreeMultiItemRoot, and NULL when it's not.
82 virtual TreeMultiItemRoot *IsTreeMultiItemRoot() const {
86 /** returns the instance pointer if the current node is
87 a TreeMultiItemWindow, and NULL when it's not.
89 virtual TreeMultiItemWindow *IsTreeMultiItemWindow() const {
93 /** returns the instance pointer if the current node is
94 a TreeMultiItemNode, and NULL when it's not.
96 virtual TreeMultiItemNode *IsTreeMultiItemNode() const {
100 /** Sets or resets the excluded flag. When excluded node is not visible */
101 void SetExcluded(bool excluded) {
102 _excluded = excluded;
105 /** Get / Set routine for X */
114 /** Get / Set routine for Y */
123 /** Get / Set routine for height */
124 void SetHeight(int height) {
128 int GetHeight() const {
132 /** Get / Set routine for width */
133 void SetWidth(int width) {
137 int GetWidth() const {
141 /** Returns true when this item is drawn somewhere in the
142 tree. Whenever a parent of this node is collapsed, it
143 is not visible and it is not necessary to perform i.e.
146 It also returns false when this node is excluded from the
149 \sa wxTreeMultiCtrl::Exclude(), wxTreeMultiCtrl::Include())
153 /* Returns if this node is excluded from the tree. If this item
154 is a Node, then all kids are excluded as well */
155 bool IsExcluded() const {
160 // item selection status handling
162 /** checks if the item is selected */
163 bool IsSelected(void) const
165 return this->m_Selected;
168 /** mark the current item as selected */
171 this->m_Selected = true;
174 /** toggle the selection status */
175 void ToggleSelection(void)
177 this->m_Selected = !(this->m_Selected);
180 /** unmark the item */
183 this->m_Selected = false;
187 /** Sets checkbox or not. This does not influence the state of the checkbox */
188 void SetCheckbox(bool value) {
192 /** Returns current state of the checkbox view */
193 bool GetCheckbox() const {
197 /** Sets checkbox state. If 0 it's unchecked, 1 = checked and 2 = tristate */
198 virtual void SetCheckboxState(int state) {
199 wxCHECK2(state < 3 && state >= 0, return);
200 _checkboxState = state;
203 /** Returns current state of checkbox */
204 int GetCheckboxState() const {
205 return _checkboxState;
210 TreeMultiItemNode *_parent;
212 // flags to indicate the status of the item: