diff options
| -rw-r--r-- | indra/newview/lluilistener.cpp | 31 | ||||
| -rw-r--r-- | indra/newview/lluilistener.h | 1 | 
2 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp index 4d6eac4958..dafca0abf2 100644 --- a/indra/newview/lluilistener.cpp +++ b/indra/newview/lluilistener.cpp @@ -47,6 +47,12 @@ LLUIListener::LLUIListener():          "as if from a user gesture on a menu -- or a button click.",          &LLUIListener::call,          LLSD().with("function", LLSD())); + +    add("getValue", +        "For the UI control identified by the path in [\"path\"], return the control's\n" +        "current value as [\"value\"] reply.", +        &LLUIListener::getValue, +        LLSD().with("path", LLSD()));  }  void LLUIListener::call(const LLSD& event) const @@ -71,3 +77,28 @@ void LLUIListener::call(const LLSD& event) const          (*func)(NULL, event["parameter"]);      }  } + +const LLUICtrl* resolve_path(const LLUICtrl* base, const std::string path)  +{ +    // *TODO: walk the path +    return NULL; +} + +void LLUIListener::getValue(const LLSD&event) const +{ +    LLSD reply; +     +    const LLUICtrl* root = NULL; // *TODO: look this up +    const LLUICtrl* ctrl = resolve_path(root, event["path"].asString()); +     +    if (ctrl)  +    { +        reply["value"] = ctrl->getValue(); +    } +    else +    { +        // *TODO: ??? return something indicating failure to resolve +    } +     +    sendReply(reply, event, "reply"); +} diff --git a/indra/newview/lluilistener.h b/indra/newview/lluilistener.h index e7847f01e8..08724024dc 100644 --- a/indra/newview/lluilistener.h +++ b/indra/newview/lluilistener.h @@ -41,6 +41,7 @@ public:  private:      void call(const LLSD& event) const; +    void getValue(const LLSD&event) const;  };  #endif /* ! defined(LL_LLUILISTENER_H) */  | 
