diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-08-30 09:53:43 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-08-30 09:53:43 -0400 |
commit | 6e8ba7e1179c0ac8c3a085e010992ea91fb15114 (patch) | |
tree | f3301a6b4bd40850da6584df925615f7e3bc9db4 /indra/llui | |
parent | 5fb224bb8196e77259bef2a0ef60e82533c358a2 (diff) |
CHOP-763: Introduce LLView::getPathname().
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llview.cpp | 19 | ||||
-rw-r--r-- | indra/llui/llview.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 56b09791a4..474b568a87 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -31,6 +31,7 @@ #include "llview.h" #include <cassert> +#include <sstream> #include <boost/tokenizer.hpp> #include <boost/foreach.hpp> #include <boost/bind.hpp> @@ -430,6 +431,24 @@ BOOL LLView::isInEnabledChain() const return enabled; } +static void buildPathname(std::ostream& out, const LLView* view) +{ + if (view) + { + // While we're not yet at root level, keep recurring towards top + buildPathname(out, view->getParent()); + } + // Build pathname into ostream on the way back from recursion. + out << '/' << view->getName(); +} + +std::string LLView::getPathname() const +{ + std::ostringstream out; + buildPathname(out, this); + return out.str(); +} + // virtual BOOL LLView::canFocusChildren() const { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 67634938fb..11f25bcd7f 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -444,6 +444,7 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); + std::string getPathname() const; template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const { |