more background dialog widget color adjustments

This commit is contained in:
thrust26 2018-08-06 10:51:45 +02:00
parent af5eea286c
commit 916cf17b80
7 changed files with 21 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -96,6 +96,7 @@ void CheckListWidget::drawWidget(bool hilite)
{
//cerr << "CheckListWidget::drawWidget\n";
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int i, pos, len = int(_list.size());
// Draw a thin frame around the list and to separate columns
@ -126,17 +127,17 @@ void CheckListWidget::drawWidget(bool hilite)
}
else
s.frameRect(_x + r.left - 3, _y + 1 + _fontHeight * i,
_w - r.left, _fontHeight, kTextColorHi);
_w - r.left, _fontHeight, onTop ? kTextColorHi : kColor);
}
if (_selectedItem == pos && _editMode)
{
adjustOffset();
s.drawString(_font, editString(), _x + r.left, y, r.width(), kTextColor,
s.drawString(_font, editString(), _x + r.left, y, r.width(), onTop ? kTextColor : kColor,
TextAlign::Left, -_editScrollOffset, false);
}
else
s.drawString(_font, _list[pos], _x + r.left, y, r.width(), textColor);
s.drawString(_font, _list[pos], _x + r.left, y, r.width(), onTop ? textColor : kColor);
}
// Only draw the caret while editing, and if it's in the current viewport

View File

@ -28,7 +28,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font,
_changed(false)
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
startEditMode(); // We're always in edit mode
}
@ -80,6 +80,7 @@ void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount
void EditTextWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
// Highlight changes
if(_changed)
@ -96,7 +97,9 @@ void EditTextWidget::drawWidget(bool hilite)
// Draw the text
adjustOffset();
s.drawString(_font, editString(), _x + 2, _y + 2, getEditRect().width(),
!_changed ? _textcolor : uInt32(kDbgChangedTextColor),
!_changed
? onTop ? _textcolor : kColor
: uInt32(kDbgChangedTextColor),
TextAlign::Left, -_editScrollOffset, false);
// Draw the caret

View File

@ -166,13 +166,13 @@ void RomInfoWidget::drawWidget(bool hilite)
const GUI::Font& font = instance().frameBuffer().font();
uInt32 x = _x + ((_w - font.getStringWidth(mySurfaceErrorMsg)) >> 1);
uInt32 y = _y + ((yoff - font.getLineHeight()) >> 1);
s.drawString(font, mySurfaceErrorMsg, x, y, _w - 10, _textcolor);
s.drawString(font, mySurfaceErrorMsg, x, y, _w - 10, onTop ? _textcolor : _shadowcolor);
}
int xpos = _x + 8, ypos = _y + yoff + 10;
for(const auto& info: myRomInfo)
{
s.drawString(_font, info, xpos, ypos, _w - 16, _textcolor);
s.drawString(_font, info, xpos, ypos, _w - 16, onTop ? _textcolor : _shadowcolor);
ypos += _font.getLineHeight();
}
}

View File

@ -58,6 +58,7 @@ void StringListWidget::handleMouseLeft()
void StringListWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
int i, pos, len = int(_list.size());
// Draw a thin frame around the list.
@ -67,7 +68,7 @@ void StringListWidget::drawWidget(bool hilite)
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++)
{
const int y = _y + 2 + _fontHeight * i;
uInt32 textColor = kTextColor;
uInt32 textColor = onTop ? kTextColor : kShadowColor;
// Draw the selected item inverted, on a highlighted background.
if (_selectedItem == pos && _hilite)

View File

@ -268,7 +268,7 @@ void TabWidget::drawWidget(bool hilite)
int i, x = _x + kTabLeftOffset;
for (i = 0; i < int(_tabs.size()); ++i)
{
uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor;
uInt32 fontcolor = _tabs[i].enabled && onTop? kTextColor : kColor;
int yOffset = (i == _activeTab) ? 0 : 1;
s.fillRect(x, _y + 1, _tabWidth, _tabHeight - 1,
(i == _activeTab)

View File

@ -354,8 +354,9 @@ void StaticTextWidget::setLabel(const string& label)
void StaticTextWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
s.drawString(_font, _label, _x, _y, _w,
isEnabled() ? _textcolor : uInt32(kColor), _align, 0, true, _shadowcolor);
isEnabled() && onTop ? _textcolor : uInt32(kColor), _align, 0, true, _shadowcolor);
setDirty();
}
@ -542,6 +543,7 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
{
_flags = WIDGET_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;
_bgcolorlo = kDlgColor;
_editable = true;
@ -638,19 +640,20 @@ void CheckboxWidget::setState(bool state, bool changed)
void CheckboxWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
bool onTop = _boss->dialog().isOnTop();
if(_drawBox)
s.frameRect(_x, _y + _boxY, 14, 14, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
s.frameRect(_x, _y + _boxY, 14, 14, onTop && hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Do we draw a square or cross?
s.fillRect(_x + 1, _y + _boxY + 1, 12, 12, _changed ? uInt32(kDbgChangedColor)
: isEnabled() ? _bgcolor : uInt32(kColor));
if(_state)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, onTop && isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
: kColor, 10);
// Finally draw the label
s.drawString(_font, _label, _x + 20, _y + _textY, _w,
isEnabled() ? kTextColor : kColor);
onTop && isEnabled() ? kTextColor : kColor);
setDirty();
}