OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TCharFormat Class Reference

TCharFormat encapsulates the CHARFORMAT2 structure which contains information about character formatting in a rich edit control. More...

#include <owl/richedit.h>

Inheritance diagram for owl::TCharFormat:

Public Member Functions

 TCharFormat (ulong mask=0)
 Constructor of a 'TCharFormat' structure initialized with the specified mask.
 
 TCharFormat (const TRichEdit &, bool selection=true, ulong mask=CFM_ALL)
 Constructs a CharacterFormat structure from the current character attributes of a RICHEDIT control.
 
void ToggleEffectsBit (ulong flag)
 Toggles the effect bits specified in the 'flag' parameter.
 
void ToggleMaskBit (ulong flag)
 Toggles the mask bits specified in the 'flag' parameter.
 
void EnableBold (bool=true)
 Toggles the bold character attribute according to the boolean parameter specified.
 
void EnableItalic (bool=true)
 Toggles italic character attribute based on the boolean parameter specified.
 
void EnableUnderline (bool=true)
 Toggles the underline character attribute based on the boolean parameter specified.
 
void EnableStrikeOut (bool=true)
 Toggles the strike-out character attribute based on the boolean parameter specified.
 
void EnableProtected (bool=true)
 Toggles the protected character attribute based on the boolean parameter specified.
 
void SetHeight (long)
 Sets the character height.
 
void SetOffset (long)
 Sets the character offset from the baseline.
 
void SetTextColor (const TColor &=TColor::None)
 Updates the CHARFORMAT structure with the specified color.
 
void SetCharSet (uint8)
 Sets the character set of the font.
 
void SetPitchAndFamily (uint8)
 Sets the pitch and family of the font.
 
void SetFaceName (LPCTSTR)
 Sets the face name of the font.
 
void SetFaceName (const tstring &f)
 
TColor GetTextColor () const
 Retrieves the character color stored in the CHARFORMAT structure.
 
TColor GetBkColor () const
 Retrieves the character background color stored in the CHARFORMAT structure.
 
void SetFontInfo (LOGFONT &lf) const
 Transfers the information currently in the underlying CHARFORMAT structure to a LOGFONT structure.
 
void GetFontInfo (const LOGFONT &lf)
 Initializes the underlying CHARFORMAT structure using the information stored in a LOGFONT structure.
 
void SetWeight (uint16 weigh)
 Font weight (LOGFONT value)
 
void SetSpacing (int16 spacing)
 Amount to space between letters.
 
void SetBkColor (const TColor &clr)
 Background color.
 
void SetLCID (LCID lcid)
 Locale ID.
 
void SetStyle (int16 style)
 Style handle.
 
void SetKerning (uint16 kern)
 Twip size above which to kern char pair.
 
void SetUnderlineType (uint8 utype)
 Underline type.
 
void SetAnimation (uint8 anim)
 Animated text like marching ants.
 
void SetRevAuthor (uint8 revav)
 Revision author index.
 

Detailed Description

TCharFormat encapsulates the CHARFORMAT2 structure which contains information about character formatting in a rich edit control.

Definition at line 56 of file richedit.h.

Constructor & Destructor Documentation

◆ TCharFormat() [1/2]

owl::TCharFormat::TCharFormat ( ulong mask = 0)
inline

Constructor of a 'TCharFormat' structure initialized with the specified mask.

Note
This constructor is typically used for constructing an object which will be filled with the appropriate character format information by a rich edit control. The 'mask' specifies which field should be filled.

Definition at line 578 of file richedit.h.

◆ TCharFormat() [2/2]

owl::TCharFormat::TCharFormat ( const TRichEdit & edit,
bool selection = true,
ulong mask = CFM_ALL )

Constructs a CharacterFormat structure from the current character attributes of a RICHEDIT control.

Note
Specifying 'true' for selection will return the attribute of the character at the current location if there are no block of data selected in the control.

Definition at line 53 of file richedit.cpp.

References owl::TRichEdit::GetCharFormat(), and PRECONDITION.

Member Function Documentation

◆ EnableBold()

void owl::TCharFormat::EnableBold ( bool flag = true)

Toggles the bold character attribute according to the boolean parameter specified.

Definition at line 71 of file richedit.cpp.

◆ EnableItalic()

void owl::TCharFormat::EnableItalic ( bool flag = true)

Toggles italic character attribute based on the boolean parameter specified.

Definition at line 84 of file richedit.cpp.

◆ EnableProtected()

void owl::TCharFormat::EnableProtected ( bool flag = true)

Toggles the protected character attribute based on the boolean parameter specified.

Definition at line 123 of file richedit.cpp.

◆ EnableStrikeOut()

void owl::TCharFormat::EnableStrikeOut ( bool flag = true)

Toggles the strike-out character attribute based on the boolean parameter specified.

Definition at line 110 of file richedit.cpp.

◆ EnableUnderline()

void owl::TCharFormat::EnableUnderline ( bool flag = true)

Toggles the underline character attribute based on the boolean parameter specified.

Definition at line 97 of file richedit.cpp.

◆ GetBkColor()

TColor owl::TCharFormat::GetBkColor ( ) const

Retrieves the character background color stored in the CHARFORMAT structure.

Note
RichEdit 2.0 specific

Definition at line 305 of file richedit.cpp.

References owl::TColor::SysWindow.

◆ GetFontInfo()

void owl::TCharFormat::GetFontInfo ( const LOGFONT & lf)

Initializes the underlying CHARFORMAT structure using the information stored in a LOGFONT structure.

Definition at line 259 of file richedit.cpp.

References _T.

◆ GetTextColor()

TColor owl::TCharFormat::GetTextColor ( ) const

Retrieves the character color stored in the CHARFORMAT structure.

Note
Default to system text color if no explicit color was set in the CHARFORMAT structure.

Definition at line 138 of file richedit.cpp.

References owl::TColor::SysWindowText.

◆ SetAnimation()

void owl::TCharFormat::SetAnimation ( uint8 anim)

Animated text like marching ants.

Note
RichEdit 2.0 specific

Definition at line 371 of file richedit.cpp.

◆ SetBkColor()

void owl::TCharFormat::SetBkColor ( const TColor & clr)

Background color.

Sets Background color.

Note
RichEdit 2.0 specific

Definition at line 316 of file richedit.cpp.

References owl::TColor::None.

◆ SetCharSet()

void owl::TCharFormat::SetCharSet ( uint8 charSet)

Sets the character set of the font.

Valid values include the following: ANSI_CHARSET, OEM_CHARSET, and SYMBOL_CHARSET.

Definition at line 180 of file richedit.cpp.

◆ SetFaceName() [1/2]

void owl::TCharFormat::SetFaceName ( const tstring & f)
inline

Definition at line 77 of file richedit.h.

References SetFaceName().

◆ SetFaceName() [2/2]

void owl::TCharFormat::SetFaceName ( LPCTSTR name)

Sets the face name of the font.

Note
If the given name is greater or equal to LF_FACESIZE, the name is truncated.

Definition at line 168 of file richedit.cpp.

References _T, and PRECONDITION.

◆ SetFontInfo()

void owl::TCharFormat::SetFontInfo ( LOGFONT & lf) const

Transfers the information currently in the underlying CHARFORMAT structure to a LOGFONT structure.

This is useful when changing the editor's font, as initialized LOGFONT structure can subsequently be used when invoking the FONT Common Dialog (i.e., TChooseFontDialog).

Definition at line 228 of file richedit.cpp.

References _T.

◆ SetHeight()

void owl::TCharFormat::SetHeight ( long height)

Sets the character height.

Definition at line 204 of file richedit.cpp.

◆ SetKerning()

void owl::TCharFormat::SetKerning ( uint16 kern)

Twip size above which to kern char pair.

Note
RichEdit 2.0 specific

Definition at line 351 of file richedit.cpp.

◆ SetLCID()

void owl::TCharFormat::SetLCID ( LCID lcid)

Locale ID.

Definition at line 331 of file richedit.cpp.

◆ SetOffset()

void owl::TCharFormat::SetOffset ( long offset)

Sets the character offset from the baseline.

If the parameter is positive, the character is a superscript; if it is negative, the character is a subscript.

Definition at line 215 of file richedit.cpp.

◆ SetPitchAndFamily()

void owl::TCharFormat::SetPitchAndFamily ( uint8 pitchFam)

Sets the pitch and family of the font.

The two lower-bits specify the pitch of the font and can be one of the following values: DEFAULT_PITCH, FIXED_PITCH, or VARIABLE_PITCH.

Bits 4 through 7 of the member specify the font family and can be one of the following values: FF_DECORATIVE, FF_DONTCARE, FF_MODERN, FF_ROMAN, FF_SCRIPT or FF_SWISS.

Definition at line 195 of file richedit.cpp.

◆ SetRevAuthor()

void owl::TCharFormat::SetRevAuthor ( uint8 revav)

Revision author index.

Sets Revision author index.

Note
RichEdit 2.0 specific

Definition at line 381 of file richedit.cpp.

◆ SetSpacing()

void owl::TCharFormat::SetSpacing ( int16 spacing)

Amount to space between letters.

Sets Amount to space between letters.

Note
RichEdit 2.0 specific

Definition at line 294 of file richedit.cpp.

◆ SetStyle()

void owl::TCharFormat::SetStyle ( int16 style)

Style handle.

Sets Style handle.

Note
RichEdit 2.0 specific

Definition at line 341 of file richedit.cpp.

◆ SetTextColor()

void owl::TCharFormat::SetTextColor ( const TColor & color = TColor::None)

Updates the CHARFORMAT structure with the specified color.

Note
If 'TColor::None' is specified, enable the flag specifying that the color should default to the system text color.

Definition at line 151 of file richedit.cpp.

References owl::TColor::None.

◆ SetUnderlineType()

void owl::TCharFormat::SetUnderlineType ( uint8 utype)

Underline type.

Set underline type.

Note
RichEdit 2.0 specific

Definition at line 361 of file richedit.cpp.

◆ SetWeight()

void owl::TCharFormat::SetWeight ( uint16 weigh)

Font weight (LOGFONT value)

Sets Font weight (LOGFONT value).

Note
RichEdit 2.0 specific

Definition at line 284 of file richedit.cpp.

◆ ToggleEffectsBit()

void owl::TCharFormat::ToggleEffectsBit ( ulong flag)
inline

Toggles the effect bits specified in the 'flag' parameter.

Definition at line 587 of file richedit.h.

◆ ToggleMaskBit()

void owl::TCharFormat::ToggleMaskBit ( ulong flag)
inline

Toggles the mask bits specified in the 'flag' parameter.

Definition at line 595 of file richedit.h.


The documentation for this class was generated from the following files: