aboutsummaryrefslogtreecommitdiff
path: root/gui/ListWidget.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2006-04-19 01:05:28 +0000
committerJohannes Schickel2006-04-19 01:05:28 +0000
commit30787714d30e9202890922ec10833e695bc8a3bf (patch)
treeb2a699d793bbafd7a5fade0f366b3ec3636f4ffe /gui/ListWidget.cpp
parentec7e734adb2133a653f500636b101fc09ab6e4ae (diff)
downloadscummvm-rg350-30787714d30e9202890922ec10833e695bc8a3bf.tar.gz
scummvm-rg350-30787714d30e9202890922ec10833e695bc8a3bf.tar.bz2
scummvm-rg350-30787714d30e9202890922ec10833e695bc8a3bf.zip
Started to prepare the gui for runtime resolution switches.
(some little things could be missing yet though) svn-id: r22017
Diffstat (limited to 'gui/ListWidget.cpp')
-rw-r--r--gui/ListWidget.cpp39
1 files changed, 36 insertions, 3 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 240223f760..07a3cd25fd 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -31,7 +31,7 @@ namespace GUI {
ListWidget::ListWidget(GuiObject *boss, String name)
: EditableWidget(boss, name), CommandSender(boss) {
- int w = g_gui.evaluator()->getVar(name + ".w");
+ int w = g_gui.evaluator()->getVar(_name + ".w");
WidgetSize ws = g_gui.getWidgetSize();
@@ -47,6 +47,9 @@ ListWidget::ListWidget(GuiObject *boss, String name)
} else {
_w = w - kNormalScrollBarWidth;
}
+
+ _scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
+ _scrollBar->setTarget(this);
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
setHints(THEME_HINT_SAVE_BACKGROUND);
@@ -56,8 +59,6 @@ ListWidget::ListWidget(GuiObject *boss, String name)
_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
_currentPos = 0;
_selectedItem = -1;
- _scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
- _scrollBar->setTarget(this);
_currentKeyDown = 0;
_quickSelectTime = 0;
@@ -436,4 +437,36 @@ void ListWidget::abortEditMode() {
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
}
+void ListWidget::handleScreenChanged() {
+ Widget::handleScreenChanged();
+
+ int w = g_gui.evaluator()->getVar(_name + ".w");
+
+ WidgetSize ws = g_gui.getWidgetSize();
+
+ _leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);
+ _rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0);
+ _topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0);
+ _bottomPadding = g_gui.evaluator()->getVar("ListWidget.bottomPadding", 0);
+ _hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
+ _hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
+
+ if (ws == kBigWidgetSize) {
+ _w = w - kBigScrollBarWidth;
+ } else {
+ _w = w - kNormalScrollBarWidth;
+ }
+
+ _entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
+
+ delete [] _textWidth;
+ _textWidth = new int[_entriesPerPage];
+
+ for (int i = 0; i < _entriesPerPage; i++)
+ _textWidth[i] = 0;
+
+ _scrollBar->resize(_x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
+ scrollBarRecalc();
+}
+
} // End of namespace GUI