mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 02:10:28 +00:00
GUI: tabs with scrollbars
This commit is contained in:
parent
30a8d927a1
commit
4ef38a9255
@ -36,7 +36,7 @@
|
||||
#include "graphics/pixelformat.h"
|
||||
|
||||
|
||||
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.0"
|
||||
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.9.1"
|
||||
|
||||
class OSystem;
|
||||
|
||||
|
@ -138,7 +138,7 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
||||
//
|
||||
// 1) The game tab
|
||||
//
|
||||
tab->addTab(_("Game"), "GameOptions_Game");
|
||||
tab->addTab(_("Game"), "GameOptions_Game", true);
|
||||
|
||||
// GUI: Label & edit widget for the game ID
|
||||
if (g_system->getOverlayWidth() > 320)
|
||||
|
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
[SCUMMVM_STX0.9.0:ResidualVM Modern Theme Remastered:No Author]
|
||||
[SCUMMVM_STX0.9.1:ResidualVM Modern Theme Remastered:No Author]
|
||||
%using ../common
|
||||
%using ../common-svg
|
||||
|
Binary file not shown.
@ -1 +1 @@
|
||||
[SCUMMVM_STX0.9.0:ScummVM Classic Theme:No Author]
|
||||
[SCUMMVM_STX0.9.1:ScummVM Classic Theme:No Author]
|
||||
|
@ -1211,6 +1211,7 @@
|
||||
type = 'PopUp'
|
||||
/>
|
||||
</layout>
|
||||
<widget name = 'Container'/>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
@ -1251,12 +1252,6 @@
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget'>
|
||||
<layout type = 'vertical' padding = '0, 0, 0, 0'>
|
||||
<widget name = 'Container'/>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
|
||||
<layout type = 'vertical' padding = '16, 16, 16, 16' align = 'center'>
|
||||
<widget name = 'Title'
|
||||
|
@ -1223,6 +1223,7 @@
|
||||
type = 'PopUp'
|
||||
/>
|
||||
</layout>
|
||||
<widget name = 'Container'/>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
@ -1263,12 +1264,6 @@
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'GameOptions_Engine' overlays = 'Dialog.GameOptions.TabWidget'>
|
||||
<layout type = 'vertical' padding = '0, 0, 0, 0'>
|
||||
<widget name = 'Container'/>
|
||||
</layout>
|
||||
</dialog>
|
||||
|
||||
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
|
||||
<layout type = 'vertical' padding = '2, 2, 2, 6' align = 'center' spacing='0'>
|
||||
<widget name = 'Title'
|
||||
|
Binary file not shown.
@ -1,2 +1,2 @@
|
||||
[SCUMMVM_STX0.9.0:ScummVM Modern Theme:No Author]
|
||||
[SCUMMVM_STX0.9.1:ScummVM Modern Theme:No Author]
|
||||
%using ../common
|
||||
|
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
[SCUMMVM_STX0.9.0:ScummVM Modern Theme Remastered:No Author]
|
||||
[SCUMMVM_STX0.9.1:ScummVM Modern Theme Remastered:No Author]
|
||||
%using ../common
|
||||
%using ../common-svg
|
||||
|
@ -91,10 +91,18 @@ TabWidget::~TabWidget() {
|
||||
// having been switched using setActiveTab() afterward, then the
|
||||
// firstWidget in the _tabs list for the active tab may not be up to
|
||||
// date. So update it now.
|
||||
|
||||
if (_activeTab != -1)
|
||||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
_firstWidget = nullptr;
|
||||
for (uint i = 0; i < _tabs.size(); ++i) {
|
||||
delete _tabs[i].scrollWidget;
|
||||
if (_tabs[i].scrollWidget) {
|
||||
delete _tabs[i].scrollWidget;
|
||||
} else {
|
||||
delete _tabs[i].firstWidget;
|
||||
}
|
||||
_tabs[i].scrollWidget = nullptr;
|
||||
_tabs[i].firstWidget = nullptr;
|
||||
}
|
||||
_tabs.clear();
|
||||
delete _navRight;
|
||||
@ -114,7 +122,7 @@ uint16 TabWidget::getHeight() const {
|
||||
return _h + _tabHeight;
|
||||
}
|
||||
|
||||
int TabWidget::addTab(const Common::U32String &title, const Common::String &dialogName) {
|
||||
int TabWidget::addTab(const Common::U32String &title, const Common::String &dialogName, bool withScroll) {
|
||||
// Add a new tab page
|
||||
Tab newTab;
|
||||
newTab.title = title;
|
||||
@ -135,7 +143,12 @@ int TabWidget::addTab(const Common::U32String &title, const Common::String &dial
|
||||
// Activate the new tab, also writes back our _firstWidget
|
||||
setActiveTab(numTabs - 1);
|
||||
|
||||
_tabs.back().scrollWidget = new ScrollContainerWidget(this, "", dialogName);
|
||||
if (withScroll) {
|
||||
_tabs.back().scrollWidget = new ScrollContainerWidget(this, "", dialogName, 'gtcr');
|
||||
_tabs.back().scrollWidget->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
||||
_tabs.back().scrollWidget->setTarget(this);
|
||||
_firstWidget = _tabs.back().scrollWidget;
|
||||
}
|
||||
|
||||
return _activeTab;
|
||||
}
|
||||
@ -145,7 +158,6 @@ Widget *TabWidget::addChild(Widget *newChild) {
|
||||
return Widget::addChild(newChild);
|
||||
|
||||
newChild->setBoss(_tabs[_activeTab].scrollWidget);
|
||||
_firstWidget = newChild;
|
||||
return _tabs[_activeTab].scrollWidget->addChild(newChild);
|
||||
}
|
||||
|
||||
@ -343,16 +355,17 @@ void TabWidget::reflowLayout() {
|
||||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
|
||||
for (uint i = 0; i < _tabs.size(); ++i) {
|
||||
_tabs[i].scrollWidget->setPos(_x, _y);
|
||||
_tabs[i].scrollWidget->setSize(_w, _h);
|
||||
if (!_tabs[i].dialogName.empty()) {
|
||||
g_gui.xmlEval()->reflowDialogLayout(_tabs[i].dialogName, _tabs[i].scrollWidget);
|
||||
}
|
||||
if (_tabs[i].scrollWidget) {
|
||||
_tabs[i].scrollWidget->resize(_x, _y, _w, _h, false);
|
||||
_tabs[i].scrollWidget->reflowLayout();
|
||||
} else {
|
||||
g_gui.xmlEval()->reflowDialogLayout(_tabs[i].dialogName, _tabs[i].firstWidget);
|
||||
|
||||
Widget *w = _tabs[i].scrollWidget;
|
||||
while (w) {
|
||||
w->reflowLayout();
|
||||
w = w->next();
|
||||
Widget *w = _tabs[i].firstWidget;
|
||||
while (w) {
|
||||
w->reflowLayout();
|
||||
w = w->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -408,14 +421,7 @@ void TabWidget::drawWidget() {
|
||||
}
|
||||
|
||||
void TabWidget::draw() {
|
||||
if (_activeTab == -1) {
|
||||
Widget::draw();
|
||||
} else {
|
||||
_tabs[_activeTab].firstWidget = _firstWidget;
|
||||
_firstWidget = _tabs[_activeTab].scrollWidget;
|
||||
Widget::draw();
|
||||
_firstWidget = _tabs[_activeTab].firstWidget;
|
||||
}
|
||||
Widget::draw();
|
||||
|
||||
if (_navButtonsVisible) {
|
||||
_navLeft->draw();
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
* Add a new tab with the given title. Returns a unique ID which can be used
|
||||
* to identify the tab (to remove it / activate it etc.).
|
||||
*/
|
||||
int addTab(const Common::U32String &title, const Common::String &dialogName);
|
||||
int addTab(const Common::U32String &title, const Common::String &dialogName, bool withScroll = false);
|
||||
|
||||
virtual Widget *addChild(Widget *newChild);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user