summaryrefslogtreecommitdiff
path: root/src/player_gui.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-08-06 07:10:40 +0000
committerpeter1138 <peter1138@openttd.org>2008-08-06 07:10:40 +0000
commit98d3d86004520bfb32e8e4d90c9f0c5210828deb (patch)
tree4eb36d7e879c9f32d78be743b8b4b3e7a274638e /src/player_gui.cpp
parent85c84c9d86cc9dc21b6e38e9a112cbe5e29576cc (diff)
downloadopenttd-98d3d86004520bfb32e8e4d90c9f0c5210828deb.tar.xz
(svn r14004) -Codechange: Clean of drop down lists.
Move empty item drawing to base ListItem Draw() function. Remove String() from base class. Pass correct width to Draw().
Diffstat (limited to 'src/player_gui.cpp')
-rw-r--r--src/player_gui.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index 16d3debdb..50177686f 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -299,20 +299,25 @@ public:
virtual ~DropDownListColourItem() {}
- virtual StringID String() const
+ StringID String() const
{
return _colour_dropdown[this->result];
}
- virtual uint Height(uint width) const
+ uint Height(uint width) const
{
return 14;
}
+
+ bool Selectable() const
+ {
+ return true;
+ }
- virtual void Draw(int x, int y, uint width, uint height, bool sel) const
+ void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const
{
DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOR_START + this->result, x + 16, y + 7);
- DrawStringTruncated(x + 32, y + 3, this->String(), sel ? TC_WHITE : TC_BLACK, x + width - 30);
+ DrawStringTruncated(x + 32, y + 3, this->String(), sel ? TC_WHITE : TC_BLACK, width - 30);
}
};