aboutsummaryrefslogtreecommitdiff
path: root/gui/TabWidget.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-16 05:38:16 +0000
committerJohannes Schickel2009-08-16 05:38:16 +0000
commita9ac38ea23ac3892b5f2eff171efd2f483f57f75 (patch)
tree234782955f1ff71a99b27bf450969e060faf367a /gui/TabWidget.cpp
parent9f981303d2e19a0fa41d9b54e7c9a5570d373d1f (diff)
downloadscummvm-rg350-a9ac38ea23ac3892b5f2eff171efd2f483f57f75.tar.gz
scummvm-rg350-a9ac38ea23ac3892b5f2eff171efd2f483f57f75.tar.bz2
scummvm-rg350-a9ac38ea23ac3892b5f2eff171efd2f483f57f75.zip
Added Ninteno DS specific hack, which takes care of tab button width problems. This actually is not a NDS specific problem, but so far the NDS seems to be the only backend, which has a custom (hardcoded) dialog, which makes problems with our theme layouts. Instead of r43423, which enabled auto width calculaction for tab buttons on all platforms, this commit limits this to the Nintendo DS backend. This takes care of possible layout changes, caused by the changes of the commit. I also added a comment with possible solutions to this problem.
svn-id: r43426
Diffstat (limited to 'gui/TabWidget.cpp')
-rw-r--r--gui/TabWidget.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp
index 9b77b2f00c..3eb45297f3 100644
--- a/gui/TabWidget.cpp
+++ b/gui/TabWidget.cpp
@@ -91,7 +91,37 @@ int TabWidget::addTab(const String &title) {
int numTabs = _tabs.size();
+ // HACK: Nintendo DS uses a custom config dialog. This dialog does not work with
+ // our default "Globals.TabWidget.Tab.Width" setting.
+ //
+ // TODO: Add proper handling in the theme layout for such cases.
+ //
+ // There are different solutions to this problem:
+ // - offer a "Tab.Width" setting per tab widget and thus let the Ninteno DS
+ // backend set a default value for its special dialog.
+ //
+ // - change our themes to use auto width calculaction by default
+ //
+ // - change "Globals.TabWidget.Tab.Width" to be the minimal tab width setting and
+ // rename it accordingly.
+ // Actually this solution is pretty similar to our HACK for the Nintendo DS
+ // backend. This hack enables auto width calculation by default with the
+ // "Globals.TabWidget.Tab.Width" value as minimal width for the tab buttons.
+ //
+ // - we might also consider letting every tab button having its own width.
+ //
+ // - other solutions you can think of, which are hopefully less evil ;-).
+ //
+ // Of course also the Ninteno DS' dialog should be in our layouting engine, instead
+ // of being hard coded like it is right now.
+ //
+ // There are checks for __DS__ all over this source file to take care of the
+ // aforemnetioned problem.
+#ifdef __DS__
+ if (true) {
+#else
if (g_gui.xmlEval()->getVar("Globals.TabWidget.Tab.Width") == 0) {
+#endif
if (_tabWidth == 0)
_tabWidth = 40;
// Determine the new tab width
@@ -217,6 +247,10 @@ void TabWidget::reflowLayout() {
if (_tabWidth == 0) {
_tabWidth = 40;
+#ifdef __DS__
+ }
+ if (true) {
+#endif
int maxWidth = _w / _tabs.size();
for (uint i = 0; i < _tabs.size(); ++i) {