aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h662
1 files changed, 331 insertions, 331 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h
index 36b0280..d9d6f82 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUITreeView.h
@@ -1,331 +1,331 @@
1// This file is part of the "Irrlicht Engine". 1// This file is part of the "Irrlicht Engine".
2// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de 2// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
3 3
4#ifndef __C_GUI_TREE_VIEW_H_INCLUDED__ 4#ifndef __C_GUI_TREE_VIEW_H_INCLUDED__
5#define __C_GUI_TREE_VIEW_H_INCLUDED__ 5#define __C_GUI_TREE_VIEW_H_INCLUDED__
6 6
7#include "IGUITreeView.h" 7#include "IGUITreeView.h"
8#include "irrList.h" 8#include "irrList.h"
9 9
10 10
11namespace irr 11namespace irr
12{ 12{
13namespace gui 13namespace gui
14{ 14{
15 // forward declarations 15 // forward declarations
16 class IGUIFont; 16 class IGUIFont;
17 class IGUIScrollBar; 17 class IGUIScrollBar;
18 class CGUITreeView; 18 class CGUITreeView;
19 19
20 //! Node for gui tree view 20 //! Node for gui tree view
21 class CGUITreeViewNode : public IGUITreeViewNode 21 class CGUITreeViewNode : public IGUITreeViewNode
22 { 22 {
23 friend class CGUITreeView; 23 friend class CGUITreeView;
24 24
25 public: 25 public:
26 //! constructor 26 //! constructor
27 CGUITreeViewNode( CGUITreeView* owner, CGUITreeViewNode* parent ); 27 CGUITreeViewNode( CGUITreeView* owner, CGUITreeViewNode* parent );
28 28
29 //! destructor 29 //! destructor
30 ~CGUITreeViewNode(); 30 ~CGUITreeViewNode();
31 31
32 //! returns the owner (tree view) of this node 32 //! returns the owner (tree view) of this node
33 virtual IGUITreeView* getOwner() const; 33 virtual IGUITreeView* getOwner() const;
34 34
35 //! Returns the parent node of this node. 35 //! Returns the parent node of this node.
36 virtual IGUITreeViewNode* getParent() const; 36 virtual IGUITreeViewNode* getParent() const;
37 37
38 //! returns the text of the node 38 //! returns the text of the node
39 virtual const wchar_t* getText() const 39 virtual const wchar_t* getText() const
40 { return Text.c_str(); } 40 { return Text.c_str(); }
41 41
42 //! sets the text of the node 42 //! sets the text of the node
43 virtual void setText( const wchar_t* text ); 43 virtual void setText( const wchar_t* text );
44 44
45 //! returns the icon text of the node 45 //! returns the icon text of the node
46 virtual const wchar_t* getIcon() const 46 virtual const wchar_t* getIcon() const
47 { return Icon.c_str(); } 47 { return Icon.c_str(); }
48 48
49 //! sets the icon text of the node 49 //! sets the icon text of the node
50 virtual void setIcon( const wchar_t* icon ); 50 virtual void setIcon( const wchar_t* icon );
51 51
52 //! returns the image index of the node 52 //! returns the image index of the node
53 virtual u32 getImageIndex() const 53 virtual u32 getImageIndex() const
54 { return ImageIndex; } 54 { return ImageIndex; }
55 55
56 //! sets the image index of the node 56 //! sets the image index of the node
57 virtual void setImageIndex( u32 imageIndex ) 57 virtual void setImageIndex( u32 imageIndex )
58 { ImageIndex = imageIndex; } 58 { ImageIndex = imageIndex; }
59 59
60 //! returns the image index of the node 60 //! returns the image index of the node
61 virtual u32 getSelectedImageIndex() const 61 virtual u32 getSelectedImageIndex() const
62 { return SelectedImageIndex; } 62 { return SelectedImageIndex; }
63 63
64 //! sets the image index of the node 64 //! sets the image index of the node
65 virtual void setSelectedImageIndex( u32 imageIndex ) 65 virtual void setSelectedImageIndex( u32 imageIndex )
66 { SelectedImageIndex = imageIndex; } 66 { SelectedImageIndex = imageIndex; }
67 67
68 //! returns the user data (void*) of this node 68 //! returns the user data (void*) of this node
69 virtual void* getData() const 69 virtual void* getData() const
70 { return Data; } 70 { return Data; }
71 71
72 //! sets the user data (void*) of this node 72 //! sets the user data (void*) of this node
73 virtual void setData( void* data ) 73 virtual void setData( void* data )
74 { Data = data; } 74 { Data = data; }
75 75
76 //! returns the user data2 (IReferenceCounted) of this node 76 //! returns the user data2 (IReferenceCounted) of this node
77 virtual IReferenceCounted* getData2() const 77 virtual IReferenceCounted* getData2() const
78 { return Data2; } 78 { return Data2; }
79 79
80 //! sets the user data2 (IReferenceCounted) of this node 80 //! sets the user data2 (IReferenceCounted) of this node
81 virtual void setData2( IReferenceCounted* data ) 81 virtual void setData2( IReferenceCounted* data )
82 { 82 {
83 if( Data2 ) 83 if( Data2 )
84 { 84 {
85 Data2->drop(); 85 Data2->drop();
86 } 86 }
87 Data2 = data; 87 Data2 = data;
88 if( Data2 ) 88 if( Data2 )
89 { 89 {
90 Data2->grab(); 90 Data2->grab();
91 } 91 }
92 } 92 }
93 93
94 //! returns the child item count 94 //! returns the child item count
95 virtual u32 getChildCount() const 95 virtual u32 getChildCount() const
96 { return Children.getSize(); } 96 { return Children.getSize(); }
97 97
98 //! removes all children (recursive) from this node 98 //! removes all children (recursive) from this node
99 virtual void clearChildren(); 99 virtual void clearChildren();
100 100
101 //! returns true if this node has child nodes 101 //! returns true if this node has child nodes
102 virtual bool hasChildren() const 102 virtual bool hasChildren() const
103 { return !Children.empty(); } 103 { return !Children.empty(); }
104 104
105 //! Adds a new node behind the last child node. 105 //! Adds a new node behind the last child node.
106 //! \param text text of the new node 106 //! \param text text of the new node
107 //! \param icon icon text of the new node 107 //! \param icon icon text of the new node
108 //! \param imageIndex index of the image for the new node (-1 = none) 108 //! \param imageIndex index of the image for the new node (-1 = none)
109 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex) 109 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
110 //! \param data user data (void*) of the new node 110 //! \param data user data (void*) of the new node
111 //! \param data2 user data2 (IReferenceCounted*) of the new node 111 //! \param data2 user data2 (IReferenceCounted*) of the new node
112 //! \return 112 //! \return
113 //! returns the new node 113 //! returns the new node
114 virtual IGUITreeViewNode* addChildBack( 114 virtual IGUITreeViewNode* addChildBack(
115 const wchar_t* text, 115 const wchar_t* text,
116 const wchar_t* icon = 0, 116 const wchar_t* icon = 0,
117 s32 imageIndex = -1, 117 s32 imageIndex = -1,
118 s32 selectedImageIndex = -1, 118 s32 selectedImageIndex = -1,
119 void* data = 0, 119 void* data = 0,
120 IReferenceCounted* data2 = 0); 120 IReferenceCounted* data2 = 0);
121 121
122 //! Adds a new node before the first child node. 122 //! Adds a new node before the first child node.
123 //! \param text text of the new node 123 //! \param text text of the new node
124 //! \param icon icon text of the new node 124 //! \param icon icon text of the new node
125 //! \param imageIndex index of the image for the new node (-1 = none) 125 //! \param imageIndex index of the image for the new node (-1 = none)
126 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex) 126 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
127 //! \param data user data (void*) of the new node 127 //! \param data user data (void*) of the new node
128 //! \param data2 user data2 (IReferenceCounted*) of the new node 128 //! \param data2 user data2 (IReferenceCounted*) of the new node
129 //! \return 129 //! \return
130 //! returns the new node 130 //! returns the new node
131 virtual IGUITreeViewNode* addChildFront( 131 virtual IGUITreeViewNode* addChildFront(
132 const wchar_t* text, 132 const wchar_t* text,
133 const wchar_t* icon = 0, 133 const wchar_t* icon = 0,
134 s32 imageIndex = -1, 134 s32 imageIndex = -1,
135 s32 selectedImageIndex = -1, 135 s32 selectedImageIndex = -1,
136 void* data = 0, 136 void* data = 0,
137 IReferenceCounted* data2 = 0 ); 137 IReferenceCounted* data2 = 0 );
138 138
139 //! Adds a new node behind the other node. 139 //! Adds a new node behind the other node.
140 //! The other node has also te be a child node from this node. 140 //! The other node has also te be a child node from this node.
141 //! \param text text of the new node 141 //! \param text text of the new node
142 //! \param icon icon text of the new node 142 //! \param icon icon text of the new node
143 //! \param imageIndex index of the image for the new node (-1 = none) 143 //! \param imageIndex index of the image for the new node (-1 = none)
144 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex) 144 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
145 //! \param data user data (void*) of the new node 145 //! \param data user data (void*) of the new node
146 //! \param data2 user data2 (IReferenceCounted*) of the new node 146 //! \param data2 user data2 (IReferenceCounted*) of the new node
147 //! \return 147 //! \return
148 //! returns the new node or 0 if other is no child node from this 148 //! returns the new node or 0 if other is no child node from this
149 virtual IGUITreeViewNode* insertChildAfter( 149 virtual IGUITreeViewNode* insertChildAfter(
150 IGUITreeViewNode* other, 150 IGUITreeViewNode* other,
151 const wchar_t* text, 151 const wchar_t* text,
152 const wchar_t* icon = 0, 152 const wchar_t* icon = 0,
153 s32 imageIndex = -1, 153 s32 imageIndex = -1,
154 s32 selectedImageIndex = -1, 154 s32 selectedImageIndex = -1,
155 void* data = 0, 155 void* data = 0,
156 IReferenceCounted* data2 = 0 ); 156 IReferenceCounted* data2 = 0 );
157 157
158 //! Adds a new node before the other node. 158 //! Adds a new node before the other node.
159 //! The other node has also te be a child node from this node. 159 //! The other node has also te be a child node from this node.
160 //! \param text text of the new node 160 //! \param text text of the new node
161 //! \param icon icon text of the new node 161 //! \param icon icon text of the new node
162 //! \param imageIndex index of the image for the new node (-1 = none) 162 //! \param imageIndex index of the image for the new node (-1 = none)
163 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex) 163 //! \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
164 //! \param data user data (void*) of the new node 164 //! \param data user data (void*) of the new node
165 //! \param data2 user data2 (IReferenceCounted*) of the new node 165 //! \param data2 user data2 (IReferenceCounted*) of the new node
166 //! \return 166 //! \return
167 //! returns the new node or 0 if other is no child node from this 167 //! returns the new node or 0 if other is no child node from this
168 virtual IGUITreeViewNode* insertChildBefore( 168 virtual IGUITreeViewNode* insertChildBefore(
169 IGUITreeViewNode* other, 169 IGUITreeViewNode* other,
170 const wchar_t* text, 170 const wchar_t* text,
171 const wchar_t* icon = 0, 171 const wchar_t* icon = 0,
172 s32 imageIndex = -1, 172 s32 imageIndex = -1,
173 s32 selectedImageIndex = -1, 173 s32 selectedImageIndex = -1,
174 void* data = 0, 174 void* data = 0,
175 IReferenceCounted* data2 = 0 ); 175 IReferenceCounted* data2 = 0 );
176 176
177 //! Return the first child note from this node. 177 //! Return the first child note from this node.
178 virtual IGUITreeViewNode* getFirstChild() const; 178 virtual IGUITreeViewNode* getFirstChild() const;
179 179
180 //! Return the last child note from this node. 180 //! Return the last child note from this node.
181 virtual IGUITreeViewNode* getLastChild() const; 181 virtual IGUITreeViewNode* getLastChild() const;
182 182
183 //! Returns the preverse sibling node from this node. 183 //! Returns the preverse sibling node from this node.
184 virtual IGUITreeViewNode* getPrevSibling() const; 184 virtual IGUITreeViewNode* getPrevSibling() const;
185 185
186 //! Returns the next sibling node from this node. 186 //! Returns the next sibling node from this node.
187 virtual IGUITreeViewNode* getNextSibling() const; 187 virtual IGUITreeViewNode* getNextSibling() const;
188 188
189 //! Returns the next visible (expanded, may be out of scrolling) node from this node. 189 //! Returns the next visible (expanded, may be out of scrolling) node from this node.
190 virtual IGUITreeViewNode* getNextVisible() const; 190 virtual IGUITreeViewNode* getNextVisible() const;
191 191
192 //! Deletes a child node. 192 //! Deletes a child node.
193 virtual bool deleteChild( IGUITreeViewNode* child ); 193 virtual bool deleteChild( IGUITreeViewNode* child );
194 194
195 //! Moves a child node one position up. 195 //! Moves a child node one position up.
196 virtual bool moveChildUp( IGUITreeViewNode* child ); 196 virtual bool moveChildUp( IGUITreeViewNode* child );
197 197
198 //! Moves a child node one position down. 198 //! Moves a child node one position down.
199 virtual bool moveChildDown( IGUITreeViewNode* child ); 199 virtual bool moveChildDown( IGUITreeViewNode* child );
200 200
201 //! Returns true if the node is expanded (children are visible). 201 //! Returns true if the node is expanded (children are visible).
202 virtual bool getExpanded() const 202 virtual bool getExpanded() const
203 { return Expanded; } 203 { return Expanded; }
204 204
205 //! Sets if the node is expanded. 205 //! Sets if the node is expanded.
206 virtual void setExpanded( bool expanded ); 206 virtual void setExpanded( bool expanded );
207 207
208 //! Returns true if the node is currently selected. 208 //! Returns true if the node is currently selected.
209 virtual bool getSelected() const; 209 virtual bool getSelected() const;
210 210
211 //! Sets this node as selected. 211 //! Sets this node as selected.
212 virtual void setSelected( bool selected ); 212 virtual void setSelected( bool selected );
213 213
214 //! Returns true if this node is the root node. 214 //! Returns true if this node is the root node.
215 virtual bool isRoot() const; 215 virtual bool isRoot() const;
216 216
217 //! Returns the level of this node. 217 //! Returns the level of this node.
218 virtual s32 getLevel() const; 218 virtual s32 getLevel() const;
219 219
220 //! Returns true if this node is visible (all parents are expanded). 220 //! Returns true if this node is visible (all parents are expanded).
221 virtual bool isVisible() const; 221 virtual bool isVisible() const;
222 222
223 private: 223 private:
224 224
225 CGUITreeView* Owner; 225 CGUITreeView* Owner;
226 CGUITreeViewNode* Parent; 226 CGUITreeViewNode* Parent;
227 core::stringw Text; 227 core::stringw Text;
228 core::stringw Icon; 228 core::stringw Icon;
229 s32 ImageIndex; 229 s32 ImageIndex;
230 s32 SelectedImageIndex; 230 s32 SelectedImageIndex;
231 void* Data; 231 void* Data;
232 IReferenceCounted* Data2; 232 IReferenceCounted* Data2;
233 bool Expanded; 233 bool Expanded;
234 core::list<CGUITreeViewNode*> Children; 234 core::list<CGUITreeViewNode*> Children;
235 }; 235 };
236 236
237 237
238 //! Default tree view GUI element. 238 //! Default tree view GUI element.
239 class CGUITreeView : public IGUITreeView 239 class CGUITreeView : public IGUITreeView
240 { 240 {
241 friend class CGUITreeViewNode; 241 friend class CGUITreeViewNode;
242 242
243 public: 243 public:
244 //! constructor 244 //! constructor
245 CGUITreeView( IGUIEnvironment* environment, IGUIElement* parent, 245 CGUITreeView( IGUIEnvironment* environment, IGUIElement* parent,
246 s32 id, core::rect<s32> rectangle, bool clip = true, 246 s32 id, core::rect<s32> rectangle, bool clip = true,
247 bool drawBack = false, bool scrollBarVertical = true, bool scrollBarHorizontal = true ); 247 bool drawBack = false, bool scrollBarVertical = true, bool scrollBarHorizontal = true );
248 248
249 //! destructor 249 //! destructor
250 virtual ~CGUITreeView(); 250 virtual ~CGUITreeView();
251 251
252 //! returns the root node (not visible) from the tree. 252 //! returns the root node (not visible) from the tree.
253 virtual IGUITreeViewNode* getRoot() const 253 virtual IGUITreeViewNode* getRoot() const
254 { return Root; } 254 { return Root; }
255 255
256 //! returns the selected node of the tree or 0 if none is selected 256 //! returns the selected node of the tree or 0 if none is selected
257 virtual IGUITreeViewNode* getSelected() const 257 virtual IGUITreeViewNode* getSelected() const
258 { return Selected; } 258 { return Selected; }
259 259
260 //! returns true if the tree lines are visible 260 //! returns true if the tree lines are visible
261 virtual bool getLinesVisible() const 261 virtual bool getLinesVisible() const
262 { return LinesVisible; } 262 { return LinesVisible; }
263 263
264 //! sets if the tree lines are visible 264 //! sets if the tree lines are visible
265 virtual void setLinesVisible( bool visible ) 265 virtual void setLinesVisible( bool visible )
266 { LinesVisible = visible; } 266 { LinesVisible = visible; }
267 267
268 //! called if an event happened. 268 //! called if an event happened.
269 virtual bool OnEvent( const SEvent &event ); 269 virtual bool OnEvent( const SEvent &event );
270 270
271 //! draws the element and its children 271 //! draws the element and its children
272 virtual void draw(); 272 virtual void draw();
273 273
274 //! Sets the font which should be used as icon font. This font is set to the Irrlicht engine 274 //! Sets the font which should be used as icon font. This font is set to the Irrlicht engine
275 //! built-in-font by default. Icons can be displayed in front of every list item. 275 //! built-in-font by default. Icons can be displayed in front of every list item.
276 //! An icon is a string, displayed with the icon font. When using the build-in-font of the 276 //! An icon is a string, displayed with the icon font. When using the build-in-font of the
277 //! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used. 277 //! Irrlicht engine as icon font, the icon strings defined in GUIIcons.h can be used.
278 virtual void setIconFont( IGUIFont* font ); 278 virtual void setIconFont( IGUIFont* font );
279 279
280 //! Sets the image list which should be used for the image and selected image of every node. 280 //! Sets the image list which should be used for the image and selected image of every node.
281 //! The default is 0 (no images). 281 //! The default is 0 (no images).
282 virtual void setImageList( IGUIImageList* imageList ); 282 virtual void setImageList( IGUIImageList* imageList );
283 283
284 //! Returns the image list which is used for the nodes. 284 //! Returns the image list which is used for the nodes.
285 virtual IGUIImageList* getImageList() const 285 virtual IGUIImageList* getImageList() const
286 { return ImageList; } 286 { return ImageList; }
287 287
288 //! Sets if the image is left of the icon. Default is true. 288 //! Sets if the image is left of the icon. Default is true.
289 virtual void setImageLeftOfIcon( bool bLeftOf ) 289 virtual void setImageLeftOfIcon( bool bLeftOf )
290 { ImageLeftOfIcon = bLeftOf; } 290 { ImageLeftOfIcon = bLeftOf; }
291 291
292 //! Returns if the Image is left of the icon. Default is true. 292 //! Returns if the Image is left of the icon. Default is true.
293 virtual bool getImageLeftOfIcon() const 293 virtual bool getImageLeftOfIcon() const
294 { return ImageLeftOfIcon; } 294 { return ImageLeftOfIcon; }
295 295
296 //! Returns the node which is associated to the last event. 296 //! Returns the node which is associated to the last event.
297 virtual IGUITreeViewNode* getLastEventNode() const 297 virtual IGUITreeViewNode* getLastEventNode() const
298 { return LastEventNode; } 298 { return LastEventNode; }
299 299
300 private: 300 private:
301 //! calculates the heigth of an node and of all visible nodes. 301 //! calculates the heigth of an node and of all visible nodes.
302 void recalculateItemHeight(); 302 void recalculateItemHeight();
303 303
304 //! executes an mouse action (like selectNew of CGUIListBox) 304 //! executes an mouse action (like selectNew of CGUIListBox)
305 void mouseAction( s32 xpos, s32 ypos, bool onlyHover = false ); 305 void mouseAction( s32 xpos, s32 ypos, bool onlyHover = false );
306 306
307 CGUITreeViewNode* Root; 307 CGUITreeViewNode* Root;
308 IGUITreeViewNode* Selected; 308 IGUITreeViewNode* Selected;
309 s32 ItemHeight; 309 s32 ItemHeight;
310 s32 IndentWidth; 310 s32 IndentWidth;
311 s32 TotalItemHeight; 311 s32 TotalItemHeight;
312 s32 TotalItemWidth; 312 s32 TotalItemWidth;
313 IGUIFont* Font; 313 IGUIFont* Font;
314 IGUIFont* IconFont; 314 IGUIFont* IconFont;
315 IGUIScrollBar* ScrollBarH; 315 IGUIScrollBar* ScrollBarH;
316 IGUIScrollBar* ScrollBarV; 316 IGUIScrollBar* ScrollBarV;
317 IGUIImageList* ImageList; 317 IGUIImageList* ImageList;
318 IGUITreeViewNode* LastEventNode; 318 IGUITreeViewNode* LastEventNode;
319 bool LinesVisible; 319 bool LinesVisible;
320 bool Selecting; 320 bool Selecting;
321 bool Clip; 321 bool Clip;
322 bool DrawBack; 322 bool DrawBack;
323 bool ImageLeftOfIcon; 323 bool ImageLeftOfIcon;
324 }; 324 };
325 325
326 326
327} // end namespace gui 327} // end namespace gui
328} // end namespace irr 328} // end namespace irr
329 329
330#endif 330#endif
331 331