00001 //--------------------------------------------------------------------------- 00002 // $RCSfile: TreeMultiItemBase.h,v $ 00003 // $Source: /cvs/creatis/bbtk/kernel/src/ThirdParty/wx/treemultictrl/TreeMultiItemBase.h,v $ 00004 // $Revision: 1.1 $ 00005 // $Date: 2008/03/28 13:42:18 $ 00006 //--------------------------------------------------------------------------- 00007 // Author: Jorgen Bodde 00008 // Copyright: (c) Jorgen Bodde 00009 // License: wxWidgets License 00010 //--------------------------------------------------------------------------- 00011 00012 #ifndef __TREEMULTIITEMBASE_HPP_ 00013 #define __TREEMULTIITEMBASE_HPP_ 00014 00015 #ifdef __GNUG__ 00016 #pragma interface "TreeMultiItemBase.cpp" 00017 #endif 00018 00019 #ifndef WX_PRECOMP 00020 #include "wx/wx.h" 00021 #endif 00022 00023 // forward definitions 00024 class TreeMultiItemRoot; 00025 class TreeMultiItemWindow; 00026 class TreeMultiItemNode; 00027 00028 class TreeMultiItemBase 00029 { 00030 protected: 00031 TreeMultiItemBase(TreeMultiItemNode *parent); 00032 00035 wxString _name; 00036 00040 bool _excluded; 00041 00043 int _type; 00044 00046 int _x, _y; 00047 00049 int _width, _height; 00050 00051 #if(CHECKBOXVIEW) 00052 00053 bool _checkbox; 00054 00058 int _checkboxState; 00059 #endif 00060 00061 public: 00062 virtual ~TreeMultiItemBase(); 00063 00064 // type of tree item 00065 00066 int GetType() const { return _type; }; 00067 TreeMultiItemNode *GetParent() const { return _parent; }; 00068 00070 wxString GetName() const { 00071 return _name; 00072 }; 00074 void SetName(wxString const& NewName) 00075 { 00076 this->_name = NewName; 00077 } 00078 00082 virtual TreeMultiItemRoot *IsTreeMultiItemRoot() const { 00083 return 0; 00084 }; 00085 00089 virtual TreeMultiItemWindow *IsTreeMultiItemWindow() const { 00090 return 0; 00091 }; 00092 00096 virtual TreeMultiItemNode *IsTreeMultiItemNode() const { 00097 return 0; 00098 }; 00099 00101 void SetExcluded(bool excluded) { 00102 _excluded = excluded; 00103 }; 00104 00106 void SetX(int x) { 00107 _x = x; 00108 }; 00109 00110 int GetX() const { 00111 return _x; 00112 }; 00113 00115 void SetY(int y) { 00116 _y = y; 00117 }; 00118 00119 int GetY() const { 00120 return _y; 00121 }; 00122 00124 void SetHeight(int height) { 00125 _height = height; 00126 }; 00127 00128 int GetHeight() const { 00129 return _height; 00130 }; 00131 00133 void SetWidth(int width) { 00134 _width = width; 00135 }; 00136 00137 int GetWidth() const { 00138 return _width; 00139 }; 00140 00151 bool IsVisible(); 00152 00153 /* Returns if this node is excluded from the tree. If this item 00154 is a Node, then all kids are excluded as well */ 00155 bool IsExcluded() const { 00156 return _excluded; 00157 }; 00158 00159 // 00160 // item selection status handling 00161 00163 bool IsSelected(void) const 00164 { 00165 return this->m_Selected; 00166 } 00167 00169 void Select(void) 00170 { 00171 this->m_Selected = true; 00172 } 00173 00175 void ToggleSelection(void) 00176 { 00177 this->m_Selected = !(this->m_Selected); 00178 } 00179 00181 void Unselect(void) 00182 { 00183 this->m_Selected = false; 00184 } 00185 00186 #if(CHECKBOXVIEW) 00187 00188 void SetCheckbox(bool value) { 00189 _checkbox = value; 00190 }; 00191 00193 bool GetCheckbox() const { 00194 return _checkbox; 00195 }; 00196 00198 virtual void SetCheckboxState(int state) { 00199 wxCHECK2(state < 3 && state >= 0, return); 00200 _checkboxState = state; 00201 }; 00202 00204 int GetCheckboxState() const { 00205 return _checkboxState; 00206 }; 00207 #endif 00208 00209 private: 00210 TreeMultiItemNode *_parent; 00211 00212 // flags to indicate the status of the item: 00213 bool m_Selected; 00214 }; 00215 00216 #endif 00217