From: Thomas Geymayer Date: Wed, 23 Oct 2013 15:11:03 +0000 (+0200) Subject: canvas::Element: add getter for parent element. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca79d99ec49260b05993b5309e40e31b19400777;p=simgear.git canvas::Element: add getter for parent element. --- diff --git a/simgear/canvas/elements/CanvasElement.cxx b/simgear/canvas/elements/CanvasElement.cxx index 3692bf90..f4eacd1f 100644 --- a/simgear/canvas/elements/CanvasElement.cxx +++ b/simgear/canvas/elements/CanvasElement.cxx @@ -85,6 +85,12 @@ namespace canvas return boost::static_pointer_cast(_self.lock()); } + //---------------------------------------------------------------------------- + ElementPtr Element::getParent() + { + return _parent ? _parent->getWeakPtr().lock() : ElementPtr(); + } + //---------------------------------------------------------------------------- void Element::update(double dt) { diff --git a/simgear/canvas/elements/CanvasElement.hxx b/simgear/canvas/elements/CanvasElement.hxx index f44bee43..53357f1c 100644 --- a/simgear/canvas/elements/CanvasElement.hxx +++ b/simgear/canvas/elements/CanvasElement.hxx @@ -84,6 +84,7 @@ namespace canvas virtual void onDestroy(); ElementWeakPtr getWeakPtr() const; + ElementPtr getParent(); /** * Called every frame to update internal state