RichTextAttr represents the character and paragraph attributes, or style,
for a range of text in a RichTextCtrl. This class
is specific to RichTextCtrl, although you can also use the
standard TextAttr class with RichTextCtrl.
When setting up a RichTextAttr object, you can pass a bitlist mask to
set_flags to indicate which style elements
should be changed. As a convenience, when you call a setter such as
set_font, the relevant bit will be set. This
should cover most normal cases.
RichTextAttr stores attributes without a Font object, so is a more
efficient way to query styles than using a TextAttr object.
No base class
The following values can be passed to RichTextAttr::SetAlignment to determine
paragraph alignment.
Of these, 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 RichTextAttr::SetFlags
to determine what attributes will be considered when setting the
attributes for a text control.
Extra formatting flags not in TextAttr
TEXT_ATTR_PARA_SPACING_AFTER TEXT_ATTR_PARA_SPACING_BEFORE TEXT_ATTR_LINE_SPACING TEXT_ATTR_CHARACTER_STYLE_NAME TEXT_ATTR_PARAGRAPH_STYLE_NAME TEXT_ATTR_LIST_STYLE_NAME TEXT_ATTR_BULLET_STYLE TEXT_ATTR_BULLET_NUMBER TEXT_ATTR_BULLET_TEXT TEXT_ATTR_BULLET_NAME TEXT_ATTR_URL TEXT_ATTR_PAGE_BREAK TEXT_ATTR_EFFECTS TEXT_ATTR_OUTLINE_LEVELThe following styles can be passed to RichTextAttr#set_bullet_style
TEXT_ATTR_BULLET_STYLE_NONE TEXT_ATTR_BULLET_STYLE_ARABIC TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER TEXT_ATTR_BULLET_STYLE_SYMBOL TEXT_ATTR_BULLET_STYLE_BITMAP TEXT_ATTR_BULLET_STYLE_PARENTHESES TEXT_ATTR_BULLET_STYLE_PERIOD TEXT_ATTR_BULLET_STYLE_STANDARD TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS TEXT_ATTR_BULLET_STYLE_OUTLINE TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT TEXT_ATTR_BULLET_STYLE_ALIGN_CENTREOf these, TEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented.
The following constants can be passed to RichTextAttr#set_line_spacing
TEXT_ATTR_LINE_SPACING_NORMAL 10 TEXT_ATTR_LINE_SPACING_HALF 15 TEXT_ATTR_LINE_SPACING_TWICE 20The following styles can be passed to RichTextAttr#set_text_effects
TEXT_ATTR_EFFECT_NONE TEXT_ATTR_EFFECT_CAPITALS TEXT_ATTR_EFFECT_SMALL_CAPITALS TEXT_ATTR_EFFECT_STRIKETHROUGH TEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH TEXT_ATTR_EFFECT_SHADOW TEXT_ATTR_EFFECT_EMBOSS TEXT_ATTR_EFFECT_OUTLINE TEXT_ATTR_EFFECT_ENGRAVE TEXT_ATTR_EFFECT_SUPERSCRIPT TEXT_ATTR_EFFECT_SUBSCRIPTOf these, only TEXT_ATTR_EFFECT_CAPITALS and TEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
Constructor.
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).
See also RichTextAttr#combine for a function that does almost the same but returns a new object instead of modifying the original object.
Combines ‘this’ with style, but not applying attributes from style that are the same as those in compareWith (if passed).
A RichTextAttr object is returned and the original object is not changed.
See also RichTextAttr#apply for a function that does almost the same but modifies the original object instead of returning a new one.
Creates a font from the font attributes.
Returns the alignment flags.
See RichTextAttr#set_alignment for a list of available styles.
Returns the background colour.
Returns a string containing the name of the font associated with the bullet symbol.
Only valid for attributes with TEXT_ATTR_BULLET_SYMBOL.
Returns the standard bullet name, applicable if the bullet style is TEXT_ATTR_BULLET_STYLE_STANDARD.
Currently the following standard bullet names are supported:
standard/circle
standard/square
standard/diamond
standard/triangle
If you wish your application to support further bullet graphics, you can derive a
class from RichTextRenderer or RichTextStdRenderer, override DrawStandardBullet
and EnumerateStandardBulletNames
, and
set an instance of the class using RichTextBuffer#set_renderer.
Returns the bullet number.
Returns the bullet style. See
RichTextAttr#set_bullet_style
for a list of available styles.
Returns the bullet text, which could be a symbol, or (for example) cached outline text.
Returns the name of the character style.
Returns flags indicating which attributes are applicable.
See RichTextAttr#set_flags for a list of available flags.
Sets the font attributes from the given font.
Returns the font face name.
Returns the font size in points.
Returns the font style.
Returns if the font is underlined.
Returns the font weight.
Returns the left indent in tenths of a millimetre.
Returns the left sub-indent in tenths of a millimetre.
Returns the line spacing value, one of TEXT_ATTR_LINE_SPACING_NORMAL,
TEXT_ATTR_LINE_SPACING_HALF, and TEXT_ATTR_LINE_SPACING_TWICE.
Returns the name of the list style.
Returns the outline level.
Returns the space in tenths of a millimeter after the paragraph.
Returns the space in tenths of a millimeter before the paragraph.
Returns the name of the paragraph style.
Returns the right indent in tenths of a millimeter.
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 the text foreground colour.
Returns the text effect bits of interest. See RichTextAttr#set_flags for further information.
Returns the text effects, a bit list of styles. See RichTextAttr#set_text_effects for
details.
Returns the URL for the content. Content with TEXT_ATTR_URL style
causes RichTextCtrl to show a hand cursor over it, and RichTextCtrl generates
a TextUrlEvent when the content is clicked.
Returns if the attribute object specifies alignment.
Returns if the attribute object specifies a background colour.
Returns if the attribute object specifies a standard bullet name.
Returns if the attribute object specifies a bullet number.
Returns if the attribute object specifies a bullet style.
Returns if the attribute object specifies bullet text (usually specifying a symbol).
Returns if the attribute object specifies a character style name.
Returns if the attribute object specifies a font face name.
Returns if the flag is present in the attribute object’s flag bitlist.
Returns if the attribute object specifies any font attributes.
Returns if the attribute object specifies italic style.
Returns if the attribute object specifies a left indent.
Returns if the attribute object specifies line spacing.
Returns if the attribute object specifies a list style name.
Returns if the attribute object specifies an outline level.
Returns if the attribute object specifies a page break before this paragraph.
Returns if the attribute object specifies spacing after a paragraph.
Returns if the attribute object specifies spacing before a paragraph.
Returns if the attribute object specifies a paragraph style name.
Returns if the attribute object specifies a right indent.
Returns if the attribute object specifies a font point size.
Returns if the attribute object specifies tab stops.
Returns if the attribute object specifies a text foreground colour.
Returns if the attribute object specifies text effects.
Returns if the attribute object specifies either underlining or no underlining.
Returns if the attribute object specifies a URL.
Returns if the attribute object specifies font weight (bold, light or normal).
Returns if the object represents a character style, that is,
the flags specify a font or a text background or foreground colour.
Returns if we have any attributes set, otherwise.
Returns if the object represents a paragraph style, that is,
the flags specify alignment, indentation, tabs, paragraph spacing, or
bullet style.
Sets the paragraph alignment. These are the possible values for alignment:
TEXT_ALIGNMENT_DEFAULT, TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTRE, TEXT_ALIGNMENT_CENTER = TEXT_ALIGNMENT_CENTRE, TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_JUSTIFIEDOf these, TEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future
justification may be supported when printing or previewing, only.
Sets the background colour.
Sets the name of the font associated with the bullet symbol.
Only valid for attributes with TEXT_ATTR_BULLET_SYMBOL.
Sets the standard bullet name, applicable if the bullet style is TEXT_ATTR_BULLET_STYLE_STANDARD.
See RichTextAttr#get_bullet_name for a list
of supported names, and how to expand the range of supported types.
Sets the bullet number.
Sets the bullet style. The following styles can be passed:
TEXT_ATTR_BULLET_STYLE_NONE TEXT_ATTR_BULLET_STYLE_ARABIC TEXT_ATTR_BULLET_STYLE_LETTERS_UPPER TEXT_ATTR_BULLET_STYLE_LETTERS_LOWER TEXT_ATTR_BULLET_STYLE_ROMAN_UPPER TEXT_ATTR_BULLET_STYLE_ROMAN_LOWER TEXT_ATTR_BULLET_STYLE_SYMBOL TEXT_ATTR_BULLET_STYLE_BITMAP TEXT_ATTR_BULLET_STYLE_PARENTHESES TEXT_ATTR_BULLET_STYLE_PERIOD TEXT_ATTR_BULLET_STYLE_STANDARD TEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS TEXT_ATTR_BULLET_STYLE_OUTLINE TEXT_ATTR_BULLET_STYLE_ALIGN_LEFT TEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT TEXT_ATTR_BULLET_STYLE_ALIGN_CENTRECurrently TEXT_ATTR_BULLET_STYLE_BITMAP is not supported.
Sets the bullet text, which could be a symbol, or (for example) cached outline text.
Sets the character style name.
Sets the flags determining which styles are being specified. The following
flags can be passed in a bitlist:
Standard TextAttr constants
TEXT_ATTR_TEXT_COLOUR TEXT_ATTR_BACKGROUND_COLOUR TEXT_ATTR_FONT_FACE TEXT_ATTR_FONT_SIZE TEXT_ATTR_FONT_WEIGHT TEXT_ATTR_FONT_ITALIC TEXT_ATTR_FONT_UNDERLINE TEXT_ATTR_FONT TEXT_ATTR_ALIGNMENT TEXT_ATTR_LEFT_INDENT TEXT_ATTR_RIGHT_INDENT TEXT_ATTR_TABSExtra formatting flags not in TextAttr
TEXT_ATTR_PARA_SPACING_AFTER TEXT_ATTR_PARA_SPACING_BEFORE TEXT_ATTR_LINE_SPACING TEXT_ATTR_CHARACTER_STYLE_NAME TEXT_ATTR_PARAGRAPH_STYLE_NAME TEXT_ATTR_LIST_STYLE_NAME TEXT_ATTR_BULLET_STYLE TEXT_ATTR_BULLET_NUMBER TEXT_ATTR_BULLET_TEXT TEXT_ATTR_BULLET_NAME TEXT_ATTR_URL TEXT_ATTR_PAGE_BREAK TEXT_ATTR_EFFECTS TEXT_ATTR_OUTLINE_LEVELSets the paragraph alignment.
Sets the font size in points.
Sets the font style (normal, italic or slanted).
Sets the font underlining.
Sets the font weight.
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.
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.
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:
Sets the list style name.
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.
Specifies a page break before this paragraph.
Sets the spacing after a paragraph, in tenths of a millimetre.
Sets the spacing before a paragraph, in tenths of a millimetre.
Sets the name of the paragraph style.
Sets the right indent in tenths of a millimetre.
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.
Sets the text foreground colout.
Sets the text effect bits of interest. You should also pass TEXT_ATTR_EFFECTS to RichTextAttr#set_flags.
See RichTextAttr#set_flags for further information.
Sets the text effects, a bit list of styles.
The following styles can be passed:
TEXT_ATTR_EFFECT_NONE TEXT_ATTR_EFFECT_CAPITALS TEXT_ATTR_EFFECT_SMALL_CAPITALS TEXT_ATTR_EFFECT_STRIKETHROUGH TEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH TEXT_ATTR_EFFECT_SHADOW TEXT_ATTR_EFFECT_EMBOSS TEXT_ATTR_EFFECT_OUTLINE TEXT_ATTR_EFFECT_ENGRAVE TEXT_ATTR_EFFECT_SUPERSCRIPT TEXT_ATTR_EFFECT_SUBSCRIPTOf these, only TEXT_ATTR_EFFECT_CAPITALS and
TEXT_ATTR_EFFECT_STRIKETHROUGH are implemented.
TEXT_ATTR_EFFECT_CAPITALS capitalises text when displayed (leaving the
case of the actual buffer text unchanged), and
TEXT_ATTR_EFFECT_STRIKETHROUGH draws a line through text.
To set effects, you should also pass TEXT_ATTR_EFFECTS to RichTextAttr#set_flags, and call RichTextAttr#set_text_effect_flags with the styles (taken from the
above set) that you are interested in setting.
Sets the URL for the content. Sets the TEXT_ATTR_URL style; content with
this style causes RichTextCtrl to show a hand cursor over it, and
RichTextCtrl generates a TextUrlEvent when the content is clicked.
[This page automatically generated from the Textile source at 2023-06-13 21:31:36 +0000]