mirror of https://github.com/stella-emu/stella.git
removed "on top" logic for drawing widgets
This commit is contained in:
parent
39b94d74e1
commit
ae452ffb09
|
@ -620,10 +620,9 @@ bool DataGridWidget::changedToolTip(const Common::Point& oldPos,
|
|||
void DataGridWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
int row, col;
|
||||
|
||||
s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : onTop ? _bgcolor : kBGColorHi);
|
||||
s.fillRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? _bgcolorhi : _bgcolor);
|
||||
// Draw the internal grid and labels
|
||||
int linewidth = _cols * _colWidth;
|
||||
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
|
||||
|
@ -642,7 +641,7 @@ void DataGridWidget::drawWidget(bool hilite)
|
|||
int x = _x + 4 + (col * _colWidth);
|
||||
int y = _y + 2 + (row * _rowHeight);
|
||||
int pos = row*_cols + col;
|
||||
ColorId textColor = onTop ? kTextColor : kColor;
|
||||
ColorId textColor = kTextColor;
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if (_currentRow == row && _currentCol == col &&
|
||||
|
@ -662,13 +661,12 @@ void DataGridWidget::drawWidget(bool hilite)
|
|||
{
|
||||
if(_changedList[pos])
|
||||
{
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
|
||||
onTop ? kDbgChangedColor : _bgcolorlo);
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
|
||||
|
||||
if(_hiliteList[pos])
|
||||
textColor = kDbgColorHi;
|
||||
else
|
||||
textColor = onTop ? kDbgChangedTextColor : textColor;
|
||||
textColor = kDbgChangedTextColor;
|
||||
}
|
||||
else if(_hiliteList[pos])
|
||||
textColor = kDbgColorHi;
|
||||
|
|
|
@ -90,7 +90,6 @@ void DelayQueueWidget::loadConfig() {
|
|||
void DelayQueueWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& surface = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
int y = _y,
|
||||
x = _x,
|
||||
|
@ -102,14 +101,14 @@ void DelayQueueWidget::drawWidget(bool hilite)
|
|||
y += 1;
|
||||
x += 1;
|
||||
w -= 1;
|
||||
surface.fillRect(x, y, w - 1, _h - 2, onTop ? kDlgColor : _bgcolorlo);
|
||||
surface.fillRect(x, y, w - 1, _h - 2, kDlgColor);
|
||||
|
||||
y += 2;
|
||||
x += 2;
|
||||
w -= 3;
|
||||
|
||||
for (const auto& line : myLines) {
|
||||
surface.drawString(_font, line, x, y, w, onTop ? _textcolor : kColor);
|
||||
surface.drawString(_font, line, x, y, w, _textcolor);
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,7 @@ void PromptWidget::drawWidget(bool hilite)
|
|||
{
|
||||
//cerr << "PromptWidget::drawWidget\n";
|
||||
ColorId fgcolor, bgcolor;
|
||||
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
// Draw text
|
||||
int start = _scrollLine - _linesPerPage + 1;
|
||||
|
@ -104,7 +102,7 @@ void PromptWidget::drawWidget(bool hilite)
|
|||
else
|
||||
fgcolor = ColorId(c >> 8);
|
||||
|
||||
s.drawChar(_font, c & 0x7f, x, y, onTop ? fgcolor : kColor);
|
||||
s.drawChar(_font, c & 0x7f, x, y, fgcolor);
|
||||
x += _kConsoleCharWidth;
|
||||
}
|
||||
y += _kConsoleLineHeight;
|
||||
|
@ -938,8 +936,6 @@ void PromptWidget::drawCaret()
|
|||
{
|
||||
//cerr << "PromptWidget::drawCaret()\n";
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
int line = _currentPos / _lineWidth;
|
||||
|
||||
// Don't draw the cursor if it's not in the current view
|
||||
|
@ -951,7 +947,7 @@ void PromptWidget::drawCaret()
|
|||
int y = _y + displayLine * _kConsoleLineHeight;
|
||||
|
||||
char c = buffer(_currentPos); //FIXME: int to char??
|
||||
s.fillRect(x, y, _kConsoleCharWidth, _kConsoleLineHeight, onTop ? kTextColor : kColor);
|
||||
s.fillRect(x, y, _kConsoleCharWidth, _kConsoleLineHeight, kTextColor);
|
||||
s.drawChar(_font, c, x, y + 2, kBGColor);
|
||||
}
|
||||
|
||||
|
|
|
@ -523,10 +523,9 @@ bool RomListWidget::changedToolTip(const Common::Point& oldPos,
|
|||
void RomListWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
const CartDebug::DisassemblyList& dlist = myDisasm->list;
|
||||
int i, pos, xpos, ypos, len = int(dlist.size());
|
||||
ColorId textColor = onTop ? kTextColor : kColor;
|
||||
ColorId textColor = kTextColor;
|
||||
|
||||
const Common::Rect& r = getEditRect();
|
||||
const Common::Rect& l = getLineRect();
|
||||
|
@ -559,7 +558,7 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
|
||||
// Draw highlighted item in a frame
|
||||
if(_highlightedItem == pos)
|
||||
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _lineHeight, onTop ? kWidColorHi : kBGColorLo);
|
||||
s.frameRect(_x + l.x() - 3, ypos - 1, _w - l.x(), _lineHeight, kWidColorHi);
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if(_selectedItem == pos && _hasFocus)
|
||||
|
|
|
@ -104,7 +104,6 @@ void ToggleBitWidget::drawWidget(bool hilite)
|
|||
{
|
||||
//cerr << "ToggleBitWidget::drawWidget\n";
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
int row, col;
|
||||
string buffer;
|
||||
|
||||
|
@ -146,18 +145,16 @@ void ToggleBitWidget::drawWidget(bool hilite)
|
|||
// Highlight changes
|
||||
if(_changedList[pos])
|
||||
{
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
|
||||
onTop ? kDbgChangedColor : _bgcolorlo);
|
||||
s.drawString(_font, buffer, x, y, _colWidth, onTop ? kDbgChangedTextColor : kColor);
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor);
|
||||
s.drawString(_font, buffer, x, y, _colWidth, kDbgChangedTextColor);
|
||||
}
|
||||
else
|
||||
s.drawString(_font, buffer, x, y, _colWidth,
|
||||
onTop ? textColor : kColor);
|
||||
s.drawString(_font, buffer, x, y, _colWidth, textColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, onTop ? kBGColorHi : kDlgColor);
|
||||
s.drawString(_font, buffer, x, y, _colWidth, onTop ? kTextColor : kColor);
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kBGColorHi);
|
||||
s.drawString(_font, buffer, x, y, _colWidth, kTextColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,6 @@ void TogglePixelWidget::drawWidget(bool hilite)
|
|||
{
|
||||
//cerr << "TogglePixelWidget::drawWidget\n";
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
int row, col;
|
||||
|
||||
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
|
||||
|
@ -146,7 +145,7 @@ void TogglePixelWidget::drawWidget(bool hilite)
|
|||
|
||||
// Either draw the pixel in given color, or erase (show background)
|
||||
s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1,
|
||||
_stateList[pos] ? onTop ? _pixelColor : kColor : onTop ? _backgroundColor : kBGColorLo);
|
||||
_stateList[pos] ? _pixelColor : _backgroundColor);
|
||||
if (_changedList[pos])
|
||||
s.frameRect(x - 3, y - 1, _colWidth - 1, _rowHeight - 1, kDbgChangedColor);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,6 @@ 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
|
||||
|
@ -112,18 +111,17 @@ void CheckListWidget::drawWidget(bool hilite)
|
|||
}
|
||||
else
|
||||
s.frameRect(_x + r.x() - 3, _y + 1 + _lineHeight * i,
|
||||
_w - r.x(), _lineHeight, onTop ? kTextColorHi : kColor);
|
||||
_w - r.x(), _lineHeight, kTextColorHi);
|
||||
}
|
||||
|
||||
if (_selectedItem == pos && _editMode)
|
||||
{
|
||||
adjustOffset();
|
||||
s.drawString(_font, editString(), _x + r.x(), y, r.w(), onTop ? kTextColor : kColor,
|
||||
s.drawString(_font, editString(), _x + r.x(), y, r.w(), kTextColor,
|
||||
TextAlign::Left, -_editScrollOffset, false);
|
||||
}
|
||||
else
|
||||
s.drawString(_font, _list[pos], _x + r.x(), y, r.w(),
|
||||
onTop ? textColor : kColor);
|
||||
s.drawString(_font, _list[pos], _x + r.x(), y, r.w(), textColor);
|
||||
}
|
||||
|
||||
// Only draw the caret while editing, and if it's in the current viewport
|
||||
|
|
|
@ -45,7 +45,6 @@ void ColorWidget::setColor(ColorId color)
|
|||
void ColorWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
if(_framed)
|
||||
{
|
||||
|
@ -53,11 +52,11 @@ void ColorWidget::drawWidget(bool hilite)
|
|||
s.frameRect(_x, _y, _w, _h + 1, kColor);
|
||||
|
||||
// Show the currently selected color
|
||||
s.fillRect(_x + 1, _y + 1, _w - 2, _h - 1, onTop ? isEnabled() ? _color : kWidColor : kBGColorLo);
|
||||
s.fillRect(_x + 1, _y + 1, _w - 2, _h - 1, isEnabled() ? _color : kWidColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
s.fillRect(_x, _y, _w, _h, onTop ? isEnabled() ? _color : kWidColor : kBGColorLo);
|
||||
s.fillRect(_x, _y, _w, _h, isEnabled() ? _color : kWidColor);
|
||||
}
|
||||
|
||||
// Cross out the grid?
|
||||
|
|
|
@ -55,7 +55,6 @@ class Dialog : public GuiObject
|
|||
void close();
|
||||
|
||||
bool isVisible() const override { return _visible; }
|
||||
bool isOnTop() const { return true; } // TODO: remove
|
||||
|
||||
virtual void setPosition();
|
||||
virtual void drawDialog();
|
||||
|
|
|
@ -76,13 +76,12 @@ 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 && onTop)
|
||||
if(_changed)
|
||||
s.fillRect(_x, _y, _w, _h, kDbgChangedColor);
|
||||
else if(!isEditable() || !isEnabled())
|
||||
s.fillRect(_x, _y, _w, _h, onTop ? kDlgColor : kBGColorLo);
|
||||
s.fillRect(_x, _y, _w, _h, kDlgColor);
|
||||
|
||||
// Draw a thin frame around us.
|
||||
s.frameRect(_x, _y, _w, _h, hilite && isEditable() && isEnabled() ? kWidColorHi : kColor);
|
||||
|
@ -90,9 +89,9 @@ void EditTextWidget::drawWidget(bool hilite)
|
|||
// Draw the text
|
||||
adjustOffset();
|
||||
s.drawString(_font, editString(), _x + _textOfs, _y + 2, getEditRect().w(), getEditRect().h(),
|
||||
_changed && onTop && isEnabled()
|
||||
_changed && isEnabled()
|
||||
? kDbgChangedTextColor
|
||||
: onTop && isEnabled() ? _textcolor : kColor,
|
||||
: isEnabled() ? _textcolor : kColor,
|
||||
TextAlign::Left, scrollOffset(), !isEditable());
|
||||
|
||||
// Draw the caret and selection
|
||||
|
|
|
@ -249,7 +249,6 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
{
|
||||
//cerr << "PopUpWidget::drawWidget\n";
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
int x = _x + _labelWidth;
|
||||
int w = _w - _labelWidth;
|
||||
|
@ -257,7 +256,7 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
// Draw the label, if any
|
||||
if(_labelWidth > 0)
|
||||
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
|
||||
isEnabled() && onTop ? _textcolor : kColor, TextAlign::Left);
|
||||
isEnabled() ? _textcolor : kColor, TextAlign::Left);
|
||||
|
||||
// Draw a thin frame around us.
|
||||
s.frameRect(x, _y, w, _h, isEnabled() && hilite ? kWidColorHi : kColor);
|
||||
|
@ -267,12 +266,12 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
// Fill the background
|
||||
ColorId bgCol = isEditable() ? kWidColor : kDlgColor;
|
||||
s.fillRect(x + 1, _y + 1, w - (_arrowWidth * 2 - 1), _h - 2,
|
||||
onTop ? _changed ? kDbgChangedColor : bgCol : kDlgColor);
|
||||
_changed ? kDbgChangedColor : bgCol);
|
||||
s.fillRect(x + w - (_arrowWidth * 2 - 2), _y + 1, (_arrowWidth * 2 - 3), _h - 2,
|
||||
onTop ? isEnabled() && hilite ? kBtnColorHi : bgCol : kBGColorLo);
|
||||
isEnabled() && hilite ? kBtnColorHi : bgCol);
|
||||
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
|
||||
s.drawBitmap(_arrowImg, x + w - (_arrowWidth * 1.5 - 1), _y + myArrowsY + 1,
|
||||
!(isEnabled() && onTop) ? kColor : kTextColor, _arrowWidth, _arrowHeight);
|
||||
!isEnabled() ? kColor : kTextColor, _arrowWidth, _arrowHeight);
|
||||
|
||||
// Draw the selected entry, if any
|
||||
const string& name = editString();
|
||||
|
@ -283,7 +282,7 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
TextAlign::Right : TextAlign::Left;
|
||||
adjustOffset();
|
||||
s.drawString(_font, name, x + _textOfs, _y + myTextY, w,
|
||||
!(isEnabled() && onTop) ? kColor : _changed ? kDbgChangedTextColor : kTextColor,
|
||||
!isEnabled() ? kColor : _changed ? kDbgChangedTextColor : kTextColor,
|
||||
align, editable ? -_editScrollOffset : 0, !editable);
|
||||
|
||||
if(editable)
|
||||
|
|
|
@ -180,11 +180,9 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node)
|
|||
void RomInfoWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
const int yoff = myAvail.h + 10;
|
||||
|
||||
s.fillRect(_x+2, _y+2, _w-4, _h-4, onTop ? _bgcolor : _bgcolorlo);
|
||||
s.fillRect(_x+2, _y+2, _w-4, _h-4, _bgcolor);
|
||||
s.frameRect(_x, _y, _w, _h, kColor);
|
||||
s.frameRect(_x, _y+yoff, _w, _h-yoff, kColor);
|
||||
|
||||
|
@ -206,7 +204,7 @@ void RomInfoWidget::drawWidget(bool hilite)
|
|||
{
|
||||
uInt32 x = _x + ((_w - _font.getStringWidth(mySurfaceErrorMsg)) >> 1);
|
||||
uInt32 y = _y + ((yoff - _font.getLineHeight()) >> 1);
|
||||
s.drawString(_font, mySurfaceErrorMsg, x, y, _w - 10, onTop ? _textcolor : _shadowcolor);
|
||||
s.drawString(_font, mySurfaceErrorMsg, x, y, _w - 10, _textcolor);
|
||||
}
|
||||
|
||||
int xpos = _x + 8, ypos = _y + yoff + 5;
|
||||
|
@ -226,7 +224,7 @@ void RomInfoWidget::drawWidget(bool hilite)
|
|||
break;
|
||||
}
|
||||
int lines = s.drawString(_font, info, xpos, ypos, _w - 16, _font.getFontHeight() * 3,
|
||||
onTop ? _textcolor : _shadowcolor);
|
||||
_textcolor);
|
||||
ypos += _font.getLineHeight() + (lines - 1) * _font.getFontHeight();
|
||||
}
|
||||
clearDirty();
|
||||
|
|
|
@ -274,9 +274,7 @@ void ScrollBarWidget::recalc()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::drawWidget(bool hilite)
|
||||
{
|
||||
//cerr << "ScrollBarWidget::drawWidget\n";
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
int bottomY = _y + _h;
|
||||
bool isSinglePage = (_numEntries <= _entriesPerPage);
|
||||
|
||||
|
@ -290,22 +288,24 @@ void ScrollBarWidget::drawWidget(bool hilite)
|
|||
s.fillRect(_x + 1, _y + 1, _w - 2, _upDownBoxHeight - 2, kScrollColor);
|
||||
s.drawBitmap(_upImg, _x + (_scrollBarWidth - _upDownWidth) / 2,
|
||||
_y + (_upDownBoxHeight - _upDownHeight) / 2,
|
||||
onTop ? isSinglePage ? kColor : (hilite && _part == Part::UpArrow) ? kWidColor
|
||||
: kTextColor : kColor, _upDownWidth, _upDownHeight);
|
||||
isSinglePage ? kColor
|
||||
: (hilite && _part == Part::UpArrow) ? kWidColor : kTextColor,
|
||||
_upDownWidth, _upDownHeight);
|
||||
|
||||
// Down arrow
|
||||
if(hilite && _part == Part::DownArrow)
|
||||
s.fillRect(_x + 1, bottomY - _upDownBoxHeight + 1, _w - 2, _upDownBoxHeight - 2, kScrollColor);
|
||||
s.drawBitmap(_downImg, _x + (_scrollBarWidth - _upDownWidth) / 2,
|
||||
bottomY - _upDownBoxHeight + (_upDownBoxHeight - _upDownHeight) / 2,
|
||||
onTop ? isSinglePage ? kColor : (hilite && _part == Part::DownArrow) ?
|
||||
kWidColor : kTextColor : kColor, _upDownWidth, _upDownHeight);
|
||||
isSinglePage ? kColor
|
||||
: (hilite && _part == Part::DownArrow) ? kWidColor : kTextColor,
|
||||
_upDownWidth, _upDownHeight);
|
||||
|
||||
// Slider
|
||||
if(!isSinglePage)
|
||||
{
|
||||
s.fillRect(_x + 1, _y + _sliderPos - 1, _w - 2, _sliderHeight + 2,
|
||||
onTop ? (hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor : kColor);
|
||||
(hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor);
|
||||
}
|
||||
clearDirty();
|
||||
}
|
||||
|
|
|
@ -95,23 +95,22 @@ bool StringListWidget::changedToolTip(const Common::Point& oldPos,
|
|||
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.
|
||||
s.frameRect(_x, _y, _w + 1, _h, onTop && hilite && _hilite ? kWidColorHi : kColor);
|
||||
s.frameRect(_x, _y, _w + 1, _h, hilite && _hilite ? kWidColorHi : kColor);
|
||||
|
||||
if (!isEnabled())
|
||||
s.fillRect(_x + 1, _y + 1, _w - 1, _h - 2, onTop ? kDlgColor : kBGColorLo);
|
||||
s.fillRect(_x + 1, _y + 1, _w - 1, _h - 2, kDlgColor);
|
||||
|
||||
// Draw the list items
|
||||
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++)
|
||||
{
|
||||
const int y = _y + 2 + _lineHeight * i;
|
||||
ColorId textColor = onTop ? kTextColor : kShadowColor;
|
||||
ColorId textColor = kTextColor;
|
||||
|
||||
// Draw the selected item inverted, on a highlighted background.
|
||||
if (onTop && _selectedItem == pos && _hilite)
|
||||
if (_selectedItem == pos && _hilite)
|
||||
{
|
||||
if(_hasFocus && !_editMode)
|
||||
{
|
||||
|
|
|
@ -265,36 +265,34 @@ void TabWidget::drawWidget(bool hilite)
|
|||
if(isDirty())
|
||||
{
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
// Iterate over all tabs and draw them
|
||||
int i, x = _x + kTabLeftOffset;
|
||||
for(i = 0; i < int(_tabs.size()); ++i)
|
||||
{
|
||||
int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth;
|
||||
ColorId fontcolor = _tabs[i].enabled && onTop ? kTextColor : kColor;
|
||||
ColorId fontcolor = _tabs[i].enabled ? kTextColor : kColor;
|
||||
int yOffset = (i == _activeTab) ? 0 : 1;
|
||||
s.fillRect(x, _y + 1, tabWidth, _tabHeight - 1,
|
||||
(i == _activeTab)
|
||||
? onTop ? kDlgColor : kBGColorLo
|
||||
: onTop ? kBGColorHi : kDlgColor); // ? kWidColor : kDlgColor
|
||||
? kDlgColor : kBGColorHi); // ? kWidColor : kDlgColor
|
||||
s.drawString(_font, _tabs[i].title, x + kTabPadding + yOffset,
|
||||
_y + yOffset + (_tabHeight - _lineHeight - 1),
|
||||
tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center);
|
||||
if(i == _activeTab)
|
||||
{
|
||||
s.hLine(x, _y, x + tabWidth - 1, onTop ? kWidColor : kDlgColor);
|
||||
s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, onTop ? kBGColorLo : kColor);
|
||||
s.hLine(x, _y, x + tabWidth - 1, kWidColor);
|
||||
s.vLine(x + tabWidth, _y + 1, _y + _tabHeight - 1, kBGColorLo);
|
||||
}
|
||||
else
|
||||
s.hLine(x, _y + _tabHeight, x + tabWidth, onTop ? kWidColor : kDlgColor);
|
||||
s.hLine(x, _y + _tabHeight, x + tabWidth, kWidColor);
|
||||
|
||||
x += tabWidth + kTabSpacing;
|
||||
}
|
||||
|
||||
// fill empty right space
|
||||
s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, onTop ? kWidColor : kDlgColor);
|
||||
s.hLine(_x, _y + _h - 1, _x + _w - 1, onTop ? kBGColorLo : kColor);
|
||||
s.hLine(x - kTabSpacing + 1, _y + _tabHeight, _x + _w - 1, kWidColor);
|
||||
s.hLine(_x, _y + _h - 1, _x + _w - 1, kBGColorLo);
|
||||
|
||||
clearDirty();
|
||||
// Make all child widgets of currently active tab dirty
|
||||
|
|
|
@ -101,8 +101,6 @@ void Widget::draw()
|
|||
//cerr << "w";
|
||||
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
int oldX = _x, oldY = _y;
|
||||
|
||||
// Account for our relative position in the dialog
|
||||
|
@ -118,9 +116,7 @@ void Widget::draw()
|
|||
x++; y++; w -= 2; h -= 2;
|
||||
}
|
||||
if(hasBackground())
|
||||
s.fillRect(x, y, w, h, !onTop
|
||||
? _bgcolorlo
|
||||
: (_flags & Widget::FLAG_HILITED) && isEnabled()
|
||||
s.fillRect(x, y, w, h, (_flags & Widget::FLAG_HILITED) && isEnabled()
|
||||
? _bgcolorhi : _bgcolor);
|
||||
else
|
||||
s.invalidateRect(x, y, w, h);
|
||||
|
@ -129,9 +125,7 @@ void Widget::draw()
|
|||
// Draw border
|
||||
if(hasBorder())
|
||||
{
|
||||
s.frameRect(_x, _y, _w, _h, !onTop
|
||||
? kColor
|
||||
: (_flags & Widget::FLAG_HILITED) && isEnabled()
|
||||
s.frameRect(_x, _y, _w, _h, (_flags & Widget::FLAG_HILITED) && isEnabled()
|
||||
? kWidColorHi : kColor);
|
||||
_x += 4;
|
||||
_y += 4;
|
||||
|
@ -275,7 +269,6 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
|||
FBSurface& s = boss->dialog().surface();
|
||||
int size = int(arr.size()), pos = -1;
|
||||
Widget* tmp;
|
||||
bool onTop = boss->dialog().isOnTop();
|
||||
|
||||
for(int i = 0; i < size; ++i)
|
||||
{
|
||||
|
@ -300,9 +293,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
|||
else
|
||||
tmp->_hasFocus = false;
|
||||
|
||||
s.frameRect(x, y, w, h, onTop ? kDlgColor : kBGColorLo);
|
||||
|
||||
//tmp->setDirty();
|
||||
s.frameRect(x, y, w, h, kDlgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,10 +346,7 @@ Widget* Widget::setFocusForChain(GuiObject* boss, WidgetArray& arr,
|
|||
tmp->setFlags(Widget::FLAG_HILITED);
|
||||
}
|
||||
|
||||
if (onTop)
|
||||
s.frameRect(x, y, w, h, kWidFrameColor, FrameStyle::Dashed);
|
||||
|
||||
//tmp->setDirty();
|
||||
s.frameRect(x, y, w, h, kWidFrameColor, FrameStyle::Dashed);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
@ -439,9 +427,9 @@ void StaticTextWidget::handleMouseLeft()
|
|||
void StaticTextWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
s.drawString(_font, _label, _x, _y, _w,
|
||||
isEnabled() && onTop ? _textcolor : kColor, _align, 0, true, _shadowcolor);
|
||||
isEnabled() ? _textcolor : kColor, _align, 0, true, _shadowcolor);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -558,17 +546,16 @@ void ButtonWidget::setBitmap(const uInt32* bitmap, int bmw, int bmh)
|
|||
void ButtonWidget::drawWidget(bool hilite)
|
||||
{
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
||||
s.frameRect(_x, _y, _w, _h, !onTop ? kShadowColor : hilite && isEnabled() ? kBtnBorderColorHi : kBtnBorderColor);
|
||||
s.frameRect(_x, _y, _w, _h, hilite && isEnabled() ? kBtnBorderColorHi : kBtnBorderColor);
|
||||
|
||||
if (!_useBitmap)
|
||||
s.drawString(_font, _label, _x, _y + (_h - _lineHeight)/2 + 1, _w,
|
||||
!(isEnabled() && onTop) ? _textcolorlo :
|
||||
!isEnabled() ? _textcolorlo :
|
||||
hilite ? _textcolorhi : _textcolor, _align);
|
||||
else
|
||||
s.drawBitmap(_bitmap, _x + (_w - _bmw) / 2, _y + (_h - _bmh) / 2,
|
||||
!(isEnabled() && onTop) ? _textcolorlo :
|
||||
!isEnabled() ? _textcolorlo :
|
||||
hilite ? _textcolorhi : _textcolor,
|
||||
_bmw, _bmh);
|
||||
}
|
||||
|
@ -703,21 +690,19 @@ 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, _boxSize, _boxSize, onTop && hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
|
||||
s.frameRect(_x, _y + _boxY, _boxSize, _boxSize, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
|
||||
// Do we draw a square or cross?
|
||||
s.fillRect(_x + 1, _y + _boxY + 1, _boxSize - 2, _boxSize - 2,
|
||||
_changed ? onTop ? kDbgChangedColor : kDlgColor :
|
||||
isEnabled() && onTop ? _bgcolor : kDlgColor);
|
||||
_changed ? kDbgChangedColor : isEnabled() ? _bgcolor : kDlgColor);
|
||||
if(_state)
|
||||
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, onTop && isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
|
||||
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
|
||||
: kColor, _boxSize - 4);
|
||||
|
||||
// Finally draw the label
|
||||
s.drawString(_font, _label, _x + prefixSize(_font), _y + _textY, _w,
|
||||
onTop && isEnabled() ? kTextColor : kColor);
|
||||
isEnabled() ? kTextColor : kColor);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue