summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-11-07 17:24:04 +0000
committeralberth <alberth@openttd.org>2009-11-07 17:24:04 +0000
commit0bc03c25f48b6abce53cb43d71b31334d3f5bf35 (patch)
tree3a2fb874963ceb2b4499ed863b014b7692a124e0 /src/widgets
parentb500170ac2e286b1fe5a6c8529f1f963cd05ecdf (diff)
downloadopenttd-0bc03c25f48b6abce53cb43d71b31334d3f5bf35.tar.xz
(svn r17997) -Codechange: Introduce functions for querying top and bottom of the main view.
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dropdown.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp
index bd8e3f0a2..409b90966 100644
--- a/src/widgets/dropdown.cpp
+++ b/src/widgets/dropdown.cpp
@@ -377,18 +377,13 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u
int height = list_height;
/* Check if the status bar is visible, as we don't want to draw over it */
- Window *w3 = FindWindowById(WC_STATUS_BAR, 0);
- int screen_bottom = w3 == NULL ? _screen.height : w3->top;
-
+ int screen_bottom = GetMainViewBottom();
bool scroll = false;
/* Check if the dropdown will fully fit below the widget */
if (top + height + 4 >= screen_bottom) {
- w3 = FindWindowById(WC_MAIN_TOOLBAR, 0);
- int screen_top = w3 == NULL ? 0 : w3->top + w3->height;
-
/* If not, check if it will fit above the widget */
- if (w->top + wi_rect.top - height > screen_top) {
+ if (w->top + wi_rect.top - height > GetMainViewTop()) {
top = w->top + wi_rect.top - height - 4;
} else {
/* ... and lastly if it won't, enable the scroll bar and fit the