Irrlicht 3D Engine
IGUIListBox.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
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_LIST_BOX_H_INCLUDED__
6 #define __I_GUI_LIST_BOX_H_INCLUDED__
7 
8 #include "IGUIElement.h"
9 #include "SColor.h"
10 
11 namespace irr
12 {
13 namespace gui
14 {
15  class IGUISpriteBank;
16  class IGUIScrollBar;
17 
20  {
31  };
32 
33 
35 
39  class IGUIListBox : public IGUIElement
40  {
41  public:
43  IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
44  : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
45 
47  virtual u32 getItemCount() const = 0;
48 
50  virtual const wchar_t* getListItem(u32 id) const = 0;
51 
53  virtual u32 addItem(const wchar_t* text) = 0;
54 
56 
59  virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
60 
62  virtual void removeItem(u32 index) = 0;
63 
65 
66  virtual s32 getItemAt(s32 xpos, s32 ypos) const = 0;
67 
69  virtual s32 getIcon(u32 index) const = 0;
70 
72 
76  virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
77 
79  virtual void clear() = 0;
80 
82  virtual s32 getSelected() const = 0;
83 
85  virtual void setSelected(s32 index) = 0;
86 
88  virtual void setSelected(const wchar_t *item) = 0;
89 
91  virtual void setAutoScrollEnabled(bool scroll) = 0;
92 
94  virtual bool isAutoScrollEnabled() const = 0;
95 
97  virtual void setItemOverrideColor(u32 index, video::SColor color) = 0;
98 
100  virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color) = 0;
101 
103  virtual void clearItemOverrideColor(u32 index) = 0;
104 
106  virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
107 
109  virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
110 
112  virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
113 
115  virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
116 
118  virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
119 
121 
122  virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
123 
125  virtual void swapItems(u32 index1, u32 index2) = 0;
126 
128  virtual void setItemHeight( s32 height ) = 0;
129 
131  virtual void setDrawBackground(bool draw) = 0;
132 
134  virtual IGUIScrollBar* getVerticalScrollBar() const = 0;
135 };
136 
137 
138 } // end namespace gui
139 } // end namespace irr
140 
141 #endif
142 
virtual void setAutoScrollEnabled(bool scroll)=0
set whether the listbox should scroll to newly selected items
virtual s32 getItemAt(s32 xpos, s32 ypos) const =0
get the the id of the item at the given absolute coordinates
Color of selected text.
Definition: IGUIListBox.h:24
virtual void clear()=0
clears the list, deletes all items in the listbox
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const =0
return the default color which is used for the given colorType
virtual void swapItems(u32 index1, u32 index2)=0
Swap the items at the given indices.
virtual void setSelected(s32 index)=0
sets the selected item. Set this to -1 if no item should be selected
virtual u32 addItem(const wchar_t *text)=0
adds an list item, returns id of item
Sprite bank interface.
virtual s32 insertItem(u32 index, const wchar_t *text, s32 icon)=0
Insert the item at the given index.
virtual void setDrawBackground(bool draw)=0
Sets whether to draw the background.
EGUI_LISTBOX_COLOR
Enumeration for listbox colors.
Definition: IGUIListBox.h:19
virtual void setItem(u32 index, const wchar_t *text, s32 icon)=0
set the item at the given index
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const =0
has the item at index its color overwritten?
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:12
GUI Environment. Used as factory and manager of all other GUI elements.
Color of text.
Definition: IGUIListBox.h:22
virtual s32 getIcon(u32 index) const =0
Returns the icon of an item.
Default list box GUI element.
Definition: IGUIListBox.h:39
virtual void setItemHeight(s32 height)=0
set global itemHeight
virtual void clearItemOverrideColor(u32 index)=0
clear all item colors at index
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
Default scroll bar GUI element.
Definition: IGUIScrollBar.h:19
virtual u32 getItemCount() const =0
returns amount of list items
virtual IGUIScrollBar * getVerticalScrollBar() const =0
Access the vertical scrollbar.
virtual void draw()
Draws the element and its children.
Definition: IGUIElement.h:309
virtual const wchar_t * getListItem(u32 id) const =0
returns string of a list item. the may id be a value from 0 to itemCount-1
A list box (IGUIListBox)
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62
Color of selected icon.
Definition: IGUIListBox.h:28
virtual s32 getSelected() const =0
returns id of selected item. returns -1 if no item is selected.
virtual void removeItem(u32 index)=0
Removes an item from the list.
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const =0
return the overwrite color at given item index.
Class representing a 32 bit ARGB color.
Definition: SColor.h:314
Base class of all GUI elements.
Definition: IGUIElement.h:23
virtual void setItemOverrideColor(u32 index, video::SColor color)=0
set all item colors at given index to color
IGUIListBox(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
constructor
Definition: IGUIListBox.h:43
Color of icon.
Definition: IGUIListBox.h:26
virtual bool isAutoScrollEnabled() const =0
returns true if automatic scrolling is enabled, false if not.
virtual void setSpriteBank(IGUISpriteBank *bank)=0
Sets the sprite bank which should be used to draw list icons.
Not used, just counts the number of available colors.
Definition: IGUIListBox.h:30