Contents Up Previous Next

wxTextAttrEx

wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes. Currently it is only used with wxRichTextCtrl.

It is intended that eventually, the members of wxTextAttrEx will be folded into wxTextAttr, and wxTextAttr will be the official cross-platform API for text controls that support attributes. However, for now, wxTextAttrEx is provided as a means of enabling extra functionality in wxRichTextCtrl, while retaining some compatibility with the wxTextAttr API.

The most efficient method of accessing wxRichTextCtrl functionality is a third attribute class, wxRichTextAttr, which optimizes its storage to allow it to be used for implementing objects in a buffer, as well as access to that buffer.

This section only documents the additional members; see wxTextAttr for the remaining functions.

Derived from

wxTextAttr

Include files

<wx/richtext/richtextbuffer.h>

Constants

The following values can be passed to SetAlignment to determine paragraph alignment.

enum wxTextAttrAlignment
{
    wxTEXT_ALIGNMENT_DEFAULT,
    wxTEXT_ALIGNMENT_LEFT,
    wxTEXT_ALIGNMENT_CENTRE,
    wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
    wxTEXT_ALIGNMENT_RIGHT,
    wxTEXT_ALIGNMENT_JUSTIFIED
};

These values are passed in a bitlist to SetFlags to determine what attributes will be considered when setting the attributes for a text control.

// Standard wxTextAttr constants

#define wxTEXT_ATTR_TEXT_COLOUR             0x0001
#define wxTEXT_ATTR_BACKGROUND_COLOUR       0x0002
#define wxTEXT_ATTR_FONT_FACE               0x0004
#define wxTEXT_ATTR_FONT_SIZE               0x0008
#define wxTEXT_ATTR_FONT_WEIGHT             0x0010
#define wxTEXT_ATTR_FONT_ITALIC             0x0020
#define wxTEXT_ATTR_FONT_UNDERLINE          0x0040
#define wxTEXT_ATTR_FONT \
  wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \
| wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE
#define wxTEXT_ATTR_ALIGNMENT               0x0080
#define wxTEXT_ATTR_LEFT_INDENT             0x0100
#define wxTEXT_ATTR_RIGHT_INDENT            0x0200
#define wxTEXT_ATTR_TABS                    0x0400

// Extra formatting flags not in wxTextAttr

#define wxTEXT_ATTR_PARA_SPACING_AFTER      0x00000800
#define wxTEXT_ATTR_PARA_SPACING_BEFORE     0x00001000
#define wxTEXT_ATTR_LINE_SPACING            0x00002000
#define wxTEXT_ATTR_CHARACTER_STYLE_NAME    0x00004000
#define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME    0x00008000
#define wxTEXT_ATTR_BULLET_STYLE            0x00010000
#define wxTEXT_ATTR_BULLET_NUMBER           0x00020000
#define wxTEXT_ATTR_BULLET_SYMBOL           0x00040000

The following styles can be passed to wxRichTextAttr::SetBulletStyle:

#define wxTEXT_ATTR_BULLET_STYLE_NONE           0x0000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC         0x0001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER  0x0002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER  0x0004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER    0x0008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER    0x0010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL         0x0020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP         0x0040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES    0x0080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD         0x0100

The following constants can be passed to wxRichTextAttr::SetLineSpacing:

#define wxTEXT_ATTR_LINE_SPACING_NORMAL         10
#define wxTEXT_ATTR_LINE_SPACING_HALF           15
#define wxTEXT_ATTR_LINE_SPACING_TWICE          20

See also

wxTextAttr, wxRichTextAttr, wxRichTextCtrl

Members

wxTextAttrEx::wxTextAttrEx
wxTextAttrEx::GetBulletNumber
wxTextAttrEx::GetBulletStyle
wxTextAttrEx::GetBulletSymbol
wxTextAttrEx::GetCharacterStyleName
wxTextAttrEx::GetLineSpacing
wxTextAttrEx::GetParagraphSpacingAfter
wxTextAttrEx::GetParagraphSpacingBefore
wxTextAttrEx::GetParagraphStyleName
wxTextAttrEx::HasBulletNumber
wxTextAttrEx::HasBulletStyle
wxTextAttrEx::HasBulletSymbol
wxTextAttrEx::HasCharacterStyleName
wxTextAttrEx::HasLineSpacing
wxTextAttrEx::HasParagraphSpacingAfter
wxTextAttrEx::HasParagraphSpacingBefore
wxTextAttrEx::HasParagraphStyleName
wxTextAttrEx::Init
wxTextAttrEx::IsCharacterStyle
wxTextAttrEx::IsDefault
wxTextAttrEx::IsParagraphStyle
wxTextAttrEx::SetBulletNumber
wxTextAttrEx::SetBulletStyle
wxTextAttrEx::SetBulletSymbol
wxTextAttrEx::SetCharacterStyleName
wxTextAttrEx::SetLineSpacing
wxTextAttrEx::SetParagraphSpacingAfter
wxTextAttrEx::SetParagraphSpacingBefore
wxTextAttrEx::SetParagraphStyleName
wxTextAttrEx::operator=


wxTextAttrEx::wxTextAttrEx

wxTextAttrEx()

wxTextAttrEx(const wxTextAttrEx& attr)

Constructors.


wxTextAttrEx::GetBulletNumber

int GetBulletNumber() const

Returns the bullet number.


wxTextAttrEx::GetBulletStyle

int GetBulletStyle() const

Returns the bullet style. See wxTextAttrEx::SetBulletStyle for a list of available styles.


wxTextAttrEx::GetBulletSymbol

wxChar GetBulletSymbol() const

Returns the bullet symbol, a character.


wxTextAttrEx::GetCharacterStyleName

const wxString& GetCharacterStyleName() const

Returns the name of the character style.


wxTextAttrEx::GetLineSpacing

int GetLineSpacing() const

Returns the line spacing value, one of wxTEXT_ATTR_LINE_SPACING_NORMAL, wxTEXT_ATTR_LINE_SPACING_HALF, and wxTEXT_ATTR_LINE_SPACING_TWICE.


wxTextAttrEx::GetParagraphSpacingAfter

int GetParagraphSpacingAfter() const

Returns the space in tenths of a millimeter after the paragraph.


wxTextAttrEx::GetParagraphSpacingBefore

int GetParagraphSpacingBefore() const

Returns the space in tenths of a millimeter before the paragraph.


wxTextAttrEx::GetParagraphStyleName

const wxString& GetParagraphStyleName() const

Returns the name of the paragraph style.


wxTextAttrEx::HasBulletNumber

bool HasBulletNumber() const

Returns true if the attribute object specifies a bullet number.


wxTextAttrEx::HasBulletStyle

bool HasBulletStyle() const

Returns true if the attribute object specifies a bullet style.


wxTextAttrEx::HasBulletSymbol

bool HasBulletSymbol() const

Returns true if the attribute object specifies a bullet symbol.


wxTextAttrEx::HasCharacterStyleName

bool HasCharacterStyleName() const

Returns true if the attribute object specifies a character style name.


wxTextAttrEx::HasLineSpacing

bool HasLineSpacing() const

Returns true if the attribute object specifies line spacing.


wxTextAttrEx::HasParagraphSpacingAfter

bool HasParagraphSpacingAfter() const

Returns true if the attribute object specifies spacing after a paragraph.


wxTextAttrEx::HasParagraphSpacingBefore

bool HasParagraphSpacingBefore() const

Returns true if the attribute object specifies spacing before a paragraph.


wxTextAttrEx::HasParagraphStyleName

bool HasParagraphStyleName() const

Returns true if the attribute object specifies a paragraph style name.


wxTextAttrEx::Init

void Init()

Initialises this object.


wxTextAttrEx::IsCharacterStyle

bool IsCharacterStyle() const

Returns true if the object represents a character style, that is, the flags specify a font or a text background or foreground colour.


wxTextAttrEx::IsDefault

bool IsDefault() const

Returns false if we have any attributes set, true otherwise.


wxTextAttrEx::IsParagraphStyle

bool IsParagraphStyle() const

Returns true if the object represents a paragraph style, that is, the flags specify alignment, indentation, tabs, paragraph spacing, or bullet style.


wxTextAttrEx::SetBulletNumber

void SetBulletNumber(int n)

Sets the bullet number.


wxTextAttrEx::SetBulletStyle

void SetBulletStyle(int style)

Sets the bullet style. The following styles can be passed:

#define wxTEXT_ATTR_BULLET_STYLE_NONE           0x0000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC         0x0001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER  0x0002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER  0x0004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER    0x0008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER    0x0010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL         0x0020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP         0x0040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES    0x0080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD         0x0100


wxTextAttrEx::SetBulletSymbol

void SetBulletSymbol(wxChar symbol)

Sets the paragraph symbol.


wxTextAttrEx::SetCharacterStyleName

void SetCharacterStyleName(const wxString& name)

Sets the character style name.


wxTextAttrEx::SetLineSpacing

void SetLineSpacing(int spacing)

Sets the line spacing. spacing is a multiple, where 10 means single-spacing, 15 means 1.5 spacing, and 20 means double spacing. The following constants are defined for convenience:

#define wxTEXT_ATTR_LINE_SPACING_NORMAL         10
#define wxTEXT_ATTR_LINE_SPACING_HALF           15
#define wxTEXT_ATTR_LINE_SPACING_TWICE          20


wxTextAttrEx::SetParagraphSpacingAfter

void SetParagraphSpacingAfter(int spacing)

Sets the spacing after a paragraph, in tenths of a millimetre.


wxTextAttrEx::SetParagraphSpacingBefore

void SetParagraphSpacingBefore(int spacing)

Sets the spacing before a paragraph, in tenths of a millimetre.


wxTextAttrEx::SetParagraphStyleName

void SetParagraphStyleName(const wxString& name)

Sets the name of the paragraph style.


wxTextAttrEx::operator=

void operator operator=(const wxTextAttr& attr)

Assignment from a wxTextAttr object.

void operator operator=(const wxTextAttrEx& attr)

Assignment from a wxTextAttrEx object.