add getInfo to LLView to get state information about ui elements.
parent
9fd8fb15d9
commit
2d19a20025
|
|
@ -149,6 +149,11 @@ public:
|
|||
* @endcode
|
||||
*/
|
||||
LLSD& operator[](const LLSD::String& key) { return mResp[key]; }
|
||||
|
||||
/**
|
||||
* set the response to the given data
|
||||
*/
|
||||
void setResponse(LLSD const & response){ mResp = response; }
|
||||
|
||||
LLSD mResp, mReq;
|
||||
LLSD::String mKey;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -301,7 +301,9 @@ protected:
|
|||
|
||||
static F32 sActiveControlTransparency;
|
||||
static F32 sInactiveControlTransparency;
|
||||
|
||||
|
||||
virtual void addInfo(LLSD & info);
|
||||
|
||||
private:
|
||||
|
||||
BOOL mIsChrome;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -135,18 +135,6 @@ protected:
|
|||
|
||||
namespace {
|
||||
|
||||
void insertViewInformation(LLEventAPI::Response & response, LLView * target)
|
||||
{
|
||||
// Get info about this LLView* for when we send response.
|
||||
response["path"] = target->getPathname();
|
||||
response["class"] = typeid(*target).name();
|
||||
response["visible"] = target->getVisible();
|
||||
response["visible_chain"] = target->isInVisibleChain();
|
||||
response["enabled"] = target->getEnabled();
|
||||
response["enabled_chain"] = target->isInEnabledChain();
|
||||
response["available"] = target->isAvailable();
|
||||
}
|
||||
|
||||
// helper for getMask()
|
||||
MASK lookupMask_(const std::string& maskname)
|
||||
{
|
||||
|
|
@ -219,10 +207,7 @@ void LLWindowListener::getInfo(LLSD const & evt)
|
|||
LLUI::resolvePath(gViewerWindow->getRootView(), path);
|
||||
if (target_view != 0)
|
||||
{
|
||||
insertViewInformation(response, target_view);
|
||||
LLRect rect(target_view->calcScreenRect());
|
||||
response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop)
|
||||
("right", rect.mRight)("bottom", rect.mBottom);
|
||||
response.setResponse(target_view->getInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -253,7 +238,7 @@ void LLWindowListener::keyDown(LLSD const & evt)
|
|||
}
|
||||
else if(target_view->isAvailable())
|
||||
{
|
||||
insertViewInformation(response, target_view);
|
||||
response.setResponse(target_view->getInfo());
|
||||
|
||||
gFocusMgr.setKeyboardFocus(target_view);
|
||||
KEY key = getKEY(evt);
|
||||
|
|
@ -290,7 +275,7 @@ void LLWindowListener::keyUp(LLSD const & evt)
|
|||
}
|
||||
else if (target_view->isAvailable())
|
||||
{
|
||||
insertViewInformation(response, target_view);
|
||||
response.setResponse(target_view->getInfo());
|
||||
|
||||
gFocusMgr.setKeyboardFocus(target_view);
|
||||
mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
|
||||
|
|
@ -370,12 +355,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request)
|
|||
"specified invalid \"path\": '" << path << "'"));
|
||||
}
|
||||
|
||||
insertViewInformation(response, target);
|
||||
|
||||
// Don't show caller the LLView's own relative rectangle; that only
|
||||
// tells its dimensions. Provide actual location on screen.
|
||||
LLRect rect(target->calcScreenRect());
|
||||
response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop)("right", rect.mRight)("bottom", rect.mBottom);
|
||||
response.setResponse(target->getInfo());
|
||||
|
||||
// The intent of this test is to prevent trying to drill down to a
|
||||
// widget in a hidden floater, or on a tab that's not current, etc.
|
||||
|
|
@ -397,6 +377,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request)
|
|||
|
||||
if (! has_pos)
|
||||
{
|
||||
LLRect rect(target->calcScreenRect());
|
||||
pos.set(rect.getCenterX(), rect.getCenterY());
|
||||
// nonstandard warning tactic: probably usual case; we want event
|
||||
// sender to know synthesized (x, y), but maybe don't need to log?
|
||||
|
|
|
|||
Loading…
Reference in New Issue