mirror of https://github.com/stella-emu/stella.git
Some cleanups to Widget class.
This commit is contained in:
parent
e428768307
commit
e34575753a
|
@ -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);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue