From 09074b1685e4d2f7555c24b7b011eb3ea13c562b Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 31 May 2006 12:27:05 +0000 Subject: More cleanup. We shouldn't need these widget size parameters either. svn-id: r22799 --- gui/ListWidget.cpp | 4 +--- gui/dialog.cpp | 14 +++++++++----- gui/dialog.h | 2 +- gui/message.cpp | 9 +++------ gui/widget.cpp | 6 +++--- gui/widget.h | 4 ++-- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 413d821052..624a38f325 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -444,8 +444,6 @@ void ListWidget::abortEditMode() { void ListWidget::handleScreenChanged() { Widget::handleScreenChanged(); - 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); @@ -453,7 +451,7 @@ void ListWidget::handleScreenChanged() { _hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0); _hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0); - if (ws == kBigWidgetSize) { + if (g_gui.getWidgetSize() == kBigWidgetSize) { _scrollBarWidth = kBigScrollBarWidth; } else { _scrollBarWidth = kNormalScrollBarWidth; diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 0bccfb91ab..43baaf4b88 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -329,14 +329,18 @@ void Dialog::deleteWidget(Widget *del) { } } -ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) { - int w = kButtonWidth; - int h = kButtonHeight; - if (ws == kBigWidgetSize) { +ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey) { + int w, h; + + if (g_gui.getWidgetSize() == kBigWidgetSize) { w = kBigButtonWidth; h = kBigButtonHeight; + } else { + w = kButtonWidth; + h = kButtonHeight; } - return new ButtonWidget(boss, x, y, w, h, label, cmd, hotkey, ws); + + return new ButtonWidget(boss, x, y, w, h, label, cmd, hotkey); } uint32 GuiObject::getMillis() { diff --git a/gui/dialog.h b/gui/dialog.h index a2471ea59a..f14bc06015 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -84,7 +84,7 @@ protected: Widget *findWidget(const char *name); void deleteWidget(Widget *widget); - ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize); + ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey); void setResult(int result) { _result = result; } int getResult() const { return _result; } diff --git a/gui/message.cpp b/gui/message.cpp index 96d620bb07..2453c9506b 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -41,15 +41,12 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB const int screenW = g_system->getOverlayWidth(); const int screenH = g_system->getOverlayHeight(); - GUI::WidgetSize ws; int buttonWidth, buttonHeight; - if (screenW >= 400 && screenH >= 300) { - ws = GUI::kBigWidgetSize; + if (g_gui.getWidgetSize() == kBigWidgetSize) { buttonWidth = kBigButtonWidth; buttonHeight = kBigButtonHeight; } else { - ws = GUI::kNormalWidgetSize; buttonWidth = kButtonWidth; buttonHeight = kButtonHeight; } @@ -96,10 +93,10 @@ MessageDialog::MessageDialog(const Common::String &message, const char *defaultB } if (defaultButton) - addButton(this, okButtonPos, _h - buttonHeight - 8, defaultButton, kOkCmd, '\n', ws); // Confirm dialog + addButton(this, okButtonPos, _h - buttonHeight - 8, defaultButton, kOkCmd, '\n'); // Confirm dialog if (altButton) - addButton(this, cancelButtonPos, _h - buttonHeight - 8, altButton, kCancelCmd, '\27', ws); // Cancel dialog + addButton(this, cancelButtonPos, _h - buttonHeight - 8, altButton, kCancelCmd, '\27'); // Cancel dialog } void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { diff --git a/gui/widget.cpp b/gui/widget.cpp index 6a5dc57452..7a03be033e 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -190,7 +190,7 @@ void StaticTextWidget::drawWidget(bool hilite) { #pragma mark - -ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws) +ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey) : StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter), CommandSender(boss), _cmd(cmd), _hotkey(hotkey) { _flags = WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG; @@ -215,8 +215,8 @@ void ButtonWidget::drawWidget(bool hilite) { #pragma mark - -CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws) - : ButtonWidget(boss, x, y, w, h, label, cmd, hotkey, ws), _state(false) { +CheckboxWidget::CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey) + : ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) { _flags = WIDGET_ENABLED; _type = kCheckboxWidget; } diff --git a/gui/widget.h b/gui/widget.h index d638e6fa2e..0023bca9d5 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -189,7 +189,7 @@ protected: uint32 _cmd; uint8 _hotkey; public: - ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0, WidgetSize ws = kDefaultWidgetSize); + ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0); ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0); void setCmd(uint32 cmd) { _cmd = cmd; } @@ -208,7 +208,7 @@ class CheckboxWidget : public ButtonWidget { protected: bool _state; public: - CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0, WidgetSize ws = kDefaultWidgetSize); + CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0); CheckboxWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0); void handleMouseUp(int x, int y, int button, int clickCount); -- cgit v1.2.3