diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -98,11 +98,22 @@ struct StatusBarWindow : Window { this->InitNested(desc); } + virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) + { + Point pt = { (_screen.width - max(sm_width, desc->default_width)) / 2, _screen.height - sm_height }; + return pt; + } + virtual void OnPaint() { this->DrawWidgets(); } + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) + { + size->height = FONT_HEIGHT_NORMAL + padding.height; + } + virtual void DrawWidget(const Rect &r, int widget) const { switch (widget) { @@ -202,7 +213,7 @@ static const NWidgetPart _nested_main_st EndContainer(), }; -static WindowDesc _main_status_desc( +static const WindowDesc _main_status_desc( WDP_CENTER, 0, 320, 12, 640, 12, WC_STATUS_BAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_NO_FOCUS, @@ -220,6 +231,5 @@ bool IsNewsTickerShown() void ShowStatusBar() { - _main_status_desc.top = _screen.height - 12; new StatusBarWindow(&_main_status_desc); }