]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/CanvasEvent.hxx
Canvas: base Elements/Canvas on SGWeakReferenced.
[simgear.git] / simgear / canvas / CanvasEvent.hxx
index 88cb42161551029c8432fd2b49d48a712659bdcd..c3121269e90c90435e16eab424bac5f34c3ab5d1 100644 (file)
@@ -1,4 +1,4 @@
-// Canvas Event for event model similar to DOM Level 2 Event Model
+// Canvas Event for event model similar to DOM Level 3 Event Model
 //
 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
 //
@@ -26,7 +26,7 @@ namespace simgear
 namespace canvas
 {
 
-  struct Event
+  class Event
   {
     public:
 
@@ -41,12 +41,28 @@ namespace canvas
       };
 
       Type              type;
-      ElementWeakPtr    target;
+      ElementWeakPtr    target,
+                        current_target;
+      double            time;
+      bool              propagation_stopped;
 
       Event();
+
+      // We need a vtable to allow nasal::Ghost to determine the dynamic type
+      // of the actual event instances.
+      virtual ~Event();
+
       Type getType() const;
       std::string getTypeString() const;
+
       ElementWeakPtr getTarget() const;
+      ElementWeakPtr getCurrentTarget() const;
+
+      double getTime() const;
+
+      void stopPropagation();
+
+      static Type strToType(const std::string& str);
 
   };