Cleanup. We no longer need these widget size parameters.
svn-id: r22798
This commit is contained in:
parent
acb3ff742b
commit
8975ba8963
11 changed files with 15 additions and 33 deletions
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, WidgetSize ws)
|
EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text)
|
||||||
: EditableWidget(boss, x, y - 1, w, h + 2, ws) {
|
: EditableWidget(boss, x, y - 1, w, h + 2) {
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
|
||||||
_type = kEditTextWidget;
|
_type = kEditTextWidget;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
||||||
int _rightPadding;
|
int _rightPadding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, WidgetSize ws = kNormalWidgetSize);
|
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text);
|
||||||
EditTextWidget(GuiObject *boss, String name, const String &text);
|
EditTextWidget(GuiObject *boss, String name, const String &text);
|
||||||
|
|
||||||
void setEditString(const String &str);
|
void setEditString(const String &str);
|
||||||
|
|
|
@ -32,8 +32,6 @@ namespace GUI {
|
||||||
ListWidget::ListWidget(GuiObject *boss, String name)
|
ListWidget::ListWidget(GuiObject *boss, String name)
|
||||||
: EditableWidget(boss, name), CommandSender(boss) {
|
: EditableWidget(boss, name), CommandSender(boss) {
|
||||||
|
|
||||||
WidgetSize ws = g_gui.getWidgetSize();
|
|
||||||
|
|
||||||
_leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);
|
_leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);
|
||||||
_rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0);
|
_rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0);
|
||||||
_topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0);
|
_topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0);
|
||||||
|
@ -41,7 +39,7 @@ ListWidget::ListWidget(GuiObject *boss, String name)
|
||||||
_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
|
_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
|
||||||
_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
|
_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
|
||||||
|
|
||||||
if (ws == kBigWidgetSize) {
|
if (g_gui.getWidgetSize() == kBigWidgetSize) {
|
||||||
_scrollBarWidth = kBigScrollBarWidth;
|
_scrollBarWidth = kBigScrollBarWidth;
|
||||||
} else {
|
} else {
|
||||||
_scrollBarWidth = kNormalScrollBarWidth;
|
_scrollBarWidth = kNormalScrollBarWidth;
|
||||||
|
|
|
@ -47,7 +47,7 @@ protected:
|
||||||
int _rightPadding;
|
int _rightPadding;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws = kDefaultWidgetSize);
|
PopUpDialog(PopUpWidget *boss, int clickX, int clickY);
|
||||||
|
|
||||||
void drawDialog();
|
void drawDialog();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ protected:
|
||||||
void moveDown();
|
void moveDown();
|
||||||
};
|
};
|
||||||
|
|
||||||
PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws)
|
PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY)
|
||||||
: Dialog(0, 0, 16, 16, false),
|
: Dialog(0, 0, 16, 16, false),
|
||||||
_popUpBoss(boss) {
|
_popUpBoss(boss) {
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ PopUpWidget::PopUpWidget(GuiObject *boss, String name, const String &label, uint
|
||||||
void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||||
|
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
PopUpDialog popupDialog(this, x + getAbsX(), y + getAbsY(), _ws);
|
PopUpDialog popupDialog(this, x + getAbsX(), y + getAbsY());
|
||||||
int newSel = popupDialog.runModal();
|
int newSel = popupDialog.runModal();
|
||||||
if (newSel != -1 && _selectedItem != newSel) {
|
if (newSel != -1 && _selectedItem != newSel) {
|
||||||
_selectedItem = newSel;
|
_selectedItem = newSel;
|
||||||
|
@ -370,8 +370,6 @@ void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopUpWidget::handleScreenChanged() {
|
void PopUpWidget::handleScreenChanged() {
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
|
|
||||||
_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
|
_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
|
||||||
_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
|
_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
|
||||||
_labelSpacing = g_gui.evaluator()->getVar("PopUpWidget.labelSpacing", 0);
|
_labelSpacing = g_gui.evaluator()->getVar("PopUpWidget.labelSpacing", 0);
|
||||||
|
|
|
@ -49,7 +49,6 @@ class PopUpWidget : public Widget, public CommandSender {
|
||||||
};
|
};
|
||||||
typedef Common::Array<Entry> EntryList;
|
typedef Common::Array<Entry> EntryList;
|
||||||
protected:
|
protected:
|
||||||
WidgetSize _ws;
|
|
||||||
EntryList _entries;
|
EntryList _entries;
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
|
|
||||||
|
|
|
@ -36,14 +36,13 @@ enum {
|
||||||
kTabPadding = 3
|
kTabPadding = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws)
|
TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h)
|
||||||
: Widget(boss, x, y, w, h), _ws(ws) {
|
: Widget(boss, x, y, w, h) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
TabWidget::TabWidget(GuiObject *boss, String name)
|
TabWidget::TabWidget(GuiObject *boss, String name)
|
||||||
: Widget(boss, name) {
|
: Widget(boss, name) {
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ void TabWidget::init() {
|
||||||
|
|
||||||
_tabWidth = 40;
|
_tabWidth = 40;
|
||||||
|
|
||||||
if (_ws == kBigWidgetSize) {
|
if (g_gui.getWidgetSize() == kBigWidgetSize) {
|
||||||
_tabHeight = kBigTabHeight;
|
_tabHeight = kBigTabHeight;
|
||||||
} else {
|
} else {
|
||||||
_tabHeight = kTabHeight;
|
_tabHeight = kTabHeight;
|
||||||
|
@ -145,13 +144,12 @@ void TabWidget::handleScreenChanged() {
|
||||||
w = w->next();
|
w = w->next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Widget::handleScreenChanged();
|
if (g_gui.getWidgetSize() == kBigWidgetSize) {
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
if (_ws == kBigWidgetSize) {
|
|
||||||
_tabHeight = kBigTabHeight;
|
_tabHeight = kBigTabHeight;
|
||||||
} else {
|
} else {
|
||||||
_tabHeight = kTabHeight;
|
_tabHeight = kTabHeight;
|
||||||
}
|
}
|
||||||
|
Widget::handleScreenChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TabWidget::drawWidget(bool hilite) {
|
void TabWidget::drawWidget(bool hilite) {
|
||||||
|
|
|
@ -40,10 +40,9 @@ protected:
|
||||||
TabList _tabs;
|
TabList _tabs;
|
||||||
int _tabWidth;
|
int _tabWidth;
|
||||||
int _tabHeight;
|
int _tabHeight;
|
||||||
WidgetSize _ws;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kDefaultWidgetSize);
|
TabWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||||
TabWidget(GuiObject *boss, String name);
|
TabWidget(GuiObject *boss, String name);
|
||||||
~TabWidget();
|
~TabWidget();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws)
|
EditableWidget::EditableWidget(GuiObject *boss, int x, int y, int w, int h)
|
||||||
: Widget(boss, x, y, w, h) {
|
: Widget(boss, x, y, w, h) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ protected:
|
||||||
Theme::kFontStyle _font;
|
Theme::kFontStyle _font;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditableWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kNormalWidgetSize);
|
EditableWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||||
EditableWidget(GuiObject *boss, String name);
|
EditableWidget(GuiObject *boss, String name);
|
||||||
virtual ~EditableWidget();
|
virtual ~EditableWidget();
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,6 @@ bool Widget::isVisible() const {
|
||||||
|
|
||||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align)
|
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align)
|
||||||
: Widget(boss, x, y, w, h), _align(align) {
|
: Widget(boss, x, y, w, h), _align(align) {
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
_flags = WIDGET_ENABLED;
|
_flags = WIDGET_ENABLED;
|
||||||
_type = kStaticTextWidget;
|
_type = kStaticTextWidget;
|
||||||
_label = text;
|
_label = text;
|
||||||
|
@ -151,7 +150,6 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
|
||||||
|
|
||||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text)
|
StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text)
|
||||||
: Widget(boss, name) {
|
: Widget(boss, name) {
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
_flags = WIDGET_ENABLED;
|
_flags = WIDGET_ENABLED;
|
||||||
_type = kStaticTextWidget;
|
_type = kStaticTextWidget;
|
||||||
_label = text;
|
_label = text;
|
||||||
|
@ -190,11 +188,6 @@ void StaticTextWidget::drawWidget(bool hilite) {
|
||||||
g_gui.theme()->convertAligment(_align));
|
g_gui.theme()->convertAligment(_align));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaticTextWidget::handleScreenChanged() {
|
|
||||||
Widget::handleScreenChanged();
|
|
||||||
_ws = g_gui.getWidgetSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark -
|
#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, WidgetSize ws)
|
||||||
|
|
|
@ -169,7 +169,6 @@ protected:
|
||||||
|
|
||||||
String _label;
|
String _label;
|
||||||
TextAlignment _align;
|
TextAlignment _align;
|
||||||
WidgetSize _ws;
|
|
||||||
public:
|
public:
|
||||||
StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align);
|
StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align);
|
||||||
StaticTextWidget(GuiObject *boss, String name, const String &text);
|
StaticTextWidget(GuiObject *boss, String name, const String &text);
|
||||||
|
@ -179,8 +178,6 @@ public:
|
||||||
void setAlign(TextAlignment align);
|
void setAlign(TextAlignment align);
|
||||||
TextAlignment getAlign() const { return _align; }
|
TextAlignment getAlign() const { return _align; }
|
||||||
|
|
||||||
virtual void handleScreenChanged();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite);
|
void drawWidget(bool hilite);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue