| Version: 3.2.5

Public Member Functions | Static Public Member Functions | List of all members
wxTextAttr Class Reference
Class List by Category » Rich Text

`#include <wx/textctrl.h>`

Inheritance diagram for wxTextAttr:
[legend]

## Detailed Description

wxTextAttr represents the character and paragraph attributes, or style, for a range of text in a wxTextCtrl or wxRichTextCtrl.

Unless explicitly mentioned, the attributes are only implemented in wxRichTextCtrl, and not wxTextCtrl.

When setting up a wxTextAttr object, pass a bitlist mask to wxTextAttr::SetFlags() to indicate which style elements should be changed. As a convenience, when you call a setter such as SetFont, the relevant bit will be set.

##

Library: wxCore
Category: Rich Text

See also
  wxTextCtrl, wxRichTextCtrl

## Public Member Functions

bool | Apply (const wxTextAttr &style, const wxTextAttr *compareWith=NULL)
| Applies the attributes in style to the original object, but not those attributes from style that are the same as those in compareWith (if passed). More...
void | Merge (const wxTextAttr &overlay)
| Copies all defined/valid properties from overlay to current object. More...
bool | EqPartial (const wxTextAttr &attr, bool weakTest=true) const
| Partial equality test. More...
void | operator= (const wxTextAttr &attr)
| Assignment from a wxTextAttr object. More...
| wxTextAttr ()
| Constructors. More...
| wxTextAttr (const wxColour &colText, const wxColour &colBack=wxNullColour, const wxFont &font=wxNullFont, wxTextAttrAlignment alignment=wxTEXT_ALIGNMENT_DEFAULT)
| Constructors. More...
| wxTextAttr (const wxTextAttr &attr)
| Constructors. More...
GetXXX functions
wxTextAttrAlignment | GetAlignment () const
| Returns the alignment flags. More...
const wxColour & | GetBackgroundColour () const
| Returns the background colour. More...
const wxString & | GetBulletFont () const
| Returns a string containing the name of the font associated with the bullet symbol. More...
const wxString & | GetBulletName () const
| Returns the standard bullet name, applicable if the bullet style is wxTEXT_ATTR_BULLET_STYLE_STANDARD. More...
int | GetBulletNumber () const
| Returns the bullet number. More...
int | GetBulletStyle () const
| Returns the bullet style. More...
const wxString & | GetBulletText () const
| Returns the bullet text, which could be a symbol, or (for example) cached outline text. More...
const wxString & | GetCharacterStyleName () const
| Returns the name of the character style. More...
long | GetFlags () const
| Returns flags indicating which attributes are applicable. More...
wxFont | GetFont () const
| Creates and returns a font specified by the font attributes in the wxTextAttr object. More...
bool | GetFontAttributes (const wxFont &font, int flags=wxTEXT_ATTR_FONT)
| Gets the font attributes from the given font, using only the attributes specified by flags. More...
wxFontEncoding | GetFontEncoding () const
| Returns the font encoding. More...
const wxString & | GetFontFaceName () const
| Returns the font face name. More...
wxFontFamily | GetFontFamily () const
| Returns the font family. More...
int | GetFontSize () const
| Returns the font size in points. More...
wxFontStyle | GetFontStyle () const
| Returns the font style. More...
bool | GetFontUnderlined () const
| Returns true if the font is underlined. More...
wxTextAttrUnderlineType | GetUnderlineType () const
| Returns the underline type, which is one of the wxTextAttrUnderlineType values. More...
const wxColour & | GetUnderlineColour () const
| Returns the underline color used. More...
wxFontWeight | GetFontWeight () const
| Returns the font weight. More...
long | GetLeftIndent () const
| Returns the left indent in tenths of a millimetre. More...
long | GetLeftSubIndent () const
| Returns the left sub-indent in tenths of a millimetre. More...
int | GetLineSpacing () const
| Returns the line spacing value, one of wxTextAttrLineSpacing values. More...
const wxString & | GetListStyleName () const
| Returns the name of the list style. More...
int | GetOutlineLevel () const
| Returns the outline level. More...
int | GetParagraphSpacingAfter () const
| Returns the space in tenths of a millimeter after the paragraph. More...
int | GetParagraphSpacingBefore () const
| Returns the space in tenths of a millimeter before the paragraph. More...
const wxString & | GetParagraphStyleName () const
| Returns the name of the paragraph style. More...
long | GetRightIndent () const
| Returns the right indent in tenths of a millimeter. More...
const wxArrayInt & | GetTabs () const
| Returns an array of tab stops, each expressed in tenths of a millimeter. More...
const wxColour & | GetTextColour () const
| Returns the text foreground colour. More...
int | GetTextEffectFlags () const
| Returns the text effect bits of interest. More...
int | GetTextEffects () const
| Returns the text effects, a bit list of styles. More...
const wxString & | GetURL () const
| Returns the URL for the content. More...
HasXXX and IsXXX functions
bool | HasAlignment () const
| Returns true if the attribute object specifies alignment. More...
bool | HasBackgroundColour () const
| Returns true if the attribute object specifies a background colour. More...
bool | HasBulletName () const
| Returns true if the attribute object specifies a standard bullet name. More...
bool | HasBulletNumber () const
| Returns true if the attribute object specifies a bullet number. More...
bool | HasBulletStyle () const
| Returns true if the attribute object specifies a bullet style. More...
bool | HasBulletText () const
| Returns true if the attribute object specifies bullet text (usually specifying a symbol). More...
bool | HasCharacterStyleName () const
| Returns true if the attribute object specifies a character style name. More...
bool | HasFlag (long flag) const
| Returns true if the flag is present in the attribute object's flag bitlist. More...
bool | HasFont () const
| Returns true if the attribute object specifies any font attributes. More...
bool | HasFontEncoding () const
| Returns true if the attribute object specifies an encoding. More...
bool | HasFontFaceName () const
| Returns true if the attribute object specifies a font face name. More...
bool | HasFontFamily () const
| Returns true if the attribute object specifies a font family. More...
bool | HasFontItalic () const
| Returns true if the attribute object specifies italic style. More...
bool | HasFontSize () const
| Returns true if the attribute object specifies a font point or pixel size. More...
bool | HasFontPointSize () const
| Returns true if the attribute object specifies a font point size. More...
bool | HasFontPixelSize () const
| Returns true if the attribute object specifies a font pixel size. More...
bool | HasFontUnderlined () const
| Returns true if the attribute object specifies either underlining or no underlining. More...
bool | HasFontWeight () const
| Returns true if the attribute object specifies font weight (bold, light or normal). More...
bool | HasLeftIndent () const
| Returns true if the attribute object specifies a left indent. More...
bool | HasLineSpacing () const
| Returns true if the attribute object specifies line spacing. More...
bool | HasListStyleName () const
| Returns true if the attribute object specifies a list style name. More...
bool | HasOutlineLevel () const
| Returns true if the attribute object specifies an outline level. More...
bool | HasPageBreak () const
| Returns true if the attribute object specifies a page break before this paragraph. More...
bool | HasParagraphSpacingAfter () const
| Returns true if the attribute object specifies spacing after a paragraph. More...
bool | HasParagraphSpacingBefore () const
| Returns true if the attribute object specifies spacing before a paragraph. More...
bool | HasParagraphStyleName () const
| Returns true if the attribute object specifies a paragraph style name. More...
bool | HasRightIndent () const
| Returns true if the attribute object specifies a right indent. More...
bool | HasTabs () const
| Returns true if the attribute object specifies tab stops. More...
bool | HasTextColour () const
| Returns true if the attribute object specifies a text foreground colour. More...
bool | HasTextEffects () const
| Returns true if the attribute object specifies text effects. More...
bool | HasURL () const
| Returns true if the attribute object specifies a URL. More...
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. More...
bool | IsDefault () const
| Returns false if we have any attributes set, true otherwise. More...
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. More...
SetXXX functions
void | SetAlignment (wxTextAttrAlignment alignment)
| Sets the paragraph alignment. More...
void | SetBackgroundColour (const wxColour &colBack)
| Sets the background colour. More...
void | SetBulletFont (const wxString &font)
| Sets the name of the font associated with the bullet symbol. More...
void | SetBulletName (const wxString &name)
| Sets the standard bullet name, applicable if the bullet style is wxTEXT_ATTR_BULLET_STYLE_STANDARD. More...
void | SetBulletNumber (int n)
| Sets the bullet number. More...
void | SetBulletStyle (int style)
| Sets the bullet style. More...
void | SetBulletText (const wxString &text)
| Sets the bullet text, which could be a symbol, or (for example) cached outline text. More...
void | SetCharacterStyleName (const wxString &name)
| Sets the character style name. More...
void | SetFlags (long flags)
| Sets the flags determining which styles are being specified. More...
void | SetFont (const wxFont &font, int flags=wxTEXT_ATTR_FONT &~wxTEXT_ATTR_FONT_PIXEL_SIZE)
| Sets the attributes for the given font. More...
void | SetFontEncoding (wxFontEncoding encoding)
| Sets the font encoding. More...
void | SetFontFaceName (const wxString &faceName)
| Sets the font face name. More...
void | SetFontFamily (wxFontFamily family)
| Sets the font family. More...
void | SetFontSize (int pointSize)
| Sets the font size in points. More...
void | SetFontPointSize (int pointSize)
| Sets the font size in points. More...
void | SetFontPixelSize (int pixelSize)
| Sets the font size in pixels. More...
void | SetFontStyle (wxFontStyle fontStyle)
| Sets the font style (normal, italic or slanted). More...
void | SetFontUnderlined (bool underlined)
| Sets the font underlining (solid line, text colour). More...
void | SetFontUnderlined (wxTextAttrUnderlineType type, const wxColour &colour=wxNullColour)
| Sets the font underlining. More...
void | SetFontWeight (wxFontWeight fontWeight)
| Sets the font weight. More...
void | SetLeftIndent (int indent, int subIndent=0)
| Sets the left indent and left subindent in tenths of a millimetre. More...
void | SetLineSpacing (int spacing)
| Sets the line spacing. More...
void | SetListStyleName (const wxString &name)
| Sets the list style name. More...
void | SetOutlineLevel (int level)
| Specifies the outline level. More...
void | SetPageBreak (bool pageBreak=true)
| Specifies a page break before this paragraph. More...
void | SetParagraphSpacingAfter (int spacing)
| Sets the spacing after a paragraph, in tenths of a millimetre. More...
void | SetParagraphSpacingBefore (int spacing)
| Sets the spacing before a paragraph, in tenths of a millimetre. More...
void | SetParagraphStyleName (const wxString &name)
| Sets the name of the paragraph style. More...
void | SetRightIndent (int indent)
| Sets the right indent in tenths of a millimetre. More...
void | SetTabs (const wxArrayInt &tabs)
| Sets the tab stops, expressed in tenths of a millimetre. More...
void | SetTextColour (const wxColour &colText)
| Sets the text foreground colour. More...
void | SetTextEffectFlags (int flags)
| Sets the text effect bits of interest. More...
void | SetTextEffects (int effects)
| Sets the text effects, a bit list of styles. More...
void | SetURL (const wxString &url)
| Sets the URL for the content. More...

## Static Public Member Functions

static wxTextAttr | Merge (const wxTextAttr &base, const wxTextAttr &overlay)
| Creates a new `wxTextAttr` which is a merge of base and overlay. More...

## Constructor & Destructor Documentation

## ◆ wxTextAttr() [1/3]

wxTextAttr::wxTextAttr | ( |  | ) |

Constructors.

## ◆ wxTextAttr() [2/3]

wxTextAttr::wxTextAttr | ( | const wxColour & | colText,
|  | const wxColour & | colBack = `wxNullColour`,
|  | const wxFont & | font = `wxNullFont`,
|  | wxTextAttrAlignment | alignment = `wxTEXT_ALIGNMENT_DEFAULT`
| ) |  |

Constructors.

## ◆ wxTextAttr() [3/3]

wxTextAttr::wxTextAttr | ( | const wxTextAttr & | attr | ) |

Constructors.

## Member Function Documentation

## ◆ Apply()

bool wxTextAttr::Apply | ( | const wxTextAttr & | style,
|  | const wxTextAttr * | compareWith = `NULL`
| ) |  |

Applies the attributes in style to the original object, but not those attributes from style that are the same as those in compareWith (if passed).

## ◆ EqPartial()

bool wxTextAttr::EqPartial | ( | const wxTextAttr & | attr,
|  | bool | weakTest = `true`
| ) |  | const

Partial equality test.

If weakTest is true, attributes of this object do not have to be present if those attributes of attr are present. If weakTest is false, the function will fail if an attribute is present in attr but not in this object.

## ◆ GetAlignment()

wxTextAttrAlignment wxTextAttr::GetAlignment | ( |  | ) | const

Returns the alignment flags.

See wxTextAttrAlignment for a list of available styles.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetBackgroundColour()

const wxColour& wxTextAttr::GetBackgroundColour | ( |  | ) | const

Returns the background colour.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetBulletFont()

const wxString& wxTextAttr::GetBulletFont | ( |  | ) | const

Returns a string containing the name of the font associated with the bullet symbol.

Only valid for attributes with wxTEXT_ATTR_BULLET_SYMBOL.

## ◆ GetBulletName()

const wxString& wxTextAttr::GetBulletName | ( |  | ) | const

Returns the standard bullet name, applicable if the bullet style is wxTEXT_ATTR_BULLET_STYLE_STANDARD.

Currently the following standard bullet names are supported:

- `standard/circle`
- `standard/square`
- `standard/diamond`
- `standard/triangle`

Note
  For wxRichTextCtrl users only: if you wish your rich text controls to support further bullet graphics, you can derive a class from wxRichTextRenderer or wxRichTextStdRenderer, override `DrawStandardBullet` and `EnumerateStandardBulletNames`, and set an instance of the class using wxRichTextBuffer::SetRenderer.

## ◆ GetBulletNumber()

int wxTextAttr::GetBulletNumber | ( |  | ) | const

Returns the bullet number.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetBulletStyle()

int wxTextAttr::GetBulletStyle | ( |  | ) | const

Returns the bullet style.

See wxTextAttrBulletStyle for a list of available styles.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetBulletText()

const wxString& wxTextAttr::GetBulletText | ( |  | ) | const

Returns the bullet text, which could be a symbol, or (for example) cached outline text.

## ◆ GetCharacterStyleName()

const wxString& wxTextAttr::GetCharacterStyleName | ( |  | ) | const

Returns the name of the character style.

## ◆ GetFlags()

long wxTextAttr::GetFlags | ( |  | ) | const

Returns flags indicating which attributes are applicable.

See SetFlags() for a list of available flags.

## ◆ GetFont()

wxFont wxTextAttr::GetFont | ( |  | ) | const

Creates and returns a font specified by the font attributes in the wxTextAttr object.

Note that wxTextAttr does not store a wxFont object, so this is only a temporary font.

For greater efficiency, access the font attributes directly.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetFontAttributes()

bool wxTextAttr::GetFontAttributes | ( | const wxFont & | font,
|  | int | flags = `wxTEXT_ATTR_FONT`
| ) |  |

Gets the font attributes from the given font, using only the attributes specified by flags.

## ◆ GetFontEncoding()

wxFontEncoding wxTextAttr::GetFontEncoding | ( |  | ) | const

Returns the font encoding.

## ◆ GetFontFaceName()

const wxString& wxTextAttr::GetFontFaceName | ( |  | ) | const

Returns the font face name.

## ◆ GetFontFamily()

wxFontFamily wxTextAttr::GetFontFamily | ( |  | ) | const

Returns the font family.

## ◆ GetFontSize()

int wxTextAttr::GetFontSize | ( |  | ) | const

Returns the font size in points.

## ◆ GetFontStyle()

wxFontStyle wxTextAttr::GetFontStyle | ( |  | ) | const

Returns the font style.

## ◆ GetFontUnderlined()

bool wxTextAttr::GetFontUnderlined | ( |  | ) | const

Returns true if the font is underlined.

## ◆ GetFontWeight()

wxFontWeight wxTextAttr::GetFontWeight | ( |  | ) | const

Returns the font weight.

## ◆ GetLeftIndent()

long wxTextAttr::GetLeftIndent | ( |  | ) | const

Returns the left indent in tenths of a millimetre.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetLeftSubIndent()

long wxTextAttr::GetLeftSubIndent | ( |  | ) | const

Returns the left sub-indent in tenths of a millimetre.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetLineSpacing()

int wxTextAttr::GetLineSpacing | ( |  | ) | const

Returns the line spacing value, one of wxTextAttrLineSpacing values.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetListStyleName()

const wxString& wxTextAttr::GetListStyleName | ( |  | ) | const

Returns the name of the list style.

## ◆ GetOutlineLevel()

int wxTextAttr::GetOutlineLevel | ( |  | ) | const

Returns the outline level.

## ◆ GetParagraphSpacingAfter()

int wxTextAttr::GetParagraphSpacingAfter | ( |  | ) | const

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

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetParagraphSpacingBefore()

int wxTextAttr::GetParagraphSpacingBefore | ( |  | ) | const

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

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetParagraphStyleName()

const wxString& wxTextAttr::GetParagraphStyleName | ( |  | ) | const

Returns the name of the paragraph style.

## ◆ GetRightIndent()

long wxTextAttr::GetRightIndent | ( |  | ) | const

Returns the right indent in tenths of a millimeter.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ GetTabs()

const wxArrayInt& wxTextAttr::GetTabs | ( |  | ) | const

Returns an array of tab stops, each expressed in tenths of a millimeter.

Each stop is measured from the left margin and therefore each value must be larger than the last.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetTextColour()

const wxColour& wxTextAttr::GetTextColour | ( |  | ) | const

Returns the text foreground colour.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ GetTextEffectFlags()

int wxTextAttr::GetTextEffectFlags | ( |  | ) | const

Returns the text effect bits of interest.

See SetFlags() for further information.

## ◆ GetTextEffects()

int wxTextAttr::GetTextEffects | ( |  | ) | const

Returns the text effects, a bit list of styles.

See SetTextEffects() for details.

## ◆ GetUnderlineColour()

const wxColour& wxTextAttr::GetUnderlineColour | ( |  | ) | const

Returns the underline color used.

wxNullColour when the text colour is used.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

Since
  3.1.3

## ◆ GetUnderlineType()

wxTextAttrUnderlineType wxTextAttr::GetUnderlineType | ( |  | ) | const

Returns the underline type, which is one of the wxTextAttrUnderlineType values.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

Since
  3.1.3

## ◆ GetURL()

const wxString& wxTextAttr::GetURL | ( |  | ) | const

Returns the URL for the content.

Content with wxTEXT_ATTR_URL style causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates a wxTextUrlEvent when the content is clicked.

## ◆ HasAlignment()

bool wxTextAttr::HasAlignment | ( |  | ) | const

Returns true if the attribute object specifies alignment.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasBackgroundColour()

bool wxTextAttr::HasBackgroundColour | ( |  | ) | const

Returns true if the attribute object specifies a background colour.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasBulletName()

bool wxTextAttr::HasBulletName | ( |  | ) | const

Returns true if the attribute object specifies a standard bullet name.

## ◆ HasBulletNumber()

bool wxTextAttr::HasBulletNumber | ( |  | ) | const

Returns true if the attribute object specifies a bullet number.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ HasBulletStyle()

bool wxTextAttr::HasBulletStyle | ( |  | ) | const

Returns true if the attribute object specifies a bullet style.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ HasBulletText()

bool wxTextAttr::HasBulletText | ( |  | ) | const

Returns true if the attribute object specifies bullet text (usually specifying a symbol).

## ◆ HasCharacterStyleName()

bool wxTextAttr::HasCharacterStyleName | ( |  | ) | const

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

## ◆ HasFlag()

bool wxTextAttr::HasFlag | ( | long | flag | ) | const

Returns true if the flag is present in the attribute object's flag bitlist.

## ◆ HasFont()

bool wxTextAttr::HasFont | ( |  | ) | const

Returns true if the attribute object specifies any font attributes.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasFontEncoding()

bool wxTextAttr::HasFontEncoding | ( |  | ) | const

Returns true if the attribute object specifies an encoding.

## ◆ HasFontFaceName()

bool wxTextAttr::HasFontFaceName | ( |  | ) | const

Returns true if the attribute object specifies a font face name.

## ◆ HasFontFamily()

bool wxTextAttr::HasFontFamily | ( |  | ) | const

Returns true if the attribute object specifies a font family.

## ◆ HasFontItalic()

bool wxTextAttr::HasFontItalic | ( |  | ) | const

Returns true if the attribute object specifies italic style.

## ◆ HasFontPixelSize()

bool wxTextAttr::HasFontPixelSize | ( |  | ) | const

Returns true if the attribute object specifies a font pixel size.

## ◆ HasFontPointSize()

bool wxTextAttr::HasFontPointSize | ( |  | ) | const

Returns true if the attribute object specifies a font point size.

## ◆ HasFontSize()

bool wxTextAttr::HasFontSize | ( |  | ) | const

Returns true if the attribute object specifies a font point or pixel size.

## ◆ HasFontUnderlined()

bool wxTextAttr::HasFontUnderlined | ( |  | ) | const

Returns true if the attribute object specifies either underlining or no underlining.

## ◆ HasFontWeight()

bool wxTextAttr::HasFontWeight | ( |  | ) | const

Returns true if the attribute object specifies font weight (bold, light or normal).

## ◆ HasLeftIndent()

bool wxTextAttr::HasLeftIndent | ( |  | ) | const

Returns true if the attribute object specifies a left indent.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasLineSpacing()

bool wxTextAttr::HasLineSpacing | ( |  | ) | const

Returns true if the attribute object specifies line spacing.

For wxTextCtrl, is implemented under wxMSW and wxOSX. Also implemented in wxRichTextCtrl.

## ◆ HasListStyleName()

bool wxTextAttr::HasListStyleName | ( |  | ) | const

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

## ◆ HasOutlineLevel()

bool wxTextAttr::HasOutlineLevel | ( |  | ) | const

Returns true if the attribute object specifies an outline level.

## ◆ HasPageBreak()

bool wxTextAttr::HasPageBreak | ( |  | ) | const

Returns true if the attribute object specifies a page break before this paragraph.

## ◆ HasParagraphSpacingAfter()

bool wxTextAttr::HasParagraphSpacingAfter | ( |  | ) | const

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

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ HasParagraphSpacingBefore()

bool wxTextAttr::HasParagraphSpacingBefore | ( |  | ) | const

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

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasParagraphStyleName()

bool wxTextAttr::HasParagraphStyleName | ( |  | ) | const

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

## ◆ HasRightIndent()

bool wxTextAttr::HasRightIndent | ( |  | ) | const

Returns true if the attribute object specifies a right indent.

## ◆ HasTabs()

bool wxTextAttr::HasTabs | ( |  | ) | const

Returns true if the attribute object specifies tab stops.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasTextColour()

bool wxTextAttr::HasTextColour | ( |  | ) | const

Returns true if the attribute object specifies a text foreground colour.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ HasTextEffects()

bool wxTextAttr::HasTextEffects | ( |  | ) | const

Returns true if the attribute object specifies text effects.

## ◆ HasURL()

bool wxTextAttr::HasURL | ( |  | ) | const

Returns true if the attribute object specifies a URL.

## ◆ IsCharacterStyle()

bool wxTextAttr::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.

## ◆ IsDefault()

bool wxTextAttr::IsDefault | ( |  | ) | const

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

## ◆ IsParagraphStyle()

bool wxTextAttr::IsParagraphStyle | ( |  | ) | const

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

## ◆ Merge() [1/2]

static wxTextAttr wxTextAttr::Merge | ( | const wxTextAttr & | base,
|  | const wxTextAttr & | overlay
| ) |  |

static

Creates a new `wxTextAttr` which is a merge of base and overlay.

Properties defined in overlay take precedence over those in base. Properties undefined/invalid in both are undefined in the result.

## ◆ Merge() [2/2]

void wxTextAttr::Merge | ( | const wxTextAttr & | overlay | ) |

Copies all defined/valid properties from overlay to current object.

## ◆ operator=()

void wxTextAttr::operator= | ( | const wxTextAttr & | attr | ) |

Assignment from a wxTextAttr object.

## ◆ SetAlignment()

void wxTextAttr::SetAlignment | ( | wxTextAttrAlignment | alignment | ) |

Sets the paragraph alignment.

See wxTextAttrAlignment enumeration values.

wxTEXT_ALIGNMENT_JUSTIFIED is not implemented for wxRichTextCtrl. In the future, wxRichTextCtrl justification may be supported when printing or previewing only.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ SetBackgroundColour()

void wxTextAttr::SetBackgroundColour | ( | const wxColour & | colBack | ) |

Sets the background colour.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ SetBulletFont()

void wxTextAttr::SetBulletFont | ( | const wxString & | font | ) |

Sets the name of the font associated with the bullet symbol.

Only valid for attributes with wxTEXT_ATTR_BULLET_SYMBOL.

## ◆ SetBulletName()

void wxTextAttr::SetBulletName | ( | const wxString & | name | ) |

Sets the standard bullet name, applicable if the bullet style is wxTEXT_ATTR_BULLET_STYLE_STANDARD.

See GetBulletName() for a list of supported names, and how to expand the range of supported types.

## ◆ SetBulletNumber()

void wxTextAttr::SetBulletNumber | ( | int | n | ) |

Sets the bullet number.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ SetBulletStyle()

void wxTextAttr::SetBulletStyle | ( | int | style | ) |

Sets the bullet style.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

For wxRichTextCtrl, the wxTextAttrBulletStyle enumeration values are all supported, except for wxTEXT_ATTR_BULLET_STYLE_BITMAP.

For wxTextCtrl under wxMSW, the wxTextAttrBulletStyle enumeration values are all supported, except for wxTEXT_ATTR_BULLET_STYLE_BITMAP, wxTEXT_ATTR_BULLET_STYLE_OUTLINE, wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT, wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT, wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE, and wxTEXT_ATTR_BULLET_STYLE_CONTINUATION.

## ◆ SetBulletText()

void wxTextAttr::SetBulletText | ( | const wxString & | text | ) |

Sets the bullet text, which could be a symbol, or (for example) cached outline text.

## ◆ SetCharacterStyleName()

void wxTextAttr::SetCharacterStyleName | ( | const wxString & | name | ) |

Sets the character style name.

## ◆ SetFlags()

void wxTextAttr::SetFlags | ( | long | flags | ) |

Sets the flags determining which styles are being specified.

The wxTextAttrFlags values can be passed in a bitlist.

## ◆ SetFont()

void wxTextAttr::SetFont | ( | const wxFont & | font,
|  | int | flags = `wxTEXT_ATTR_FONT &~wxTEXT_ATTR_FONT_PIXEL_SIZE`
| ) |  |

Sets the attributes for the given font.

Note that wxTextAttr does not store an actual wxFont object.

For wxTextCtrl, is implemented under wxMSW, wxOSX and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ SetFontEncoding()

void wxTextAttr::SetFontEncoding | ( | wxFontEncoding | encoding | ) |

Sets the font encoding.

## ◆ SetFontFaceName()

void wxTextAttr::SetFontFaceName | ( | const wxString & | faceName | ) |

Sets the font face name.

## ◆ SetFontFamily()

void wxTextAttr::SetFontFamily | ( | wxFontFamily | family | ) |

Sets the font family.

## ◆ SetFontPixelSize()

void wxTextAttr::SetFontPixelSize | ( | int | pixelSize | ) |

Sets the font size in pixels.

## ◆ SetFontPointSize()

void wxTextAttr::SetFontPointSize | ( | int | pointSize | ) |

Sets the font size in points.

## ◆ SetFontSize()

void wxTextAttr::SetFontSize | ( | int | pointSize | ) |

Sets the font size in points.

## ◆ SetFontStyle()

void wxTextAttr::SetFontStyle | ( | wxFontStyle | fontStyle | ) |

Sets the font style (normal, italic or slanted).

## ◆ SetFontUnderlined() [1/2]

void wxTextAttr::SetFontUnderlined | ( | bool | underlined | ) |

Sets the font underlining (solid line, text colour).

## ◆ SetFontUnderlined() [2/2]

void wxTextAttr::SetFontUnderlined | ( | wxTextAttrUnderlineType | type,
|  | const wxColour & | colour = `wxNullColour`
| ) |  |

Sets the font underlining.

Parameters

  type | Type of underline.
  colour | Colour to use for underlining, text colour is used by default.

Note
  On wxMSW, wxTEXT_ATTR_UNDERLINE_DOUBLE is shown as wxTEXT_ATTR_UNDERLINE_SOLID. There is only a limited number of colours supported, the RGB values are listed here. wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line.
  On wxGTK, underline colour is only supported by wxGTK3. wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a waved line. GTK might overrule the colour of wxTEXT_ATTR_UNDERLINE_SPECIAL.
  On wxOSX, wxTEXT_ATTR_UNDERLINE_SPECIAL is shown as a dotted line.

Since
  3.1.3

## ◆ SetFontWeight()

void wxTextAttr::SetFontWeight | ( | wxFontWeight | fontWeight | ) |

Sets the font weight.

## ◆ SetLeftIndent()

void wxTextAttr::SetLeftIndent | ( | int | indent,
|  | int | subIndent = `0`
| ) |  |

Sets the left indent and left subindent in tenths of a millimetre.

The sub-indent is an offset from the left of the paragraph, and is used for all but the first line in a paragraph.

A positive value will cause the first line to appear to the left of the subsequent lines, and a negative value will cause the first line to be indented relative to the subsequent lines.

wxRichTextBuffer uses indentation to render a bulleted item. The left indent is the distance between the margin and the bullet. The content of the paragraph, including the first line, starts at leftMargin + leftSubIndent. So the distance between the left edge of the bullet and the left of the actual paragraph is leftSubIndent.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ SetLineSpacing()

void wxTextAttr::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 wxTextAttrLineSpacing values are defined for convenience.

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ SetListStyleName()

void wxTextAttr::SetListStyleName | ( | const wxString & | name | ) |

Sets the list style name.

## ◆ SetOutlineLevel()

void wxTextAttr::SetOutlineLevel | ( | int | level | ) |

Specifies the outline level.

Zero represents normal text. At present, the outline level is not used, but may be used in future for determining list levels and for applications that need to store document structure information.

## ◆ SetPageBreak()

void wxTextAttr::SetPageBreak | ( | bool | pageBreak = `true` | ) |

Specifies a page break before this paragraph.

## ◆ SetParagraphSpacingAfter()

void wxTextAttr::SetParagraphSpacingAfter | ( | int | spacing | ) |

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

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ SetParagraphSpacingBefore()

void wxTextAttr::SetParagraphSpacingBefore | ( | int | spacing | ) |

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

For wxTextCtrl, is implemented under wxMSW. Also implemented in wxRichTextCtrl.

## ◆ SetParagraphStyleName()

void wxTextAttr::SetParagraphStyleName | ( | const wxString & | name | ) |

Sets the name of the paragraph style.

## ◆ SetRightIndent()

void wxTextAttr::SetRightIndent | ( | int | indent | ) |

Sets the right indent in tenths of a millimetre.

## ◆ SetTabs()

void wxTextAttr::SetTabs | ( | const wxArrayInt & | tabs | ) |

Sets the tab stops, expressed in tenths of a millimetre.

Each stop is measured from the left margin and therefore each value must be larger than the last.

For wxTextCtrl, is implemented under wxMSW and wxGTK. Also implemented in wxRichTextCtrl.

## ◆ SetTextColour()

void wxTextAttr::SetTextColour | ( | const wxColour & | colText | ) |

Sets the text foreground colour.

## ◆ SetTextEffectFlags()

void wxTextAttr::SetTextEffectFlags | ( | int | flags | ) |

Sets the text effect bits of interest.

You should also pass wxTEXT_ATTR_EFFECTS to SetFlags(). See SetFlags() for further information.

## ◆ SetTextEffects()

void wxTextAttr::SetTextEffects | ( | int | effects | ) |

Sets the text effects, a bit list of styles.

The wxTextAttrEffects enumeration values can be used.

Of these, only wxTEXT_ATTR_EFFECT_CAPITALS, wxTEXT_ATTR_EFFECT_STRIKETHROUGH, wxTEXT_ATTR_EFFECT_SUPERSCRIPT and wxTEXT_ATTR_EFFECT_SUBSCRIPT are implemented.

wxTEXT_ATTR_EFFECT_CAPITALS capitalises text when displayed (leaving the case of the actual buffer text unchanged), and wxTEXT_ATTR_EFFECT_STRIKETHROUGH draws a line through text.

To set effects, you should also pass wxTEXT_ATTR_EFFECTS to SetFlags(), and call SetTextEffectFlags() with the styles (taken from the above set) that you are interested in setting.

## ◆ SetURL()

void wxTextAttr::SetURL | ( | const wxString & | url | ) |

Sets the URL for the content.

Sets the wxTEXT_ATTR_URL style; content with this style causes wxRichTextCtrl to show a hand cursor over it, and wxRichTextCtrl generates a wxTextUrlEvent when the content is clicked.