summaryrefslogtreecommitdiff
path: root/indra/llui/lluictrl.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lluictrl.h')
-rw-r--r--indra/llui/lluictrl.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 8cd9950917..2c73ff6b57 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -274,11 +274,56 @@ public:
template <typename F, typename DERIVED> class CallbackRegistry : public LLRegistrySingleton<std::string, F, DERIVED >
{};
+ struct CommitCallbackInfo
+ {
+ enum EUntrustedCall
+ {
+ UNTRUSTED_ALLOW,
+ UNTRUSTED_BLOCK,
+ UNTRUSTED_THROTTLE
+ };
+
+ CommitCallbackInfo(commit_callback_t func = {}, EUntrustedCall handle_untrusted = UNTRUSTED_ALLOW) :
+ callback_func(func),
+ handle_untrusted(handle_untrusted)
+ {
+ }
- class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry>
+ public:
+ commit_callback_t callback_func;
+ EUntrustedCall handle_untrusted;
+ };
+ typedef LLUICtrl::CommitCallbackInfo cb_info;
+ class CommitCallbackRegistry : public CallbackRegistry<CommitCallbackInfo, CommitCallbackRegistry>
{
LLSINGLETON_EMPTY_CTOR(CommitCallbackRegistry);
};
+
+ class CommitRegistrarHelper
+ {
+ public:
+ CommitRegistrarHelper(LLUICtrl::CommitCallbackRegistry::Registrar &registrar) : mRegistrar(registrar) {}
+
+ template <typename... ARGS> void add(const std::string &name, ARGS &&...args)
+ {
+ mRegistrar.add(name, {std::forward<ARGS>(args)...});
+ }
+ private:
+ LLUICtrl::CommitCallbackRegistry::Registrar &mRegistrar;
+ };
+
+ class ScopedRegistrarHelper
+ {
+ public:
+ template <typename... ARGS> void add(const std::string &name, ARGS &&...args)
+ {
+ mRegistrar.add(name, {std::forward<ARGS>(args)...});
+ }
+
+ private:
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar mRegistrar;
+ };
+
// the enable callback registry is also used for visiblity callbacks
class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry>
{