Resizeable smallmap GUI, that will fit all FIRS industries
This commit is contained in:
@@ -71,7 +71,6 @@ protected:
|
||||
static const uint FORCE_REFRESH_PERIOD = 930; ///< map is redrawn after that many milliseconds.
|
||||
static const uint BLINK_PERIOD = 450; ///< highlight blinking interval in milliseconds.
|
||||
|
||||
bool show_legend; ///< Display legend.
|
||||
uint min_number_of_columns; ///< Minimal number of columns in legends.
|
||||
uint min_number_of_fixed_rows; ///< Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY).
|
||||
uint column_width; ///< Width of a column in the #WID_SM_LEGEND widget.
|
||||
@@ -112,15 +111,6 @@ protected:
|
||||
GfxFillRect(x2 - 3, y, x2, y, PC_VERY_LIGHT_YELLOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute minimal required width of the legends.
|
||||
* @return Minimally needed width for displaying the smallmap legends in pixels.
|
||||
*/
|
||||
inline uint GetMinLegendWidth() const
|
||||
{
|
||||
return show_legend ? WD_FRAMERECT_LEFT + this->min_number_of_columns * this->column_width : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of columns that can be displayed in \a width pixels.
|
||||
* @return Number of columns to display.
|
||||
@@ -137,8 +127,8 @@ protected:
|
||||
*/
|
||||
inline uint GetLegendHeight(uint num_columns) const
|
||||
{
|
||||
return show_legend ? WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM +
|
||||
this->min_number_of_fixed_rows * this->row_height : 0;
|
||||
return WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM +
|
||||
this->min_number_of_fixed_rows * this->row_height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,6 +172,16 @@ public:
|
||||
void SmallMapCenterOnCurrentPos();
|
||||
Point GetStationMiddle(const Station *st) const;
|
||||
|
||||
/**
|
||||
* Compute minimal required width of the legends.
|
||||
* @return Minimally needed width for displaying the smallmap legends in pixels.
|
||||
*/
|
||||
inline int GetMinLegendWidth() const
|
||||
{
|
||||
printf("GetMinLegendWidth: this->min_number_of_columns %d this->column_width %d\n", this->min_number_of_columns, this->column_width);
|
||||
return WD_FRAMERECT_LEFT + this->min_number_of_columns * this->column_width;
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const;
|
||||
virtual void OnInit();
|
||||
virtual void OnPaint();
|
||||
@@ -194,6 +194,7 @@ public:
|
||||
virtual void OnScroll(Point delta);
|
||||
virtual void OnMouseOver(Point pt, int widget);
|
||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize);
|
||||
|
||||
};
|
||||
|
||||
#endif /* SMALLMAP_GUI_H */
|
||||
|
||||
Reference in New Issue
Block a user