Change: Use Rect helpers for widget drawing.
This replaces repetitive and sometimes unwieldy use of constants.
This commit is contained in:
@@ -52,18 +52,20 @@ public:
|
||||
case WID_TT_CATENARY:
|
||||
case WID_TT_LOADING: {
|
||||
uint i = widget - WID_TT_BEGIN;
|
||||
if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, r.left + 1, r.top + 1);
|
||||
if (HasBit(_transparency_lock, i)) DrawSprite(SPR_LOCK, PAL_NONE, r.left + WD_BEVEL_LEFT, r.top + WD_BEVEL_TOP);
|
||||
break;
|
||||
}
|
||||
case WID_TT_BUTTONS:
|
||||
case WID_TT_BUTTONS: {
|
||||
const Rect fr = r.Shrink(WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM);
|
||||
for (uint i = WID_TT_BEGIN; i < WID_TT_END; i++) {
|
||||
if (i == WID_TT_LOADING) continue; // Do not draw button for invisible loading indicators.
|
||||
|
||||
const NWidgetBase *wi = this->GetWidget<NWidgetBase>(i);
|
||||
DrawFrameRect(wi->pos_x + 1, r.top + 2, wi->pos_x + wi->current_x - 2, r.bottom - 2, COLOUR_PALE_GREEN,
|
||||
const Rect wr = this->GetWidget<NWidgetBase>(i)->GetCurrentRect().Shrink(WD_BEVEL_LEFT, WD_BEVEL_TOP, WD_BEVEL_RIGHT, WD_BEVEL_BOTTOM);
|
||||
DrawFrameRect(wr.left, fr.top, wr.right, fr.bottom, COLOUR_PALE_GREEN,
|
||||
HasBit(_invisibility_opt, i - WID_TT_BEGIN) ? FR_LOWERED : FR_NONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user