]> git.mxchange.org Git - simgear.git/commitdiff
canvas::Element: add getter for parent element.
authorThomas Geymayer <tomgey@gmail.com>
Wed, 23 Oct 2013 15:11:03 +0000 (17:11 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Wed, 23 Oct 2013 15:11:03 +0000 (17:11 +0200)
simgear/canvas/elements/CanvasElement.cxx
simgear/canvas/elements/CanvasElement.hxx

index 3692bf90bef5d0584b98471caf09bbe6949908cc..f4eacd1f41c864798d3b442e1503c3974ce4db8d 100644 (file)
@@ -85,6 +85,12 @@ namespace canvas
     return boost::static_pointer_cast<Element>(_self.lock());
   }
 
+  //----------------------------------------------------------------------------
+  ElementPtr Element::getParent()
+  {
+    return _parent ? _parent->getWeakPtr().lock() : ElementPtr();
+  }
+
   //----------------------------------------------------------------------------
   void Element::update(double dt)
   {
index f44bee43bedef270722ef820c91ec73e41139115..53357f1c7ce709b8c0f3a0188e7a0ac5f20c82d6 100644 (file)
@@ -84,6 +84,7 @@ namespace canvas
       virtual void onDestroy();
 
       ElementWeakPtr getWeakPtr() const;
+      ElementPtr getParent();
 
       /**
        * Called every frame to update internal state