Author: matt
Date: 2012-04-29 17:27:48 -0700 (Sun, 29 Apr 2012)
New Revision: 9410
Log:
Testing window coordinte calculation for popup menu.

Modified:
   branches/branch-3.0/src/fltk3/MenuButton.cxx

Modified: branches/branch-3.0/src/fltk3/MenuButton.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/MenuButton.cxx        2012-04-29 23:59:59 UTC 
(rev 9409)
+++ branches/branch-3.0/src/fltk3/MenuButton.cxx        2012-04-30 00:27:48 UTC 
(rev 9410)
@@ -61,9 +61,21 @@
   redraw();
   fltk3::WidgetTracker mb(this);
   if (!box() || type()) {
-    m = menu()->popup(fltk3::event_x(), fltk3::event_y(), label(), mvalue(), 
this);
+    m = menu()->popup(event_x_root()-event_x(), event_y_root()-event_y(), 
label(), mvalue(), this);
   } else {
-    m = menu()->pulldown(x(), y(), w(), h(), 0, this);
+    // FIXME: we need a function in Widget for this
+    int mx = x(), my = y();
+    Group *gi = parent();
+    while (gi) {
+      if (gi->is_group_relative()) {
+        mx += gi->x();
+        my += gi->y();
+      }
+      if (gi->type()>=WINDOW) 
+        break;
+      gi = gi->parent();
+    }
+    m = menu()->pulldown(mx, my, w(), h(), 0, this);
   }
   picked(m);
   pressed_menu_button_ = 0;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to