Changeset - r23441:2965f5a62eaa
[Not reviewed]
master
0 5 0
peter1138 - 5 years ago 2019-03-09 18:20:03
peter1138@openttd.org
Codechange: Use Colours type instead of byte.
5 files changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -533,13 +533,13 @@ public:
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
	{
 
		bool rtl = _current_text_dir == TD_RTL;
 
		int height = bottom - top;
 
		int icon_y_offset = height / 2;
 
		int text_y_offset = (height - FONT_HEIGHT_NORMAL) / 2 + 1;
 
		DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + (this->result % COLOUR_END),
src/newgrf_gui.cpp
Show inline comments
 
@@ -575,13 +575,13 @@ public:
 

	
 
	bool Selectable() const
 
	{
 
		return true;
 
	}
 

	
 
	void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
	void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
	{
 
		DrawString(left + 2, right + 2, top, _grf_preset_list[this->result], sel ? TC_WHITE : TC_BLACK);
 
	}
 
};
 

	
 

	
src/toolbar_gui.cpp
Show inline comments
 
@@ -101,13 +101,13 @@ public:
 

	
 
	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
 
	void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
	{
 
		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);
 
@@ -146,13 +146,13 @@ public:
 

	
 
	uint Height(uint width) const
 
	{
 
		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, int bg_colour) const
 
	void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
	{
 
		CompanyID company = (CompanyID)this->result;
 
		bool rtl = _current_text_dir == TD_RTL;
 

	
 
		/* It's possible the company is deleted while the dropdown is open */
 
		if (!Company::IsValidID(company)) return;
src/widgets/dropdown.cpp
Show inline comments
 
@@ -19,13 +19,13 @@
 

	
 
#include "dropdown_widget.h"
 

	
 
#include "../safeguards.h"
 

	
 

	
 
void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
{
 
	int c1 = _colour_gradient[bg_colour][3];
 
	int c2 = _colour_gradient[bg_colour][7];
 

	
 
	int mid = top + this->Height(0) / 2;
 
	GfxFillRect(left + 1, mid - 2, right - 1, mid - 2, c1);
 
@@ -36,13 +36,13 @@ uint DropDownListStringItem::Width() con
 
{
 
	char buffer[512];
 
	GetString(buffer, this->String(), lastof(buffer));
 
	return GetStringBoundingBox(buffer).width;
 
}
 

	
 
void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
 
void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
 
{
 
	DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->String(), sel ? TC_WHITE : TC_BLACK);
 
}
 

	
 
/**
 
 * Natural sorting comparator function for DropDownList::sort().
src/widgets/dropdown_type.h
Show inline comments
 
@@ -29,13 +29,13 @@ public:
 
	DropDownListItem(int result, bool masked) : result(result), masked(masked) {}
 
	virtual ~DropDownListItem() {}
 

	
 
	virtual bool Selectable() const { return false; }
 
	virtual uint Height(uint width) const { return FONT_HEIGHT_NORMAL; }
 
	virtual uint Width() const { return 0; }
 
	virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const;
 
	virtual void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const;
 
};
 

	
 
/**
 
 * Common string list item.
 
 */
 
class DropDownListStringItem : public DropDownListItem {
 
@@ -44,13 +44,13 @@ public:
 

	
 
	DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
 
	virtual ~DropDownListStringItem() {}
 

	
 
	virtual bool Selectable() const { return true; }
 
	virtual uint Width() const;
 
	virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const;
 
	virtual void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const;
 
	virtual StringID String() const { return this->string; }
 

	
 
	static int CDECL NatSortFunc(const DropDownListItem * const *first, const DropDownListItem * const *second);
 
};
 

	
 
/**
0 comments (0 inline, 0 general)