aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h380
1 files changed, 190 insertions, 190 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h
index d00921f..3ef8660 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUIListBox.h
@@ -1,190 +1,190 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_GUI_LIST_BOX_H_INCLUDED__ 5#ifndef __C_GUI_LIST_BOX_H_INCLUDED__
6#define __C_GUI_LIST_BOX_H_INCLUDED__ 6#define __C_GUI_LIST_BOX_H_INCLUDED__
7 7
8#include "IrrCompileConfig.h" 8#include "IrrCompileConfig.h"
9#ifdef _IRR_COMPILE_WITH_GUI_ 9#ifdef _IRR_COMPILE_WITH_GUI_
10 10
11#include "IGUIListBox.h" 11#include "IGUIListBox.h"
12#include "irrArray.h" 12#include "irrArray.h"
13 13
14namespace irr 14namespace irr
15{ 15{
16namespace gui 16namespace gui
17{ 17{
18 18
19 class IGUIFont; 19 class IGUIFont;
20 class IGUIScrollBar; 20 class IGUIScrollBar;
21 21
22 class CGUIListBox : public IGUIListBox 22 class CGUIListBox : public IGUIListBox
23 { 23 {
24 public: 24 public:
25 //! constructor 25 //! constructor
26 CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent, 26 CGUIListBox(IGUIEnvironment* environment, IGUIElement* parent,
27 s32 id, core::rect<s32> rectangle, bool clip=true, 27 s32 id, core::rect<s32> rectangle, bool clip=true,
28 bool drawBack=false, bool moveOverSelect=false); 28 bool drawBack=false, bool moveOverSelect=false);
29 29
30 //! destructor 30 //! destructor
31 virtual ~CGUIListBox(); 31 virtual ~CGUIListBox();
32 32
33 //! returns amount of list items 33 //! returns amount of list items
34 virtual u32 getItemCount() const; 34 virtual u32 getItemCount() const;
35 35
36 //! returns string of a list item. the id may be a value from 0 to itemCount-1 36 //! returns string of a list item. the id may be a value from 0 to itemCount-1
37 virtual const wchar_t* getListItem(u32 id) const; 37 virtual const wchar_t* getListItem(u32 id) const;
38 38
39 //! adds an list item, returns id of item 39 //! adds an list item, returns id of item
40 virtual u32 addItem(const wchar_t* text); 40 virtual u32 addItem(const wchar_t* text);
41 41
42 //! clears the list 42 //! clears the list
43 virtual void clear(); 43 virtual void clear();
44 44
45 //! returns id of selected item. returns -1 if no item is selected. 45 //! returns id of selected item. returns -1 if no item is selected.
46 virtual s32 getSelected() const; 46 virtual s32 getSelected() const;
47 47
48 //! sets the selected item. Set this to -1 if no item should be selected 48 //! sets the selected item. Set this to -1 if no item should be selected
49 virtual void setSelected(s32 id); 49 virtual void setSelected(s32 id);
50 50
51 //! sets the selected item. Set this to -1 if no item should be selected 51 //! sets the selected item. Set this to -1 if no item should be selected
52 virtual void setSelected(const wchar_t *item); 52 virtual void setSelected(const wchar_t *item);
53 53
54 //! called if an event happened. 54 //! called if an event happened.
55 virtual bool OnEvent(const SEvent& event); 55 virtual bool OnEvent(const SEvent& event);
56 56
57 //! draws the element and its children 57 //! draws the element and its children
58 virtual void draw(); 58 virtual void draw();
59 59
60 //! adds an list item with an icon 60 //! adds an list item with an icon
61 //! \param text Text of list entry 61 //! \param text Text of list entry
62 //! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon 62 //! \param icon Sprite index of the Icon within the current sprite bank. Set it to -1 if you want no icon
63 //! \return 63 //! \return
64 //! returns the id of the new created item 64 //! returns the id of the new created item
65 virtual u32 addItem(const wchar_t* text, s32 icon); 65 virtual u32 addItem(const wchar_t* text, s32 icon);
66 66
67 //! Returns the icon of an item 67 //! Returns the icon of an item
68 virtual s32 getIcon(u32 id) const; 68 virtual s32 getIcon(u32 id) const;
69 69
70 //! removes an item from the list 70 //! removes an item from the list
71 virtual void removeItem(u32 id); 71 virtual void removeItem(u32 id);
72 72
73 //! get the the id of the item at the given absolute coordinates 73 //! get the the id of the item at the given absolute coordinates
74 virtual s32 getItemAt(s32 xpos, s32 ypos) const; 74 virtual s32 getItemAt(s32 xpos, s32 ypos) const;
75 75
76 //! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of 76 //! Sets the sprite bank which should be used to draw list icons. This font is set to the sprite bank of
77 //! the built-in-font by default. A sprite can be displayed in front of every list item. 77 //! the built-in-font by default. A sprite can be displayed in front of every list item.
78 //! An icon is an index within the icon sprite bank. Several default icons are available in the 78 //! An icon is an index within the icon sprite bank. Several default icons are available in the
79 //! skin through getIcon 79 //! skin through getIcon
80 virtual void setSpriteBank(IGUISpriteBank* bank); 80 virtual void setSpriteBank(IGUISpriteBank* bank);
81 81
82 //! set whether the listbox should scroll to newly selected items 82 //! set whether the listbox should scroll to newly selected items
83 virtual void setAutoScrollEnabled(bool scroll); 83 virtual void setAutoScrollEnabled(bool scroll);
84 84
85 //! returns true if automatic scrolling is enabled, false if not. 85 //! returns true if automatic scrolling is enabled, false if not.
86 virtual bool isAutoScrollEnabled() const; 86 virtual bool isAutoScrollEnabled() const;
87 87
88 //! Update the position and size of the listbox, and update the scrollbar 88 //! Update the position and size of the listbox, and update the scrollbar
89 virtual void updateAbsolutePosition(); 89 virtual void updateAbsolutePosition();
90 90
91 //! Writes attributes of the element. 91 //! Writes attributes of the element.
92 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; 92 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
93 93
94 //! Reads attributes of the element 94 //! Reads attributes of the element
95 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); 95 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
96 96
97 //! set all item colors at given index to color 97 //! set all item colors at given index to color
98 virtual void setItemOverrideColor(u32 index, video::SColor color); 98 virtual void setItemOverrideColor(u32 index, video::SColor color);
99 99
100 //! set all item colors of specified type at given index to color 100 //! set all item colors of specified type at given index to color
101 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color); 101 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color);
102 102
103 //! clear all item colors at index 103 //! clear all item colors at index
104 virtual void clearItemOverrideColor(u32 index); 104 virtual void clearItemOverrideColor(u32 index);
105 105
106 //! clear item color at index for given colortype 106 //! clear item color at index for given colortype
107 virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType); 107 virtual void clearItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType);
108 108
109 //! has the item at index its color overwritten? 109 //! has the item at index its color overwritten?
110 virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; 110 virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
111 111
112 //! return the overwrite color at given item index. 112 //! return the overwrite color at given item index.
113 virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const; 113 virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const;
114 114
115 //! return the default color which is used for the given colorType 115 //! return the default color which is used for the given colorType
116 virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const; 116 virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const;
117 117
118 //! set the item at the given index 118 //! set the item at the given index
119 virtual void setItem(u32 index, const wchar_t* text, s32 icon); 119 virtual void setItem(u32 index, const wchar_t* text, s32 icon);
120 120
121 //! Insert the item at the given index 121 //! Insert the item at the given index
122 //! Return the index on success or -1 on failure. 122 //! Return the index on success or -1 on failure.
123 virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon); 123 virtual s32 insertItem(u32 index, const wchar_t* text, s32 icon);
124 124
125 //! Swap the items at the given indices 125 //! Swap the items at the given indices
126 virtual void swapItems(u32 index1, u32 index2); 126 virtual void swapItems(u32 index1, u32 index2);
127 127
128 //! set global itemHeight 128 //! set global itemHeight
129 virtual void setItemHeight( s32 height ); 129 virtual void setItemHeight( s32 height );
130 130
131 //! Sets whether to draw the background 131 //! Sets whether to draw the background
132 virtual void setDrawBackground(bool draw); 132 virtual void setDrawBackground(bool draw);
133 133
134 134
135 private: 135 private:
136 136
137 struct ListItem 137 struct ListItem
138 { 138 {
139 ListItem() : icon(-1) 139 ListItem() : icon(-1)
140 {} 140 {}
141 141
142 core::stringw text; 142 core::stringw text;
143 s32 icon; 143 s32 icon;
144 144
145 // A multicolor extension 145 // A multicolor extension
146 struct ListItemOverrideColor 146 struct ListItemOverrideColor
147 { 147 {
148 ListItemOverrideColor() : Use(false) {} 148 ListItemOverrideColor() : Use(false) {}
149 bool Use; 149 bool Use;
150 video::SColor Color; 150 video::SColor Color;
151 }; 151 };
152 ListItemOverrideColor OverrideColors[EGUI_LBC_COUNT]; 152 ListItemOverrideColor OverrideColors[EGUI_LBC_COUNT];
153 }; 153 };
154 154
155 void recalculateItemHeight(); 155 void recalculateItemHeight();
156 void selectNew(s32 ypos, bool onlyHover=false); 156 void selectNew(s32 ypos, bool onlyHover=false);
157 void recalculateScrollPos(); 157 void recalculateScrollPos();
158 158
159 // extracted that function to avoid copy&paste code 159 // extracted that function to avoid copy&paste code
160 void recalculateItemWidth(s32 icon); 160 void recalculateItemWidth(s32 icon);
161 161
162 // get labels used for serialization 162 // get labels used for serialization
163 bool getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::stringc & useColorLabel, core::stringc & colorLabel) const; 163 bool getSerializationLabels(EGUI_LISTBOX_COLOR colorType, core::stringc & useColorLabel, core::stringc & colorLabel) const;
164 164
165 core::array< ListItem > Items; 165 core::array< ListItem > Items;
166 s32 Selected; 166 s32 Selected;
167 s32 ItemHeight; 167 s32 ItemHeight;
168 s32 ItemHeightOverride; 168 s32 ItemHeightOverride;
169 s32 TotalItemHeight; 169 s32 TotalItemHeight;
170 s32 ItemsIconWidth; 170 s32 ItemsIconWidth;
171 gui::IGUIFont* Font; 171 gui::IGUIFont* Font;
172 gui::IGUISpriteBank* IconBank; 172 gui::IGUISpriteBank* IconBank;
173 gui::IGUIScrollBar* ScrollBar; 173 gui::IGUIScrollBar* ScrollBar;
174 u32 selectTime; 174 u32 selectTime;
175 u32 LastKeyTime; 175 u32 LastKeyTime;
176 core::stringw KeyBuffer; 176 core::stringw KeyBuffer;
177 bool Selecting; 177 bool Selecting;
178 bool DrawBack; 178 bool DrawBack;
179 bool MoveOverSelect; 179 bool MoveOverSelect;
180 bool AutoScroll; 180 bool AutoScroll;
181 bool HighlightWhenNotFocused; 181 bool HighlightWhenNotFocused;
182 }; 182 };
183 183
184 184
185} // end namespace gui 185} // end namespace gui
186} // end namespace irr 186} // end namespace irr
187 187
188#endif // _IRR_COMPILE_WITH_GUI_ 188#endif // _IRR_COMPILE_WITH_GUI_
189 189
190#endif 190#endif