Skip to content

Commit

Permalink
Add more resizing code to CGUISTKListBox
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingJellyfish committed Apr 22, 2024
1 parent f683699 commit 85e52de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/guiengine/widgets/CGUISTKListBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ void CGUISTKListBox::clear()
}


void CGUISTKListBox::updateDefaultItemHeight()
{
if (ItemHeightOverride == 0)
ItemHeight = Font->getHeightPerLine() + 4;
}


void CGUISTKListBox::recalculateItemHeight()
{
IGUISkin* skin = Environment->getSkin();
Expand All @@ -176,9 +183,7 @@ void CGUISTKListBox::recalculateItemHeight()

if (Font)
{
if ( 0 == ItemHeightOverride )
ItemHeight = Font->getHeightPerLine() + 4;

updateDefaultItemHeight();
Font->grab();
}
}
Expand Down Expand Up @@ -470,7 +475,11 @@ void CGUISTKListBox::updateAbsolutePosition()
}
}

recalculateItemHeight();
if (Font)
updateDefaultItemHeight();
ItemsIconWidth = 0;
if (!Items.empty())
recalculateIconWidth();
}


Expand Down
1 change: 1 addition & 0 deletions src/guiengine/widgets/CGUISTKListBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ namespace irr
private:

void recalculateItemHeight();
void updateDefaultItemHeight();
void selectNew(s32 ypos, bool onlyHover=false);
void recalculateScrollPos();
void updateScrollBarSize(s32 size);
Expand Down

0 comments on commit 85e52de

Please sign in to comment.