wxRichTextAttrwxRichTextAttr represents the character and paragraph attributes, or style, for a range of text in a wxRichTextCtrl. This class is specific to wxRichTextCtrl, although you can also use the standard wxTextAttr class with wxRichTextCtrl. When setting up a wxRichTextAttr object, pass a bitlist mask to 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. wxRichTextAttr stores attributes without a wxFont object, so is a more efficient way to query styles than using a wxTextAttr or wxTextAttrEx object. Derived from No base class Include files <wx/richtext/richtextbuffer.h> Constants The following values can be passed to wxRichTextAttr::SetAlignment to determine paragraph alignment.
Of these, wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only. The following values are passed in a bitlist to wxRichTextAttr::SetFlags to determine what attributes will be considered when setting the attributes for a text control.
The following styles can be passed to wxRichTextAttr::SetBulletStyle:
Of these, wxTEXT_ATTR_BULLET_STYLE_BITMAP is unimplemented. The following constants can be passed to wxRichTextAttr::SetLineSpacing:
The following styles can be passed to wxTextAttrEx::SetTextEffects:
Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH are implemented. See also wxTextAttr, wxTextAttrEx, wxRichTextCtrl Members
wxRichTextAttr::wxRichTextAttr
wxRichTextAttr::wxRichTextAttrwxRichTextAttr() wxRichTextAttr(const wxColour& colText, const wxColour& colBack = wxNullColour, wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT) wxRichTextAttr(const wxTextAttrEx& attr) Constructors.
wxRichTextAttr::Applybool Combine(const wxRichTextAttrEx& style, const wxRichTextAttrEx* 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). See also wxRichTextAttr::Combine for a function that does almost the same but returns a new object instead of modifying the original object.
wxRichTextAttr::CombinewxRichTextAttr Combine(const wxRichTextAttrEx& style, const wxRichTextAttrEx* compareWith = NULL) const Combines 'this' with style, but not applying attributes from style that are the same as those in compareWith (if passed). A wxRichTextAttr object is returned and the original object is not changed. See also wxRichTextAttr::Apply for a function that does almost the same but modifies the original object instead of returning a new one.
wxRichTextAttr::CreateFontwxFont CreateFont() const Creates a font from the font attributes.
wxRichTextAttr::GetAlignmentwxTextAttrAlignment GetAlignment() const Returns the alignment flags. See wxRichTextAttr::SetAlignment for a list of available styles.
wxRichTextAttr::GetBackgroundColourconst wxColour& GetBackgroundColour() const Returns the background colour.
wxRichTextAttr::GetBulletFontconst wxString& 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.
wxRichTextAttr::GetBulletNameconst wxString& 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:
If you wish your application 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.
wxRichTextAttr::GetBulletNumberint GetBulletNumber() const Returns the bullet number.
wxRichTextAttr::GetBulletStyleint GetBulletStyle() const Returns the bullet style. See wxRichTextAttr::SetBulletStyle for a list of available styles.
wxRichTextAttr::GetBulletTextconst wxString& GetBulletText() const Returns the bullet text, which could be a symbol, or (for example) cached outline text.
wxRichTextAttr::GetCharacterStyleNameconst wxString& GetCharacterStyleName() const Returns the name of the character style.
wxRichTextAttr::GetFlagslong GetFlags() const Returns flags indicating which attributes are applicable. See wxRichTextAttr::SetFlags for a list of available flags.
wxRichTextAttr::GetFontAttributesbool GetFontAttributes(const wxFont& font) Sets the font attributes from the given font.
wxRichTextAttr::GetFontFaceNameconst wxString& GetFontFaceName() const Returns the font face name.
wxRichTextAttr::GetFontSizeint GetFontSize() const Returns the font size in points.
wxRichTextAttr::GetFontStyleint GetFontStyle() const Returns the font style.
wxRichTextAttr::GetFontUnderlinedbool GetFontUnderlined() const Returns true if the font is underlined.
wxRichTextAttr::GetFontWeightint GetFontWeight() const Returns the font weight.
wxRichTextAttr::GetLeftIndentlong GetLeftIndent() const Returns the left indent in tenths of a millimetre.
wxRichTextAttr::GetLeftSubIndentlong GetLeftSubIndent() const Returns the left sub-indent in tenths of a millimetre.
wxRichTextAttr::GetLineSpacingint 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.
wxRichTextAttr::GetListStyleNameconst wxString& GetListStyleName() const Returns the name of the list style.
wxRichTextAttr::GetOutlineLevelint GetOutlineLevel() const Returns the outline level.
wxRichTextAttr::GetParagraphSpacingAfterint GetParagraphSpacingAfter() const Returns the space in tenths of a millimeter after the paragraph.
wxRichTextAttr::GetParagraphSpacingBeforeint GetParagraphSpacingBefore() const Returns the space in tenths of a millimeter before the paragraph.
wxRichTextAttr::GetParagraphStyleNameconst wxString& GetParagraphStyleName() const Returns the name of the paragraph style.
wxRichTextAttr::GetRightIndentlong GetRightIndent() const Returns the right indent in tenths of a millimeter.
wxRichTextAttr::GetTabsconst wxArrayInt& 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.
wxRichTextAttr::GetTextColourconst wxColour& GetTextColour() const Returns the text foreground colour.
wxRichTextAttr::GetTextEffectFlagsint GetTextEffectFlags() const Returns the text effect bits of interest. See wxRichTextAttr::SetFlags for further information.
wxRichTextAttr::GetTextEffectsint GetTextEffects() const Returns the text effects, a bit list of styles. See wxRichTextAttr::SetTextEffects for details.
wxRichTextAttr::GetURLconst wxString& 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.
wxRichTextAttr::HasAlignmentbool HasAlignment() const Returns true if the attribute object specifies alignment.
wxRichTextAttr::HasBackgroundColourbool HasBackgroundColour() const Returns true if the attribute object specifies a background colour.
wxRichTextAttr::HasBulletNamebool HasBulletName() const Returns true if the attribute object specifies a standard bullet name.
wxRichTextAttr::HasBulletNumberbool HasBulletNumber() const Returns true if the attribute object specifies a bullet number.
wxRichTextAttr::HasBulletStylebool HasBulletStyle() const Returns true if the attribute object specifies a bullet style.
wxRichTextAttr::HasBulletTextbool HasBulletText() const Returns true if the attribute object specifies bullet text (usually specifying a symbol).
wxRichTextAttr::HasCharacterStyleNamebool HasCharacterStyleName() const Returns true if the attribute object specifies a character style name.
wxRichTextAttr::HasFontFaceNamebool HasFontFaceName() const Returns true if the attribute object specifies a font face name.
wxRichTextAttr::HasFlagbool HasFlag(long flag) const Returns true if the flag is present in the attribute object's flag bitlist.
wxRichTextAttr::HasFontbool HasFont() const Returns true if the attribute object specifies any font attributes.
wxRichTextAttr::HasFontItalicbool HasFontItalic() const Returns true if the attribute object specifies italic style.
wxRichTextAttr::HasLeftIndentbool HasLeftIndent() const Returns true if the attribute object specifies a left indent.
wxRichTextAttr::HasLineSpacingbool HasLineSpacing() const Returns true if the attribute object specifies line spacing.
wxRichTextAttr::HasListStyleNamebool HasListStyleName() const Returns true if the attribute object specifies a list style name.
wxRichTextAttr::HasOutlineLevelbool HasOutlineLevel() const Returns true if the attribute object specifies an outline level.
wxRichTextAttr::HasPageBreakbool HasPageBreak() const Returns true if the attribute object specifies a page break before this paragraph.
wxRichTextAttr::HasParagraphSpacingAfterbool HasParagraphSpacingAfter() const Returns true if the attribute object specifies spacing after a paragraph.
wxRichTextAttr::HasParagraphSpacingBeforebool HasParagraphSpacingBefore() const Returns true if the attribute object specifies spacing before a paragraph.
wxRichTextAttr::HasParagraphStyleNamebool HasParagraphStyleName() const Returns true if the attribute object specifies a paragraph style name.
wxRichTextAttr::HasRightIndentbool HasRightIndent() const Returns true if the attribute object specifies a right indent.
wxRichTextAttr::HasFontSizebool HasFontSize() const Returns true if the attribute object specifies a font point size.
wxRichTextAttr::HasTabsbool HasTabs() const Returns true if the attribute object specifies tab stops.
wxRichTextAttr::HasTextColourbool HasTextColour() const Returns true if the attribute object specifies a text foreground colour.
wxRichTextAttr::HasTextEffectsbool HasTextEffects() const Returns true if the attribute object specifies text effects.
wxRichTextAttr::HasFontUnderlinedbool HasFontUnderlined() const Returns true if the attribute object specifies either underlining or no underlining.
wxRichTextAttr::HasURLbool HasURL() const Returns true if the attribute object specifies a URL.
wxRichTextAttr::HasFontWeightbool HasFontWeight() const Returns true if the attribute object specifies font weight (bold, light or normal).
wxRichTextAttr::IsCharacterStylebool 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.
wxRichTextAttr::IsDefaultbool IsDefault() const Returns false if we have any attributes set, true otherwise.
wxRichTextAttr::IsParagraphStylebool IsParagraphStyle() const Returns true if the object represents a paragraph style, that is, the flags specify alignment, indentation, tabs, paragraph spacing, or bullet style.
wxRichTextAttr::SetAlignmentvoid SetAlignment(wxTextAttrAlignment alignment) Sets the paragraph alignment. These are the possible values for alignment:
Of these, wxTEXT_ALIGNMENT_JUSTIFIED is unimplemented. In future justification may be supported when printing or previewing, only.
wxRichTextAttr::SetBackgroundColourvoid SetBackgroundColour(const wxColour& colBack) Sets the background colour.
wxRichTextAttr::SetBulletFontvoid SetBulletFont(const wxString& font) Sets the name of the font associated with the bullet symbol. Only valid for attributes with wxTEXT_ATTR_BULLET_SYMBOL.
wxRichTextAttr::SetBulletNamevoid SetBulletName(const wxString& name) Sets the standard bullet name, applicable if the bullet style is wxTEXT_ATTR_BULLET_STYLE_STANDARD. See wxRichTextAttr::GetBulletName for a list of supported names, and how to expand the range of supported types.
wxRichTextAttr::SetBulletNumbervoid SetBulletNumber(int n) Sets the bullet number.
wxRichTextAttr::SetBulletStylevoid SetBulletStyle(int style) Sets the bullet style. The following styles can be passed:
Currently wxTEXT_ATTR_BULLET_STYLE_BITMAP is not supported.
wxRichTextAttr::SetBulletTextvoid SetBulletText(const wxStringtext) Sets the bullet text, which could be a symbol, or (for example) cached outline text.
wxRichTextAttr::SetCharacterStyleNamevoid SetCharacterStyleName(const wxString& name) Sets the character style name.
wxRichTextAttr::SetFlagsvoid SetFlags(long flags) Sets the flags determining which styles are being specified. The following flags can be passed in a bitlist:
wxRichTextAttr::SetFontFaceNamevoid SetFontFaceName(const wxString& faceName) Sets the paragraph alignment.
wxRichTextAttr::SetFontSizevoid SetFontSize(int pointSize) Sets the font size in points.
wxRichTextAttr::SetFontStylevoid SetFontStyle(int fontStyle) Sets the font style (normal, italic or slanted).
wxRichTextAttr::SetFontUnderlinedvoid SetFontUnderlined(bool underlined) Sets the font underlining.
wxRichTextAttr::SetFontWeightvoid SetFontWeight(int fontWeight) Sets the font weight.
wxRichTextAttr::SetLeftIndentvoid 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.
wxRichTextAttr::SetLineSpacingvoid 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:
wxRichTextAttr::SetListStyleNamevoid SetListStyleName(const wxString& name) Sets the list style name.
wxRichTextAttr::SetOutlineLevelvoid 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.
wxRichTextAttr::SetPageBreakvoid SetPageBreak(bool pageBreak = true) Specifies a page break before this paragraph.
wxRichTextAttr::SetParagraphSpacingAftervoid SetParagraphSpacingAfter(int spacing) Sets the spacing after a paragraph, in tenths of a millimetre.
wxRichTextAttr::SetParagraphSpacingBeforevoid SetParagraphSpacingBefore(int spacing) Sets the spacing before a paragraph, in tenths of a millimetre.
wxRichTextAttr::SetParagraphStyleNamevoid SetParagraphStyleName(const wxString& name) Sets the name of the paragraph style.
wxRichTextAttr::SetRightIndentvoid SetRightIndent(int indent) Sets the right indent in tenths of a millimetre.
wxRichTextAttr::SetTabsvoid 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.
wxRichTextAttr::SetTextColourvoid SetTextColour(const wxColour& colText) Sets the text foreground colout.
wxRichTextAttr::SetTextEffectFlagsvoid SetTextEffectFlags(int flags) Sets the text effect bits of interest. You should also pass wxTEXT_ATTR_EFFECTS to wxRichTextAttr::SetFlags. See wxRichTextAttr::SetFlags for further information.
wxRichTextAttr::SetTextEffectsvoid SetTextEffects(int effects) Sets the text effects, a bit list of styles. The following styles can be passed:
Of these, only wxTEXT_ATTR_EFFECT_CAPITALS and wxTEXT_ATTR_EFFECT_STRIKETHROUGH 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 wxRichTextAttr::SetFlags, and call wxRichTextAttr::SetTextEffectFlags with the styles (taken from the above set) that you are interested in setting.
wxRichTextAttr::SetURLvoid 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.
wxRichTextAttr::operator=void operator operator=(const wxTextAttrEx& attr) Assignment from a wxTextAttrEx object. void operator operator=(const wxRichTextAttr& attr) Assignment from a wxRichTextAttr object.
wxRichTextAttr::wxTextAttrExoperator wxTextAttrEx() const Makes a wxTextAttrEx object from this object.
|