diff options
author | alberth <alberth@openttd.org> | 2009-11-07 17:24:04 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-11-07 17:24:04 +0000 |
commit | 0bc03c25f48b6abce53cb43d71b31334d3f5bf35 (patch) | |
tree | 3a2fb874963ceb2b4499ed863b014b7692a124e0 /src/window.cpp | |
parent | b500170ac2e286b1fe5a6c8529f1f963cd05ecdf (diff) | |
download | openttd-0bc03c25f48b6abce53cb43d71b31334d3f5bf35.tar.xz |
(svn r17997) -Codechange: Introduce functions for querying top and bottom of the main view.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 0bffa019e..9af98fb07 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1602,6 +1602,26 @@ void ResizeWindow(Window *w, int delta_x, int delta_y) w->SetDirty(); } +/** Return the top of the main view available for general use. + * @return Uppermost vertical coordinate available. + * @note Above the upper y coordinate is often the main toolbar. + */ +int GetMainViewTop() +{ + Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0); + return (w == NULL) ? 0 : w->top + w->height; +} + +/** Return the bottom of the main view available for general use. + * @return The vertical coordinate of the first unusable row, so 'top + height <= bottom' gives the correct result. + * @note At and below the bottom y coordinate is often the status bar. + */ +int GetMainViewBottom() +{ + Window *w = FindWindowById(WC_STATUS_BAR, 0); + return (w == NULL) ? _screen.height : w->top; +} + /** The minimum number of pixels of the title bar must be visible in both the X or Y direction */ static const int MIN_VISIBLE_TITLE_BAR = 13; |