diff options
author | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2007-01-02 08:33:20 +0000 |
commit | 420b91db29485df39fd6e724e782c449158811cb (patch) | |
tree | b471a94563af914d3ed3edd3e856d21cb1b69945 /indra/llui/llclipboard.cpp |
Print done when done.
Diffstat (limited to 'indra/llui/llclipboard.cpp')
-rw-r--r-- | indra/llui/llclipboard.cpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp new file mode 100644 index 0000000000..f2b546ec28 --- /dev/null +++ b/indra/llui/llclipboard.cpp @@ -0,0 +1,71 @@ +/** + * @file llclipboard.cpp + * @brief LLClipboard base class + * + * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" + +#include "llclipboard.h" + +#include "llerror.h" +#include "llmath.h" +#include "llstring.h" +#include "llview.h" +#include "llwindow.h" + +// Global singleton +LLClipboard gClipboard; + + +LLClipboard::LLClipboard() +{ +} + + +LLClipboard::~LLClipboard() +{ +} + + +void LLClipboard::copyFromSubstring(const LLWString &src, S32 pos, S32 len, const LLUUID& source_id ) +{ + mSourceID = source_id; + mString = src.substr(pos, len); + LLView::getWindow()->copyTextToClipboard( mString ); +} + + +LLWString LLClipboard::getPasteWString( LLUUID* source_id ) +{ + if( mSourceID.notNull() ) + { + LLWString temp_string; + LLView::getWindow()->pasteTextFromClipboard(temp_string); + + if( temp_string != mString ) + { + mSourceID.setNull(); + mString = temp_string; + } + } + else + { + LLView::getWindow()->pasteTextFromClipboard(mString); + } + + if( source_id ) + { + *source_id = mSourceID; + } + + return mString; +} + + +BOOL LLClipboard::canPasteString() +{ + return LLView::getWindow()->isClipboardTextAvailable(); +} |