From e34575753af29d8545b239fffbee84da36f633b7 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 27 Apr 2019 22:09:05 -0230 Subject: [PATCH] Some cleanups to Widget class. --- src/debugger/gui/DataGridOpsWidget.cxx | 14 +++---- src/debugger/gui/DataGridWidget.cxx | 6 +-- src/debugger/gui/DebuggerDialog.cxx | 6 +-- src/debugger/gui/PromptWidget.cxx | 4 +- src/debugger/gui/RamWidget.cxx | 4 +- src/debugger/gui/RomListWidget.cxx | 10 ++--- src/debugger/gui/TiaZoomWidget.cxx | 8 ++-- src/debugger/gui/ToggleWidget.cxx | 8 ++-- src/gui/AboutDialog.cxx | 10 ++--- src/gui/BrowserDialog.cxx | 12 +++--- src/gui/CheckListWidget.cxx | 8 ++-- src/gui/ColorWidget.cxx | 2 +- src/gui/DeveloperDialog.cxx | 8 ++-- src/gui/Dialog.cxx | 20 +++++----- src/gui/EditTextWidget.cxx | 6 +-- src/gui/EditableWidget.cxx | 4 +- src/gui/EditableWidget.hxx | 6 +-- src/gui/EventMappingWidget.cxx | 8 ++-- src/gui/HelpDialog.cxx | 10 ++--- src/gui/InputDialog.cxx | 4 +- src/gui/JoystickDialog.cxx | 2 +- src/gui/LauncherDialog.cxx | 2 +- src/gui/ListWidget.cxx | 2 +- src/gui/OptionsDialog.cxx | 14 +++---- src/gui/PopUpWidget.cxx | 6 +-- src/gui/RadioButtonWidget.cxx | 2 +- src/gui/RomInfoWidget.cxx | 2 +- src/gui/ScrollBarWidget.cxx | 6 +-- src/gui/StringListWidget.cxx | 4 +- src/gui/TabWidget.cxx | 6 +-- src/gui/TimeLineWidget.cxx | 2 +- src/gui/TimeMachineDialog.cxx | 4 +- src/gui/UIDialog.cxx | 2 +- src/gui/VideoDialog.cxx | 4 +- src/gui/Widget.cxx | 32 ++++++++-------- src/gui/Widget.hxx | 51 +++++++++++++------------- 36 files changed, 150 insertions(+), 149 deletions(-) diff --git a/src/debugger/gui/DataGridOpsWidget.cxx b/src/debugger/gui/DataGridOpsWidget.cxx index 21da254a4..e9fd01889 100644 --- a/src/debugger/gui/DataGridOpsWidget.cxx +++ b/src/debugger/gui/DataGridOpsWidget.cxx @@ -72,13 +72,13 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font, // We don't enable the buttons until the DataGridWidget is attached // Don't call setEnabled(false), since that does an immediate redraw - _zeroButton->clearFlags(WIDGET_ENABLED); - _invButton->clearFlags(WIDGET_ENABLED); - _negButton->clearFlags(WIDGET_ENABLED); - _incButton->clearFlags(WIDGET_ENABLED); - _decButton->clearFlags(WIDGET_ENABLED); - _shiftLeftButton->clearFlags(WIDGET_ENABLED); - _shiftRightButton->clearFlags(WIDGET_ENABLED); + _zeroButton->clearFlags(Widget::FLAG_ENABLED); + _invButton->clearFlags(Widget::FLAG_ENABLED); + _negButton->clearFlags(Widget::FLAG_ENABLED); + _incButton->clearFlags(Widget::FLAG_ENABLED); + _decButton->clearFlags(Widget::FLAG_ENABLED); + _shiftLeftButton->clearFlags(Widget::FLAG_ENABLED); + _shiftRightButton->clearFlags(Widget::FLAG_ENABLED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index da5e68d9d..fbb763baa 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -50,7 +50,7 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font, _opsWidget(nullptr), _scrollBar(nullptr) { - _flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS | WIDGET_WANTS_RAWDATA; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_WANTS_RAWDATA; _editMode = false; // The item is selected, thus _bgcolor is used to draw the caret and @@ -252,14 +252,14 @@ void DataGridWidget::setRange(int lower, int upper) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DataGridWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DataGridWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 4c58508b6..d3ab25ae1 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -504,7 +504,7 @@ void DebuggerDialog::addStatusArea() xpos, ypos, myTiaZoom->getWidth(), myLFont->getLineHeight(), ""); myMessageBox->setEditable(false, false); - myMessageBox->clearFlags(WIDGET_RETAIN_FOCUS); + myMessageBox->clearFlags(Widget::FLAG_RETAIN_FOCUS); myMessageBox->setTextColor(kTextColorEm); } @@ -577,7 +577,7 @@ void DebuggerDialog::addRomArea() myRewindButton = new ButtonWidget(this, *myLFont, buttonX, buttonY, bwidth, bheight, LEFT_ARROW, 7, 11, kDDRewindCmd); - myRewindButton->clearFlags(WIDGET_ENABLED); + myRewindButton->clearFlags(Widget::FLAG_ENABLED); buttonY += bheight + 4; bheight = (myLFont->getLineHeight() + 2) * 2 + 4 * 1; @@ -585,7 +585,7 @@ void DebuggerDialog::addRomArea() myUnwindButton = new ButtonWidget(this, *myLFont, buttonX, buttonY, bwidth, bheight, RIGHT_ARROW, 7, 11, kDDUnwindCmd); - myUnwindButton->clearFlags(WIDGET_ENABLED); + myUnwindButton->clearFlags(Widget::FLAG_ENABLED); int xpos = buttonX - 8*myLFont->getMaxCharWidth() - 20, ypos = 30; diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index c49732c8d..a9740ca44 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -41,8 +41,8 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font, _firstTime(true), _exitedEarly(false) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | - WIDGET_WANTS_TAB | WIDGET_WANTS_RAWDATA; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS | + Widget::FLAG_WANTS_TAB | Widget::FLAG_WANTS_RAWDATA; _textcolor = kTextColor; _bgcolor = kWidColor; _bgcolorlo = kDlgColor; diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index ad4d78b43..6bbfcbced 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -158,8 +158,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n myInputBox->setTarget(this); // Start with these buttons disabled - myCompareButton->clearFlags(WIDGET_ENABLED); - myRestartButton->clearFlags(WIDGET_ENABLED); + myCompareButton->clearFlags(Widget::FLAG_ENABLED); + myRestartButton->clearFlags(Widget::FLAG_ENABLED); // Calculate final height if(_h == 0) _h = ypos + myLineHeight - y; diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 9e16eca4a..91123f8e5 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -43,7 +43,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, myDisasm(nullptr), myBPState(nullptr) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kWidColor; _bgcolorhi = kWidColor; _textcolor = kTextColor; @@ -130,12 +130,12 @@ void RomListWidget::setList(const CartDebug::Disassembly& disasm, // Enable all checkboxes for(int i = 0; i < _rows; ++i) - myCheckList[i]->setFlags(WIDGET_ENABLED); + myCheckList[i]->setFlags(Widget::FLAG_ENABLED); // Then turn off any extras if(int(myDisasm->list.size()) < _rows) for(int i = int(myDisasm->list.size()); i < _rows; ++i) - myCheckList[i]->clearFlags(WIDGET_ENABLED); + myCheckList[i]->clearFlags(Widget::FLAG_ENABLED); recalc(); } @@ -290,14 +290,14 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomListWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomListWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx index f78232da3..0c4fb7256 100644 --- a/src/debugger/gui/TiaZoomWidget.cxx +++ b/src/debugger/gui/TiaZoomWidget.cxx @@ -32,8 +32,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font, : Widget(boss, font, x, y, 16, 16), CommandSender(boss) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | - WIDGET_RETAIN_FOCUS | WIDGET_TRACK_MOUSE; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | + Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_TRACK_MOUSE; _bgcolor = _bgcolorhi = kDlgColor; // Use all available space, up to the maximum bounds of the TIA image @@ -167,14 +167,14 @@ void TiaZoomWidget::handleMouseMoved(int x, int y) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaZoomWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaZoomWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); myMouseMoving = false; } diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index 9df615c82..93847709f 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -36,21 +36,21 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font, _clicksToChange(clicksToChange), _editable(true) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | - WIDGET_WANTS_RAWDATA; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS | + Widget::FLAG_WANTS_RAWDATA; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ToggleWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ToggleWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx index c3a4857e2..8ddf1038c 100644 --- a/src/gui/AboutDialog.cxx +++ b/src/gui/AboutDialog.cxx @@ -47,7 +47,7 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent, myPrevButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, "Previous", GuiObject::kPrevCmd); - myPrevButton->clearFlags(WIDGET_ENABLED); + myPrevButton->clearFlags(Widget::FLAG_ENABLED); wid.push_back(myPrevButton); xpos += buttonWidth + 8; @@ -237,9 +237,9 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id case GuiObject::kNextCmd: myPage++; if(myPage >= myNumPages) - myNextButton->clearFlags(WIDGET_ENABLED); + myNextButton->clearFlags(Widget::FLAG_ENABLED); if(myPage >= 2) - myPrevButton->setFlags(WIDGET_ENABLED); + myPrevButton->setFlags(Widget::FLAG_ENABLED); displayInfo(); break; @@ -247,9 +247,9 @@ void AboutDialog::handleCommand(CommandSender* sender, int cmd, int data, int id case GuiObject::kPrevCmd: myPage--; if(myPage <= myNumPages) - myNextButton->setFlags(WIDGET_ENABLED); + myNextButton->setFlags(Widget::FLAG_ENABLED); if(myPage <= 1) - myPrevButton->clearFlags(WIDGET_ENABLED); + myPrevButton->clearFlags(Widget::FLAG_ENABLED); displayInfo(); break; diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index ea11a43f0..701a4a5c8 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -117,23 +117,23 @@ void BrowserDialog::show(const string& startpath, _fileList->setFileListMode(FilesystemNode::ListMode::All); _fileList->setFileExtension(ext); _selected->setEditable(false); - _selected->clearFlags(WIDGET_INVISIBLE); - _type->clearFlags(WIDGET_INVISIBLE); + _selected->clearFlags(Widget::FLAG_INVISIBLE); + _type->clearFlags(Widget::FLAG_INVISIBLE); break; case FileSave: _fileList->setFileListMode(FilesystemNode::ListMode::All); _fileList->setFileExtension(ext); _selected->setEditable(false); // FIXME - disable user input for now - _selected->clearFlags(WIDGET_INVISIBLE); - _type->clearFlags(WIDGET_INVISIBLE); + _selected->clearFlags(Widget::FLAG_INVISIBLE); + _type->clearFlags(Widget::FLAG_INVISIBLE); break; case Directories: _fileList->setFileListMode(FilesystemNode::ListMode::DirectoriesOnly); _selected->setEditable(false); - _selected->setFlags(WIDGET_INVISIBLE); - _type->setFlags(WIDGET_INVISIBLE); + _selected->setFlags(Widget::FLAG_INVISIBLE); + _type->setFlags(Widget::FLAG_INVISIBLE); break; } diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 83d96059d..56ceec54b 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -49,14 +49,14 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckListWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckListWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } @@ -70,12 +70,12 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state) // Enable all checkboxes for(int i = 0; i < _rows; ++i) - _checkList[i]->setFlags(WIDGET_ENABLED); + _checkList[i]->setFlags(Widget::FLAG_ENABLED); // Then turn off any extras if(int(_stateList.size()) < _rows) for(int i = int(_stateList.size()); i < _rows; ++i) - _checkList[i]->clearFlags(WIDGET_ENABLED); + _checkList[i]->clearFlags(Widget::FLAG_ENABLED); ListWidget::recalc(); } diff --git a/src/gui/ColorWidget.cxx b/src/gui/ColorWidget.cxx index e70ca0022..86ee01260 100644 --- a/src/gui/ColorWidget.cxx +++ b/src/gui/ColorWidget.cxx @@ -32,7 +32,7 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font, _cmd(cmd), _crossGrid(false) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 7c6ab5efd..eaa0663be 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -559,8 +559,8 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) #endif if(!debuggerAvailable) { - myDebuggerWidthSlider->clearFlags(WIDGET_ENABLED); - myDebuggerHeightSlider->clearFlags(WIDGET_ENABLED); + myDebuggerWidthSlider->clearFlags(Widget::FLAG_ENABLED); + myDebuggerHeightSlider->clearFlags(Widget::FLAG_ENABLED); } #else new StaticTextWidget(myTab, font, 0, 20, _w - 20, font.getFontHeight(), @@ -1331,8 +1331,8 @@ void DeveloperDialog::handleDebugColours(int idx, int color) if(!instance().hasConsole()) { - myDbgColour[idx]->clearFlags(WIDGET_ENABLED); - myDbgColourSwatch[idx]->clearFlags(WIDGET_ENABLED); + myDbgColour[idx]->clearFlags(Widget::FLAG_ENABLED); + myDbgColourSwatch[idx]->clearFlags(Widget::FLAG_ENABLED); return; } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index c94572e25..2feaa68b8 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -62,7 +62,7 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font _th(0), _surface(nullptr), _tabID(0), - _flags(WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG), + _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG), _max_w(0), _max_h(0) { @@ -198,7 +198,7 @@ void Dialog::addFocusWidget(Widget* w) return; // All focusable widgets should retain focus - w->setFlags(WIDGET_RETAIN_FOCUS); + w->setFlags(Widget::FLAG_RETAIN_FOCUS); _myFocus.widget = w; _myFocus.list.push_back(w); @@ -209,7 +209,7 @@ void Dialog::addToFocusList(WidgetArray& list) { // All focusable widgets should retain focus for(const auto& w: list) - w->setFlags(WIDGET_RETAIN_FOCUS); + w->setFlags(Widget::FLAG_RETAIN_FOCUS); Vec::append(_myFocus.list, list); _focusList = _myFocus.list; @@ -222,14 +222,14 @@ void Dialog::addToFocusList(WidgetArray& list) void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId) { // Only add the list if the tab actually exists - if(!w || w->getID() < 0 || uInt32(w->getID()) >= _myTabList.size()) + if(!w || w->getID() >= _myTabList.size()) return; assert(w == _myTabList[w->getID()].widget); // All focusable widgets should retain focus for(const auto& fw: list) - fw->setFlags(WIDGET_RETAIN_FOCUS); + fw->setFlags(Widget::FLAG_RETAIN_FOCUS); // First get the appropriate focus list FocusList& focus = _myTabList[w->getID()].focus; @@ -254,7 +254,7 @@ void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::addTabWidget(TabWidget* w) { - if(!w || w->getID() < 0) + if(!w) return; // Make sure the array is large enough @@ -341,7 +341,7 @@ void Dialog::drawDialog() || (parent().myDialogStack.get(parent().myDialogStack.size() - 2) == this && !parent().myDialogStack.top()->hasTitle()); - if(_flags & WIDGET_CLEARBG) + if(_flags & Widget::FLAG_CLEARBG) { // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; s.fillRect(_x, _y + _th, _w, _h - _th, _onTop ? kDlgColor : kBGColorLo); @@ -354,7 +354,7 @@ void Dialog::drawDialog() } else s.invalidate(); - if(_flags & WIDGET_BORDER) // currently only used by Dialog itself + if(_flags & Widget::FLAG_BORDER) // currently only used by Dialog itself s.frameRect(_x, _y, _w, _h, _onTop ? kColor : kShadowColor); // Make all child widget dirty @@ -459,7 +459,7 @@ void Dialog::handleMouseUp(int x, int y, MouseButton b, int clickCount) if(_focusedWidget) { // Lose focus on mouseup unless the widget requested to retain the focus - if(! (_focusedWidget->getFlags() & WIDGET_RETAIN_FOCUS )) + if(! (_focusedWidget->getFlags() & Widget::FLAG_RETAIN_FOCUS )) releaseFocus(); } @@ -531,7 +531,7 @@ void Dialog::handleMouseMoved(int x, int y) _mouseWidget = w; } - if (w && (w->getFlags() & WIDGET_TRACK_MOUSE)) + if (w && (w->getFlags() & Widget::FLAG_TRACK_MOUSE)) w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y)); } diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index f7d8eb801..85e1778ba 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -27,7 +27,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font, : EditableWidget(boss, font, x, y, w, h + 2, text), _changed(false) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; startEditMode(); // We're always in edit mode } @@ -43,14 +43,14 @@ void EditTextWidget::setText(const string& str, bool changed) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditTextWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditTextWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index f214173e5..689b6c546 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -70,12 +70,12 @@ void EditableWidget::setEditable(bool editable, bool hiliteBG) _editable = editable; if(_editable) { - setFlags(WIDGET_WANTS_RAWDATA | WIDGET_RETAIN_FOCUS); + setFlags(Widget::FLAG_WANTS_RAWDATA | Widget::FLAG_RETAIN_FOCUS); _bgcolor = kWidColor; } else { - clearFlags(WIDGET_WANTS_RAWDATA | WIDGET_RETAIN_FOCUS); + clearFlags(Widget::FLAG_WANTS_RAWDATA | Widget::FLAG_RETAIN_FOCUS); _bgcolor = hiliteBG ? kBGColorHi : kWidColor; } } diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index d6a5dab6e..66fb75174 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -64,9 +64,9 @@ class EditableWidget : public Widget, public CommandSender void setTextFilter(const TextFilter& filter) { _filter = filter; } protected: - virtual void startEditMode() { setFlags(WIDGET_WANTS_RAWDATA); } - virtual void endEditMode() { clearFlags(WIDGET_WANTS_RAWDATA); } - virtual void abortEditMode() { clearFlags(WIDGET_WANTS_RAWDATA); } + virtual void startEditMode() { setFlags(Widget::FLAG_WANTS_RAWDATA); } + virtual void endEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); } + virtual void abortEditMode() { clearFlags(Widget::FLAG_WANTS_RAWDATA); } virtual GUI::Rect getEditRect() const = 0; virtual int getCaretOffset() const; diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index 4437213d5..21edc2d6a 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -78,7 +78,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, buttonWidth, buttonHeight, "Cancel", kStopMapCmd); myCancelMapButton->setTarget(this); - myCancelMapButton->clearFlags(WIDGET_ENABLED); + myCancelMapButton->clearFlags(Widget::FLAG_ENABLED); addFocusWidget(myCancelMapButton); ypos += lineHeight + 20; @@ -119,7 +119,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, myKeyMapping = new EditTextWidget(boss, font, xpos + t->getWidth() + 8, ypos, _w - xpos - t->getWidth() - 8 - HBORDER, lineHeight, ""); myKeyMapping->setEditable(false, true); - myKeyMapping->clearFlags(WIDGET_RETAIN_FOCUS); + myKeyMapping->clearFlags(Widget::FLAG_RETAIN_FOCUS); // Add information for hardcoded keys ypos += lineHeight + 8; @@ -178,7 +178,7 @@ void EventMappingWidget::startRemapping() // Make sure that this widget receives all raw data, before any // pre-processing occurs - myActionsList->setFlags(WIDGET_WANTS_RAWDATA); + myActionsList->setFlags(Widget::FLAG_WANTS_RAWDATA); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -223,7 +223,7 @@ void EventMappingWidget::stopRemapping() drawKeyMapping(); // Widget is now free to process events normally - myActionsList->clearFlags(WIDGET_WANTS_RAWDATA); + myActionsList->clearFlags(Widget::FLAG_WANTS_RAWDATA); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index 21706b2fa..6ae094eab 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -45,7 +45,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent, myPrevButton = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, "Previous", GuiObject::kPrevCmd); - myPrevButton->clearFlags(WIDGET_ENABLED); + myPrevButton->clearFlags(Widget::FLAG_ENABLED); wid.push_back(myPrevButton); xpos += buttonWidth + 8; @@ -195,9 +195,9 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd, case GuiObject::kNextCmd: ++myPage; if(myPage >= myNumPages) - myNextButton->clearFlags(WIDGET_ENABLED); + myNextButton->clearFlags(Widget::FLAG_ENABLED); if(myPage >= 2) - myPrevButton->setFlags(WIDGET_ENABLED); + myPrevButton->setFlags(Widget::FLAG_ENABLED); displayInfo(); break; @@ -205,9 +205,9 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd, case GuiObject::kPrevCmd: --myPage; if(myPage <= myNumPages) - myNextButton->setFlags(WIDGET_ENABLED); + myNextButton->setFlags(Widget::FLAG_ENABLED); if(myPage <= 1) - myPrevButton->clearFlags(WIDGET_ENABLED); + myPrevButton->clearFlags(Widget::FLAG_ENABLED); displayInfo(); break; diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 773a512f3..9e4f8a9f7 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -136,7 +136,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) "Mouse cursor visibility ", lwidth); wid.push_back(myCursorState); #ifndef WINDOWED_SUPPORT - myCursorState->clearFlags(WIDGET_ENABLED); + myCursorState->clearFlags(Widget::FLAG_ENABLED); #endif lwidth = font.getStringWidth("Digital paddle sensitivity "); @@ -196,7 +196,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) "Grab mouse in emulation mode"); wid.push_back(myGrabMouse); #ifndef WINDOWED_SUPPORT - myGrabMouse->clearFlags(WIDGET_ENABLED); + myGrabMouse->clearFlags(Widget::FLAG_ENABLED); #endif // Enable/disable control key-combos diff --git a/src/gui/JoystickDialog.cxx b/src/gui/JoystickDialog.cxx index 8f15f4aeb..a0412f9f9 100644 --- a/src/gui/JoystickDialog.cxx +++ b/src/gui/JoystickDialog.cxx @@ -61,7 +61,7 @@ JoystickDialog::JoystickDialog(GuiObject* boss, const GUI::Font& font, xpos -= buttonWidth + 8; myRemoveBtn = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, "Remove", kRemoveCmd); - myRemoveBtn->clearFlags(WIDGET_ENABLED); + myRemoveBtn->clearFlags(Widget::FLAG_ENABLED); // Now we can finally add the widgets to the focus list wid.push_back(myRemoveBtn); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index b55cbe820..6d7aaabbd 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -164,7 +164,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, xpos += lwidth; myDir = new EditTextWidget(this, font, xpos, ypos, _w - xpos - HBORDER, lineHeight, ""); myDir->setEditable(false, true); - myDir->clearFlags(WIDGET_RETAIN_FOCUS); + myDir->clearFlags(Widget::FLAG_RETAIN_FOCUS); if(!myUseMinimalUI) { diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index f6fb6cd26..f0515c6ce 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -41,7 +41,7 @@ ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, _quickSelect(quickSelect), _quickSelectTime(0) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kWidColor; _bgcolorhi = kWidColor; _textcolor = kTextColor; diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index 51cca2713..55375bb10 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -87,7 +87,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, b = ADD_OD_BUTTON("Audio" + ELLIPSIS, kAudCmd); #ifndef SOUND_SUPPORT - b->clearFlags(WIDGET_ENABLED); + b->clearFlags(Widget::FLAG_ENABLED); #endif wid.push_back(b); @@ -112,7 +112,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, myCheatCodeButton = ADD_OD_BUTTON("Cheat Codes" + ELLIPSIS, kCheatCmd); #ifndef CHEATCODE_SUPPORT - myCheatCodeButton->clearFlags(WIDGET_ENABLED); + myCheatCodeButton->clearFlags(Widget::FLAG_ENABLED); #endif wid.push_back(myCheatCodeButton); @@ -154,11 +154,11 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, // Certain buttons are disabled depending on mode if(myMode == Menu::AppMode::launcher) { - myCheatCodeButton->clearFlags(WIDGET_ENABLED); + myCheatCodeButton->clearFlags(Widget::FLAG_ENABLED); } else { - myRomAuditButton->clearFlags(WIDGET_ENABLED); + myRomAuditButton->clearFlags(Widget::FLAG_ENABLED); } } @@ -176,13 +176,13 @@ void OptionsDialog::loadConfig() switch(instance().eventHandler().state()) { case EventHandlerState::EMULATION: - myGameInfoButton->setFlags(WIDGET_ENABLED); + myGameInfoButton->setFlags(Widget::FLAG_ENABLED); break; case EventHandlerState::LAUNCHER: if(instance().launcher().selectedRomMD5() != "") - myGameInfoButton->setFlags(WIDGET_ENABLED); + myGameInfoButton->setFlags(Widget::FLAG_ENABLED); else - myGameInfoButton->clearFlags(WIDGET_ENABLED); + myGameInfoButton->clearFlags(Widget::FLAG_ENABLED); break; default: break; diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index 8368cba4a..e24d80cf7 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -45,7 +45,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, _labelWidth(labelWidth), _changed(false) { - _flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kDlgColor; _bgcolorhi = kDlgColor; // do not highlight the background _textcolor = kTextColor; @@ -143,14 +143,14 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PopUpWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PopUpWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 3a94d80ab..c7ae84106 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -91,7 +91,7 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, : CheckboxWidget(boss, font, x, y, label, cmd), myGroup(group) { - _flags = WIDGET_ENABLED; + _flags = Widget::FLAG_ENABLED; _bgcolor = _bgcolorhi = kWidColor; _editable = true; diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 84c5791c2..0248b9b2a 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -39,7 +39,7 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font, GUI::Size(TIAConstants::viewableWidth*2, TIAConstants::viewableHeight*2) : GUI::Size(TIAConstants::viewableWidth, TIAConstants::viewableHeight)) { - _flags = WIDGET_ENABLED; + _flags = Widget::FLAG_ENABLED; _bgcolor = kDlgColor; _bgcolorlo = kBGColorLo; } diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx index b2e032b74..de0298325 100644 --- a/src/gui/ScrollBarWidget.cxx +++ b/src/gui/ScrollBarWidget.cxx @@ -68,7 +68,7 @@ ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font, _sliderPos(0), _sliderDeltaMouseDownPos(0) { - _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG; _bgcolor = kWidColor; _bgcolorhi = kWidColor; } @@ -208,7 +208,7 @@ void ScrollBarWidget::checkBounds(int old_pos) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ScrollBarWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } @@ -216,7 +216,7 @@ void ScrollBarWidget::handleMouseEntered() void ScrollBarWidget::handleMouseLeft() { _part = kNoPart; - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index 4de437571..8ce4394b1 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -43,14 +43,14 @@ void StringListWidget::setList(const StringList& list) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void StringListWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void StringListWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 108678ac4..999ca8013 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -35,7 +35,7 @@ TabWidget::TabWidget(GuiObject* boss, const GUI::Font& font, { _id = 0; // For dialogs with multiple tab widgets, they should specifically // call ::setID to differentiate among them - _flags = WIDGET_ENABLED | WIDGET_CLEARBG; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG; _bgcolor = kDlgColor; _bgcolorhi = kDlgColor; _textcolor = kTextColor; @@ -219,14 +219,14 @@ void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); setDirty(); } diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index cd69175ae..923ec7ddf 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -39,7 +39,7 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font, _isDragging(false), _labelWidth(labelWidth) { - _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE; _bgcolor = kDlgColor; _bgcolorhi = kDlgColor; diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index 56d0a7f08..b31870791 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -177,8 +177,8 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, _w = width; // Parent determines our width (based on window size) _h = V_BORDER * 2 + rowHeight + buttonHeight + 2; - this->clearFlags(WIDGET_CLEARBG); // does only work combined with blending (0..100)! - this->clearFlags(WIDGET_BORDER); + this->clearFlags(Widget::FLAG_CLEARBG); // does only work combined with blending (0..100)! + this->clearFlags(Widget::FLAG_BORDER); xpos = H_BORDER; ypos = V_BORDER; diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 7fca1d21e..2d80617b5 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -207,7 +207,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, // All ROM settings are disabled while in game mode if(!myIsGlobal) { - romButton->clearFlags(WIDGET_ENABLED); + romButton->clearFlags(Widget::FLAG_ENABLED); myRomPath->setEditable(false); } diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index d1917b667..5598e55d0 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -321,8 +321,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, // Disable certain functions when we know they aren't present #ifndef WINDOWED_SUPPORT - myFullscreen->clearFlags(WIDGET_ENABLED); - myCenter->clearFlags(WIDGET_ENABLED); + myFullscreen->clearFlags(Widget::FLAG_ENABLED); + myCenter->clearFlags(Widget::FLAG_ENABLED); #endif } diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 6889e456b..89c46189b 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -81,7 +81,7 @@ void Widget::draw() bool onTop = _boss->dialog().isOnTop(); - bool hasBorder = _flags & WIDGET_BORDER; // currently only used by Dialog widget + bool hasBorder = _flags & Widget::FLAG_BORDER; // currently only used by Dialog widget int oldX = _x, oldY = _y; // Account for our relative position in the dialog @@ -89,20 +89,20 @@ void Widget::draw() _y = getAbsY(); // Clear background (unless alpha blending is enabled) - if(_flags & WIDGET_CLEARBG) + if(_flags & Widget::FLAG_CLEARBG) { int x = _x, y = _y, w = _w, h = _h; if(hasBorder) { x++; y++; w-=2; h-=2; } - s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & WIDGET_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor); + s.fillRect(x, y, w, h, !onTop ? _bgcolorlo : (_flags & Widget::FLAG_HILITED) && isEnabled() ? _bgcolorhi : _bgcolor); } // Draw border if(hasBorder) { - s.frameRect(_x, _y, _w, _h, !onTop ? kColor : (_flags & WIDGET_HILITED) && isEnabled() ? kWidColorHi : kColor); + s.frameRect(_x, _y, _w, _h, !onTop ? kColor : (_flags & Widget::FLAG_HILITED) && isEnabled() ? kWidColorHi : kColor); _x += 4; _y += 4; _w -= 8; @@ -110,7 +110,7 @@ void Widget::draw() } // Now perform the actual widget draw - drawWidget((_flags & WIDGET_HILITED) ? true : false); + drawWidget((_flags & Widget::FLAG_HILITED) ? true : false); // Restore x/y if (hasBorder) @@ -156,8 +156,8 @@ void Widget::lostFocus() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Widget::setEnabled(bool e) { - if(e) setFlags(WIDGET_ENABLED); - else clearFlags(WIDGET_ENABLED); + if(e) setFlags(Widget::FLAG_ENABLED); + else clearFlags(Widget::FLAG_ENABLED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -311,7 +311,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font, : Widget(boss, font, x, y, w, h), _align(align) { - _flags = WIDGET_ENABLED; + _flags = Widget::FLAG_ENABLED; _bgcolor = kDlgColor; _bgcolorhi = kDlgColor; _textcolor = kTextColor; @@ -373,7 +373,7 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, _bmw(0), _bmh(0) { - _flags = WIDGET_ENABLED | WIDGET_CLEARBG; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG; _bgcolor = kBtnColor; _bgcolorhi = kBtnColorHi; _bgcolorlo = kColor; @@ -416,13 +416,13 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ButtonWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ButtonWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -447,7 +447,7 @@ void ButtonWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount) { if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); sendCommand(_cmd, 0, _id); } } @@ -541,7 +541,7 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, _boxY(0), _textY(0) { - _flags = WIDGET_ENABLED; + _flags = Widget::FLAG_ENABLED; _bgcolor = _bgcolorhi = kWidColor; _bgcolorlo = kDlgColor; @@ -567,13 +567,13 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckboxWidget::handleMouseEntered() { - setFlags(WIDGET_HILITED); + setFlags(Widget::FLAG_HILITED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckboxWidget::handleMouseLeft() { - clearFlags(WIDGET_HILITED); + clearFlags(Widget::FLAG_HILITED); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -677,7 +677,7 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font, _valueLabelWidth(valueLabelWidth), _numIntervals(0) { - _flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE; + _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE; _bgcolor = kDlgColor; _bgcolorhi = kDlgColor; diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index 4a89b0744..084164e87 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -34,18 +34,6 @@ namespace GUI { #include "GuiObject.hxx" #include "Font.hxx" -enum { - WIDGET_ENABLED = 1 << 0, - WIDGET_INVISIBLE = 1 << 1, - WIDGET_HILITED = 1 << 2, - WIDGET_BORDER = 1 << 3, - WIDGET_CLEARBG = 1 << 4, - WIDGET_TRACK_MOUSE = 1 << 5, - WIDGET_RETAIN_FOCUS = 1 << 6, - WIDGET_WANTS_TAB = 1 << 7, - WIDGET_WANTS_RAWDATA = 1 << 8 -}; - /** This is the base class for all widgets. @@ -55,6 +43,19 @@ class Widget : public GuiObject { friend class Dialog; + public: + enum : uInt32 { + FLAG_ENABLED = 1 << 0, + FLAG_INVISIBLE = 1 << 1, + FLAG_HILITED = 1 << 2, + FLAG_BORDER = 1 << 3, + FLAG_CLEARBG = 1 << 4, + FLAG_TRACK_MOUSE = 1 << 5, + FLAG_RETAIN_FOCUS = 1 << 6, + FLAG_WANTS_TAB = 1 << 7, + FLAG_WANTS_RAWDATA = 1 << 8 + }; + public: Widget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h); virtual ~Widget(); @@ -91,21 +92,21 @@ class Widget : public GuiObject Vec::append(_focusList, list); } - /** Set/clear WIDGET_ENABLED flag */ + /** Set/clear FLAG_ENABLED */ void setEnabled(bool e); - void setFlags(int flags) { _flags |= flags; setDirty(); } - void clearFlags(int flags) { _flags &= ~flags; setDirty(); } - int getFlags() const { return _flags; } + void setFlags(uInt32 flags) { _flags |= flags; setDirty(); } + void clearFlags(uInt32 flags) { _flags &= ~flags; setDirty(); } + uInt32 getFlags() const { return _flags; } - bool isEnabled() const { return _flags & WIDGET_ENABLED; } - bool isVisible() const override { return !(_flags & WIDGET_INVISIBLE); } - virtual bool wantsFocus() const { return _flags & WIDGET_RETAIN_FOCUS; } - bool wantsTab() const { return _flags & WIDGET_WANTS_TAB; } - bool wantsRaw() const { return _flags & WIDGET_WANTS_RAWDATA; } + bool isEnabled() const { return _flags & FLAG_ENABLED; } + bool isVisible() const override { return !(_flags & FLAG_INVISIBLE); } + virtual bool wantsFocus() const { return _flags & FLAG_RETAIN_FOCUS; } + bool wantsTab() const { return _flags & FLAG_WANTS_TAB; } + bool wantsRaw() const { return _flags & FLAG_WANTS_RAWDATA; } - void setID(int id) { _id = id; } - int getID() const { return _id; } + void setID(uInt32 id) { _id = id; } + uInt32 getID() const { return _id; } virtual const GUI::Font& font() const { return _font; } @@ -135,8 +136,8 @@ class Widget : public GuiObject GuiObject* _boss; const GUI::Font& _font; Widget* _next; - int _id; - int _flags; + uInt32 _id; + uInt32 _flags; bool _hasFocus; int _fontWidth; int _fontHeight;