Use openssl's sha1 and sha256, optionally (#15472)
[minetest.git] / irr / include / IGUIListBox.h
blob6271eb560383e83b21c0d1b644056fd731a1aaba
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
5 #pragma once
7 #include "IGUIElement.h"
8 #include "SColor.h"
10 namespace irr
12 namespace gui
14 class IGUISpriteBank;
15 class IGUIScrollBar;
17 //! Enumeration for listbox colors
18 enum EGUI_LISTBOX_COLOR
20 //! Color of text
21 EGUI_LBC_TEXT = 0,
22 //! Color of selected text
23 EGUI_LBC_TEXT_HIGHLIGHT,
24 //! Color of icon
25 EGUI_LBC_ICON,
26 //! Color of selected icon
27 EGUI_LBC_ICON_HIGHLIGHT,
28 //! Not used, just counts the number of available colors
29 EGUI_LBC_COUNT
32 //! Default list box GUI element.
33 /** \par This element can create the following events of type EGUI_EVENT_TYPE:
34 \li EGET_LISTBOX_CHANGED
35 \li EGET_LISTBOX_SELECTED_AGAIN
37 class IGUIListBox : public IGUIElement
39 public:
40 //! constructor
41 IGUIListBox(IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect<s32> rectangle) :
42 IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
44 //! returns amount of list items
45 virtual u32 getItemCount() const = 0;
47 //! returns string of a list item. the may id be a value from 0 to itemCount-1
48 virtual const wchar_t *getListItem(u32 id) const = 0;
50 //! adds an list item, returns id of item
51 virtual u32 addItem(const wchar_t *text) = 0;
53 //! adds an list item with an icon
54 /** \param text Text of list entry
55 \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
56 \return The id of the new created item */
57 virtual u32 addItem(const wchar_t *text, s32 icon) = 0;
59 //! Removes an item from the list
60 virtual void removeItem(u32 index) = 0;
62 //! get the the id of the item at the given absolute coordinates
63 /** \return The id of the list item or -1 when no item is at those coordinates*/
64 virtual s32 getItemAt(s32 xpos, s32 ypos) const = 0;
66 //! Returns the icon of an item
67 virtual s32 getIcon(u32 index) const = 0;
69 //! Sets the sprite bank which should be used to draw list icons.
70 /** This font is set to the sprite bank of the built-in-font by
71 default. A sprite can be displayed in front of every list item.
72 An icon is an index within the icon sprite bank. Several
73 default icons are available in the skin through getIcon. */
74 virtual void setSpriteBank(IGUISpriteBank *bank) = 0;
76 //! clears the list, deletes all items in the listbox
77 virtual void clear() = 0;
79 //! returns id of selected item. returns -1 if no item is selected.
80 virtual s32 getSelected() const = 0;
82 //! sets the selected item. Set this to -1 if no item should be selected
83 virtual void setSelected(s32 index) = 0;
85 //! sets the selected item. Set this to 0 if no item should be selected
86 virtual void setSelected(const wchar_t *item) = 0;
88 //! set whether the listbox should scroll to newly selected items
89 virtual void setAutoScrollEnabled(bool scroll) = 0;
91 //! returns true if automatic scrolling is enabled, false if not.
92 virtual bool isAutoScrollEnabled() const = 0;
94 //! set all item colors at given index to color
95 virtual void setItemOverrideColor(u32 index, video::SColor color) = 0;
97 //! set all item colors of specified type at given index to color
98 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color) = 0;
100 //! clear all item colors at index
101 virtual void clearItemOverrideColor(u32 index) = 0;
103 //! clear item color at index for given colortype
104 virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
106 //! has the item at index its color overwritten?
107 virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
109 //! return the overwrite color at given item index.
110 virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
112 //! return the default color which is used for the given colorType
113 virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
115 //! set the item at the given index
116 virtual void setItem(u32 index, const wchar_t *text, s32 icon) = 0;
118 //! Insert the item at the given index
119 /** \return The index on success or -1 on failure. */
120 virtual s32 insertItem(u32 index, const wchar_t *text, s32 icon) = 0;
122 //! Swap the items at the given indices
123 virtual void swapItems(u32 index1, u32 index2) = 0;
125 //! set global itemHeight
126 virtual void setItemHeight(s32 height) = 0;
128 //! Sets whether to draw the background
129 virtual void setDrawBackground(bool draw) = 0;
131 //! Access the vertical scrollbar
132 virtual IGUIScrollBar *getVerticalScrollBar() const = 0;
135 } // end namespace gui
136 } // end namespace irr