LClipboard is a PowerPlant class that is used for supporting the global clipboard in your application. It contains all the methods for setting and getting data or arbitrary type and size.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
To use LCLipboard, you create a single instance of it in your application, and attach the clipboard object to your application object. As an attachment, LClipboard looks for the msg_Event message. If a suspend or resume event occurs, LClipboard converts the local clipboard to the global scrap, or vice versa.
You always get a pointer to the clipboard with the static method GetClipboard(). To learn more information on using this object, refer to The PowerPlant Book.
Source files:
Ancestors:
Purpose:
The constructor creates the clipboard for your application.
Access:
Prototype:
LClipboard();Parameters:
Purpose:
The destructor destroys the clipboardobject.
Access:
Prototype:
virtual ~LClipboard();
Purpose:
Clipboard watches for Suspend and Resume events. The inMessage parameter will be msg_Event. The ioParam will be an EventRecord*. This method is an override of ExecuteSelf() in LAttachment.
Purpose:
Export the data in a local scrap to the global scrap.
Access:
Prototype:
virtual void ExportSelf();Parameters:
Return:
Remarks:
This implementation does nothing since this class uses the global scrap when setting and getting clipboard data. Subclasses should override this method if they maintain a local scrap.
Purpose:
This method returns the value of sClipboard, a pointer to the clipboard.
Access:
Prototype:
static LClipboard* GetClipboard();Parameters:
Return:
A pointer to an LClipboard object.
Remarks:
There is only one LClipboard object in an application, since this is a static data member.
Purpose:
This method passes back the data in the Clipboard of the specified type in a Handle, and returns the size of the data.
If ioDataH is nil, the data is not passed, but its size is returned. Otherwise,
ioDataH is resized if necessary to hold all the data.
This is a wrapper method which imports the global scrap if necessary, then calls a lower level function to actually retrieve the data.
Access:
Prototype:
virtual SInt32 GetData( ResType inDataType,Parameters:
Handle ioDataH);
This method has the following parameters:
Return:
SInt32 indicating the size of the data, in bytes.
Purpose:
Pass back the data in the Clipboard of the specified type in a Handle and return the size of the data
If ioDataH is nil, the data is not passed data, but its size is returned Otherwise, ioDataH is resized if necessary to hold all the data
This implementation gets the data from the global scrap. Subclasses should override to maintain a local scrap.
Access:
Prototype:
virtual SInt32 GetDataSelf( ResType inDataType,Parameters:
Handle ioDataH);
This method has the following parameters:
Return:
SInt32 indicating the size of the data, in bytes.
Purpose:
This implementation does nothing since this class uses the global scrap when setting and getting clipboard data. Subclasses should override this method if they maintain a local scrap.
Access:
Prototype:
virtual void ImportSelf();Parameters:
Return:
Purpose:
This method sets the Clipboard contents to the data specified by a pointer and length, or it sets the Clipboard contents to the data in a Handle.
Access:
Prototype:
virtual void SetData( ResType inDataType,
Ptr inDataPtr,
SInt32 inDataLength,
Boolean inReset );
virtual void SetData( ResType inDataType,Parameters:
Handle inDataH,
Boolean inReset );
This method has the following parameters:
Return:
Purpose:
This method sets the Clipboard contents to the data specified by a pointer and length. This implementation sets the data in the global scrap. Subclasses should override this method to maintain a local scrap.
Access:
Prototype:
virtual void SetDataSelf( ResType inDataType,Parameters:
Ptr inDataPtr,
SInt32 inDataLength,
Boolean inReset );
This method has the following parameters:
Return:
Purpose:
This data member is a static pointer to the Clipboard. There is only one Clipboard, hence the reason for the static pointer.
Access:
Prototype:
static LClipboard *sClipboard;
Purpose:
This data member indicates whether an import is pending. If the scrap changed while we were suspended, then we set the import pending flag to true. We don't need to import the data now, since the program may never request the data. This member would be set on receiving a Resume event.
Access:
Prototype:
Boolean mImportPending;
Purpose:
This data member indicates whether an export is pending. This member would be set on receiving a Suspend event.
Access:
Prototype:
Boolean mExportPending;