Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CP_TextBlock Class Reference

A class used to manage and draw a block of text. More...

List of all members.

Public Member Functions

Constructor / Destructor
 CP_TextBlock (CP_Canvas &inDestCanvas, const CP_String &inText, const CP_Rect &inBounds, SInt16 inLineSpacing=-1)
 Constructor.
 CP_TextBlock (const CP_TextBlock &inTextBlock)
virtual ~CP_TextBlock () throw ()
 Destructor.
Drawing
void DrawText (SInt16 inHorJustification, SInt16 inVerJustification)
Getters
SInt16 GetLineSpacing ()
SInt32 GetLongestLineLength ()
SInt32 GetActualTextDepth ()
Setters
void SetLineSpacing (SInt16 inLineSpacing)

Protected Attributes

CP_Canvas fDestCanvas
CP_String fText
CP_Rect fBounds
CP_SInt32s_Array fLineStarts
CP_SInt32s_Array fLineLengths
SInt16 fLineSpacing
CP_FontMetricsfDestCanvasFontMetrics

Private Member Functions

Calculation
void CalcLineEndings ()
SInt32 CalcVerStartPosn (SInt16 inVerJustification, SInt16 inLineHeight, SInt16 inLeading, SInt32 inNumberLines, SInt32 inAscentHeight)
SInt32 CalcHorStartPosn (SInt16 inHorJustification, char *inText, SInt32 inLineStart, SInt32 inlineLength)
bool IsWordBreakChar (char inCharacter)
Drawing
void DrawLine (SInt32 inHorPosn, SInt32 inVerPosn, char *inText, SInt32 inTextStart, SInt32 inLineLength)


Detailed Description

This class is used with the CP_View classes to handle the layout and drawing of text blocks.


Constructor & Destructor Documentation

CPLAT_Begin_Namespace_CPLAT CP_TextBlock::CP_TextBlock CP_Canvas inDestCanvas,
const CP_String inText,
const CP_Rect inBounds,
SInt16  inLineSpacing = -1
 

Constructor.

CP_TextBlock::CP_TextBlock const CP_TextBlock inTextBlock  ) 
 

Constructor.

CP_TextBlock::~CP_TextBlock  )  throw () [virtual]
 

Destructor.


Member Function Documentation

void CP_TextBlock::DrawText SInt16  inHorJustification,
SInt16  inVerJustification
 

SInt16 CP_TextBlock::GetLineSpacing  ) 
 

Returns the distance between each line when drawing the text block. This dimenstion is also referred to as the leading between lines.

Exceptions:
none 
Returns:
SInt16 The leading or distance between each line.

SInt32 CP_TextBlock::GetLongestLineLength  ) 
 

SInt32 CP_TextBlock::GetActualTextDepth  ) 
 

void CP_TextBlock::SetLineSpacing SInt16  inLineSpacing  ) 
 

Sets the distance between each line when drawing the text block. This dimenstion is also referred to as the leading between lines.

Exceptions:
none 
Returns:
SInt16 The leading or distance between each line.

void CP_TextBlock::CalcLineEndings  )  [private]
 

SInt32 CP_TextBlock::CalcVerStartPosn SInt16  inVerJustification,
SInt16  inLineHeight,
SInt16  inLeading,
SInt32  inNumberLines,
SInt32  inAscentHeight
[private]
 

SInt32 CP_TextBlock::CalcHorStartPosn SInt16  inHorJustification,
char *  inText,
SInt32  inLineStart,
SInt32  inlineLength
[private]
 

bool CP_TextBlock::IsWordBreakChar char  inCharacter  )  [private]
 

void CP_TextBlock::DrawLine SInt32  inHorPosn,
SInt32  inVerPosn,
char *  inText,
SInt32  inTextStart,
SInt32  inLineLength
[private]
 


Member Data Documentation

CP_Canvas CP_TextBlock::fDestCanvas [protected]
 

CP_String CP_TextBlock::fText [protected]
 

CP_Canvas to draw the text into.

CP_Rect CP_TextBlock::fBounds [protected]
 

The text being drawn.

CP_SInt32s_Array CP_TextBlock::fLineStarts [protected]
 

The area we want to draw the text into.

CP_SInt32s_Array CP_TextBlock::fLineLengths [protected]
 

Character index of where each line starts in the text.

SInt16 CP_TextBlock::fLineSpacing [protected]
 

Length of each line in characters.

CP_FontMetrics* CP_TextBlock::fDestCanvasFontMetrics [protected]
 

Leading or distance between each line when drawn.


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:22:13 2005 for CPLAT_MacOS by  doxygen 1.4.0