changeset 161:e3fe6acc16fb

Replaced WidgetManager's click and motion callbacks with a drag event system. This is less flexible, but much closer to what is required (and is simpler and less open to bugs through unintended use). The widget under the mouse is now passed (although could just as easily have been before).
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 21 May 2009 22:15:40 +0200
parents ccd01fde535e
children 2476790223b8
files mde/gui/widget/AChildWidget.d
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mde/gui/widget/AChildWidget.d	Thu May 21 22:15:32 2009 +0200
+++ b/mde/gui/widget/AChildWidget.d	Thu May 21 22:15:40 2009 +0200
@@ -283,7 +283,7 @@
     }
     
     /// Called when a mouse click event occurs while held; handles up-click
-    override bool dragRelease (wdabs cx, wdabs cy, IChildWidget target) {
+    override bool dragRelease (wdabs cx, wdabs cy, IChildWidget) {
 	if (pushed) {	// on button
 	    parentIPPW.menuDone;
 	    activated();
@@ -295,8 +295,9 @@
 	return true;
     }
     /// Called when a mouse motion event occurs while held; handles pushing in/out on hover
-    override void dragMotion (wdabs cx, wdabs cy, IChildWidget) {
+    override void dragMotion (wdabs cx, wdabs cy, IChildWidget target) {
         bool oldPushed = pushed;
+	// test against dimensions and not target to include sub-widgets
         if (cx >= x && cx < x+w && cy >= y && cy < y+h) pushed = true;
         else pushed = false;
         if (oldPushed != pushed)