]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/CanvasEventManager.hxx
Canvas: Ensure all element types are initialized before first usage.
[simgear.git] / simgear / canvas / CanvasEventManager.hxx
index f8e80571f405264ff2be2c6a653fb55eb30bac0f..efdd0b560ddf395c844acff6e861ca1f46d6f377 100644 (file)
@@ -34,6 +34,10 @@ namespace canvas
                     local_delta;
   };
   typedef std::deque<EventTarget> EventPropagationPath;
+  inline bool operator==(const EventTarget& t1, const EventTarget& t2)
+  {
+    return t1.element.lock() == t2.element.lock();
+  }
 
   class EventManager
   {
@@ -46,14 +50,11 @@ namespace canvas
     protected:
       struct StampedPropagationPath
       {
-        StampedPropagationPath():
-          time(0)
-        {}
+        StampedPropagationPath();
+        StampedPropagationPath(const EventPropagationPath& path, double time);
 
-        StampedPropagationPath(const EventPropagationPath& path, double time):
-          path(path),
-          time(time)
-        {}
+        void clear();
+        bool valid() const;
 
         EventPropagationPath path;
         double time;
@@ -62,15 +63,22 @@ namespace canvas
       // TODO if we really need the paths modify to not copy around the paths
       //      that much.
       StampedPropagationPath _last_mouse_down,
-                             _last_click;
+                             _last_click,
+                             _last_mouse_over;
       size_t _current_click_count;
 
       /**
        * Propagate click event and handle multi-click (eg. create dblclick)
        */
-      void handleClick( const MouseEventPtr& event,
+      bool handleClick( const MouseEventPtr& event,
                         const EventPropagationPath& path );
 
+      /**
+       * Handle mouseover/enter/out/leave
+       */
+      bool handleMove( const MouseEventPtr& event,
+                       const EventPropagationPath& path );
+
       bool propagateEvent( const EventPtr& event,
                            const EventPropagationPath& path );