Scaleform::GFx::State Scaleform::GFx::Clipboard
class Clipboard : public State;
TextClipboard is the default platform independent implementation of text clipboard. The platform specific implementations could be created by inheriting from this class and overloading OnTextStore virtual method. GetText virtual method can be overridden too, in order to retrieve data from the system clipboard (by default, it just returns internally stored data.
Use StateBag::SetClipboard method to set these custom clipboards to the loader.
An example of implementation of Win32 system text clipboard:
class FxPlayerTextClipboard : public Clipboard { public: void OnTextStore(const wchar_t* ptext, UPInt len) { // Store the text in a system clipboard. if (OpenClipboard(NULL)) { // Empty the Clipboard. This also has the effect of allowing Windows to free the memory associated with any data that is in the Clipboard EmptyClipboard(); HGLOBAL hClipboardData; hClipboardData = GlobalAlloc(GMEM_DDESHARE, (len+1)*sizeof(wchar_t)); SF_ASSERT(sizeof(wchar_t) == 2); // Calling GlobalLock returns a pointer to the data associated with the handle returned from GlobalAlloc wchar_t * pchData; pchData = (wchar_t*)GlobalLock(hClipboardData); SFwcscpy(pchData, len+1, ptext); // Once done, unlock the memory. Don't call GlobalFree because Windows will free the memory automatically when EmptyClipboard is next called. GlobalUnlock(hClipboardData); // Now,set the Clipboard data by specifying that Unicode text is being used and passing the handle to the global memory. SetClipboardData(CF_UNICODETEXT, hClipboardData); // Finally, close the Clipboard which has the effect of unlocking it so that other apps can examine or modify its contents. CloseClipboard(); } } };
Enumeration |
Description |
Formats in Clipboard as in flash.desktop.ClipboardFormats. |
Method |
Description |
Clipboard constructor. | |
Removes the text in the clipboard. | |
Determines whether a rich text is stored on the clipboard. | |
Clears the currently available format in the clipboard. | |
Returns the Formats currently available in the Clipboard. | |
Returns the rich text info stored in the text clipboard. | |
Returns the Formats supported by Clipboard implementation. | |
Returns a plain string stored in the clipborad. | |
A virtual method that is invoked when GFx stores plain text data in the clipboard. This callback may be used to store the data in a system clipboard. | |
Saves plain text inside the clipboard. | |
| |
Stores plain text and rich text in clipboard. |
GFx_Loader.h