mirror of https://github.com/OpenTTD/OpenTTD
(svn r22310) -Codechange: Derive DropDownListCharStringItem from DropDownListStringItem.
parent
5bf90860f8
commit
18f0add50a
|
@ -44,14 +44,10 @@ StringID DropDownListParamStringItem::String() const
|
||||||
return this->string;
|
return this->string;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint DropDownListCharStringItem::Width() const
|
StringID DropDownListCharStringItem::String() const
|
||||||
{
|
{
|
||||||
return GetStringBoundingBox(this->string).width;
|
SetDParamStr(0, this->raw_string);
|
||||||
}
|
return this->string;
|
||||||
|
|
||||||
void DropDownListCharStringItem::Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
|
|
||||||
{
|
|
||||||
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->string, sel ? TC_WHITE : TC_BLACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "../window_type.h"
|
#include "../window_type.h"
|
||||||
#include "../gfx_func.h"
|
#include "../gfx_func.h"
|
||||||
|
#include "table/strings.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,16 +68,14 @@ public:
|
||||||
/**
|
/**
|
||||||
* List item containing a C char string.
|
* List item containing a C char string.
|
||||||
*/
|
*/
|
||||||
class DropDownListCharStringItem : public DropDownListItem {
|
class DropDownListCharStringItem : public DropDownListStringItem {
|
||||||
public:
|
public:
|
||||||
const char *string;
|
const char *raw_string;
|
||||||
|
|
||||||
DropDownListCharStringItem(const char *string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
|
DropDownListCharStringItem(const char *raw_string, int result, bool masked) : DropDownListStringItem(STR_JUST_RAW_STRING, result, masked), raw_string(raw_string) {}
|
||||||
virtual ~DropDownListCharStringItem() {}
|
virtual ~DropDownListCharStringItem() {}
|
||||||
|
|
||||||
virtual bool Selectable() const { return true; }
|
virtual StringID String() const;
|
||||||
virtual uint Width() const;
|
|
||||||
virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue