diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/widget.cpp | 8 | ||||
-rw-r--r-- | gui/widget.h | 3 |
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); |