CGUITabControl: Center selected tab whenever possible

This greatly improves the navigation speed by clicking through the tabs
without losing track of the current scroll position.
This commit is contained in:
SmallJoker
2022-07-09 22:15:34 +02:00
committed by sfan5
parent 05a00a8d91
commit afbe41019c
2 changed files with 93 additions and 43 deletions

View File

@ -153,8 +153,11 @@ namespace gui
void scrollLeft();
void scrollRight();
bool needScrollControl( s32 startIndex=0, bool withScrollControl=false );
s32 calcTabWidth(s32 pos, IGUIFont* font, const wchar_t* text, bool withScrollControl ) const;
//! Indicates whether the tabs overflow in X direction
bool needScrollControl( s32 startIndex=0, bool withScrollControl=false, s32 *pos_rightmost=nullptr );
//! Left index calculation based on the selected tab
s32 calculateScrollIndexFromActive();
s32 calcTabWidth(IGUIFont* font, const wchar_t* text) const;
core::rect<s32> calcTabPos();
void setVisibleTab(s32 idx);
void removeTabButNotChild(s32 idx);