diff options
author | Merov Linden <merov@lindenlab.com> | 2012-02-17 14:42:12 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-02-17 14:42:12 -0800 |
commit | bb6ace0672fa5e1c47c534ba74396ef04daa408b (patch) | |
tree | 701f16864159f3777c29f27049b33066da2e8e3d /indra/llui | |
parent | 6363145f4556f3213f943637866445fae407593a (diff) |
EXP-1902, EXP-1903 : Move items cut to the trash when clipboard reset.
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llclipboard.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llclipboard.h | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp index ee1f1aa816..e0729366cc 100644 --- a/indra/llui/llclipboard.cpp +++ b/indra/llui/llclipboard.cpp @@ -47,9 +47,17 @@ LLClipboard::~LLClipboard() void LLClipboard::reset() { + // Increment the clipboard state mState++; + // Call the cleanup function (if any) before releasing the object list + if (mCutMode && mCleanupCallback) + { + mCleanupCallback(); + } + // Clear the clipboard mObjects.reset(); mCutMode = false; + mCleanupCallback = NULL; mString = LLWString(); } diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h index 0231169748..3947fa0229 100644 --- a/indra/llui/llclipboard.h +++ b/indra/llui/llclipboard.h @@ -27,6 +27,7 @@ #ifndef LL_LLCLIPBOARD_H #define LL_LLCLIPBOARD_H +#include <boost/function.hpp> #include "llstring.h" #include "lluuid.h" @@ -35,6 +36,8 @@ #include "llassettype.h" #include "llinventory.h" +typedef boost::function<void ()> cleanup_callback_t; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLClipboard // @@ -77,13 +80,15 @@ public: bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard bool isCutMode() const { return mCutMode; } - void setCutMode(bool mode) { mCutMode = mode; mState++; } + void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mState++; } private: LLDynamicArray<LLUUID> mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat) LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment). - bool mCutMode; // This is a convenience flag for the viewer. It has no influence on the cliboard management. + bool mCutMode; // This is a convenience flag for the viewer. Will determine if mCleanupCallback() needs to be called. + cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then). int mState; // Incremented when the clipboard change so that interested parties can check its state. + }; #endif // LL_LLCLIPBOARD_H |