diff options
-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 { |