(svn r25020) -Codechange: refactor SmallMapWindow to make adding map types easier and unduplicate some code (fonsinchen)

This commit is contained in:
rubidium
2013-02-17 20:51:55 +00:00
parent dfdced2239
commit 52aeef1a79
2 changed files with 123 additions and 109 deletions

View File

@@ -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();