6#ifndef HEADER_CGUISTKListBox_HPP
7#define HEADER_CGUISTKListBox_HPP
9#include "IrrCompileConfig.h"
11#include "IGUIListBox.h"
12#include "IGUIElement.h"
17#include "GlyphLayout.h"
35 irr::core::stringw m_text;
38 std::vector<GlyphLayout> m_glyph_layouts;
41 ListCell(irr::core::stringw text, s32 icon = -1,
int proportion = 1,
bool center =
false)
44 m_proportion = proportion;
50 core::array< ListCell > m_contents;
53 std::string m_internal_name;
56 bool m_word_wrap =
false;
57 float m_line_height_scale = 0.0f;
72 s32
id, core::rect<s32> rectangle,
bool clip=
true,
73 bool drawBack=
false,
bool moveOverSelect=
false);
81 virtual const wchar_t* getCellText(u32 row_num, u32 col_num)
const;
83 virtual ListItem getItem(u32
id)
const;
94 virtual s32 getRowByCellText(
const wchar_t * text);
99 virtual s32 getRowByInternalName(
const std::string & text)
const;
102 virtual bool OnEvent(
const SEvent& event);
117 virtual s32
getIcon(u32 row_num, u32 col_num)
const;
123 virtual s32
getItemAt(s32 xpos, s32 ypos)
const;
144 virtual void setItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType, video::SColor color);
162 virtual void setCell(u32 row_num, u32 col_num,
const wchar_t* text, s32 icon);
165 virtual void swapItems(u32 index1, u32 index2);
173 void setAlternatingDarkness(
bool val) { m_alternating_darkness = val; }
174 gui::IGUIScrollBar* getScrollBar()
const {
return ScrollBar; }
175 void setDisactivated(
bool val)
183 void recalculateItemHeight();
184 void selectNew(s32 ypos,
bool onlyHover=
false);
185 void recalculateScrollPos();
188 void recalculateIconWidth();
190 core::array< ListItem > Items;
193 s32 ItemHeightOverride;
198 gui::IGUISpriteBank* IconBank;
199 gui::IGUIScrollBar* ScrollBar;
201 core::stringw KeyBuffer;
207 bool HighlightWhenNotFocused;
208 bool m_alternating_darkness;
Definition: CGUISTKListBox.hpp:27
virtual void setCell(u32 row_num, u32 col_num, const wchar_t *text, s32 icon)
set the item at the given index
Definition: CGUISTKListBox.cpp:704
virtual video::SColor getItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const
return the overwrite color at given item index.
Definition: CGUISTKListBox.cpp:775
virtual void setItemHeight(s32 height)
set global itemHeight
Definition: CGUISTKListBox.cpp:806
virtual void draw()
draws the element and its children
Definition: CGUISTKListBox.cpp:472
virtual bool OnEvent(const SEvent &event)
called if an event happened.
Definition: CGUISTKListBox.cpp:257
virtual s32 getItemAt(s32 xpos, s32 ypos) const
get the the id of the item at the given absolute coordinates
Definition: CGUISTKListBox.cpp:134
virtual void setSelectedByCellText(const wchar_t *text)
sets the selected item. Set this to -1 if no item should be selected
Definition: CGUISTKListBox.cpp:238
virtual bool isAutoScrollEnabled() const
returns true if automatic scrolling is enabled, false if not.
Definition: CGUISTKListBox.cpp:677
virtual void setDrawBackground(bool draw)
Sets whether to draw the background.
Definition: CGUISTKListBox.cpp:814
virtual void swapItems(u32 index1, u32 index2)
Swap the items at the given indices.
Definition: CGUISTKListBox.cpp:717
virtual void removeItem(u32 id)
removes an item from the list
Definition: CGUISTKListBox.cpp:113
virtual video::SColor getItemDefaultColor(EGUI_LISTBOX_COLOR colorType) const
return the default color which is used for the given colorType
Definition: CGUISTKListBox.cpp:784
virtual u32 getItemCount() const
returns amount of list items
Definition: CGUISTKListBox.cpp:81
virtual void setSelected(s32 id)
sets the selected item. Set this to -1 if no item should be selected
Definition: CGUISTKListBox.cpp:208
virtual ~CGUISTKListBox()
destructor
Definition: CGUISTKListBox.cpp:67
virtual void clearItemOverrideColor(u32 index)
clear all item colors at index
Definition: CGUISTKListBox.cpp:748
virtual s32 getIcon(u32 row_num, u32 col_num) const
Returns the icon of an item.
Definition: CGUISTKListBox.cpp:104
virtual void setItemOverrideColor(u32 index, video::SColor color)
set all item colors at given index to color
Definition: CGUISTKListBox.cpp:728
virtual bool hasItemOverrideColor(u32 index, EGUI_LISTBOX_COLOR colorType) const
has the item at index its color overwritten?
Definition: CGUISTKListBox.cpp:766
virtual s32 getSelected() const
returns id of selected item. returns -1 if no item is selected.
Definition: CGUISTKListBox.cpp:201
virtual u32 addItem(const ListItem &item)
adds an list item with an icon
Definition: CGUISTKListBox.cpp:630
virtual void setSpriteBank(IGUISpriteBank *bank)
Sets the sprite bank which should be used to draw list icons.
Definition: CGUISTKListBox.cpp:639
virtual void updateAbsolutePosition()
Update the position and size of the listbox, and update the scrollbar.
Definition: CGUISTKListBox.cpp:463
virtual void clear()
clears the list
Definition: CGUISTKListBox.cpp:152
virtual void setAutoScrollEnabled(bool scroll)
set whether the listbox should scroll to newly selected items
Definition: CGUISTKListBox.cpp:671
Definition: spherical_harmonics.hpp:26
Definition: CGUISTKListBox.hpp:34
Definition: CGUISTKListBox.hpp:61
Definition: CGUISTKListBox.hpp:31