summaryrefslogtreecommitdiff
path: root/src/widgets/dropdown_type.h
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/widgets/dropdown_type.h
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/widgets/dropdown_type.h')
-rw-r--r--src/widgets/dropdown_type.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h
index 3cdb48f87..aa4baafe1 100644
--- a/src/widgets/dropdown_type.h
+++ b/src/widgets/dropdown_type.h
@@ -19,9 +19,10 @@ public:
DropDownListItem(int result, bool masked) : result(result), masked(masked) {}
virtual ~DropDownListItem() {}
- virtual StringID String() const;
- virtual uint Height(uint width) const;
- virtual void Draw(int x, int y, uint width, uint height, bool sel) const;
+
+ virtual bool Selectable() const { return false; }
+ virtual uint Height(uint width) const { return 10; }
+ virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const;
};
/**
@@ -34,7 +35,9 @@ public:
DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
virtual ~DropDownListStringItem() {}
- StringID String() const;
+ virtual bool Selectable() const { return true; }
+ virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const;
+ virtual StringID String() const { return this->string; }
};
/**
@@ -47,8 +50,8 @@ public:
DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {}
virtual ~DropDownListParamStringItem() {}
- StringID String() const;
- void SetParam(uint index, uint64 value) { decode_params[index] = value; }
+ virtual StringID String() const;
+ virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; }
};
/**