Codechange: Use override specifier for DropDownListItem classes.

pull/82/head
peter1138 5 years ago committed by Michael Lutz
parent af7d9020a1
commit aafce47596

@ -524,17 +524,17 @@ public:
return this->result >= COLOUR_END ? STR_COLOUR_DEFAULT : _colour_dropdown[this->result]; return this->result >= COLOUR_END ? STR_COLOUR_DEFAULT : _colour_dropdown[this->result];
} }
uint Height(uint width) const uint Height(uint width) const override
{ {
return max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2); return max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2);
} }
bool Selectable() const bool Selectable() const override
{ {
return true; return true;
} }
void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override
{ {
bool rtl = _current_text_dir == TD_RTL; bool rtl = _current_text_dir == TD_RTL;
int height = bottom - top; int height = bottom - top;

@ -127,12 +127,12 @@ public:
this->lock_size = GetSpriteSize(SPR_LOCK); this->lock_size = GetSpriteSize(SPR_LOCK);
} }
bool Selectable() const bool Selectable() const override
{ {
return true; return true;
} }
uint Width() const uint Width() const override
{ {
CompanyID company = (CompanyID)this->result; CompanyID company = (CompanyID)this->result;
SetDParam(0, company); SetDParam(0, company);
@ -140,12 +140,12 @@ public:
return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_size.width + this->lock_size.width + 6; return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_size.width + this->lock_size.width + 6;
} }
uint Height(uint width) const uint Height(uint width) const override
{ {
return max(max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL); return max(max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL);
} }
void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override
{ {
CompanyID company = (CompanyID)this->result; CompanyID company = (CompanyID)this->result;
bool rtl = _current_text_dir == TD_RTL; bool rtl = _current_text_dir == TD_RTL;

@ -44,9 +44,9 @@ public:
DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {} DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
virtual bool Selectable() const { return true; } bool Selectable() const override { return true; }
virtual uint Width() const; uint Width() const override;
virtual void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const; void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override;
virtual StringID String() const { return this->string; } virtual StringID String() const { return this->string; }
static int CDECL NatSortFunc(const DropDownListItem * const *first, const DropDownListItem * const *second); static int CDECL NatSortFunc(const DropDownListItem * const *first, const DropDownListItem * const *second);
@ -61,8 +61,8 @@ public:
DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {} DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {}
virtual StringID String() const; StringID String() const override;
virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; } void SetParam(uint index, uint64 value) { decode_params[index] = value; }
}; };
/** /**
@ -74,7 +74,7 @@ public:
DropDownListCharStringItem(const char *raw_string, int result, bool masked) : DropDownListStringItem(STR_JUST_RAW_STRING, result, masked), raw_string(raw_string) {} DropDownListCharStringItem(const char *raw_string, int result, bool masked) : DropDownListStringItem(STR_JUST_RAW_STRING, result, masked), raw_string(raw_string) {}
virtual StringID String() const; StringID String() const override;
}; };
/** /**

Loading…
Cancel
Save