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

 

LCaption



Overview:

LCaption is a PowerPlant class that is used for displaying static text.

Methods :

The methods in this class are:

 

LCaption()  
~LCaption()  
DrawSelf()  
GetDescriptor()  
GetTextTraitsID()  
GetValue()  
SetDescriptor()  
SetTextTraitsID()  
SetValue()  
 

Data Members:

The data members in this class are:

 

mText  
mTxtrID  

Operation:

This class uses a text traits resource to specify characteristics such as font, size, style, color, and justification. LCaption uses the UTextDrawing class to draw text.

You can configure the text and the text traits resource in the Constructor resource editor, or you can may these characteristics at runtime.

It is possible that you will encounter a drawing problem if you modify the contents of the caption at runtime. DrawSelf() uses the DrawWithJustification() method of UTextDrawing, that does not erase the previous contents of the caption. The best way to erase the contents is to attach an LEraseAttachment object to the caption.

Source files:

(Pane Classes)

LCaption.h

LCaption.cp

See also:

LAttachment

LEraseAttachment

UTextDrawing

LCaption()

Purpose:

The constructors create the object from the passed-in parameters.

Access:

Public

Prototype:

LCaption();

LCaption( const LCaption &inOriginal );

LCaption( const SPaneInfo &inPaneInfo,
ConstStringPtr inString,
ResIDT inTextTraitsID );

LCaption( LStream *inStream );
Parameters:

The parameters for these constructors are:

 

SPaneInfo&  
inPaneInfo  
A reference to the Pane that hosts this caption.  
LCaption&  
inOriginal  
A reference to a caption to be copied.  
ConstStringPtr  
inString  
A pointer to the caption text.  
ResIDT  
inTextTraitsID  
The text traits for the caption.  
LStream*  
inStream  
A pointer to a stream object that contains the information to create the LCaption object.  

~LCaption()

Purpose:

The destructor destroys the object.

Access:

Virtual, Public

Prototype:

virtual ~LCaption();
Parameters:

None

DrawSelf()

Purpose:

Draw the caption using the colors and traits specified.

Access:

Virtual, Protected

Prototype:

virtual void DrawSelf();
Parameters:

None

Return:

None

GetDescriptor()

Purpose:

Return contents of the caption as a string.

Access:

Virtual, Public

Prototype:

virtual StringPtr GetDescriptor(
Str255 outDescriptor) const;
Parameters:

The parameter for this method is:

 

Str255  
outDescriptor  
A pointer to a buffer, to contain the string on exit.  

Return:

A pointer to a string, using the StringPtr type.

GetTextTraitsID()

Purpose:

This method returns the value of the mTxtrID data member.

Access:

Inline, Public

Prototype:

ResIDT GetTextTraitsID() const;
Parameters :

None

Return:

A resource ID, using the ResIDT type.

GetValue()

Purpose:

Return the integer value represented by the text of the caption, held in the mText data member.

Access:

Virtual, Public

Prototype:

virtual SInt32 GetValue() const;
Parameters:

None

Return:

SInt32 containing the value of mText.

SetDescriptor()

Purpose:

Set contents of the caption from a string.

Access:

Virtual, Public

Prototype:

virtual void SetDescriptor(
ConstStringPtr inDescriptor);
Parameters:

The parameter for this method is:

 

ConstStringPtr  
inDescriptor  
A pointer to a buffer, containing the string to set for the caption.  

Return:

None

SetTextTraitsID()

Purpose:

This member sets the value of the mTxtrID data member to a resource ID for a resource containing the text traits information.

Access:

Public

Prototype:

void SetTextTraitsID( ResIDT inTxtrID );
Parameters:

The parameter for this method is:

 

ResIDT  
inTxtrID  
A ResIDT containing the resource ID value to put in the mTxtrID data member.  

Return:

None

SetValue()

Purpose:

Set a caption to the text representation of an integer value.

Access:

Virtual, Public

Prototype:

virtual void SetValue( SInt32 inValue );
Parameters:

The parameter for this method is:

 

SInt32  
inValue  
The integer value to set the caption to.  

Return:

None

mText

Purpose:

This data member contains the caption string.

Access:

Protected

Prototype:

LStr255 mText;

mTxtrID

Purpose:

This data member contains a resource ID for a resource that contains the text traits information for the caption.

Access:

Protected

Prototype:

ResIDT mTxtrID;

 


[ 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