FLAT_UI label default alignment fix

This commit is contained in:
thrust26 2017-12-18 09:42:36 +01:00
parent 200b5cfe87
commit df71881392
5 changed files with 34 additions and 13 deletions

View File

@ -351,9 +351,15 @@ void DebuggerDialog::addTabArea()
int tabID;
// The Prompt/console tab
#ifndef FLAT_UI
tabID = myTab->addTab(" Prompt ");
myPrompt = new PromptWidget(myTab, *myNFont,
2, 2, widWidth, widHeight);
#else
tabID = myTab->addTab("Prompt");
myPrompt = new PromptWidget(myTab, *myNFont,
2, 2, widWidth - 4, widHeight);
#endif
myTab->setParentWidget(tabID, myPrompt);
addToFocusList(myPrompt->getFocusList(), myTab, tabID);

View File

@ -59,7 +59,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
{
_flags = WIDGET_ENABLED | WIDGET_RETAIN_FOCUS;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor; // do not highlight the label
_bgcolorhi = kDlgColor; // do not highlight the background
_textcolor = kTextColor;
_textcolorhi = kTextColor; // do not highlight the label
@ -218,29 +218,33 @@ void PopUpWidget::drawWidget(bool hilite)
int x = _x + _labelWidth;
int w = _w - _labelWidth;
#ifndef FLAT_UI
// Draw the label, if any
if (_labelWidth > 0)
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? _textcolor : uInt32(kColor), TextAlign::Right);
#ifndef FLAT_UI
// Draw a thin frame around us.
s.hLine(x, _y, x + w - 1, kColor);
s.hLine(x, _y +_h-1, x + w - 1, kShadowColor);
s.vLine(x, _y, _y+_h-1, kColor);
s.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor);
#else
s.frameRect(x, _y, w, _h, kColor);
s.frameRect(x + w - 16, _y + 1, 15, _h - 2, hilite ? kTextColorHi : kBGColorLo);
#endif // !FLAT_UI
#ifndef FLAT_UI
// Fill the background
s.fillRect(x + 1, _y + 1, w - 2, _h - 2, kWidColor);
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
s.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY,
s.drawBitmap(up_down_arrows, x + w - 10, _y + myArrowsY,
!isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor);
#else
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + myTextY, _labelWidth,
isEnabled() ? _textcolor : uInt32(kColor), TextAlign::Left);
// Draw a thin frame around us.
s.frameRect(x, _y, w, _h, kColor);
s.frameRect(x + w - 16, _y + 1, 15, _h - 2, hilite ? kTextColorHi : kBGColorLo);
// Fill the background
s.fillRect(x + 1, _y + 1, w - 17, _h - 2, kWidColor);
s.fillRect(x + w - 15, _y + 2, 13, _h - 4, kBGColorHi);

View File

@ -329,6 +329,9 @@ void TabWidget::drawWidget(bool hilite)
s.vLine(_x + _w - 2, _y + _tabHeight - 1, _y + _h - 2, kColor);
s.vLine(_x + _w - 1, _y + _tabHeight - 1, _y + _h - 2, kShadowColor);
#else
/*s.fillRect(x, _y, _w - x, _tabHeight - 1, kDlgColor); // ? kWidColor : kDlgColor
s.hLine(x, _y + _tabHeight, _w - x, kScrollColorHi);*/
s.hLine(right1, _y, left2 - 1, kScrollColorHi);
#endif
}

View File

@ -92,11 +92,13 @@ class TabWidget : public Widget, public CommandSender
enum {
#ifndef FLAT_UI
kTabLeftOffset = 4,
#else
kTabLeftOffset = 0,
#endif
kTabSpacing = 2,
kTabPadding = 3
#else
kTabLeftOffset = 0,
kTabSpacing = 1,
kTabPadding = 4
#endif
};
private:

View File

@ -792,11 +792,12 @@ void SliderWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
#ifndef FLAT_UI
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth,
isEnabled() ? kTextColor : kColor, TextAlign::Right);
#ifndef FLAT_UI
// Draw the box
s.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor);
// Fill the box
@ -806,6 +807,11 @@ void SliderWidget::drawWidget(bool hilite)
s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4,
!isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor);
#else
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth,
isEnabled() ? kTextColor : kColor, TextAlign::Left);
// Draw the box
s.frameRect(_x + _labelWidth, _y, _w - _labelWidth, _h, hilite ? kSliderColorHi : kShadowColor);
// Fill the box