summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-08 12:59:47 +0000
committerrubidium <rubidium@openttd.org>2008-05-08 12:59:47 +0000
commitf3d184aee49946ee00b41423059d59478ab0cdc8 (patch)
tree93e0cdfaa25c7e394324651ebd74bbe7cc253e3b /src
parent92aac531c2fdc3e58c108a35e66f723360f46a9a (diff)
downloadopenttd-f3d184aee49946ee00b41423059d59478ab0cdc8.tar.xz
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
Diffstat (limited to 'src')
-rw-r--r--src/toolbar_gui.cpp20
-rw-r--r--src/window.cpp21
-rw-r--r--src/window_gui.h1
3 files changed, 20 insertions, 22 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index f0ac39dd8..17061c005 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -77,6 +77,26 @@ static Point GetToolbarDropdownPos(uint16 parent_button, int width, int height)
return pos;
}
+/**
+ * In a window with menu_d custom extension, retrieve the menu item number from a position
+ * @param w Window holding the menu items
+ * @param x X coordinate of the position
+ * @param y Y coordinate of the position
+ * @return Index number of the menu item, or \c -1 if no valid selection under position
+ */
+static int GetMenuItemIndex(const Window *w, int x, int y)
+{
+ if ((x -= w->left) >= 0 && x < w->width && (y -= w->top + 1) >= 0) {
+ y /= 10;
+
+ if (y < WP(w, const menu_d).item_count &&
+ !HasBit(WP(w, const menu_d).disabled_items, y)) {
+ return y;
+ }
+ }
+ return -1;
+}
+
/* --- Pausing --- */
static void ToolbarPauseClick(Window *w)
diff --git a/src/window.cpp b/src/window.cpp
index d59c39cef..787c607f7 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2009,27 +2009,6 @@ void UpdateWindows()
DrawMouseCursor();
}
-
-/**
- * In a window with menu_d custom extension, retrieve the menu item number from a position
- * @param w Window holding the menu items
- * @param x X coordinate of the position
- * @param y Y coordinate of the position
- * @return Index number of the menu item, or \c -1 if no valid selection under position
- */
-int GetMenuItemIndex(const Window *w, int x, int y)
-{
- if ((x -= w->left) >= 0 && x < w->width && (y -= w->top + 1) >= 0) {
- y /= 10;
-
- if (y < WP(w, const menu_d).item_count &&
- !HasBit(WP(w, const menu_d).disabled_items, y)) {
- return y;
- }
- }
- return -1;
-}
-
/**
* Mark window as dirty (in need of repainting)
* @param cls Window class
diff --git a/src/window_gui.h b/src/window_gui.h
index 14e666a63..fbc39f030 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -577,7 +577,6 @@ Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *d
void DrawWindowViewport(const Window *w);
-int GetMenuItemIndex(const Window *w, int x, int y);
void RelocateAllWindows(int neww, int newh);
/* misc_gui.cpp */