Fix API for TogglePixelWidget to properly use ColorId datatypes.

This commit is contained in:
Stephen Anthony 2018-08-19 17:03:54 -02:30
parent 4a2a07d5a7
commit 6cd5c9d327
3 changed files with 14 additions and 15 deletions

View File

@ -173,7 +173,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myGRP0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1);
myGRP0->setTarget(this);
myGRP0->setID(kGRP0ID);
myGRP0->setBackgroundColor(-1);
myGRP0->clearBackgroundColor();
addFocusWidget(myGRP0);
// posP0
@ -220,7 +220,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myGRP0Old = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1);
myGRP0Old->setTarget(this);
myGRP0Old->setID(kGRP0OldID);
myGRP0Old->setBackgroundColor(-1);
myGRP0Old->clearBackgroundColor();
addFocusWidget(myGRP0Old);
// P0 delay
@ -258,7 +258,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myGRP1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1);
myGRP1->setTarget(this);
myGRP1->setID(kGRP1ID);
myGRP1->setBackgroundColor(-1);
myGRP1->clearBackgroundColor();
addFocusWidget(myGRP1);
// posP1
@ -304,7 +304,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myGRP1Old = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 8, 1);
myGRP1Old->setTarget(this);
myGRP1Old->setID(kGRP1OldID);
myGRP1Old->setBackgroundColor(-1);
myGRP1Old->clearBackgroundColor();
addFocusWidget(myGRP1Old);
// P1 delay
@ -342,7 +342,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myEnaM0 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaM0->setTarget(this);
myEnaM0->setID(kEnaM0ID);
myEnaM0->setBackgroundColor(-1);
myEnaM0->clearBackgroundColor();
addFocusWidget(myEnaM0);
// posM0
@ -405,7 +405,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myEnaM1 = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaM1->setTarget(this);
myEnaM1->setID(kEnaM1ID);
myEnaM1->setBackgroundColor(-1);
myEnaM1->clearBackgroundColor();
addFocusWidget(myEnaM1);
// posM0
@ -468,7 +468,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myEnaBL = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaBL->setTarget(this);
myEnaBL->setID(kEnaBLID);
myEnaBL->setBackgroundColor(-1);
myEnaBL->clearBackgroundColor();
addFocusWidget(myEnaBL);
// posBL
@ -517,7 +517,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
myEnaBLOld = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 1, 1);
myEnaBLOld->setTarget(this);
myEnaBLOld->setID(kEnaBLOldID);
myEnaBLOld->setBackgroundColor(-1);
myEnaBLOld->clearBackgroundColor();
addFocusWidget(myEnaBLOld);
// Ball delay

View File

@ -26,7 +26,7 @@
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows)
: ToggleWidget(boss, font, x, y, cols, rows, 1),
_pixelColor(0),
_pixelColor(kNone),
_backgroundColor(kDlgColor),
_swapBits(false),
_crossBits(false)

View File

@ -28,12 +28,11 @@ class TogglePixelWidget : public ToggleWidget
int x, int y, int cols, int rows);
virtual ~TogglePixelWidget() = default;
void setColor(ColorId color) {
_pixelColor = color <= kNumColors ? color : kDlgColor;
}
void setBackgroundColor(ColorId color) {
_backgroundColor = color <= kNumColors ? color : kDlgColor;
}
void setColor(ColorId color) { _pixelColor = color; }
void clearColor() { _pixelColor = kDlgColor; }
void setBackgroundColor(ColorId color) { _backgroundColor = color; }
void clearBackgroundColor() { _backgroundColor = kDlgColor; }
void setState(const BoolArray& state);
void setIntState(int value, bool swap);