Commit 0d5d30ac authored by cutealien's avatar cutealien

Add IGUIComboBox::setMaxSelectionRows and IGUIComboBox::getMaxSelectionRows

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3883 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 029b1865
Changes in 1.8 (??.??.2011) Changes in 1.8 (??.??.2011)
- Add IGUIComboBox::setMaxSelectionRows and IGUIComboBox::getMaxSelectionRows
- Scenemanager switches from type ESNT_UNKNOWN to type ESNT_SCENE_MANAGER. - Scenemanager switches from type ESNT_UNKNOWN to type ESNT_SCENE_MANAGER.
- Add getActiveFont to all elements which have setOverrideFont for cleaner code - Add getActiveFont to all elements which have setOverrideFont for cleaner code
......
...@@ -55,6 +55,12 @@ namespace gui ...@@ -55,6 +55,12 @@ namespace gui
\param vertical: EGUIA_UPPERLEFT to align with top edge, \param vertical: EGUIA_UPPERLEFT to align with top edge,
EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */ EGUIA_LOWEERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0; virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;
//! Set the maximal number of rows for the selection listbox
virtual void setMaxSelectionRows(u32 max) = 0;
//! Get the maximimal number of rows for the selection listbox
virtual u32 getMaxSelectionRows() const = 0;
}; };
......
...@@ -24,7 +24,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent, ...@@ -24,7 +24,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
s32 id, core::rect<s32> rectangle) s32 id, core::rect<s32> rectangle)
: IGUIComboBox(environment, parent, id, rectangle), : IGUIComboBox(environment, parent, id, rectangle),
ListButton(0), SelectedText(0), ListBox(0), LastFocus(0), ListButton(0), SelectedText(0), ListBox(0), LastFocus(0),
Selected(-1), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), HasFocus(false) Selected(-1), HAlign(EGUIA_UPPERLEFT), VAlign(EGUIA_CENTER), MaxSelectionRows(5), HasFocus(false)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CGUIComboBox"); setDebugName("CGUIComboBox");
...@@ -81,6 +81,26 @@ void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ve ...@@ -81,6 +81,26 @@ void CGUIComboBox::setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT ve
} }
//! Set the maximal number of rows for the selection listbox
void CGUIComboBox::setMaxSelectionRows(u32 max)
{
MaxSelectionRows = max;
// force recalculation of open listbox
if (ListBox)
{
openCloseMenu();
openCloseMenu();
}
}
//! Get the maximimal number of rows for the selection listbox
u32 CGUIComboBox::getMaxSelectionRows() const
{
return MaxSelectionRows;
}
//! Returns amount of items in box //! Returns amount of items in box
u32 CGUIComboBox::getItemCount() const u32 CGUIComboBox::getItemCount() const
{ {
...@@ -410,8 +430,8 @@ void CGUIComboBox::openCloseMenu() ...@@ -410,8 +430,8 @@ void CGUIComboBox::openCloseMenu()
IGUISkin* skin = Environment->getSkin(); IGUISkin* skin = Environment->getSkin();
s32 h = Items.size(); s32 h = Items.size();
if (h > 5) if (h > getMaxSelectionRows())
h = 5; h = getMaxSelectionRows();
if (h == 0) if (h == 0)
h = 1; h = 1;
......
...@@ -62,6 +62,12 @@ namespace gui ...@@ -62,6 +62,12 @@ namespace gui
//! sets the text alignment of the text part //! sets the text alignment of the text part
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
//! Set the maximal number of rows for the selection listbox
virtual void setMaxSelectionRows(u32 max);
//! Get the maximimal number of rows for the selection listbox
virtual u32 getMaxSelectionRows() const;
//! called if an event happened. //! called if an event happened.
virtual bool OnEvent(const SEvent& event); virtual bool OnEvent(const SEvent& event);
...@@ -97,6 +103,7 @@ namespace gui ...@@ -97,6 +103,7 @@ namespace gui
s32 Selected; s32 Selected;
EGUI_ALIGNMENT HAlign, VAlign; EGUI_ALIGNMENT HAlign, VAlign;
u32 MaxSelectionRows;
bool HasFocus; bool HasFocus;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment