diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-07-09 10:17:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 10:17:11 -0400 |
commit | 0b337d5ffec731120adf85da45ceb1ddf5e74621 (patch) | |
tree | f9f875a4ce16ec8c5528aa90d729d0ba8ebf96e4 /indra/llui | |
parent | 66fb45ddc7dd1a994f6b8312687cb73dbb1281dd (diff) | |
parent | ece0f4eb566af937d724f60f934beb6dfcb4d493 (diff) |
Merge pull request #1892 from secondlife/lua-appearance-listener
Lua appearance listener
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llluafloater.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/indra/llui/llluafloater.cpp b/indra/llui/llluafloater.cpp index e584a67a00..b08508bf9b 100644 --- a/indra/llui/llluafloater.cpp +++ b/indra/llui/llluafloater.cpp @@ -101,6 +101,15 @@ LLLuaFloater::LLLuaFloater(const LLSD &key) : } }, requiredParams); + mDispatchListener.add("clear_list", "", [this](const LLSD &event) + { + LLScrollListCtrl *ctrl = getChild<LLScrollListCtrl>(event["ctrl_name"].asString()); + if(ctrl) + { + ctrl->deleteAllItems(); + } + }, llsd::map("ctrl_name", LLSD())); + mDispatchListener.add("add_text", "", [this](const LLSD &event) { LLTextEditor *editor = getChild<LLTextEditor>(event["ctrl_name"].asString()); @@ -111,15 +120,35 @@ LLLuaFloater::LLLuaFloater(const LLSD &key) : } }, requiredParams); + mDispatchListener.add("set_label", "", [this](const LLSD &event) + { + LLButton *btn = getChild<LLButton>(event["ctrl_name"].asString()); + if (btn) + { + btn->setLabel((event["value"]).asString()); + } + }, requiredParams); + mDispatchListener.add("set_title", "", [this](const LLSD &event) { setTitle(event["value"].asString()); }, llsd::map("value", LLSD())); - + mDispatchListener.add("get_value", "", [ctrl_lookup](const LLSD &event) { return ctrl_lookup(event, [](LLUICtrl *ctrl, const LLSD &event) { return llsd::map("value", ctrl->getValue()); }); }, llsd::map("ctrl_name", LLSD(), "reqid", LLSD())); + + mDispatchListener.add("get_selected_id", "", [this](const LLSD &event) + { + LLScrollListCtrl *ctrl = getChild<LLScrollListCtrl>(event["ctrl_name"].asString()); + if (!ctrl) + { + LL_WARNS("LuaFloater") << "Control not found: " << event["ctrl_name"] << LL_ENDL; + return LLSD(); + } + return llsd::map("value", ctrl->getCurrentID()); + }, llsd::map("ctrl_name", LLSD(), "reqid", LLSD())); } LLLuaFloater::~LLLuaFloater() |