diff mde/gui/WidgetManager.d @ 91:4d5d53e4f881

Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too. Some debugging improvements. When multiple .mtt files are read for merging, files with invalid headers are ignored and no error is thrown so long as at least one file os valid.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 16 Oct 2008 17:43:48 +0100
parents b525ff28774b
children 085f2ca31914
line wrap: on
line diff
--- a/mde/gui/WidgetManager.d	Wed Oct 01 23:37:51 2008 +0100
+++ b/mde/gui/WidgetManager.d	Thu Oct 16 17:43:48 2008 +0100
@@ -95,8 +95,12 @@
             // See IWidgetManager.addClickCallback's documentation:
             if (dg (cast(wdabs)cx, cast(wdabs)cy, b, state)) return;
         
-        // NOTE: do we need to test if the click was on the gui (and thus child)?
-        // FIXME: yes, unless we can guarantee this!
+        // test the click was on the child widget
+        // cx/cy are unsigned, thus >= 0. Widget starts at (0,0)
+        if (cx >= child.width || cy >= child.height) {
+            debug logger.warn ("WidgetManager received click not on child; potentially an error");
+            return;
+        }
         IChildWidget widg = child.getWidget (cast(wdabs)cx,cast(wdabs)cy);
         if (widg !is null)
             widg.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state);
@@ -387,7 +391,7 @@
      * given in that module has the flag TAKES_CONTENT. */
     IChildWidget makeWidget (widgetID id, IContent content = null) {
         debug (mdeWidgets) logger.trace ("Creating widget \""~id~'"');
-        return createWidget (this, curData[id], content);
+        return createWidget (this, id, curData[id], content);
     }
     
     /** For making changes. */