]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/MouseEvent.hxx
Canvas::Text: add line-height property.
[simgear.git] / simgear / canvas / MouseEvent.hxx
index 39a6404d7ffbfe905fcf15594f00deee7e31f6db..f6faee76d8de3498d2d9694d9097143fdfe2ad1e 100644 (file)
@@ -34,18 +34,46 @@ namespace canvas
       MouseEvent():
         button(-1),
         state(-1),
-        mod(-1)
+        mod(-1),
+        click_count(0)
       {}
 
-      osg::Vec2f getPos() const { return pos; }
-      osg::Vec3f getPos3() const { return osg::Vec3f(pos, 0); }
+      MouseEvent(const osgGA::GUIEventAdapter& ea):
+        button(ea.getButton()),
+        state(ea.getButtonMask()),
+        mod(ea.getModKeyMask()),
+        click_count(0)
+      {
+        time = ea.getTime();
+      }
+
+      osg::Vec2f getScreenPos() const { return screen_pos; }
+      osg::Vec2f getClientPos() const { return client_pos; }
+      osg::Vec2f getLocalPos()  const { return  local_pos; }
       osg::Vec2f getDelta() const { return delta; }
 
-      osg::Vec2f  pos,
+      float getScreenX() const { return screen_pos.x(); }
+      float getScreenY() const { return screen_pos.y(); }
+
+      float getClientX() const { return client_pos.x(); }
+      float getClientY() const { return client_pos.y(); }
+
+      float getLocalX() const { return local_pos.x(); }
+      float getLocalY() const { return local_pos.y(); }
+
+      float getDeltaX() const { return delta.x(); }
+      float getDeltaY() const { return delta.y(); }
+
+      int getCurrentClickCount() const { return click_count; }
+
+      osg::Vec2f  screen_pos,   //<! Position in screen coordinates
+                  client_pos,   //<! Position in window/canvas coordinates
+                  local_pos,    //<! Position in local/element coordinates
                   delta;
-      int         button, //<! Button for this event
-                  state,  //<! Current button state
-                  mod;    //<! Keyboard modifier state
+      int         button,       //<! Button for this event
+                  state,        //<! Current button state
+                  mod,          //<! Keyboard modifier state
+                  click_count;  //<! Current click count
   };
 
 } // namespace canvas