(svn r17947) -Codechange: make the statusbar, chat input and news window know of eachothers size so they don't get overlapped and don't get invisible (bottoms) of windows when a larger font is used

This commit is contained in:
rubidium
2009-11-02 10:15:48 +00:00
parent 4cb1409391
commit c4c56ea04d
4 changed files with 24 additions and 6 deletions

View File

@@ -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_status_widgets[] = {
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);
}