Changeset - r9144:012e6a5899cf
[Not reviewed]
master
0 3 0
rubidium - 16 years ago 2008-05-08 12:59:47
rubidium@openttd.org
(svn r13006) -Codechange: GetMenuItemIndex is only used for the toolbar, so move it to there.
3 files changed with 20 insertions and 22 deletions:
0 comments (0 inline, 0 general)
src/toolbar_gui.cpp
Show inline comments
 
@@ -77,6 +77,26 @@ static Point GetToolbarDropdownPos(uint1
 
	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)
src/window.cpp
Show inline comments
 
@@ -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
src/window_gui.h
Show inline comments
 
@@ -577,7 +577,6 @@ Wcls *AllocateWindowDescFront(const Wind
 

	
 
void DrawWindowViewport(const Window *w);
 

	
 
int GetMenuItemIndex(const Window *w, int x, int y);
 
void RelocateAllWindows(int neww, int newh);
 

	
 
/* misc_gui.cpp */
0 comments (0 inline, 0 general)