Add more resizing code to CGUISTKListBox

This commit is contained in:
CodingJellyfish 2024-04-22 11:35:19 +08:00
parent f6836998f0
commit 85e52de194
2 changed files with 14 additions and 4 deletions

View File

@ -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();
}

View File

@ -181,6 +181,7 @@ namespace irr
private:
void recalculateItemHeight();
void updateDefaultItemHeight();
void selectNew(s32 ypos, bool onlyHover=false);
void recalculateScrollPos();
void updateScrollBarSize(s32 size);