aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/include/IGUITreeView.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/include/IGUITreeView.h')
-rw-r--r--src/others/irrlicht-1.8.1/include/IGUITreeView.h278
1 files changed, 278 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/include/IGUITreeView.h b/src/others/irrlicht-1.8.1/include/IGUITreeView.h
new file mode 100644
index 0000000..4552b29
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/include/IGUITreeView.h
@@ -0,0 +1,278 @@
1// written by Reinhard Ostermeier, reinhard@nospam.r-ostermeier.de
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_TREE_VIEW_H_INCLUDED__
6#define __I_GUI_TREE_VIEW_H_INCLUDED__
7
8#include "IGUIElement.h"
9#include "IGUIImageList.h"
10#include "irrTypes.h"
11
12namespace irr
13{
14namespace gui
15{
16 class IGUIFont;
17 class IGUITreeView;
18
19
20 //! Node for gui tree view
21 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
22 \li EGET_TREEVIEW_NODE_EXPAND
23 \li EGET_TREEVIEW_NODE_COLLAPS
24 \li EGET_TREEVIEW_NODE_DESELECT
25 \li EGET_TREEVIEW_NODE_SELECT
26 */
27 class IGUITreeViewNode : public IReferenceCounted
28 {
29 public:
30 //! returns the owner (tree view) of this node
31 virtual IGUITreeView* getOwner() const = 0;
32
33 //! Returns the parent node of this node.
34 /** For the root node this will return 0. */
35 virtual IGUITreeViewNode* getParent() const = 0;
36
37 //! returns the text of the node
38 virtual const wchar_t* getText() const = 0;
39
40 //! sets the text of the node
41 virtual void setText( const wchar_t* text ) = 0;
42
43 //! returns the icon text of the node
44 virtual const wchar_t* getIcon() const = 0;
45
46 //! sets the icon text of the node
47 virtual void setIcon( const wchar_t* icon ) = 0;
48
49 //! returns the image index of the node
50 virtual u32 getImageIndex() const = 0;
51
52 //! sets the image index of the node
53 virtual void setImageIndex( u32 imageIndex ) = 0;
54
55 //! returns the image index of the node
56 virtual u32 getSelectedImageIndex() const = 0;
57
58 //! sets the image index of the node
59 virtual void setSelectedImageIndex( u32 imageIndex ) = 0;
60
61 //! returns the user data (void*) of this node
62 virtual void* getData() const = 0;
63
64 //! sets the user data (void*) of this node
65 virtual void setData( void* data ) = 0;
66
67 //! returns the user data2 (IReferenceCounted) of this node
68 virtual IReferenceCounted* getData2() const = 0;
69
70 //! sets the user data2 (IReferenceCounted) of this node
71 virtual void setData2( IReferenceCounted* data ) = 0;
72
73 //! returns the child item count
74 virtual u32 getChildCount() const = 0;
75
76 //! removes all children (recursive) from this node
77 virtual void clearChildren() = 0;
78
79 //! removes all children (recursive) from this node
80 /** \deprecated Deprecated in 1.8, use clearChildren() instead.
81 This method may be removed by Irrlicht 1.9 */
82 _IRR_DEPRECATED_ void clearChilds()
83 {
84 return clearChildren();
85 }
86
87 //! returns true if this node has child nodes
88 virtual bool hasChildren() const = 0;
89
90 //! returns true if this node has child nodes
91 /** \deprecated Deprecated in 1.8, use hasChildren() instead.
92 This method may be removed by Irrlicht 1.9 */
93 _IRR_DEPRECATED_ bool hasChilds() const
94 {
95 return hasChildren();
96 }
97
98 //! Adds a new node behind the last child node.
99 /** \param text text of the new node
100 \param icon icon text of the new node
101 \param imageIndex index of the image for the new node (-1 = none)
102 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
103 \param data user data (void*) of the new node
104 \param data2 user data2 (IReferenceCounted*) of the new node
105 \return The new node
106 */
107 virtual IGUITreeViewNode* addChildBack(
108 const wchar_t* text, const wchar_t* icon = 0,
109 s32 imageIndex=-1, s32 selectedImageIndex=-1,
110 void* data=0, IReferenceCounted* data2=0) =0;
111
112 //! Adds a new node before the first child node.
113 /** \param text text of the new node
114 \param icon icon text of the new node
115 \param imageIndex index of the image for the new node (-1 = none)
116 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
117 \param data user data (void*) of the new node
118 \param data2 user data2 (IReferenceCounted*) of the new node
119 \return The new node
120 */
121 virtual IGUITreeViewNode* addChildFront(
122 const wchar_t* text, const wchar_t* icon = 0,
123 s32 imageIndex=-1, s32 selectedImageIndex=-1,
124 void* data=0, IReferenceCounted* data2=0 ) =0;
125
126 //! Adds a new node behind the other node.
127 /** The other node has also te be a child node from this node.
128 \param other Node to insert after
129 \param text text of the new node
130 \param icon icon text of the new node
131 \param imageIndex index of the image for the new node (-1 = none)
132 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
133 \param data user data (void*) of the new node
134 \param data2 user data2 (IReferenceCounted*) of the new node
135 \return The new node or 0 if other is no child node from this
136 */
137 virtual IGUITreeViewNode* insertChildAfter(
138 IGUITreeViewNode* other,
139 const wchar_t* text, const wchar_t* icon = 0,
140 s32 imageIndex=-1, s32 selectedImageIndex=-1,
141 void* data=0, IReferenceCounted* data2=0) =0;
142
143 //! Adds a new node before the other node.
144 /** The other node has also te be a child node from this node.
145 \param other Node to insert before
146 \param text text of the new node
147 \param icon icon text of the new node
148 \param imageIndex index of the image for the new node (-1 = none)
149 \param selectedImageIndex index of the selected image for the new node (-1 = same as imageIndex)
150 \param data user data (void*) of the new node
151 \param data2 user data2 (IReferenceCounted*) of the new node
152 \return The new node or 0 if other is no child node from this
153 */
154 virtual IGUITreeViewNode* insertChildBefore(
155 IGUITreeViewNode* other,
156 const wchar_t* text, const wchar_t* icon = 0,
157 s32 imageIndex=-1, s32 selectedImageIndex=-1,
158 void* data=0, IReferenceCounted* data2=0) = 0;
159
160 //! Return the first child node from this node.
161 /** \return The first child node or 0 if this node has no children. */
162 virtual IGUITreeViewNode* getFirstChild() const = 0;
163
164 //! Return the last child node from this node.
165 /** \return The last child node or 0 if this node has no children. */
166 virtual IGUITreeViewNode* getLastChild() const = 0;
167
168 //! Returns the previous sibling node from this node.
169 /** \return The previous sibling node from this node or 0 if this is
170 the first node from the parent node.
171 */
172 virtual IGUITreeViewNode* getPrevSibling() const = 0;
173
174 //! Returns the next sibling node from this node.
175 /** \return The next sibling node from this node or 0 if this is
176 the last node from the parent node.
177 */
178 virtual IGUITreeViewNode* getNextSibling() const = 0;
179
180 //! Returns the next visible (expanded, may be out of scrolling) node from this node.
181 /** \return The next visible node from this node or 0 if this is
182 the last visible node. */
183 virtual IGUITreeViewNode* getNextVisible() const = 0;
184
185 //! Deletes a child node.
186 /** \return Returns true if the node was found as a child and is deleted. */
187 virtual bool deleteChild( IGUITreeViewNode* child ) = 0;
188
189 //! Moves a child node one position up.
190 /** \return True if the node was found as achild node and was not already the first child. */
191 virtual bool moveChildUp( IGUITreeViewNode* child ) = 0;
192
193 //! Moves a child node one position down.
194 /** \return True if the node was found as achild node and was not already the last child. */
195 virtual bool moveChildDown( IGUITreeViewNode* child ) = 0;
196
197 //! Returns true if the node is expanded (children are visible).
198 virtual bool getExpanded() const = 0;
199
200 //! Sets if the node is expanded.
201 virtual void setExpanded( bool expanded ) = 0;
202
203 //! Returns true if the node is currently selected.
204 virtual bool getSelected() const = 0;
205
206 //! Sets this node as selected.
207 virtual void setSelected( bool selected ) = 0;
208
209 //! Returns true if this node is the root node.
210 virtual bool isRoot() const = 0;
211
212 //! Returns the level of this node.
213 /** The root node has level 0. Direct children of the root has level 1 ... */
214 virtual s32 getLevel() const = 0;
215
216 //! Returns true if this node is visible (all parents are expanded).
217 virtual bool isVisible() const = 0;
218 };
219
220
221 //! Default tree view GUI element.
222 /** Displays a windows like tree buttons to expand/collaps the child
223 nodes of an node and optional tree lines. Each node consits of an
224 text, an icon text and a void pointer for user data. */
225 class IGUITreeView : public IGUIElement
226 {
227 public:
228 //! constructor
229 IGUITreeView(IGUIEnvironment* environment, IGUIElement* parent,
230 s32 id, core::rect<s32> rectangle)
231 : IGUIElement( EGUIET_TREE_VIEW, environment, parent, id, rectangle ) {}
232
233 //! returns the root node (not visible) from the tree.
234 virtual IGUITreeViewNode* getRoot() const = 0;
235
236 //! returns the selected node of the tree or 0 if none is selected
237 virtual IGUITreeViewNode* getSelected() const = 0;
238
239 //! returns true if the tree lines are visible
240 virtual bool getLinesVisible() const = 0;
241
242 //! sets if the tree lines are visible
243 /** \param visible true for visible, false for invisible */
244 virtual void setLinesVisible( bool visible ) = 0;
245
246 //! Sets the font which should be used as icon font.
247 /** This font is set to the Irrlicht engine built-in-font by
248 default. Icons can be displayed in front of every list item.
249 An icon is a string, displayed with the icon font. When using
250 the build-in-font of the Irrlicht engine as icon font, the icon
251 strings defined in GUIIcons.h can be used.
252 */
253 virtual void setIconFont( IGUIFont* font ) = 0;
254
255 //! Sets the image list which should be used for the image and selected image of every node.
256 /** The default is 0 (no images). */
257 virtual void setImageList( IGUIImageList* imageList ) = 0;
258
259 //! Returns the image list which is used for the nodes.
260 virtual IGUIImageList* getImageList() const = 0;
261
262 //! Sets if the image is left of the icon. Default is true.
263 virtual void setImageLeftOfIcon( bool bLeftOf ) = 0;
264
265 //! Returns if the Image is left of the icon. Default is true.
266 virtual bool getImageLeftOfIcon() const = 0;
267
268 //! Returns the node which is associated to the last event.
269 /** This pointer is only valid inside the OnEvent call! */
270 virtual IGUITreeViewNode* getLastEventNode() const = 0;
271 };
272
273
274} // end namespace gui
275} // end namespace irr
276
277#endif
278