Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoXtClipboard Class Reference

Supports copy/paste for Open Inventor using the Xt clipboard. More...

#include <Inventor/Xt/SoXtClipboard.h>

Public Member Functions

 SoXtClipboard (SoWidget w, Atom selectionAtom=_XA_CLIPBOARD_)
 Constructor.
 
 ~SoXtClipboard ()
 Destructor.
 
void copy (SoNode *node, Time eventTime)
 This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.
 
void copy (SoPath *path, Time eventTime)
 This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.
 
void copy (SoPathList *pathList, Time eventTime)
 This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.
 
void copy (Atom dataType, void *data, uint32_t numBytes, Time eventTime)
 
void paste (Time eventTime, SoXtClipboardPasteCB *pasteDoneFunc, void *userData=NULL)
 This makes a request to the X server for data to paste from the selection atom specified in the constructor (selectionAtom), then returns.
 
void addPasteInterest (Atom dataType, SoXtClipboardImportCB *pasteImportFunc, void *userData=NULL)
 This extends the paste interest to recognize an additional target as specified by dataType.
 

Detailed Description

Supports copy/paste for Open Inventor using the Xt clipboard.

This class manages data transfers for copy and paste. Transfers may occur within the same process, or between different processes. This uses the Xt selection mechanism to implement the ICCCM protocol for the transfer of data.

SEE ALSO

SoSelection, SoXt

Definition at line 112 of file SoXtClipboard.h.

Constructor & Destructor Documentation

◆ SoXtClipboard()

SoXtClipboard::SoXtClipboard ( SoWidget  w,
Atom  selectionAtom = _XA_CLIPBOARD_ 
)

Constructor.

w is the Xt widget that will be used for the clipboard operations. selectionAtom is the X selection through which data should be transferred. For quick data transfers, this should be XA_PRIMARY. The default is XA_CLIPBOARD which uses the X clipboard selection.

◆ ~SoXtClipboard()

SoXtClipboard::~SoXtClipboard ( )

Destructor.

Member Function Documentation

◆ addPasteInterest()

void SoXtClipboard::addPasteInterest ( Atom  dataType,
SoXtClipboardImportCB pasteImportFunc,
void *  userData = NULL 
)

This extends the paste interest to recognize an additional target as specified by dataType.

It can be called multiple times to register interest in more than one extension. The pasteImportFunc will be called when data of the registered type is pasted. Passing NULL as the pasteImportFunc will remove paste interest for that data type (even if the data type is one of the defaults). This should be called before paste() so that paste() will accept pastes of data types that have been registered here.

A dataType atom can be created with XmInternAtom, e.g.:

 XmInternAtom(XtDisplay(widget),"INVENTOR",False);

◆ copy() [1/4]

void SoXtClipboard::copy ( Atom  dataType,
void *  data,
uint32_t  numBytes,
Time  eventTime 
)

◆ copy() [2/4]

void SoXtClipboard::copy ( SoNode node,
Time  eventTime 
)

This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.

When a paste happens (in this window, another window, or another process), the X server will ask this clipboard for the data it copied here. The eventTime should be the time found in the X event structure which triggered the copy operation, and is used to ensure synchronization of copy and paste requests. Data targets supported for export are INVENTOR_2_1, INVENTOR_2_1_FILE, INVENTOR_2_0, INVENTOR_2_0_FILE. Also exported for backwards compatibility are INVENTOR and INVENTOR_FILE, which are equivalent to INVENTOR_2_0 and INVENTOR_2_0_FILE.

◆ copy() [3/4]

void SoXtClipboard::copy ( SoPath path,
Time  eventTime 
)

This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.

See copy(SoNode *node, Time eventTime) for additional details.

◆ copy() [4/4]

void SoXtClipboard::copy ( SoPathList pathList,
Time  eventTime 
)

This copies the passed scene graph object, and tells the X server that the clipboard now owns the selection which was specified by selectionAtom in the constructor.

See copy(SoNode *node, Time eventTime) for additional details.

◆ paste()

void SoXtClipboard::paste ( Time  eventTime,
SoXtClipboardPasteCB pasteDoneFunc,
void *  userData = NULL 
)

This makes a request to the X server for data to paste from the selection atom specified in the constructor (selectionAtom), then returns.

When the data is retrieved from the selection owner, the pasteDoneFunc callback is invoked. The newly pasted data is passed as the callback function's pathList argument (an SoPathList). Data targets supported for import are INVENTOR_2_1, INVENTOR_2_1_FILE, INVENTOR_2_0, INVENTOR_2_0_FILE. Also imported for backwards compatibility are INVENTOR and INVENTOR_FILE, which are equivalent to INVENTOR_2_0 and INVENTOR_2_0_FILE.


The documentation for this class was generated from the following file: