diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/dialog.cpp | 42 | ||||
-rw-r--r-- | gui/widget.cpp | 24 |
2 files changed, 32 insertions, 34 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 31ab646236..953f1802eb 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -26,10 +26,10 @@ void Dialog::draw() { Widget *w = _firstWidget; - + _gui->clearArea(_x, _y, _w, _h); _gui->box(_x, _y, _w, _h); - + while (w) { w->draw(); w = w->_next; @@ -60,7 +60,7 @@ void Dialog::handleMouseMoved(int x, int y, int button) * Determine the widget at location (x,y) if any. Assumes the coordinates are * in the local coordinate system, i.e. relative to the top left of the dialog. */ -Widget* Dialog::findWidget(int x, int y) +Widget *Dialog::findWidget(int x, int y) { Widget *w = _firstWidget; while (w) { @@ -108,30 +108,30 @@ void Dialog::addButton(int x, int y, int w, int h, char hotkey, int resID, uint3 #pragma mark - enum { - kSaveCmd = 'SAVE', - kLoadCmd = 'LOAD', - kPlayCmd = 'PLAY', - kOptionsCmd = 'OPTN', - kQuitCmd = 'QUIT' + kSaveCmd = 'SAVE', + kLoadCmd = 'LOAD', + kPlayCmd = 'PLAY', + kOptionsCmd = 'OPTN', + kQuitCmd = 'QUIT' }; -SaveLoadDialog::SaveLoadDialog(NewGui *gui) - : Dialog(gui, 30, 20, 260, 124) +SaveLoadDialog::SaveLoadDialog(NewGui * gui) +:Dialog(gui, 30, 20, 260, 124) { addResText(10, 7, 240, 16, 1); -// addResText(10, 7, 240, 16, 2); -// addResText(10, 7, 240, 16, 3); - - addButton(200, 20, 54, 16, 'S', 4, kSaveCmd); // Save - addButton(200, 40, 54, 16, 'L', 5, kLoadCmd); // Load - addButton(200, 60, 54, 16, 'P', 6, kPlayCmd); // Play - addButton(200, 80, 54, 16, 'O', 17, kOptionsCmd); // Options - addButton(200, 100, 54, 16, 'Q', 8, kQuitCmd); // Quit +// addResText(10, 7, 240, 16, 2); +// addResText(10, 7, 240, 16, 3); + + addButton(200, 20, 54, 16, 'S', 4, kSaveCmd); // Save + addButton(200, 40, 54, 16, 'L', 5, kLoadCmd); // Load + addButton(200, 60, 54, 16, 'P', 6, kPlayCmd); // Play + addButton(200, 80, 54, 16, 'O', 17, kOptionsCmd); // Options + addButton(200, 100, 54, 16, 'Q', 8, kQuitCmd); // Quit } void SaveLoadDialog::handleCommand(uint32 cmd) { - switch(cmd) { + switch (cmd) { case kSaveCmd: break; case kLoadCmd: @@ -151,8 +151,8 @@ void SaveLoadDialog::handleCommand(uint32 cmd) #pragma mark - -PauseDialog::PauseDialog(NewGui *gui) - : Dialog(gui, 50, 80, 220, 16) +PauseDialog::PauseDialog(NewGui * gui) +:Dialog(gui, 50, 80, 220, 16) { addResText(2, 2, 220, 16, 10); } diff --git a/gui/widget.cpp b/gui/widget.cpp index 35e0afc366..a423529005 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -24,8 +24,8 @@ #include "newgui.h" -Widget::Widget(Dialog *boss, int x, int y, int w, int h) - : _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0) +Widget::Widget(Dialog * boss, int x, int y, int w, int h) +:_boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0) { // Insert into the widget list of the boss _next = _boss->_firstWidget; @@ -40,26 +40,24 @@ void Widget::draw() // Account for our relative position in the dialog _x += _boss->_x; _y += _boss->_y; - + // Clear background if (_flags & WIDGET_CLEARBG) _boss->_gui->clearArea(_x, _y, _w, _h); - + // Draw border if (_flags & WIDGET_BORDER) { _boss->_gui->box(_x, _y, _w, _h); _x += 4; _y += 4; } - // Now perform the actual widget draw drawWidget(_flags & WIDGET_HILITED); - + if (_flags & WIDGET_BORDER) { _x -= 4; _y -= 4; } - // Restore x/y _x -= _boss->_x; _y -= _boss->_y; @@ -69,8 +67,8 @@ void Widget::draw() #pragma mark - -StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text) - : Widget(boss, x, y, w, h) +StaticTextWidget::StaticTextWidget(Dialog * boss, int x, int y, int w, int h, const char *text) +:Widget(boss, x, y, w, h) { // FIXME - maybe we should make a real copy of the string? _text = text; @@ -78,7 +76,7 @@ StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, con void StaticTextWidget::drawWidget(bool hilite) { - NewGui *gui = _boss->_gui; + NewGui *gui = _boss->_gui; gui->drawString(_text, _x, _y, _w, hilite ? gui->_textcolorhi : gui->_textcolor); } @@ -86,10 +84,10 @@ void StaticTextWidget::drawWidget(bool hilite) #pragma mark - -ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd) - : StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0) +ButtonWidget::ButtonWidget(Dialog * boss, int x, int y, int w, int h, const char *label, uint32 cmd) +:StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0) { - _flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */; + _flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */ ; } void ButtonWidget::handleClick(int button) |