(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 148d9b8e38
commit 4a970202a9
4 changed files with 24 additions and 6 deletions

View File

@@ -280,6 +280,7 @@ assert_compile(lengthof(_news_type_data) == NT_END);
/** Window class displaying a news item. */
struct NewsWindow : Window {
uint16 chat_height; ///< Height of the chat window.
uint16 status_height; ///< Height of the status bar window
NewsItem *ni; ///< News item to display.
static uint duration; ///< Remaining time for showing current news message (may only be accessed while a news item is displayed).
@@ -288,6 +289,7 @@ struct NewsWindow : Window {
NewsWindow::duration = 555;
const Window *w = FindWindowById(WC_SEND_NETWORK_MSG, 0);
this->chat_height = (w != NULL) ? w->height : 0;
this->status_height = FindWindowById(WC_STATUS_BAR, 0)->height;
this->flags4 |= WF_DISABLE_VP_SCROLL;
@@ -490,7 +492,7 @@ struct NewsWindow : Window {
virtual void OnTick()
{
/* Scroll up newsmessages from the bottom in steps of 4 pixels */
int y = max(this->top - 4, _screen.height - this->height - 12 - this->chat_height);
int y = max(this->top - 4, _screen.height - this->height - this->status_height - this->chat_height);
if (y == this->top) return;
if (this->viewport != NULL) this->viewport->top += y - this->top;