diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dropdown.cpp | 23 | ||||
-rw-r--r-- | src/widgets/dropdown_type.h | 6 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 88d31ab7a..c3eaa7d35 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -12,13 +12,13 @@ #include "table/strings.h" -void DropDownListItem::Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const +void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const { int c1 = _colour_gradient[bg_colour][3]; int c2 = _colour_gradient[bg_colour][7]; - GfxFillRect(x + 1, y + 3, x + width - 2, y + 3, c1); - GfxFillRect(x + 1, y + 4, x + width - 2, y + 4, c2); + GfxFillRect(left + 1, top + 3, right - 1, top + 3, c1); + GfxFillRect(left + 1, top + 4, right - 1, top + 4, c2); } uint DropDownListStringItem::Width() const @@ -28,9 +28,9 @@ uint DropDownListStringItem::Width() const return GetStringBoundingBox(buffer).width; } -void DropDownListStringItem::Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const +void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const { - DrawStringTruncated(x + 2, y, this->String(), sel ? TC_WHITE : TC_BLACK, width); + DrawString(left + 2, right - 2, top, this->String(), sel ? TC_WHITE : TC_BLACK); } StringID DropDownListParamStringItem::String() const @@ -44,9 +44,9 @@ uint DropDownListCharStringItem::Width() const return GetStringBoundingBox(this->string).width; } -void DropDownListCharStringItem::Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const +void DropDownListCharStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const { - DoDrawStringTruncated(this->string, x + 2, y, sel ? TC_WHITE : TC_BLACK, width); + DrawString(left + 2, right - 2, top, this->string, sel ? TC_WHITE : TC_BLACK); } /** @@ -133,7 +133,8 @@ struct DropdownWindow : Window { int sel = this->selected_index; int width = this->widget[0].right - 2; - int height = this->widget[0].bottom; + int right = this->widget[0].right; + int bottom = this->widget[0].bottom; int pos = this->vscroll.pos; DropDownList *list = this->list; @@ -146,12 +147,12 @@ struct DropdownWindow : Window { if (--pos >= 0) continue; if (y + item_height < height) { - if (sel == item->result) GfxFillRect(x + 1, y, x + width - 1, y + item_height - 1, 0); + if (sel == item->result) GfxFillRect(x + 1, y, right - 1, y + item_height - 1, 0); - item->Draw(x, y, width, height, sel == item->result, (TextColour)this->widget[0].colour); + item->Draw(0, right, y, bottom, sel == item->result, (TextColour)this->widget[0].colour); if (item->masked) { - GfxFillRect(x, y, x + width - 1, y + item_height - 1, + GfxFillRect(x, y, right - 1, y + item_height - 1, _colour_gradient[this->widget[0].colour][5], FILLRECT_CHECKER ); } diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index 607799656..594cabe7e 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -23,7 +23,7 @@ public: virtual bool Selectable() const { return false; } virtual uint Height(uint width) const { return 10; } virtual uint Width() const { return 0; } - virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const; + virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const; }; /** @@ -38,7 +38,7 @@ public: virtual bool Selectable() const { return true; } virtual uint Width() const; - virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const; + virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const; virtual StringID String() const { return this->string; } }; @@ -68,7 +68,7 @@ public: virtual bool Selectable() const { return true; } virtual uint Width() const; - virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const; + virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const; }; /** |