diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-19 12:19:11 +0200 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2009-11-19 12:19:11 +0200 |
commit | 58439da4c696f8dd6002e6399e4563cbda251a1e (patch) | |
tree | 261b81d6f3492b020852a03f8b358aabfd040836 /indra/newview/llappearancemgr.h | |
parent | da2a0cfceb9fbc7c66f23f8820309f36b6629530 (diff) | |
parent | 88cce61b09d225df0bcd8aab9dbd2c5a01ee7e19 (diff) |
Merge
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llappearancemgr.h')
-rw-r--r-- | indra/newview/llappearancemgr.h | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 88d3320d1f..12ffa336b4 100644 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -36,6 +36,7 @@ #include "llsingleton.h" #include "llinventorymodel.h" #include "llviewerinventory.h" +#include "llcallbacklist.h" class LLWearable; struct LLWearableHoldingPattern; @@ -81,6 +82,11 @@ public: void setAttachmentInvLinkEnable(bool val); void linkRegisteredAttachments(); + // utility function for bulk linking. + void linkAll(const LLUUID& category, + LLInventoryModel::item_array_t& items, + LLPointer<LLInventoryCallback> cb); + protected: LLAppearanceManager(); ~LLAppearanceManager(); @@ -88,9 +94,6 @@ protected: private: void filterWearableItems(LLInventoryModel::item_array_t& items, S32 max_per_type); - void linkAll(const LLUUID& category, - LLInventoryModel::item_array_t& items, - LLPointer<LLInventoryCallback> cb); void getDescendentsOfAssetType(const LLUUID& category, LLInventoryModel::item_array_t& items, @@ -111,4 +114,36 @@ private: #define SUPPORT_ENSEMBLES 0 +// Shim class and template function to allow arbitrary boost::bind +// expressions to be run as one-time idle callbacks. +template <typename T> +class OnIdleCallback +{ +public: + OnIdleCallback(T callable): + mCallable(callable) + { + } + static void onIdle(void *data) + { + gIdleCallbacks.deleteFunction(onIdle, data); + OnIdleCallback<T>* self = reinterpret_cast<OnIdleCallback<T>*>(data); + self->call(); + delete self; + } + void call() + { + mCallable(); + } +private: + T mCallable; +}; + +template <typename T> +void doOnIdle(T callable) +{ + OnIdleCallback<T>* cb_functor = new OnIdleCallback<T>(callable); + gIdleCallbacks.addFunction(&OnIdleCallback<T>::onIdle,cb_functor); +} + #endif |