diff --git a/stella/src/debugger/gui/DebuggerDialog.cxx b/stella/src/debugger/gui/DebuggerDialog.cxx index e331a816f..5caaea2f0 100644 --- a/stella/src/debugger/gui/DebuggerDialog.cxx +++ b/stella/src/debugger/gui/DebuggerDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerDialog.cxx,v 1.19 2007-06-21 12:27:00 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.20 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -215,7 +215,7 @@ void DebuggerDialog::addStatusArea() font.getLineHeight(), ""); myMessageBox->setEditable(false); myMessageBox->clearFlags(WIDGET_RETAIN_FOCUS); - myMessageBox->setColor(kTextColorEm); + myMessageBox->setTextColor(kTextColorEm); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index ea6cd9999..7185a0ff7 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: FrameBuffer.hxx,v 1.87 2007-06-20 16:33:22 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.88 2007-08-06 20:16:51 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -74,6 +74,15 @@ enum { kTextColor, kTextColorHi, kTextColorEm, + kDlgColor, + kListColor, + kBtnColor, + kBtnColorHi, + kBtnFntColor, + kBtnFntColorHi, + kScrollColor, + kScrollColorHi, + kWidColor, kNumColors }; @@ -86,7 +95,7 @@ enum { All GUI elements (ala ScummVM) are drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.87 2007-06-20 16:33:22 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.88 2007-08-06 20:16:51 stephena Exp $ */ class FrameBuffer { diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index d36bdc5a0..88bb1e3e6 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.100 2007-07-27 13:49:16 stephena Exp $ +// $Id: OSystem.cxx,v 1.101 2007-08-06 20:16:51 stephena Exp $ //============================================================================ #include @@ -764,21 +764,64 @@ void OSystem::queryVideoHardware() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* - Palette is defined as follows: - kColor + kColor kBGColor kShadowColor kHiliteColor kTextColor kTextColorHi kTextColorEm + + + Palette is defined as follows: + kColor TODO + kBGColor TODO + kShadowColor Item is disabled + kHiliteColor Highlighted color in debugger data cells + kTextColor Normal text color + kTextColorHi Highlighted text color + kTextColorEm TODO + + kDlgColor Dialog background + kListColor File list background + + kBtnColor Normal button background + kBtnColorHi Highlighted button background + kBtnFntColor Normal button font color + kBtnFntColorHi Highlighted button font color + + kScrollColor Normal scrollbar color + kScrollColorHi Highlighted scrollbar color + + kWidColor Border for currently selected widget */ uInt32 OSystem::ourGUIColors[kNumUIPalettes][kNumColors-256] = { // Normal mode - { 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x00ff00, 0xc80000 }, + { 0x686868, // kColor + 0x000000, // kBGColor + 0x606060, // kShadowColor + 0xc8c8ff, // kHiliteColor + 0x000000, // kTextColor + 0x62a108, // kTextColorHi + 0xc80000, // kTextColorEm + 0xe69d10, // kDlgColor + 0xffffde, // kListColor + 0xac3410, // kBtnColor + 0xd55941, // kBtnColorHi + 0xffffff, // kBtnFntColor + 0xffd652, // kBtnFntColorHi + 0x000000, // kScrollColor + 0x000000, // kScrollColorHi + 0xc80000 // kWidColor + }, + +/* { 0x686868, 0xffe69c, 0x404040, 0xc8c8ff, 0x000000, 0x62a108, 0xc80000 }, */ + + // GP2X - { 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x0000ff, 0xc80000 } - // Others to be added ... + { 0x686868, 0x000000, 0x404040, 0xc8c8ff, 0x20a020, 0x0000ff, 0xc80000, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, + 0x000000, 0x000000 } }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/AboutDialog.cxx b/stella/src/gui/AboutDialog.cxx index aec541a47..76667c5ef 100644 --- a/stella/src/gui/AboutDialog.cxx +++ b/stella/src/gui/AboutDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: AboutDialog.cxx,v 1.19 2007-07-19 16:21:39 stephena Exp $ +// $Id: AboutDialog.cxx,v 1.20 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -54,7 +54,7 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent, myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(), "", kTextAlignCenter); - myTitle->setColor(kTextColorHi); + myTitle->setTextColor(kTextColorHi); for(int i = 0; i < LINES_PER_PAGE; i++) { @@ -232,7 +232,7 @@ void AboutDialog::displayInfo() } myDesc[i]->setAlign(align); - myDesc[i]->setColor(color); + myDesc[i]->setTextColor(color); myDesc[i]->setLabel(str); } diff --git a/stella/src/gui/CheckListWidget.cxx b/stella/src/gui/CheckListWidget.cxx index 1ceda79ae..ba9adb294 100644 --- a/stella/src/gui/CheckListWidget.cxx +++ b/stella/src/gui/CheckListWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: CheckListWidget.cxx,v 1.14 2007-07-31 15:46:21 stephena Exp $ +// $Id: CheckListWidget.cxx,v 1.15 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -61,13 +61,13 @@ void CheckListWidget::setStyle(CheckStyle style) { _checkList[i]->drawBox(true); _checkList[i]->setFill(false); - _checkList[i]->setColor(kTextColor); + _checkList[i]->setTextColor(kTextColor); } else if(style == kSolidFill) { _checkList[i]->drawBox(false); _checkList[i]->setFill(true); - _checkList[i]->setColor(kTextColorEm); + _checkList[i]->setTextColor(kTextColorEm); } } } diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index 2423977d2..383105b73 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Dialog.cxx,v 1.55 2007-01-24 21:36:38 stephena Exp $ +// $Id: Dialog.cxx,v 1.56 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -230,7 +230,7 @@ void Dialog::drawDialog() // cerr << "Dialog::drawDialog()\n"; FrameBuffer& fb = instance()->frameBuffer(); - fb.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor); + fb.fillRect(_x+1, _y+1, _w-2, _h-2, kDlgColor); fb.box(_x, _y, _w, _h, kColor, kShadowColor); // Make all child widget dirty diff --git a/stella/src/gui/EditTextWidget.cxx b/stella/src/gui/EditTextWidget.cxx index 5e752f14d..788757b3d 100644 --- a/stella/src/gui/EditTextWidget.cxx +++ b/stella/src/gui/EditTextWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EditTextWidget.cxx,v 1.17 2007-01-01 18:04:52 stephena Exp $ +// $Id: EditTextWidget.cxx,v 1.18 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -83,7 +83,7 @@ void EditTextWidget::drawWidget(bool hilite) // Draw the text adjustOffset(); fb.drawString(_font, _editString, _x + 2, _y + 2, getEditRect().width(), - _color, kTextAlignLeft, -_editScrollOffset, false); + _textcolor, kTextAlignLeft, -_editScrollOffset, false); // Draw the caret drawCaret(); diff --git a/stella/src/gui/EditableWidget.cxx b/stella/src/gui/EditableWidget.cxx index bce58213e..39b0625cf 100644 --- a/stella/src/gui/EditableWidget.cxx +++ b/stella/src/gui/EditableWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EditableWidget.cxx,v 1.21 2007-01-01 18:04:52 stephena Exp $ +// $Id: EditableWidget.cxx,v 1.22 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -36,6 +36,11 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font, _caretInverse = false; _editScrollOffset = 0; + + _bgcolor = kListColor; + _bgcolorhi = kListColor; + _textcolor = kTextColor; + _textcolorhi = kTextColor; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/EventMappingWidget.cxx b/stella/src/gui/EventMappingWidget.cxx index bc966c5d0..9dfbc4d97 100644 --- a/stella/src/gui/EventMappingWidget.cxx +++ b/stella/src/gui/EventMappingWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: EventMappingWidget.cxx,v 1.19 2007-01-01 18:04:52 stephena Exp $ +// $Id: EventMappingWidget.cxx,v 1.20 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -129,7 +129,7 @@ void EventMappingWidget::startRemapping() buf << "Select action for '" << instance()->eventHandler().actionAtIndex(myActionSelected, myEventMode) << "' event"; - myKeyMapping->setColor(kTextColorEm); + myKeyMapping->setTextColor(kTextColorEm); myKeyMapping->setLabel(buf.str()); // Make sure that this widget receives all raw data, before any @@ -183,7 +183,7 @@ void EventMappingWidget::drawKeyMapping() ostringstream buf; buf << "Action: " << instance()->eventHandler().keyAtIndex(myActionSelected, myEventMode); - myKeyMapping->setColor(kTextColor); + myKeyMapping->setTextColor(kTextColor); myKeyMapping->setLabel(buf.str()); } } diff --git a/stella/src/gui/InputTextDialog.cxx b/stella/src/gui/InputTextDialog.cxx index 2fe685891..f5d3fdf58 100644 --- a/stella/src/gui/InputTextDialog.cxx +++ b/stella/src/gui/InputTextDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: InputTextDialog.cxx,v 1.16 2007-01-01 18:04:53 stephena Exp $ +// $Id: InputTextDialog.cxx,v 1.17 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -80,7 +80,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, xpos = 10; myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - 2*xpos, fontHeight, "", kTextAlignCenter); - myTitle->setColor(kTextColorEm); + myTitle->setTextColor(kTextColorEm); ButtonWidget* b; #ifndef MAC_OSX diff --git a/stella/src/gui/ListWidget.cxx b/stella/src/gui/ListWidget.cxx index 5ec89c2e6..3a276a0ef 100644 --- a/stella/src/gui/ListWidget.cxx +++ b/stella/src/gui/ListWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: ListWidget.cxx,v 1.47 2007-01-01 18:04:53 stephena Exp $ +// $Id: ListWidget.cxx,v 1.48 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -46,6 +46,10 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _type = kListWidget; + _bgcolor = kListColor; + _bgcolorhi = kListColor; + _textcolor = kTextColor; + _textcolorhi = kTextColor; _cols = w / _fontWidth; _rows = h / _fontHeight; diff --git a/stella/src/gui/PopUpWidget.cxx b/stella/src/gui/PopUpWidget.cxx index e7a489dc0..d6575213b 100644 --- a/stella/src/gui/PopUpWidget.cxx +++ b/stella/src/gui/PopUpWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: PopUpWidget.cxx,v 1.33 2007-06-21 12:27:00 stephena Exp $ +// $Id: PopUpWidget.cxx,v 1.34 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -86,7 +86,7 @@ void PopUpDialog::drawDialog() // The last entry may be empty. Fill it with black. if(_twoColumns && (count & 1)) fb.fillRect(_x + 1 + _w / 2, _y + 1 + _popUpBoss->_fontHeight * (_entriesPerColumn - 1), - _w / 2 - 1, _popUpBoss->_fontHeight, kBGColor); + _w / 2 - 1, _popUpBoss->_fontHeight, _popUpBoss->_bgcolor); _dirty = false; fb.addDirtyRect(_x, _y, _w, _h); @@ -242,7 +242,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) } else fb.drawString(_popUpBoss->font(), name, x + 1, y + 2, w - 2, - hilite ? kBGColor : kTextColor); + hilite ? _popUpBoss->_textcolorhi : _popUpBoss->_textcolor); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -430,6 +430,10 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; _type = kPopUpWidget; + _bgcolor = kDlgColor; + _bgcolorhi = kListColor; + _textcolor = kTextColor; + _textcolorhi = kTextColor; _selectedItem = -1; @@ -553,7 +557,7 @@ void PopUpWidget::drawWidget(bool hilite) // Draw the label, if any if (_labelWidth > 0) fb.drawString(_font, _label, _x, _y + myTextY, _labelWidth, - isEnabled() ? kTextColor : kColor, kTextAlignRight); + isEnabled() ? _textcolor : kColor, kTextAlignRight); // Draw a thin frame around us. fb.hLine(x, _y, x + w - 1, kColor); @@ -561,6 +565,9 @@ void PopUpWidget::drawWidget(bool hilite) fb.vLine(x, _y, _y+_h-1, kColor); fb.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor); + // Fill the background + fb.fillRect(x + 1, _y + 1, w - 2, _h - 2, kListColor); + // Draw an arrow pointing down at the right end to signal this is a dropdown/popup fb.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY, !isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor); diff --git a/stella/src/gui/ProgressDialog.cxx b/stella/src/gui/ProgressDialog.cxx index 83ca2ac65..37115b01d 100644 --- a/stella/src/gui/ProgressDialog.cxx +++ b/stella/src/gui/ProgressDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: ProgressDialog.cxx,v 1.8 2007-01-01 18:04:54 stephena Exp $ +// $Id: ProgressDialog.cxx,v 1.9 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -53,7 +53,7 @@ ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font, xpos = fontWidth; ypos = lineHeight; myMessage = new StaticTextWidget(this, font, xpos, ypos, lwidth, fontHeight, message, kTextAlignCenter); - myMessage->setColor(kTextColorEm); + myMessage->setTextColor(kTextColorEm); xpos = fontWidth; ypos += 2 * lineHeight; mySlider = new SliderWidget(this, font, xpos, ypos, lwidth, lineHeight, "", 0, 0); diff --git a/stella/src/gui/TabWidget.cxx b/stella/src/gui/TabWidget.cxx index 8f7bae97a..15b5b18e0 100644 --- a/stella/src/gui/TabWidget.cxx +++ b/stella/src/gui/TabWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: TabWidget.cxx,v 1.27 2007-01-24 20:48:54 stephena Exp $ +// $Id: TabWidget.cxx,v 1.28 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -39,6 +39,10 @@ TabWidget::TabWidget(GuiObject* boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_CLEARBG; _type = kTabWidget; + _bgcolor = kDlgColor; + _bgcolorhi = kDlgColor; + _textcolor = kTextColor; + _textcolorhi = kTextColor; _tabHeight = font.getLineHeight() + 4; } diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index 2c38a98f1..50e1e1ce6 100644 --- a/stella/src/gui/Widget.cxx +++ b/stella/src/gui/Widget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Widget.cxx,v 1.50 2007-07-31 15:46:21 stephena Exp $ +// $Id: Widget.cxx,v 1.51 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -41,7 +41,10 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font, _id(-1), _flags(0), _hasFocus(false), - _color(kTextColor) + _bgcolor(kBGColor), + _bgcolorhi(kBGColor), + _textcolor(kTextColor), + _textcolorhi(kTextColorHi) { // Insert into the widget list of the boss _next = _boss->_firstWidget; @@ -81,7 +84,8 @@ void Widget::draw() // Clear background (unless alpha blending is enabled) if(_flags & WIDGET_CLEARBG) - fb.fillRect(_x, _y, _w, _h, kBGColor); + fb.fillRect(_x, _y, _w, _h, + (_flags & WIDGET_HILITED) ? _bgcolorhi : _bgcolor); // Draw border if(_flags & WIDGET_BORDER) { @@ -239,7 +243,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr, if(tmp->_hasFocus) { tmp->lostFocus(); - fb.frameRect(x, y, w, h, kBGColor); + fb.frameRect(x, y, w, h, kDlgColor); // FIXME - static issues tmp->setDirty(); tmp->draw(); fb.addDirtyRect(x, y, w, h); @@ -278,7 +282,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr, w = rect.width(), h = rect.height(); tmp->receivedFocus(); - fb.frameRect(x, y, w, h, kTextColorEm, kDashLine); + fb.frameRect(x, y, w, h, kWidColor, kDashLine); tmp->setDirty(); tmp->draw(); fb.addDirtyRect(x, y, w, h); @@ -300,11 +304,16 @@ void Widget::setDirtyInChain(Widget* start) StaticTextWidget::StaticTextWidget(GuiObject *boss, const GUI::Font& font, int x, int y, int w, int h, const string& text, TextAlignment align) - : Widget(boss, font, x, y, w, h), - _align(align) + : Widget(boss, font, x, y, w, h), + _align(align) { _flags = WIDGET_ENABLED | WIDGET_CLEARBG; _type = kStaticTextWidget; + _bgcolor = kDlgColor; + _bgcolorhi = kDlgColor; + _textcolor = kTextColor; + _textcolorhi = kTextColor; + _label = text; } @@ -330,7 +339,7 @@ void StaticTextWidget::drawWidget(bool hilite) { FrameBuffer& fb = _boss->instance()->frameBuffer(); fb.drawString(_font, _label, _x, _y, _w, - isEnabled() ? _color : kColor, _align); + isEnabled() ? _textcolor : kColor, _align); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -344,6 +353,10 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG; _type = kButtonWidget; + _bgcolor = kBtnColor; + _bgcolorhi = kBtnColorHi; + _textcolor = kBtnFntColor; + _textcolorhi = kBtnFntColorHi; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -392,7 +405,7 @@ void ButtonWidget::drawWidget(bool hilite) { FrameBuffer& fb = _boss->instance()->frameBuffer(); fb.drawString(_font, _label, _x, _y + (_h - _fontHeight)/2 + 1, _w, - !isEnabled() ? kColor : hilite ? kTextColorHi : _color, _align); + !isEnabled() ? kColor : hilite ? _textcolorhi : _textcolor, _align); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -417,7 +430,6 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font, _state(false), _editable(true), _holdFocus(true), - _fillRect(false), _drawBox(true), _fillColor(kColor), _boxY(0), @@ -425,6 +437,10 @@ CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font, { _flags = WIDGET_ENABLED; _type = kCheckboxWidget; + _bgcolor = kListColor; + _bgcolorhi = kBtnColorHi; + _textcolor = kBtnFntColor; + _textcolorhi = kBtnFntColorHi; if(label == "") _w = 14; @@ -479,22 +495,16 @@ void CheckboxWidget::drawWidget(bool hilite) if(_drawBox) fb.box(_x, _y + _boxY, 14, 14, kColor, kShadowColor); - // If checked, draw cross inside the box - if(_state) - { - if(_fillRect) - fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, - isEnabled() ? _color : kColor); - else - fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3, - isEnabled() ? _color : kColor); - } - else - fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, kBGColor); + // Do we draw a square or cross? + int checked = !isEnabled() ? kColor : _state ? _bgcolorhi : _bgcolor; + fb.fillRect(_x + 2, _y + _boxY + 2, 10, 10, checked); + + if(!_fillRect && isEnabled() && _state) // draw a cross + fb.drawBitmap(checked_img, _x + 3, _y + _boxY + 3, _textcolor); // Finally draw the label fb.drawString(_font, _label, _x + 20, _y + _textY, _w, - isEnabled() ? _color : kColor); + isEnabled() ? kTextColor : kColor); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -511,6 +521,10 @@ SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font, { _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; _type = kSliderWidget; + _bgcolor = kDlgColor; + _bgcolorhi = kDlgColor; + _textcolor = kBtnColor; + _textcolorhi = kBtnColorHi; if(!_label.empty() && _labelWidth == 0) _labelWidth = _font->getStringWidth(_label); @@ -625,7 +639,7 @@ void SliderWidget::drawWidget(bool hilite) // Draw the label, if any if(_labelWidth > 0) fb.drawString(_font, _label, _x, _y + 2, _labelWidth, - isEnabled() ? _color : kColor, kTextAlignRight); + isEnabled() ? kTextColor : kColor, kTextAlignRight); // Draw the box fb.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor); @@ -633,7 +647,7 @@ void SliderWidget::drawWidget(bool hilite) // Draw the 'bar' fb.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, !isEnabled() ? kColor : - hilite ? kTextColorHi : _color); + hilite ? _textcolorhi : _textcolor); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/Widget.hxx b/stella/src/gui/Widget.hxx index b6b1ecea9..05aa648be 100644 --- a/stella/src/gui/Widget.hxx +++ b/stella/src/gui/Widget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Widget.hxx,v 1.54 2007-06-20 16:33:23 stephena Exp $ +// $Id: Widget.hxx,v 1.55 2007-08-06 20:16:51 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -88,7 +88,7 @@ enum { This is the base class for all widgets. @author Stephen Anthony - @version $Id: Widget.hxx,v 1.54 2007-06-20 16:33:23 stephena Exp $ + @version $Id: Widget.hxx,v 1.55 2007-08-06 20:16:51 stephena Exp $ */ class Widget : public GuiObject { @@ -138,9 +138,13 @@ class Widget : public GuiObject void setID(int id) { _id = id; } int getID() { return _id; } - void setColor(int color) { _color = color; } virtual const GUI::Font* font() { return _font; } + void setTextColor(int color) { _textcolor = color; } + void setTextColorHi(int color) { _textcolorhi = color; } + void setBGColor(int color) { _bgcolor = color; } + void setBGColorHi(int color) { _bgcolorhi = color; } + virtual void loadConfig() {} protected: @@ -165,9 +169,12 @@ class Widget : public GuiObject int _id; int _flags; bool _hasFocus; - int _color; int _fontWidth; int _fontHeight; + int _bgcolor; + int _bgcolorhi; + int _textcolor; + int _textcolorhi; public: static Widget* findWidgetInChain(Widget* start, int x, int y);