Changeset - r15241:1536e1ddc5ef
[Not reviewed]
master
0 2 0
alberth - 14 years ago 2010-05-23 14:53:39
alberth@openttd.org
(svn r19886) -Add [FS#3705]: Perform window callback during mouse dragging for the purpose of highlighting the destination (sbr).
2 files changed with 26 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/window.cpp
Show inline comments
 
@@ -1379,12 +1379,30 @@ static bool HandleDragDrop()
 

	
 
	ResetObjectToPlace();
 

	
 
	return false;
 
}
 

	
 
static bool HandleMouseDrag()
 
{
 
	if (_special_mouse_mode != WSM_DRAGDROP) return true;
 
	if (!_left_button_down || (_cursor.delta.x == 0 && _cursor.delta.y == 0)) return true;
 

	
 
	Window *w = GetCallbackWnd();
 

	
 
	if (w != NULL) {
 
		/* Send an event in client coordinates. */
 
		Point pt;
 
		pt.x = _cursor.pos.x - w->left;
 
		pt.y = _cursor.pos.y - w->top;
 
		w->OnMouseDrag(pt, GetWidgetFromPos(w, pt.x, pt.y));
 
	}
 

	
 
	return false;
 
}
 

	
 
static bool HandleMouseOver()
 
{
 
	Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
 

	
 
	/* We changed window, put a MOUSEOVER event to the last window */
 
	if (_mouseover_last_w != NULL && _mouseover_last_w != w) {
 
@@ -2054,12 +2072,13 @@ static void HandleKeyScrolling()
 
static void MouseLoop(MouseClick click, int mousewheel)
 
{
 
	HandlePlacePresize();
 
	UpdateTileSelection();
 

	
 
	if (!VpHandlePlaceSizingDrag())  return;
 
	if (!HandleMouseDrag())          return;
 
	if (!HandleDragDrop())           return;
 
	if (!HandleWindowDragging())     return;
 
	if (!HandleScrollbarScrolling()) return;
 
	if (!HandleViewportScroll())     return;
 
	if (!HandleMouseOver())          return;
 

	
src/window_gui.h
Show inline comments
 
@@ -654,12 +654,19 @@ public:
 
	 * @param pt     the point inside the window that has been clicked.
 
	 * @param widget the clicked widget.
 
	 */
 
	virtual void OnRightClick(Point pt, int widget) {}
 

	
 
	/**
 
	 * An 'object' is being dragged at the provided position, highlight the target if possible.
 
	 * @param pt     The point inside the window that the mouse hovers over.
 
	 * @param widget The widget the mouse hovers over.
 
	 */
 
	virtual void OnMouseDrag(Point pt, int widget) {}
 

	
 
	/**
 
	 * A dragged 'object' has been released.
 
	 * @param pt     the point inside the window where the release took place.
 
	 * @param widget the widget where the release took place.
 
	 */
 
	virtual void OnDragDrop(Point pt, int widget) {}
 

	
0 comments (0 inline, 0 general)