More work on customizable GUI.
o Implemented special alias 'prev' o Added new calling scheme to several widgets o Partially converted launcher dialog to new scheme o Converted couple widgets of chooser dialog svn-id: r21118
This commit is contained in:
parent
02bdcc45c9
commit
018c93b14a
16 changed files with 133 additions and 35 deletions
|
@ -31,6 +31,16 @@ namespace GUI {
|
|||
Widget::Widget(GuiObject *boss, int x, int y, int w, int h)
|
||||
: GuiObject(x, y, w, h), _type(0), _boss(boss),
|
||||
_id(0), _flags(0), _hints(THEME_HINT_FIRST_DRAW), _hasFocus(false) {
|
||||
init();
|
||||
}
|
||||
|
||||
Widget::Widget(GuiObject *boss, String name)
|
||||
: GuiObject(name), _type(0), _boss(boss),
|
||||
_id(0), _flags(0), _hints(THEME_HINT_FIRST_DRAW), _hasFocus(false) {
|
||||
init();
|
||||
}
|
||||
|
||||
void Widget::init() {
|
||||
// Insert into the widget list of the boss
|
||||
_next = _boss->_firstWidget;
|
||||
_boss->_firstWidget = this;
|
||||
|
@ -112,6 +122,13 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
|
|||
_label = text;
|
||||
}
|
||||
|
||||
StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text, TextAlignment align, WidgetSize ws)
|
||||
: Widget(boss, name), _align(align), _ws(ws) {
|
||||
_flags = WIDGET_ENABLED;
|
||||
_type = kStaticTextWidget;
|
||||
_label = text;
|
||||
}
|
||||
|
||||
void StaticTextWidget::setValue(int value) {
|
||||
char buf[256];
|
||||
sprintf(buf, "%d", value);
|
||||
|
@ -149,6 +166,13 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const St
|
|||
_type = kButtonWidget;
|
||||
}
|
||||
|
||||
ButtonWidget::ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws)
|
||||
: StaticTextWidget(boss, name, label, kTextAlignCenter, ws), CommandSender(boss),
|
||||
_cmd(cmd), _hotkey(hotkey) {
|
||||
_flags = WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG;
|
||||
_type = kButtonWidget;
|
||||
}
|
||||
|
||||
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
|
||||
if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
|
||||
sendCommand(_cmd, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue