CGUIComboBox uses now EGDS_SCROLLBAR_SIZE instead of EGDS_WINDOW_BUTTON_WIDTH for the width of the listbox button to allow changing that without changing window topbar height.
It also changes now directly when the value is changed in the skin. Thanks @LunaRebirth for reporting. Forum-link: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52297&p=303682#p303682 git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5620 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
9d315a9354
commit
2246895ae1
|
@ -1,5 +1,7 @@
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
- CGUIComboBox uses now EGDS_SCROLLBAR_SIZE instead of EGDS_WINDOW_BUTTON_WIDTH for the width of the listbox button to allow changing that without changing window topbar height.
|
||||
Thanks @LunaRebirth for reporting. (Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52297&p=303682#p303682)
|
||||
- CGUIListbox, CGUITreeView and CGUITable now resize scrollbars when EGDS_SCROLLBAR_SIZE in the skin changes without having to re-create the elements.
|
||||
This also fixes the problem that drawing looked wrong when this value got changed after the elements were created.
|
||||
Thanks @LunaRebirth for reporting. (Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52297&p=303682#p303682)
|
||||
|
|
|
@ -149,11 +149,11 @@ namespace gui
|
|||
//! Enumeration for default sizes.
|
||||
enum EGUI_DEFAULT_SIZE
|
||||
{
|
||||
//! default with / height of scrollbar
|
||||
//! default with / height of scrollbar. Also width of drop-down button in comboboxes.
|
||||
EGDS_SCROLLBAR_SIZE = 0,
|
||||
//! height of menu
|
||||
EGDS_MENU_HEIGHT,
|
||||
//! width of a window button
|
||||
//! width and height of a window titlebar button (like minimize/maximize/close buttons). The titlebar height is also calculated from that.
|
||||
EGDS_WINDOW_BUTTON_WIDTH,
|
||||
//! width of a checkbox check
|
||||
EGDS_CHECK_BOX_WIDTH,
|
||||
|
|
|
@ -33,18 +33,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
|
||||
s32 width = 15;
|
||||
if (skin)
|
||||
width = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH);
|
||||
|
||||
core::rect<s32> r;
|
||||
r.UpperLeftCorner.X = rectangle.getWidth() - width - 2;
|
||||
r.LowerRightCorner.X = rectangle.getWidth() - 2;
|
||||
|
||||
r.UpperLeftCorner.Y = 2;
|
||||
r.LowerRightCorner.Y = rectangle.getHeight() - 2;
|
||||
|
||||
ListButton = Environment->addButton(r, this, -1, L"");
|
||||
ListButton = Environment->addButton(core::recti(0,0,1,1), this, -1, L"");
|
||||
if (skin && skin->getSpriteBank())
|
||||
{
|
||||
ListButton->setSpriteBank(skin->getSpriteBank());
|
||||
|
@ -55,12 +44,7 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
ListButton->setSubElement(true);
|
||||
ListButton->setTabStop(false);
|
||||
|
||||
r.UpperLeftCorner.X = 2;
|
||||
r.UpperLeftCorner.Y = 2;
|
||||
r.LowerRightCorner.X = RelativeRect.getWidth() - (ListButton->getAbsolutePosition().getWidth() + 2);
|
||||
r.LowerRightCorner.Y = RelativeRect.getHeight() - 2;
|
||||
|
||||
SelectedText = Environment->addStaticText(L"", r, false, false, this, -1, false);
|
||||
SelectedText = Environment->addStaticText(L"", core::recti(0,0,1,1), false, false, this, -1, false);
|
||||
SelectedText->setSubElement(true);
|
||||
SelectedText->setAlignment(EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT);
|
||||
SelectedText->setTextAlignment(EGUIA_UPPERLEFT, EGUIA_CENTER);
|
||||
|
@ -68,6 +52,8 @@ CGUIComboBox::CGUIComboBox(IGUIEnvironment* environment, IGUIElement* parent,
|
|||
SelectedText->setOverrideColor(skin->getColor(EGDC_BUTTON_TEXT));
|
||||
SelectedText->enableOverrideColor(true);
|
||||
|
||||
updateListButtonWidth(skin ? skin->getSize(EGDS_SCROLLBAR_SIZE) : 15);
|
||||
|
||||
// this element can be tabbed to
|
||||
setTabStop(true);
|
||||
setTabOrder(-1);
|
||||
|
@ -377,6 +363,24 @@ void CGUIComboBox::sendSelectionChangedEvent()
|
|||
}
|
||||
}
|
||||
|
||||
void CGUIComboBox::updateListButtonWidth(s32 width)
|
||||
{
|
||||
if (ListButton->getRelativePosition().getWidth() != width)
|
||||
{
|
||||
core::rect<s32> r;
|
||||
r.UpperLeftCorner.X = RelativeRect.getWidth() - width - 2;
|
||||
r.LowerRightCorner.X = RelativeRect.getWidth() - 2;
|
||||
r.UpperLeftCorner.Y = 2;
|
||||
r.LowerRightCorner.Y = RelativeRect.getHeight() - 2;
|
||||
ListButton->setRelativePosition(r);
|
||||
|
||||
r.UpperLeftCorner.X = 2;
|
||||
r.UpperLeftCorner.Y = 2;
|
||||
r.LowerRightCorner.X = RelativeRect.getWidth() - (width + 2);
|
||||
r.LowerRightCorner.Y = RelativeRect.getHeight() - 2;
|
||||
SelectedText->setRelativePosition(r);
|
||||
}
|
||||
}
|
||||
|
||||
//! draws the element and its children
|
||||
void CGUIComboBox::draw()
|
||||
|
@ -386,6 +390,8 @@ void CGUIComboBox::draw()
|
|||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
|
||||
updateListButtonWidth(skin->getSize(EGDS_SCROLLBAR_SIZE));
|
||||
|
||||
// font changed while the listbox is open?
|
||||
if ( ActiveFont != skin->getFont() && ListBox )
|
||||
{
|
||||
|
|
|
@ -84,6 +84,7 @@ namespace gui
|
|||
|
||||
void openCloseMenu();
|
||||
void sendSelectionChangedEvent();
|
||||
void updateListButtonWidth(s32 width);
|
||||
|
||||
IGUIButton* ListButton;
|
||||
IGUIStaticText* SelectedText;
|
||||
|
|
Loading…
Reference in New Issue