summaryrefslogtreecommitdiff
path: root/src/smallmap_gui.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-02-17 20:51:55 +0000
committerrubidium <rubidium@openttd.org>2013-02-17 20:51:55 +0000
commit52aeef1a79a91dce085fb04726b4a36340c7b091 (patch)
tree604600e340c02bdb0276b18b0b1b8a09ca7c211e /src/smallmap_gui.h
parentdfdced2239ae50ac2f672d156242a1de5d7118a3 (diff)
downloadopenttd-52aeef1a79a91dce085fb04726b4a36340c7b091.tar.xz
(svn r25020) -Codechange: refactor SmallMapWindow to make adding map types easier and unduplicate some code (fonsinchen)
Diffstat (limited to 'src/smallmap_gui.h')
-rw-r--r--src/smallmap_gui.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/smallmap_gui.h b/src/smallmap_gui.h
index d21b8d63e..3cd216440 100644
--- a/src/smallmap_gui.h
+++ b/src/smallmap_gui.h
@@ -139,8 +139,19 @@ public:
return width / this->column_width;
}
- uint GetLegendHeight(uint num_columns) const;
+ /**
+ * Compute height given a number of columns.
+ * @param num_columns Number of columns.
+ * @return Needed height for displaying the smallmap legends in pixels.
+ */
+ inline uint GetLegendHeight(uint num_columns) const
+ {
+ return WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM +
+ this->GetNumberRowsLegend(num_columns) * FONT_HEIGHT_SMALL;
+ }
+ uint GetNumberRowsLegend(uint columns) const;
+ void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item = 0);
void SwitchMapType(SmallMapType map_type);
void SetNewScroll(int sx, int sy, int sub);
void SmallMapCenterOnCurrentPos();