| 1 |
NAME SoXtClipboard SoClpBrd "" { |
| 2 |
Provides Inventor copy/paste support |
| 3 |
} |
| 4 |
|
| 5 |
INCLUDE Xt/SoXtClipboard.h |
| 6 |
|
| 7 |
DEFINE { _XA_CLIPBOARD_ ((Atom) 0) } |
| 8 |
|
| 9 |
TYPEDEF void SoXtClipboardPasteCB "(void *userData, SoPathList *pathList)" |
| 10 |
TYPEDEF void SoXtClipboardImportCB "(void *userData, Atom dataType, void *data, uint32_t numBytes)" |
| 11 |
|
| 12 |
DESC { |
| 13 |
This class manages data transfers for copy and paste. Transfers may occur |
| 14 |
within the same process, or between different processes. |
| 15 |
This uses the Xt selection mechanism to implement the ICCCM protocol |
| 16 |
for the transfer of data. |
| 17 |
} |
| 18 |
|
| 19 |
METHOD "" SoXtClipboard(Widget w, Atom selectionAtom = _XA_CLIPBOARD_) {} |
| 20 |
METHOD "" ~SoXtClipboard() |
| 21 |
{ |
| 22 |
Constructor and destructor. \vw\. is the Xt widget for which this clipboard |
| 23 |
acts as an agent. \aselectionAtom\. is the X selection through which |
| 24 |
data should be transferred. For quick data transfers, this should be |
| 25 |
XA_PRIMARY. The default is _XA_CLIPBOARD_ which uses the X clipboard selection. |
| 26 |
} |
| 27 |
|
| 28 |
METHOD copyNode void copy(SoNode *node, Time eventTime) {} |
| 29 |
METHOD copyPath void copy(SoPath *path, Time eventTime) {} |
| 30 |
METHOD copyPathList void copy(SoPathList *pathList, Time eventTime) |
| 31 |
{ |
| 32 |
This copies the passed scene graph object, and tells the X server that |
| 33 |
the clipboard now owns the selection which was specified by |
| 34 |
\aselectionAtom\. in the constructor. When a paste happens (in this |
| 35 |
window, another window, or another process), the X server will ask this |
| 36 |
clipboard for the data it copied here. The \aeventTime\. should be the time |
| 37 |
found in the X event structure which triggered the copy operation, and |
| 38 |
is used to ensure synchronization of copy and paste requests. Data |
| 39 |
targets supported for export are INVENTOR_2_1, INVENTOR_2_1_FILE, |
| 40 |
INVENTOR_2_0, INVENTOR_2_0_FILE, VRML_1_0, VRML_1_0_FILE. Also exported |
| 41 |
for backwards compatibility are INVENTOR and INVENTOR_FILE, which are |
| 42 |
equivalent to INVENTOR_2_0 and INVENTOR_2_0_FILE. |
| 43 |
} |
| 44 |
|
| 45 |
METHOD copyData void copy(Atom dataType, void *data, uint32_t numBytes, Time eventTime) |
| 46 |
{ |
| 47 |
This behaves like the above copy routines, but the data can be in any |
| 48 |
format as specified by \adataType\.. |
| 49 |
} |
| 50 |
|
| 51 |
METHOD "" void paste(Time eventTime, |
| 52 |
SoXtClipboardPasteCB *pasteDoneFunc, |
| 53 |
void *userData = NULL) |
| 54 |
{ |
| 55 |
This makes a request to the X server for data to paste from the |
| 56 |
selection atom specified in the constructor (\aselectionAtom\.), then |
| 57 |
returns. When the data is retrieved from the selection owner, the |
| 58 |
\apasteDoneFunc\. callback is invoked. The newly pasted data is passed |
| 59 |
as the callback function's \apathList\. argument (an \cSoPathList\.). |
| 60 |
Data targets supported for import are INVENTOR_2_1, INVENTOR_2_1_FILE, |
| 61 |
INVENTOR_2_0, INVENTOR_2_0_FILE, VRML_1_0, VRML_1_0_FILE. Also imported |
| 62 |
for backwards compatibility are INVENTOR and INVENTOR_FILE, which are |
| 63 |
equivalent to INVENTOR_2_0 and INVENTOR_2_0_FILE. |
| 64 |
} |
| 65 |
|
| 66 |
METHOD "" void addPasteInterest(Atom dataType, |
| 67 |
SoXtClipboardImportCB *pasteImportFunc, |
| 68 |
void *userData = NULL) |
| 69 |
{ |
| 70 |
This extends the paste interest to recognize an additional target as |
| 71 |
specified by \adataType\.. It can be called multiple times to register |
| 72 |
interest in more than one extension. The \apasteImportFunc\. will be called when |
| 73 |
data of the registered type is pasted. |
| 74 |
|
| 75 |
Passing NULL as the pasteImportFunc will remove paste interest for that |
| 76 |
data type (even if the data type is one of the defaults). |
| 77 |
|
| 78 |
This should be called before \apaste()\. so that \apaste()\. will accept |
| 79 |
pastes of data types that have been registered here. |
| 80 |
|
| 81 |
A dataType atom can be created with XmInternAtom, e.g.: |
| 82 |
XmInternAtom(XtDisplay(widget),"INVENTOR",False); |
| 83 |
} |
| 84 |
|
| 85 |
ALSO { SoSelection, SoByteStream, SoXt, X Selections } |