[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

LClipboard



Overview:

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:

 

LClipboard()  
~LClipboard()  
ExecuteSelf()  
ExportSelf()  
GetClipboard()  
GetData()  
GetDataSelf()  
ImportSelf()  
SetData()  
SetDataSelf()  

Data Members:

The data members in this class are:

 

sClipboard  
mImportPending  
mExportPending  
 

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:

(Support Classes)

LClipboard.h

LClipboard.cp

Ancestors:

LAttachment

LClipboard()

Purpose:

The constructor creates the clipboard for your application.

Access:

Public

Prototype:

LClipboard();
Parameters:

None

~LClipboard()

Purpose:

The destructor destroys the clipboardobject.

Access:

Virtual, Public

Prototype:

virtual ~LClipboard();

ExecuteSelf()

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.

ExportSelf()

Purpose:

Export the data in a local scrap to the global scrap.

Access:

Protected

Prototype:

virtual void ExportSelf();
Parameters:

None

Return:

None

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.

GetClipboard()

Purpose:

This method returns the value of sClipboard, a pointer to the clipboard.

Access:

Inline, Static, Public

Prototype:

static LClipboard* GetClipboard();
Parameters:

None

Return:

A pointer to an LClipboard object.

Remarks:

There is only one LClipboard object in an application, since this is a static data member.

GetData()

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:

Virtual, Public

Prototype:

virtual SInt32 GetData( ResType inDataType,
Handle ioDataH);
Parameters:

This method has the following parameters:

 

ResType  
inDataType  
This is the resource ID for the type of data.  
Handle  
ioDataH  
This is a handle to the data that is resized to accommodate the data.  

Return:

SInt32 indicating the size of the data, in bytes.

GetDataSelf()

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:

Virtual, Protected

Prototype:

virtual SInt32 GetDataSelf( ResType inDataType,
Handle ioDataH);
Parameters:

This method has the following parameters:

 

ResType  
inDataType  
This is the resource ID for the type of data.  
Handle  
ioDataH  
This is a handle to the data that is resized to accommodate the data.  

Return:

SInt32 indicating the size of the data, in bytes.

ImportSelf()

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:

Virtual, Protected

Prototype:

virtual void ImportSelf();
Parameters:

None

Return:

None

SetData()

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:

Virtual, Public

Prototype:

virtual void SetData( ResType inDataType,
Ptr inDataPtr,
SInt32 inDataLength,
Boolean inReset );

virtual void SetData( ResType inDataType,
Handle inDataH,
Boolean inReset );
Parameters:

This method has the following parameters:

 

ResType  
inDataType  
This is the resource ID for the type of data.  
Ptr  
inDataPtr  
This is a pointer to some data to put on the Clipboard.  
Handle  
inDataH  
This is a handle to the data that is resized to accommodate the data.  
SInt32  
inData-Length  
This is the size of the data pointed to by inDataPtr.  
Boolean  
inReset  
This specifies whether to clear the existing contents of the Clipboard before storing the new data.  

Return:

None

SetDataSelf()

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:

Virtual, Protected

Prototype:

virtual void SetDataSelf( ResType inDataType,
Ptr inDataPtr,
SInt32 inDataLength,
Boolean inReset );
Parameters:

This method has the following parameters:

 

ResType  
inDataType  
This is the resource ID for the type of data.  
Ptr  
inDataPtr  
This is a pointer to some data to put on the Clipboard.  
SInt32  
inData-Length  
This is the size of the data pointed to by inDataPtr.  
Boolean  
inReset  
This specifies whether to clear the existing contents of the Clipboard before storing the new data.  

Return:

None

sClipboard

Purpose:

This data member is a static pointer to the Clipboard. There is only one Clipboard, hence the reason for the static pointer.

Access:

Protected

Prototype:

static LClipboard *sClipboard;

mImportPending

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:

Protected

Prototype:

Boolean mImportPending;

mExportPending

Purpose:

This data member indicates whether an export is pending. This member would be set on receiving a Suspend event.

Access:

Protected

Prototype:

Boolean mExportPending;

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000