diff options
author | Willem Jan Palenstijn | 2017-02-26 18:34:02 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2017-02-28 15:55:52 +0100 |
commit | 5510640dbcd1bda6ae41942ed56c9ac037fc5228 (patch) | |
tree | bca82176d700bce72a948f046bc4acb43a740d98 /gui/widgets/tab.h | |
parent | af831f26b97590024218801528f50e008f3b2f72 (diff) | |
download | scummvm-rg350-5510640dbcd1bda6ae41942ed56c9ac037fc5228.tar.gz scummvm-rg350-5510640dbcd1bda6ae41942ed56c9ac037fc5228.tar.bz2 scummvm-rg350-5510640dbcd1bda6ae41942ed56c9ac037fc5228.zip |
GUI: Give each tab in TabWidget its own width
The width of each tab is now computed from its title, independently of
the other tabs. This increases the number of tabs that fit on the
screen.
This rewrite also fixes a bug where if the window size increased while
_firstVisibleTab > 0, some tabs would become inaccessible when the
scroll buttons were hidden.
The layout key Globals.TabWidget.Tab.Width is now treated as minimal
tab width. This is set so that the tabs fit reasonably well in lowres
layouts.
At the same time, this reduces the lowres scroll buttons heights to fit.
This patch makes the Nintento DS hacks in TabWidget obsolete.
(Hopefully! I'm not able to test.)
Diffstat (limited to 'gui/widgets/tab.h')
-rw-r--r-- | gui/widgets/tab.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index 4516c3c831..a1a5e06481 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -39,15 +39,17 @@ class TabWidget : public Widget { struct Tab { String title; Widget *firstWidget; + int _tabWidth; }; typedef Common::Array<Tab> TabList; protected: int _activeTab; int _firstVisibleTab; + int _lastVisibleTab; TabList _tabs; - int _tabWidth; int _tabHeight; + int _minTabWidth; int _bodyRP, _bodyTP, _bodyLP, _bodyBP; ThemeEngine::DialogBackground _bodyBackgroundType; @@ -57,6 +59,7 @@ protected: int _butRP, _butTP, _butW, _butH; ButtonWidget *_navLeft, *_navRight; + bool _navButtonsVisible; public: TabWidget(GuiObject *boss, int x, int y, int w, int h); @@ -101,8 +104,8 @@ public: virtual void handleMouseDown(int x, int y, int button, int clickCount); virtual bool handleKeyDown(Common::KeyState state); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); - virtual int getFirstVisible(); - virtual void setFirstVisible(int tabID); + virtual int getFirstVisible() const; + virtual void setFirstVisible(int tabID, bool adjustIfRoom = false); virtual void reflowLayout(); @@ -111,14 +114,16 @@ public: protected: // We overload getChildY to make sure child widgets are positioned correctly. // Essentially this compensates for the space taken up by the tab title header. - virtual int16 getChildY() const; - virtual uint16 getHeight() const; + virtual int16 getChildY() const; + virtual uint16 getHeight() const; virtual void drawWidget(); virtual Widget *findWidget(int x, int y); virtual void adjustTabs(int value); + + virtual void computeLastVisibleTab(bool adjustFirstIfRoom); }; } // End of namespace GUI |