Programming Guide


The ContentObject Class

The ContentObject Class is a SOM class that the BaseContainer part uses to manipulate its content. The BaseContainer part wraps its embedded frames in a FrameObject class, which is subclassed from the ContentObject class. A subclassing part can also use the ContentObject class to define its intrinsic content, which will allow the part to delegate the manipulation of the intrinsic content to the BaseContainer if desired. The ContentObject class can also be used independently of the BaseContainer part because it does not invoke any BaseContainer-specific methods.

ContentObject Attributes

The following attributes are public in the ContentObject class. They can be accessed by the SOM methods that begin with the prefixes "set" and "get".
objType  (ODULong)  The type of the ContentObject. This attribute can be set to one of the following values:
COBJ_BASECLASS A generic content object.
COBJ_FRAMECLASS An embedded frame content object.
<user defined> A content object type defined by a subclass of the ContentObject class.
selectionState  (ODULong)  The selection state of the ContentObject. If 0, the object is not selected. The subclasses of ContentObject can use this attribute support multiple selection states.
boundingRect  (ODRect)  The bounding rectangle of the content object in its containing frame's coordinates.
containingFrame  (ODFrame)  A reference to the content object's containing frame.

Methods Defined in ContentObject Class

The following are methods defined in the Content Object Class.    


DeleteContents

This method closes or deletes the content object according to the input type.

Signature
void DeleteContents (ODULong type)

Parameters

type  (ODULong)  -  input 

An constant defining the circumstances under which the object is being deleted.
FRAME_CLOSED The content object's containing frame was closed.
FRAME_REMOVED The content object's containing frame was removed.
OBJECT_DELETED The content object itself was deleted.

Returns

None.

Remarks

The ContentObject class simply clears the object's attributes. Your content object would override this method if it has other attributes that should be deallocated when the object is deleted.    


MoveBy

This method moves the content object with the input point as the offset.

Signature
void MoveBy (ODPoint endPt)

Parameters

endPt  (ODPoint  -  input 

The offset which should be applied to the content object's origin.

Returns

None.

Remarks

The ContentObject class applies the input offset to the corners of the content object's bounding box. Your content object would override this method if it uses other attributes to move itself or if it cannot be defined by a bounding box.    


MoveToBack

This method moves the content object to the back of the Z-order with respect to the other content objects in the same containing frame.

Signature
void MoveToBack ()

Parameters

None.

Returns

None.

Remarks

The ContentObject class does not have any default behavior for this method. Your content object would override this method to re-render itself, so that the new Z-order is updated onscreen.    


MoveToFront

This method moves the content object to the front of the Z-order with respect to the other content objects in the same containing frame.

Signature
void MoveToFront ()

Parameters

None.

Returns

None.

Remarks

The ContentObject class does not have any default behavior for this method. Your content object would override this method to re-render itself, so that the new Z-order is updated onscreen.    


ReadContents

This method reads the content object in from the specified storage unit.

Signature
void ReadContents (ODStorageUnit fromSU,
                   BCTransferKind ReadKind,
                   BCCloneInfo *cloneInfo)

Parameters

toSu  (ODStorageUnit)  -  input 

A reference to the storageUnit from which the content object will be read.

ReadKind  (BCTransferKind)  -  input 

The type of cloning operation to perform on the storage unit.
EXTERNALIZE Write the content object's data out to the storage unit.
INTERNALIZE Read the content object's data in from the storage unit.
CLONEALL Clone the content object to the storage unit. This operation is applicable only if the content object is a wrapper for an ODPersistentObject or a subclass of ODPersistentObject, such as ODFrame.
CLONESELECTED Clone the content object to the storage unit if the content object is in the selected state. This operation is applicable only if the content object is a wrapper for an ODPersistentObject or a subclass of ODPersistentObject, such as ODFrame.

cloneInfo  (BCCloneInfo *)  -  input 

A data structure containing information about to clone the data to the storage unit.

Returns

None.

Remarks

The ContentObject class reads the content object's bounding box in from the storage unit, and reads in any cloning information that is present. Your content object would override this method if it has other attributes would be internalized from a storage unit, or if it cannot be defined by a bounding box.    


Resize

This method resizes the content object based on the input point.

Signature
void Resize (ODPoint endPt)

Parameters

endPt  (ODPoint  -  input 

The point in the content object's containing frame coordinates with which the new size should be obtained.

Returns

None.

Remarks

The ContentObject class redefines the content object's bounding box based on the input point. Your content object would override this method if it uses other attributes to resize itself or if it cannot be defined by a bounding box.    


WriteContents

This method writes the content object to the specified storage unit.

Signature
void WriteContents (ODStorageUnit toSU,
                    BCTransferKind writeKind,
                    BCCloneInfo *cloneInfo)

Parameters

toSu  (ODStorageUnit)  -  input 

A reference to the storageUnit to which the content object will be written.

writeKind  (BCTransferKind)  -  input 

The type of cloning operation to perform on the storage unit.
EXTERNALIZE Write the content object's data out to the storage unit.
INTERNALIZE Read the content object's data in from the storage unit.
CLONEALL Clone the content object to the storage unit. This operation is applicable only if the content object is a wrapper for an ODPersistentObject or a subclass of ODPersistentObject, such as ODFrame.
CLONESELECTED Clone the content object to the storage unit if the content object is in the selected state. This operation is applicable only if the content object is a wrapper for an ODPersistentObject or a subclass of ODPersistentObject, such as ODFrame.

cloneInfo  (BCCloneInfo *)  -  input 

A data structure containing information about to clone the data to the storage unit.

Returns

None.

Remarks

The ContentObject class writes the content object type and the bounding box out to the storage unit. Your content object would override this method if it has other attributes that should be saved, or if it cannot be defined by a bounding box.


[ Top | Previous | Next | Contents | Index | Documentation Homepage ]