diff --git a/src/guiengine/widgets/CGUISTKListBox.cpp b/src/guiengine/widgets/CGUISTKListBox.cpp index ceb87093c0a..2b197aa352f 100644 --- a/src/guiengine/widgets/CGUISTKListBox.cpp +++ b/src/guiengine/widgets/CGUISTKListBox.cpp @@ -161,6 +161,13 @@ void CGUISTKListBox::clear() } +void CGUISTKListBox::updateDefaultItemHeight() +{ + if (ItemHeightOverride == 0) + ItemHeight = Font->getHeightPerLine() + 4; +} + + void CGUISTKListBox::recalculateItemHeight() { IGUISkin* skin = Environment->getSkin(); @@ -176,9 +183,7 @@ void CGUISTKListBox::recalculateItemHeight() if (Font) { - if ( 0 == ItemHeightOverride ) - ItemHeight = Font->getHeightPerLine() + 4; - + updateDefaultItemHeight(); Font->grab(); } } @@ -470,7 +475,11 @@ void CGUISTKListBox::updateAbsolutePosition() } } - recalculateItemHeight(); + if (Font) + updateDefaultItemHeight(); + ItemsIconWidth = 0; + if (!Items.empty()) + recalculateIconWidth(); } diff --git a/src/guiengine/widgets/CGUISTKListBox.hpp b/src/guiengine/widgets/CGUISTKListBox.hpp index 2d00a269627..11899e45c61 100644 --- a/src/guiengine/widgets/CGUISTKListBox.hpp +++ b/src/guiengine/widgets/CGUISTKListBox.hpp @@ -181,6 +181,7 @@ namespace irr private: void recalculateItemHeight(); + void updateDefaultItemHeight(); void selectNew(s32 ypos, bool onlyHover=false); void recalculateScrollPos(); void updateScrollBarSize(s32 size);