2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 //---------------------------------------------------------------------------
29 // $RCSfile: TreeMultiItemBase.h,v $
30 // $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemBase.h,v $
32 // $Date: 2012/11/16 08:49:16 $
33 //---------------------------------------------------------------------------
34 // Author: Jorgen Bodde
35 // Copyright: (c) Jorgen Bodde
36 // License: wxWidgets License
37 //---------------------------------------------------------------------------
39 #ifndef __TREEMULTIITEMBASE_HPP_
40 #define __TREEMULTIITEMBASE_HPP_
43 #pragma interface "TreeMultiItemBase.cpp"
50 // forward definitions
51 class TreeMultiItemRoot;
52 class TreeMultiItemWindow;
53 class TreeMultiItemNode;
55 class TreeMultiItemBase
58 TreeMultiItemBase(TreeMultiItemNode *parent);
60 /** Name property of this item, useful for assigning / coupling
61 external variable reference to this item. It is not mandatory */
64 /** Flag to indicate that this node is visible or not. The Node can be
65 temporarily excluded by flagging it. This has also consequences for all
66 the children of this node (if any) */
69 /** Type of instanced class */
72 /** Calculated X, Y position */
75 /** Calculated width, height */
79 /** Checkbox flag (draw one or not) */
82 /** Internal draw state. This is a unintelligent state, and should be
83 updated when this node has some checked and some unchecked children
84 then this should become a tri-stated item */
89 virtual ~TreeMultiItemBase();
93 int GetType() const { return _type; };
94 TreeMultiItemNode *GetParent() const { return _parent; };
96 /** Get name of this node */
97 wxString GetName() const {
100 /** Set name of the item */
101 void SetName(wxString const& NewName)
103 this->_name = NewName;
106 /** returns the instance pointer if the current node is
107 a TreeMultiItemRoot, and NULL when it's not.
109 virtual TreeMultiItemRoot *IsTreeMultiItemRoot() const {
113 /** returns the instance pointer if the current node is
114 a TreeMultiItemWindow, and NULL when it's not.
116 virtual TreeMultiItemWindow *IsTreeMultiItemWindow() const {
120 /** returns the instance pointer if the current node is
121 a TreeMultiItemNode, and NULL when it's not.
123 virtual TreeMultiItemNode *IsTreeMultiItemNode() const {
127 /** Sets or resets the excluded flag. When excluded node is not visible */
128 void SetExcluded(bool excluded) {
129 _excluded = excluded;
132 /** Get / Set routine for X */
141 /** Get / Set routine for Y */
150 /** Get / Set routine for height */
151 void SetHeight(int height) {
155 int GetHeight() const {
159 /** Get / Set routine for width */
160 void SetWidth(int width) {
164 int GetWidth() const {
168 /** Returns true when this item is drawn somewhere in the
169 tree. Whenever a parent of this node is collapsed, it
170 is not visible and it is not necessary to perform i.e.
173 It also returns false when this node is excluded from the
176 \sa wxTreeMultiCtrl::Exclude(), wxTreeMultiCtrl::Include())
180 /* Returns if this node is excluded from the tree. If this item
181 is a Node, then all kids are excluded as well */
182 bool IsExcluded() const {
187 // item selection status handling
189 /** checks if the item is selected */
190 bool IsSelected(void) const
192 return this->m_Selected;
195 /** mark the current item as selected */
198 this->m_Selected = true;
201 /** toggle the selection status */
202 void ToggleSelection(void)
204 this->m_Selected = !(this->m_Selected);
207 /** unmark the item */
210 this->m_Selected = false;
214 /** Sets checkbox or not. This does not influence the state of the checkbox */
215 void SetCheckbox(bool value) {
219 /** Returns current state of the checkbox view */
220 bool GetCheckbox() const {
224 /** Sets checkbox state. If 0 it's unchecked, 1 = checked and 2 = tristate */
225 virtual void SetCheckboxState(int state) {
226 wxCHECK2(state < 3 && state >= 0, return);
227 _checkboxState = state;
230 /** Returns current state of checkbox */
231 int GetCheckboxState() const {
232 return _checkboxState;
237 TreeMultiItemNode *_parent;
239 // flags to indicate the status of the item: