diff options
author | Andrew A. de Laix <alain@lindenlab.com> | 2011-09-08 09:46:04 -0500 |
---|---|---|
committer | Andrew A. de Laix <alain@lindenlab.com> | 2011-09-08 09:46:04 -0500 |
commit | 2d19a2002501d44ce18080b6f26ceaf2dbf796e9 (patch) | |
tree | 1053ccf7b2eb2881c77909fa9b90afd09447329c /indra/llui | |
parent | 9fd8fb15d9ef4de3c22605ec4a0745eb67ae9550 (diff) |
add getInfo to LLView to get state information about ui elements.
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/lluictrl.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 22 | ||||
-rw-r--r-- | indra/llui/llview.h | 6 |
4 files changed, 36 insertions, 2 deletions
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..9b9e2ddb55 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -1045,3 +1045,9 @@ boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); return mDoubleClickSignal->connect(cb); } + +void LLUICtrl::addInfo(LLSD & info) +{ + LLView::addInfo(info); + info["value"] = getValue(); +} diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..8a8b589e9c 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -301,7 +301,9 @@ protected: static F32 sActiveControlTransparency; static F32 sInactiveControlTransparency; - + + virtual void addInfo(LLSD & info); + private: BOOL mIsChrome; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a630a03c92..e2b9527cc5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -47,6 +47,7 @@ #include "v3color.h" #include "lluictrlfactory.h" #include "lltooltip.h" +#include "llsdutil.h" // for ui edit hack #include "llbutton.h" @@ -2606,3 +2607,24 @@ const LLViewDrawContext& LLViewDrawContext::getCurrentContext() return *sDrawContextStack.back(); } + +LLSD LLView::getInfo(void) +{ + LLSD info; + addInfo(info); + return info; +} + +void LLView::addInfo(LLSD & info) +{ + info["path"] = getPathname(); + info["class"] = typeid(*this).name(); + info["visible"] = getVisible(); + info["visible_chain"] = isInVisibleChain(); + info["enabled"] = getEnabled(); + info["enabled_chain"] = isInEnabledChain(); + info["available"] = isAvailable(); + LLRect rect(calcScreenRect()); + info["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop) + ("right", rect.mRight)("bottom", rect.mBottom); +} diff --git a/indra/llui/llview.h b/indra/llui/llview.h index fcae75c447..fe15307a5d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -516,6 +516,9 @@ public: virtual S32 notify(const LLSD& info) { return 0;}; static const LLViewDrawContext& getDrawContext(); + + // Returns useful information about this ui widget. + LLSD getInfo(void); protected: void drawDebugRect(); @@ -546,7 +549,8 @@ protected: LLView* childrenHandleToolTip(S32 x, S32 y, MASK mask); ECursorType mHoverCursor; - + + virtual void addInfo(LLSD & info); private: template <typename METHOD, typename XDATA> |