Bugfix: Text selection background in list widget overlays scrollbar (finally).

Bugfix: Game list missing one entry.

svn-id: r33658
This commit is contained in:
Vicent Marti 2008-08-06 13:58:07 +00:00
parent ef7a14dbe2
commit 4095f2eea9
6 changed files with 34 additions and 20 deletions

View file

@ -30,6 +30,8 @@
#include "gui/eval.h"
#include "gui/newgui.h"
#include "gui/ThemeEval.h"
namespace GUI {
ListWidget::ListWidget(GuiObject *boss, const String &name)
@ -374,7 +376,8 @@ void ListWidget::drawWidget() {
if (_hasFocus)
inverted = true;
else
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), _hints, Theme::kWidgetBackgroundBorderSmall);
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1),
_hints, Theme::kWidgetBackgroundBorderSmall);
}
Common::Rect r(getEditRect());
@ -385,7 +388,8 @@ void ListWidget::drawWidget() {
char temp[10];
sprintf(temp, "%2d. ", (pos + _numberingMode));
buffer = temp;
g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), buffer, _state, Theme::kTextAlignLeft, inverted, _leftPadding);
g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2),
buffer, _state, Theme::kTextAlignLeft, inverted, _leftPadding);
pad = 0;
}
@ -395,7 +399,8 @@ void ListWidget::drawWidget() {
buffer = _editString;
adjustOffset();
width = _w - r.left - _hlRightPadding - _leftPadding;
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), buffer, _state, Theme::kTextAlignLeft, inverted, pad);
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2),
buffer, _state, Theme::kTextAlignLeft, inverted, pad);
} else {
int maxWidth = _textWidth[i];
buffer = _list[pos];
@ -407,7 +412,8 @@ void ListWidget::drawWidget() {
width = _w - r.left - _hlRightPadding;
if (width > maxWidth)
maxWidth = width;
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), buffer, _state, Theme::kTextAlignLeft, inverted, pad);
g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2),
buffer, _state, Theme::kTextAlignLeft, inverted, pad);
}
_textWidth[i] = width;
@ -480,12 +486,12 @@ void ListWidget::abortEditMode() {
void ListWidget::reflowLayout() {
Widget::reflowLayout();
_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);
_leftPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Left", 0);
_rightPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Right", 0);
_topPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Top", 0);
_bottomPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.Padding.Bottom", 0);
_hlLeftPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlLeftPadding", 0);
_hlRightPadding = g_gui.xmlEval()->getVar("Globals.ListWidget.hlRightPadding", 0);
if (g_gui.getWidgetSize() == kBigWidgetSize) {
_scrollBarWidth = kBigScrollBarWidth;

View file

@ -246,7 +246,12 @@ public:
}
int getVar(const Common::String &s, int def) {
return (_vars.contains(s)) ? _vars[s] : def;
if (_vars.contains(s))
return _vars[s];
warning("Returning default value %d for '%s'", def, s.c_str());
return def;
// return (_vars.contains(s)) ? _vars[s] : def;
}
void setVar(const String &name, int val) { _vars[name] = val; }

View file

@ -362,11 +362,6 @@ void ThemeRenderer::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic
if (kDrawDataDefaults[type].parent != kDDNone && kDrawDataDefaults[type].parent != type)
queueDD(kDrawDataDefaults[type].parent, r);
// HACK: text selection backgrounds must be drawn before other widgets, because
// they are implemented poorly and they overlap.
if (type == kDDTextSelectionBackground)
_screenQueue.push_front(q);
else
_screenQueue.push_back(q);
}
} else {

View file

@ -54,8 +54,13 @@ public:
void setStringVar(const String &name, const String &val) { _strings[name] = val; }
void setAlias(const Common::String &name, const String &val) { _aliases[name] = val; }
int getVar(const Common::String &s) { return getVar_(s); }
int getVar(const Common::String &s) {
warning("Old evaluator access: '%s'", s.c_str());
return getVar_(s);
}
int getVar(const Common::String &s, int def) {
warning("Old evaluator access: '%s'", s.c_str());
int val = getVar_(s);
return (val == EVAL_UNDEF_VAR) ? def : val;
}

File diff suppressed because one or more lines are too long

View file

@ -433,6 +433,9 @@
<def var = 'Padding.Right' value = '16' />
<def var = 'Padding.Top' value = '16' />
<def var = 'ListWidget.hlLeftPadding' value = '8'/>
<def var = 'ListWidget.hlRightPadding' value = '16'/>
<widget name = 'OptionsLabel'
size = '110, 16'
/>