]> git.lizzy.rs Git - irrlicht.git/blob - include/IGUIListBox.h
Add back LightManager
[irrlicht.git] / include / IGUIListBox.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_GUI_LIST_BOX_H_INCLUDED__\r
6 #define __I_GUI_LIST_BOX_H_INCLUDED__\r
7 \r
8 #include "IGUIElement.h"\r
9 #include "SColor.h"\r
10 \r
11 namespace irr\r
12 {\r
13 namespace gui\r
14 {\r
15         class IGUISpriteBank;\r
16         class IGUIScrollBar;\r
17 \r
18         //! Enumeration for listbox colors\r
19         enum EGUI_LISTBOX_COLOR\r
20         {\r
21                 //! Color of text\r
22                 EGUI_LBC_TEXT=0,\r
23                 //! Color of selected text\r
24                 EGUI_LBC_TEXT_HIGHLIGHT,\r
25                 //! Color of icon\r
26                 EGUI_LBC_ICON,\r
27                 //! Color of selected icon\r
28                 EGUI_LBC_ICON_HIGHLIGHT,\r
29                 //! Not used, just counts the number of available colors\r
30                 EGUI_LBC_COUNT\r
31         };\r
32 \r
33 \r
34         //! Default list box GUI element.\r
35         /** \par This element can create the following events of type EGUI_EVENT_TYPE:\r
36         \li EGET_LISTBOX_CHANGED\r
37         \li EGET_LISTBOX_SELECTED_AGAIN\r
38         */\r
39         class IGUIListBox : public IGUIElement\r
40         {\r
41         public:\r
42                 //! constructor\r
43                 IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)\r
44                         : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}\r
45 \r
46                 //! returns amount of list items\r
47                 virtual u32 getItemCount() const = 0;\r
48 \r
49                 //! returns string of a list item. the may id be a value from 0 to itemCount-1\r
50                 virtual const wchar_t* getListItem(u32 id) const = 0;\r
51 \r
52                 //! adds an list item, returns id of item\r
53                 virtual u32 addItem(const wchar_t* text) = 0;\r
54 \r
55                 //! adds an list item with an icon\r
56                 /** \param text Text of list entry\r
57                 \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon\r
58                 \return The id of the new created item */\r
59                 virtual u32 addItem(const wchar_t* text, s32 icon) = 0;\r
60 \r
61                 //! Removes an item from the list\r
62                 virtual void removeItem(u32 index) = 0;\r
63 \r
64                 //! get the the id of the item at the given absolute coordinates\r
65                 /** \return The id of the list item or -1 when no item is at those coordinates*/\r
66                 virtual s32 getItemAt(s32 xpos, s32 ypos) const = 0;\r
67 \r
68                 //! Returns the icon of an item\r
69                 virtual s32 getIcon(u32 index) const = 0;\r
70 \r
71                 //! Sets the sprite bank which should be used to draw list icons.\r
72                 /** This font is set to the sprite bank of the built-in-font by\r
73                 default. A sprite can be displayed in front of every list item.\r
74                 An icon is an index within the icon sprite bank. Several\r
75                 default icons are available in the skin through getIcon. */\r
76                 virtual void setSpriteBank(IGUISpriteBank* bank) = 0;\r
77 \r
78                 //! clears the list, deletes all items in the listbox\r
79                 virtual void clear() = 0;\r
80 \r
81                 //! returns id of selected item. returns -1 if no item is selected.\r
82                 virtual s32 getSelected() const = 0;\r
83 \r
84                 //! sets the selected item. Set this to -1 if no item should be selected\r
85                 virtual void setSelected(s32 index) = 0;\r
86 \r
87                 //! sets the selected item. Set this to 0 if no item should be selected\r
88                 virtual void setSelected(const wchar_t *item) = 0;\r
89 \r
90                 //! set whether the listbox should scroll to newly selected items\r
91                 virtual void setAutoScrollEnabled(bool scroll) = 0;\r
92 \r
93                 //! returns true if automatic scrolling is enabled, false if not.\r
94                 virtual bool isAutoScrollEnabled() const = 0;\r
95 \r
96                 //! set all item colors at given index to color\r
97                 virtual void setItemOverrideColor(u32 index, video::SColor color) = 0;\r
98 \r
99                 //! set all item colors of specified type at given index to color\r
100                 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color) = 0;\r
101 \r
102                 //! clear all item colors at index\r
103                 virtual void clearItemOverrideColor(u32 index) = 0;\r
104 \r
105                 //! clear item color at index for given colortype\r
106                 virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;\r
107 \r
108                 //! has the item at index its color overwritten?\r
109                 virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;\r
110 \r
111                 //! return the overwrite color at given item index.\r
112                 virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;\r
113 \r
114                 //! return the default color which is used for the given colorType\r
115                 virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;\r
116 \r
117                 //! set the item at the given index\r
118                 virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;\r
119 \r
120                 //! Insert the item at the given index\r
121                 /** \return The index on success or -1 on failure. */\r
122                 virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;\r
123 \r
124                 //! Swap the items at the given indices\r
125                 virtual void swapItems(u32 index1, u32 index2) = 0;\r
126 \r
127                 //! set global itemHeight\r
128                 virtual void setItemHeight( s32 height ) = 0;\r
129 \r
130                 //! Sets whether to draw the background\r
131                 virtual void setDrawBackground(bool draw) = 0;\r
132 \r
133                 //! Access the vertical scrollbar\r
134                 virtual IGUIScrollBar* getVerticalScrollBar() const = 0;\r
135 };\r
136 \r
137 \r
138 } // end namespace gui\r
139 } // end namespace irr\r
140 \r
141 #endif\r
142 \r