Inheritance diagram for wx.richtext.TextAttrEx:
wx.richtext.TextAttrEx is an extended version of wx.TextAttr with more paragraph attributes. Currently it is only used with wx.richtext.RichTextCtrl.
It is intended that eventually, the members of wx.richtext.TextAttrEx will be folded into wx.TextAttr, and wx.TextAttr will be the official cross-platform API for text controls that support attributes. However, for now, wx.richtext.TextAttrEx is provided as a means of enabling extra functionality in wx.richtext.RichTextCtrl, while retaining some compatibility with the wx.TextAttr API.
The most efficient method of accessing wx.richtext.RichTextCtrl functionality is a third attribute class, wx.richtext.RichTextAttr, 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 wx.TextAttr for the remaining functions.
The following values can be passed to SetAlignment to determine paragraph alignment:
Of these, wx.TEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only.
The following values are passed in a bitlist to SetFlags to determine what attributes will be considered when setting the attributes for a text control (they are all members of the standard wx package):
Standard Constants | Value |
---|---|
wx.TEXT_ATTR_TEXT_COLOUR | 0x00000001 |
wx.TEXT_ATTR_BACKGROUND_COLOUR | 0x00000002 |
wx.TEXT_ATTR_FONT_FACE | 0x00000004 |
wx.TEXT_ATTR_FONT_SIZE | 0x00000008 |
wx.TEXT_ATTR_FONT_WEIGHT | 0x00000010 |
wx.TEXT_ATTR_FONT_ITALIC | 0x00000020 |
wx.TEXT_ATTR_FONT_UNDERLINE | 0x00000040 |
wx.TEXT_ATTR_FONT | wx.TEXT_ATTR_FONT_FACE | wx.TEXT_ATTR_FONT_SIZE | wx.TEXT_ATTR_FONT_WEIGHT | wx.TEXT_ATTR_FONT_ITALIC | wx.TEXT_ATTR_FONT_UNDERLINE |
wx.TEXT_ATTR_ALIGNMENT | 0x00000080 |
wx.TEXT_ATTR_LEFT_INDENT | 0x00000100 |
wx.TEXT_ATTR_RIGHT_INDENT | 0x00000200 |
wx.TEXT_ATTR_TABS | 0x00000400 |
These are available by importing wx.richtext:
Extra Formatting Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_PARA_SPACING_AFTER | 0x00000800 |
wx.richtext.TEXT_ATTR_PARA_SPACING_BEFORE | 0x00001000 |
wx.richtext.TEXT_ATTR_LINE_SPACING | 0x00002000 |
wx.richtext.TEXT_ATTR_CHARACTER_STYLE_NAME | 0x00004000 |
wx.richtext.TEXT_ATTR_PARAGRAPH_STYLE_NAME | 0x00008000 |
wx.richtext.TEXT_ATTR_LIST_STYLE_NAME | 0x00010000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE | 0x00020000 |
wx.richtext.TEXT_ATTR_BULLET_NUMBER | 0x00040000 |
wx.richtext.TEXT_ATTR_BULLET_TEXT | 0x00080000 |
wx.richtext.TEXT_ATTR_BULLET_NAME | 0x00100000 |
wx.richtext.TEXT_ATTR_URL | 0x00200000 |
wx.richtext.TEXT_ATTR_PAGE_BREAK | 0x00400000 |
wx.richtext.TEXT_ATTR_EFFECTS | 0x00800000 |
wx.richtext.TEXT_ATTR_OUTLINE_LEVEL | 0x01000000 |
The following styles can be passed to SetBulletStyle:
Bullet Style Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_BULLET_STYLE_NONE | 0x00000000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ARABIC | 0x00000001 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER | 0x00000002 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER | 0x00000004 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER | 0x00000008 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER | 0x00000010 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_SYMBOL | 0x00000020 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP | 0x00000040 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_PARENTHESES | 0x00000080 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_PERIOD | 0x00000100 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD | 0x00000200 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS | 0x00000400 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_OUTLINE | 0x00000800 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT | 0x00000000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT | 0x00001000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE | 0x00002000 |
Of these, wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented.
The following constants can be passed to SetLineSpacing:
Line Spacing Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_LINE_SPACING_NORMAL | 10 |
wx.richtext.TEXT_ATTR_LINE_SPACING_HALF | 15 |
wx.richtext.TEXT_ATTR_LINE_SPACING_TWICE | 20 |
The following styles can be passed to SetTextEffects:
Text Effects Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_EFFECT_NONE | 0x00000000 |
wx.richtext.TEXT_ATTR_EFFECT_CAPITALS | 0x00000001 |
wx.richtext.TEXT_ATTR_EFFECT_SMALL_CAPITALS | 0x00000002 |
wx.richtext.TEXT_ATTR_EFFECT_STRIKETHROUGH | 0x00000004 |
wx.richtext.TEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH | 0x00000008 |
wx.richtext.TEXT_ATTR_EFFECT_SHADOW | 0x00000010 |
wx.richtext.TEXT_ATTR_EFFECT_EMBOSS | 0x00000020 |
wx.richtext.TEXT_ATTR_EFFECT_OUTLINE | 0x00000040 |
wx.richtext.TEXT_ATTR_EFFECT_ENGRAVE | 0x00000080 |
wx.richtext.TEXT_ATTR_EFFECT_SUPERSCRIPT | 0x00000100 |
wx.richtext.TEXT_ATTR_EFFECT_SUBSCRIPT | 0x00000200 |
Of these, only wx.richtext.TEXT_ATTR_EFFECT_CAPITALS and wx.richtext.TEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
Constructor.
The wx.richtext.TextAttrEx class stores information about the various attributes for a block of text, including font, colour, indents, alignments, etc...
Returns:
Returns the alignment flags. See SetAlignment for a list of available styles.
Returns:
int
Returns a string containing the name of the font associated with the bullet symbol.
Only valid for attributes with wx.richtext.TEXT_ATTR_BULLET_SYMBOL.
Returns:
string
Returns the standard bullet name, applicable if the bullet style is wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD.
Currently the following standard bullet names are supported:
If you wish your application to support further bullet graphics, you can derive a class from wx.richtext.RichTextRenderer or wx.richtext.RichTextStdRenderer, override DrawStandardBullet and EnumerateStandardBulletNames, and set an instance of the class using wx.richtext.RichTextBuffer.SetRenderer.
Returns:
string
Returns the bullet number.
Returns:
int
Returns the bullet style. See SetBulletStyle for a list of available styles.
Returns:
int
Returns the bullet text, which could be a symbol, or (for example) cached outline text.
Returns:
string
Returns the name of the character style.
Returns:
string
Returns flags indicating which attributes are applicable. See SetFlags for a list of available flags.
Returns:
long
Returns the left indent in tenths of a millimetre.
Returns:
long
Returns the left sub-indent in tenths of a millimetre.
Returns:
long
Returns the line spacing value, one of wx.richtext.TEXT_ATTR_LINE_SPACING_NORMAL, wx.richtext.TEXT_ATTR_LINE_SPACING_HALF, and wx.richtext.TEXT_ATTR_LINE_SPACING_TWICE.
Returns:
int
Returns the name of the list style.
Returns:
string
Returns the outline level.
Returns:
int
Returns the space in tenths of a millimeter after the paragraph.
Returns:
int
Returns the space in tenths of a millimeter before the paragraph.
Returns:
int
Returns the name of the paragraph style.
Returns:
string
Returns the right indent in tenths of a millimeter.
Returns:
long
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.
Returns:
list of integers
Returns the text effect bits of interest. See SetFlags for further information.
Returns:
int
Returns the text effects, a bit list of styles. See SetTextEffects for details.
Returns:
int
Returns the URL for the content.
Content with wx.richtext.TEXT_ATTR_URL style causes wx.richtext.RichTextCtrl to show a hand cursor over it, and wx.richtext.RichTextCtrl generates a wx.TextUrlEvent when the content is clicked.
Returns:
string
Returns True if the attribute object specifies alignment.
Returns:
bool
Returns True if the attribute object specifies a background colour.
Returns:
bool
Returns True if the attribute object specifies a standard bullet name.
Returns:
bool
Returns True if the attribute object specifies a bullet number.
Returns:
bool
Returns True if the attribute object specifies a bullet style.
Returns:
bool
Returns True if the attribute object specifies bullet text (usually specifying a symbol).
Returns:
bool
Returns True if the attribute object specifies a character style name.
Returns:
bool
Returns True if the flag is present in the attribute object’s flag bitlist.
Parameters:
Returns:
bool
Returns True if the attribute object specifies any font attributes.
Returns:
bool
Returns True if the attribute object specifies a font face name.
Returns:
bool
Returns True if the attribute object specifies italic style.
Returns:
bool
Returns True if the attribute object specifies a font point size.
Returns:
bool
Returns True if the attribute object specifies either underlining or no underlining.
Returns:
bool
Returns True if the attribute object specifies font weight (bold, light or normal).
Returns:
bool
Returns True if the attribute object specifies a left indent.
Returns:
bool
Returns True if the attribute object specifies line spacing.
Returns:
bool
Returns True if the attribute object specifies a list style name.
Returns:
bool
Returns True if the attribute object specifies an outline level.
Returns:
bool
Returns True if the attribute object specifies a page break before this paragraph.
Returns:
bool
Returns True if the attribute object specifies spacing after a paragraph.
Returns:
bool
Returns True if the attribute object specifies spacing before a paragraph.
Returns:
bool
Returns True if the attribute object specifies a paragraph style name.
Returns:
bool
Returns True if the attribute object specifies a right indent.
Returns:
bool
Returns True if the attribute object specifies tab stops.
Returns:
bool
Returns True if the attribute object specifies a text foreground colour.
Returns:
bool
Returns True if the attribute object specifies text effects.
Returns:
bool
Returns True if the attribute object specifies a URL.
Returns:
bool
Returns True if the object represents a character style, that is, the flags specify a font or a text background or foreground colour.
Returns:
bool
Returns False if we have any attributes set, True otherwise.
Returns:
bool
Returns True if the object represents a paragraph style, that is, the flags specify alignment, indentation, tabs, paragraph spacing, or bullet style.
Returns:
bool
Sets the paragraph alignment. These are the possible values for alignment:
Of these, wx.TEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only.
Parameters:
Sets the name of the font associated with the bullet symbol. Only valid for attributes with wx.richtext.TEXT_ATTR_BULLET_SYMBOL.
Parameters:
Sets the standard bullet name, applicable if the bullet style is wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD.
See GetBulletName for a list of supported names, and how to expand the range of supported types.
Parameters:
Sets the bullet number.
Parameters:
Sets the bullet style. The following styles can be passed:
Bullet Style Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_BULLET_STYLE_NONE | 0x00000000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ARABIC | 0x00000001 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER | 0x00000002 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER | 0x00000004 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER | 0x00000008 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER | 0x00000010 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_SYMBOL | 0x00000020 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP | 0x00000040 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_PARENTHESES | 0x00000080 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_PERIOD | 0x00000100 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_STANDARD | 0x00000200 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS | 0x00000400 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_OUTLINE | 0x00000800 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT | 0x00000000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT | 0x00001000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE | 0x00002000 |
Of these, wx.richtext.TEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented.
Parameters:
Sets the bullet text, which could be a symbol, or (for example) cached outline text.
Parameters:
Sets the character style name.
Parameters:
Sets the flags determining which styles are being specified. The following flags can be passed in a bitlist:
Standard Constants | Value |
---|---|
wx.TEXT_ATTR_TEXT_COLOUR | 0x00000001 |
wx.TEXT_ATTR_BACKGROUND_COLOUR | 0x00000002 |
wx.TEXT_ATTR_FONT_FACE | 0x00000004 |
wx.TEXT_ATTR_FONT_SIZE | 0x00000008 |
wx.TEXT_ATTR_FONT_WEIGHT | 0x00000010 |
wx.TEXT_ATTR_FONT_ITALIC | 0x00000020 |
wx.TEXT_ATTR_FONT_UNDERLINE | 0x00000040 |
wx.TEXT_ATTR_FONT | wx.TEXT_ATTR_FONT_FACE | wx.TEXT_ATTR_FONT_SIZE | wx.TEXT_ATTR_FONT_WEIGHT | wx.TEXT_ATTR_FONT_ITALIC | wx.TEXT_ATTR_FONT_UNDERLINE |
wx.TEXT_ATTR_ALIGNMENT | 0x00000080 |
wx.TEXT_ATTR_LEFT_INDENT | 0x00000100 |
wx.TEXT_ATTR_RIGHT_INDENT | 0x00000200 |
wx.TEXT_ATTR_TABS | 0x00000400 |
These are available by importing wx.richtext:
Extra Formatting Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_PARA_SPACING_AFTER | 0x00000800 |
wx.richtext.TEXT_ATTR_PARA_SPACING_BEFORE | 0x00001000 |
wx.richtext.TEXT_ATTR_LINE_SPACING | 0x00002000 |
wx.richtext.TEXT_ATTR_CHARACTER_STYLE_NAME | 0x00004000 |
wx.richtext.TEXT_ATTR_PARAGRAPH_STYLE_NAME | 0x00008000 |
wx.richtext.TEXT_ATTR_LIST_STYLE_NAME | 0x00010000 |
wx.richtext.TEXT_ATTR_BULLET_STYLE | 0x00020000 |
wx.richtext.TEXT_ATTR_BULLET_NUMBER | 0x00040000 |
wx.richtext.TEXT_ATTR_BULLET_TEXT | 0x00080000 |
wx.richtext.TEXT_ATTR_BULLET_NAME | 0x00100000 |
wx.richtext.TEXT_ATTR_URL | 0x00200000 |
wx.richtext.TEXT_ATTR_PAGE_BREAK | 0x00400000 |
wx.richtext.TEXT_ATTR_EFFECTS | 0x00800000 |
wx.richtext.TEXT_ATTR_OUTLINE_LEVEL | 0x01000000 |
Parameters:
Sets the font face name.
Parameters:
Sets the font size in points.
Parameters:
Sets the font style (normal, italic or slanted).
Parameters:
Sets the font underlining.
Parameters:
Sets the font weight.
Parameters:
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.
wx.richtext.RichTextBuffer 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.
Parameters:
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:
Line Spacing Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_LINE_SPACING_NORMAL | 10 |
wx.richtext.TEXT_ATTR_LINE_SPACING_HALF | 15 |
wx.richtext.TEXT_ATTR_LINE_SPACING_TWICE | 20 |
Parameters:
Sets the list style name.
Parameters:
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.
Parameters:
Specifies a page break before this paragraph.
Parameters:
Sets the spacing after a paragraph, in tenths of a millimetre.
Parameters:
Sets the spacing before a paragraph, in tenths of a millimetre.
Parameters:
Sets the name of the paragraph style.
Parameters:
Sets the right indent in tenths of a millimetre.
Parameters:
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.
Parameters:
Sets the text effect bits of interest.
You should also pass wx.richtext.TEXT_ATTR_EFFECTS to SetFlags.
See SetFlags for further information.
Parameters:
Sets the text effects, a bit list of styles.
The following styles can be passed:
Text Effects Flags | Value |
---|---|
wx.richtext.TEXT_ATTR_EFFECT_NONE | 0x00000000 |
wx.richtext.TEXT_ATTR_EFFECT_CAPITALS | 0x00000001 |
wx.richtext.TEXT_ATTR_EFFECT_SMALL_CAPITALS | 0x00000002 |
wx.richtext.TEXT_ATTR_EFFECT_STRIKETHROUGH | 0x00000004 |
wx.richtext.TEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH | 0x00000008 |
wx.richtext.TEXT_ATTR_EFFECT_SHADOW | 0x00000010 |
wx.richtext.TEXT_ATTR_EFFECT_EMBOSS | 0x00000020 |
wx.richtext.TEXT_ATTR_EFFECT_OUTLINE | 0x00000040 |
wx.richtext.TEXT_ATTR_EFFECT_ENGRAVE | 0x00000080 |
wx.richtext.TEXT_ATTR_EFFECT_SUPERSCRIPT | 0x00000100 |
wx.richtext.TEXT_ATTR_EFFECT_SUBSCRIPT | 0x00000200 |
Of these, only wx.richtext.TEXT_ATTR_EFFECT_CAPITALS and wx.richtext.TEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
wx.richtext.TEXT_ATTR_EFFECT_CAPITALS capitalises text when displayed (leaving the case of the actual buffer text unchanged), and wx.richtext.TEXT_ATTR_EFFECT_STRIKETHROUGH draws a line through text.
To set effects, you should also pass wx.richtext.TEXT_ATTR_EFFECTS to SetFlags, and call SetTextEffectFlags with the styles (taken from the above set) that you are interested in setting.
Parameters:
Sets the URL for the content.
Sets the wx.richtext.TEXT_ATTR_URL style.
Content with wx.richtext.TEXT_ATTR_URL style causes wx.richtext.RichTextCtrl to show a hand cursor over it, and wx.richtext.RichTextCtrl generates a wx.TextUrlEvent when the content is clicked.
Parameters: