aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2002-07-15 12:59:56 +0000
committerMax Horn2002-07-15 12:59:56 +0000
commite6f6e5df8f97caf7ba2f009336efda4c760ed193 (patch)
tree9eb83388adbcda403d7263e1bad2e06aaef81be7 /gui
parent272c391eb04b51a088e43fcbae37a84c39d8ff35 (diff)
downloadscummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.tar.gz
scummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.tar.bz2
scummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.zip
allow static text/button widgets in NewGUI to be drawn centred
svn-id: r4551
Diffstat (limited to 'gui')
-rw-r--r--gui/widget.cpp8
-rw-r--r--gui/widget.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index c72d44647c..4b8219cc08 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -52,6 +52,7 @@ void Widget::draw()
gui->box(_x, _y, _w, _h);
_x += 4;
_y += 4;
+ _w -= 8;
}
// Now perform the actual widget draw
@@ -64,6 +65,7 @@ void Widget::draw()
if (_flags & WIDGET_BORDER) {
_x -= 4;
_y -= 4;
+ _w += 8;
}
_x -= _boss->_x;
_y -= _boss->_y;
@@ -74,7 +76,7 @@ void Widget::draw()
StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text)
- : Widget (boss, x, y, w, h), _label(0)
+ : Widget (boss, x, y, w, h), _label(0), _centred(false)
{
_type = kStaticTextWidget;
setLabel(text);
@@ -104,7 +106,7 @@ void StaticTextWidget::setLabel(const char *label)
void StaticTextWidget::drawWidget(bool hilite)
{
NewGui *gui = _boss->getGui();
- gui->drawString(_label, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor);
+ gui->drawString(_label, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor, _centred);
}
@@ -117,6 +119,8 @@ ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char
assert(label);
_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG ;
_type = kButtonWidget;
+
+ setCentred(true);
}
ButtonWidget::~ButtonWidget()
diff --git a/gui/widget.h b/gui/widget.h
index 8d2f49e164..4b72df1b42 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -112,11 +112,14 @@ protected:
class StaticTextWidget : public Widget {
protected:
char *_label;
+ bool _centred;
public:
StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text);
~StaticTextWidget();
void setLabel(const char *label);
const char *getLabel() const { return _label; }
+ void setCentred(bool centred) { _centred = centred; }
+ bool isCentred() const { return _centred; }
protected:
void drawWidget(bool hilite);