Supports copy/paste for Open Inventor using the Windows clipboard. More...
#include <Inventor/Win/SoWinClipboard.h>
Public Member Functions | |
SoWinClipboard (SoWidget w, Atom selectionAtom=_XA_CLIPBOARD_) | |
~SoWinClipboard () | |
void | copy (SoNode *node, Time eventTime) |
void | copy (SoPath *path, Time eventTime) |
void | copy (SoPathList *pathList, Time eventTime) |
void | paste (Time eventTime, SoWinClipboardPasteCB *pasteDoneFunc, void *userData=NULL) |
This class manages data transfers for copy and paste to and from the Windows clipboard. Transfers may occur within the same window, from one window to another window, and from process to process.
Clipboard support is currently strictly text. The copy type cbFormat will be forced to CF_TEXT, no matter what, if anything, is specified in the second argument of the constructor.
SoWinClipboard::SoWinClipboard | ( | SoWidget | w, | |
Atom | selectionAtom = _XA_CLIPBOARD_ | |||
) |
Constructor.
w is the window that will be used for the clipboard operations. cbFormat specifies the Windows clipboard format to be used for the data transfer.
SoWinClipboard::~SoWinClipboard | ( | ) |
Destructor.
void SoWinClipboard::copy | ( | SoPathList * | pathList, | |
Time | eventTime | |||
) |
Copies the passed pathlist to the clipboard using the current clipboard format.
See copy() for details.
void SoWinClipboard::copy | ( | SoPath * | path, | |
Time | eventTime | |||
) |
Copies the passed path to the clipboard using the current clipboard format.
See copy() for details.
void SoWinClipboard::copy | ( | SoNode * | node, | |
Time | eventTime | |||
) |
Copies the passed scene graph object (node, path, or pathlist) to the clipboard using the current clipboard format.
The eventTime should be the time returned by the system routine time (), and can be used to insure synchronization of copy and paste requests.
For example,
#include <windows.h> #include <time.h> #include <...> ... (necessary Inventor includes) void SomeFunc(some_args) { HWND hwnd; // (window value gets set in normal Windows usage // or is passed in as an argument) ... SoNode *the_node // a node to copy to the clipboard // (will be incorporated in a pathlist) ... SoWinClipboard the_clipboard(hwnd); // CF_TEXT is forced as the clipboard format ... the_clipboard.copy(the_node, time(NULL)); // copy the node to the clipboard ... }
void SoWinClipboard::paste | ( | Time | eventTime, | |
SoWinClipboardPasteCB * | pasteDoneFunc, | |||
void * | userData = NULL | |||
) |
This requests data from the clipboard in the current clipboard format.
When the data is retrieved, the pasteDoneFunc callback is invoked. The newly pasted data is passed as the callback function's pathList argument (an SoPathList).