From 95ca2ea04349e79629e8a34c803331cbae5f9b95 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 27 Jul 2002 00:36:09 +0000 Subject: added support for right aligned text; made use of that in the sound dialog; less redrawing in the sound dialog svn-id: r4649 --- gui/widget.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'gui/widget.cpp') diff --git a/gui/widget.cpp b/gui/widget.cpp index c13ae7f4e1..79354de515 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -76,8 +76,8 @@ void Widget::draw() #pragma mark - -StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text, bool centred) - : Widget (boss, x, y, w, h), _label(0), _centred(centred) +StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text, int align) + : Widget (boss, x, y, w, h), _label(0), _align(align) { _type = kStaticTextWidget; setLabel(text); @@ -117,7 +117,7 @@ void StaticTextWidget::setValue(int value) void StaticTextWidget::drawWidget(bool hilite) { NewGui *gui = _boss->getGui(); - gui->drawString(_label, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor, _centred); + gui->drawString(_label, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor, _align); } @@ -125,13 +125,11 @@ void StaticTextWidget::drawWidget(bool hilite) ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd, uint8 hotkey) - : StaticTextWidget(boss, x, y, w, h, label), CommandSender(boss), _cmd(cmd), _hotkey(hotkey) + : StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter), CommandSender(boss), _cmd(cmd), _hotkey(hotkey) { assert(label); _flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG ; _type = kButtonWidget; - - setCentred(true); } ButtonWidget::~ButtonWidget() -- cgit v1.2.3