|
@@ -129,25 +129,25 @@ public:
|
|
|
this->checkmark_width = GetStringBoundingBox(STR_JUST_CHECKMARK).width + 3;
|
|
|
}
|
|
|
|
|
|
virtual ~DropDownListCheckedItem() {}
|
|
|
|
|
|
uint Width() const
|
|
|
{
|
|
|
return DropDownListStringItem::Width() + this->checkmark_width;
|
|
|
}
|
|
|
|
|
|
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
|
|
|
{
|
|
|
bool rtl = _dynlang.text_dir == TD_RTL;
|
|
|
bool rtl = _current_text_dir == TD_RTL;
|
|
|
if (this->checked) {
|
|
|
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_JUST_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
|
|
|
}
|
|
|
DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : this->checkmark_width), right - WD_FRAMERECT_RIGHT - (rtl ? this->checkmark_width : 0), top, this->String(), sel ? TC_WHITE : TC_BLACK);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Drop down list entry for showing a company entry, with companies 'blob'.
|
|
|
*/
|
|
|
class DropDownListCompanyItem : public DropDownListItem {
|
|
|
uint icon_width;
|
|
@@ -168,25 +168,25 @@ public:
|
|
|
|
|
|
uint Width() const
|
|
|
{
|
|
|
CompanyID company = (CompanyID)this->result;
|
|
|
SetDParam(0, company);
|
|
|
SetDParam(1, company);
|
|
|
return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_width + 3;
|
|
|
}
|
|
|
|
|
|
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
|
|
|
{
|
|
|
CompanyID company = (CompanyID)this->result;
|
|
|
bool rtl = _dynlang.text_dir == TD_RTL;
|
|
|
bool rtl = _current_text_dir == TD_RTL;
|
|
|
|
|
|
/* It's possible the company is deleted while the dropdown is open */
|
|
|
if (!Company::IsValidID(company)) return;
|
|
|
|
|
|
DrawCompanyIcon(company, rtl ? right - this->icon_width - WD_FRAMERECT_RIGHT : left + WD_FRAMERECT_LEFT, top + 1 + (FONT_HEIGHT_NORMAL - 10) / 2);
|
|
|
|
|
|
SetDParam(0, company);
|
|
|
SetDParam(1, company);
|
|
|
TextColour col;
|
|
|
if (this->greyed) {
|
|
|
col = TC_GREY;
|
|
|
} else {
|
|
@@ -1045,25 +1045,25 @@ public:
|
|
|
} else {
|
|
|
cur_wid++;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* virtual */ void Draw(const Window *w)
|
|
|
{
|
|
|
/* Draw brown-red toolbar bg. */
|
|
|
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB2);
|
|
|
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, 0xB4, FILLRECT_CHECKER);
|
|
|
|
|
|
bool rtl = _dynlang.text_dir == TD_RTL;
|
|
|
bool rtl = _current_text_dir == TD_RTL;
|
|
|
for (NWidgetBase *child_wid = rtl ? this->tail : this->head; child_wid != NULL; child_wid = rtl ? child_wid->prev : child_wid->next) {
|
|
|
if (child_wid->type == NWID_SPACER) continue;
|
|
|
if (!this->visible[((NWidgetCore*)child_wid)->index]) continue;
|
|
|
|
|
|
child_wid->Draw(w);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y)
|
|
|
{
|
|
|
if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL;
|
|
|
|