~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to include/IGUIListBox.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 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
 
 
17
        //! Enumeration for listbox colors
 
18
        enum EGUI_LISTBOX_COLOR
 
19
        {
 
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
 
30
        };
 
31
 
 
32
 
 
33
        //! Default list box GUI element.
 
34
        class IGUIListBox : public IGUIElement
 
35
        {
 
36
        public:
 
37
                //! constructor
 
38
                IGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
 
39
                        : IGUIElement(EGUIET_LIST_BOX, environment, parent, id, rectangle) {}
 
40
 
 
41
                //! returns amount of list items
 
42
                virtual u32 getItemCount() const = 0;
 
43
 
 
44
                //! returns string of a list item. the may id be a value from 0 to itemCount-1
 
45
                virtual const wchar_t* getListItem(u32 id) const = 0;
 
46
 
 
47
                //! adds an list item, returns id of item
 
48
                virtual u32 addItem(const wchar_t* text) = 0;
 
49
 
 
50
                //! adds an list item with an icon
 
51
                /** \param text Text of list entry
 
52
                \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
 
53
                \return The id of the new created item */
 
54
                virtual u32 addItem(const wchar_t* text, s32 icon) = 0;
 
55
 
 
56
                //! Removes an item from the list
 
57
                virtual void removeItem(u32 index) = 0;
 
58
 
 
59
                //! get the the id of the item at the given absolute coordinates
 
60
                /** \return The id of the listitem or -1 when no item is at those coordinates*/
 
61
                virtual s32 getItemAt(s32 xpos, s32 ypos) const = 0;
 
62
 
 
63
                //! Returns the icon of an item
 
64
                virtual s32 getIcon(u32 index) const = 0;
 
65
 
 
66
                //! Sets the sprite bank which should be used to draw list icons.
 
67
                /** This font is set to the sprite bank of the built-in-font by
 
68
                default. A sprite can be displayed in front of every list item.
 
69
                An icon is an index within the icon sprite bank. Several
 
70
                default icons are available in the skin through getIcon. */
 
71
                virtual void setSpriteBank(IGUISpriteBank* bank) = 0;
 
72
 
 
73
                //! clears the list, deletes all items in the listbox
 
74
                virtual void clear() = 0;
 
75
 
 
76
                //! returns id of selected item. returns -1 if no item is selected.
 
77
                virtual s32 getSelected() const = 0;
 
78
 
 
79
                //! sets the selected item. Set this to -1 if no item should be selected
 
80
                virtual void setSelected(s32 index) = 0;
 
81
 
 
82
                //! sets the selected item. Set this to 0 if no item should be selected
 
83
                virtual void setSelected(const wchar_t *item) = 0;
 
84
 
 
85
                //! set whether the listbox should scroll to newly selected items
 
86
                virtual void setAutoScrollEnabled(bool scroll) = 0;
 
87
 
 
88
                //! returns true if automatic scrolling is enabled, false if not.
 
89
                virtual bool isAutoScrollEnabled() const = 0;
 
90
 
 
91
                //! set all item colors at given index to color
 
92
                virtual void setItemOverrideColor(u32 index, const video::SColor &color) = 0;
 
93
 
 
94
                //! set all item colors of specified type at given index to color
 
95
                virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, const video::SColor &color) = 0;
 
96
 
 
97
                //! clear all item colors at index
 
98
                virtual void clearItemOverrideColor(u32 index) = 0;
 
99
 
 
100
                //! clear item color at index for given colortype
 
101
                virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) = 0;
 
102
 
 
103
                //! has the item at index its color overwritten?
 
104
                virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
 
105
 
 
106
                //! return the overwrite color at given item index.
 
107
                virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const = 0;
 
108
 
 
109
                //! return the default color which is used for the given colorType
 
110
                virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const = 0;
 
111
 
 
112
                //! set the item at the given index
 
113
                virtual void setItem(u32 index, const wchar_t* text, s32 icon) = 0;
 
114
 
 
115
                //! Insert the item at the given index
 
116
                /** \return The index on success or -1 on failure. */
 
117
                virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon) = 0;
 
118
 
 
119
                //! Swap the items at the given indices
 
120
                virtual void swapItems(u32 index1, u32 index2) = 0;
 
121
 
 
122
                //! set global itemHeight
 
123
                virtual void setItemHeight( s32 height ) = 0;
 
124
 
 
125
                //! Sets whether to draw the background
 
126
                virtual void setDrawBackground(bool draw) = 0;
 
127
};
 
128
 
 
129
 
 
130
} // end namespace gui
 
131
} // end namespace irr
 
132
 
 
133
#endif
 
134