Merged wxRichTextAttr and wxTextAttrEx into wxTextAttr, and added a font table

to wxRichTextBuffer to reduce wxFont consumption and increase performance.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-10-09 11:20:36 +00:00
parent e97e6073b3
commit 44cc96a80c
46 changed files with 2101 additions and 4010 deletions

View File

@@ -187,16 +187,18 @@ All (GUI):
- Show standard options in wxCmdLineParser usage message (Francesco Montorsi). - Show standard options in wxCmdLineParser usage message (Francesco Montorsi).
- Added wxRect::operator+ (union) and * (intersection) (bdonner). - Added wxRect::operator+ (union) and * (intersection) (bdonner).
- Added support for two auxiliary mouse buttons to wxMouseEvent (Chris Weiland). - Added support for two auxiliary mouse buttons to wxMouseEvent (Chris Weiland).
- Added wxToolTip::SetAutoPop() and SetReshow() (Jan Knepper) - Added wxToolTip::SetAutoPop() and SetReshow() (Jan Knepper).
- Added wxTaskBarIcon::Destroy() - Added wxTaskBarIcon::Destroy().
- Added XRC handler for wxSearchCtrl (Sander Berents) - Added XRC handler for wxSearchCtrl (Sander Berents).
- Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto) - Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto).
- Add support for reading alpha data from TIFF images - Add support for reading alpha data from TIFF images.
- Added wxSYS_DCLICK_TIME system metric constant (Arne Steinarson) - Added wxSYS_DCLICK_TIME system metric constant (Arne Steinarson).
- Added wxApp::Get/SetAppDisplayName() (Brian A. Vanderburg II) - Added wxApp::Get/SetAppDisplayName() (Brian A. Vanderburg II).
- Added wxWindow::GetPopupMenuSelectionFromUser() (Arne Steinarson) - Added wxWindow::GetPopupMenuSelectionFromUser() (Arne Steinarson).
- Implemented wxTreeCtrl::GetPrevVisible() in the generic version and made the - Implemented wxTreeCtrl::GetPrevVisible() in the generic version and made the
behaviour of GetNextSibling() consistent between wxMSW and generic versions behaviour of GetNextSibling() consistent between wxMSW and generic versions.
- Merged wxRichTextAttr and wxTextAttrEx into wxTextAttr, and added a font table
to wxRichTextBuffer to reduce wxFont consumption and increase performance.
wxGTK: wxGTK:

View File

@@ -620,7 +620,6 @@ and paragraph formatting.
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxRichTextCtrl}{wxrichtextctrl}}{A rich text control.} \twocolitem{\helpref{wxRichTextCtrl}{wxrichtextctrl}}{A rich text control.}
\twocolitem{\helpref{wxRichTextBuffer}{wxrichtextbuffer}}{The content of a rich text control.} \twocolitem{\helpref{wxRichTextBuffer}{wxrichtextbuffer}}{The content of a rich text control.}
\twocolitem{\helpref{wxRichTextAttr}{wxrichtextattr}}{Attributes specifying rich text styling.}
\twocolitem{\helpref{wxRichTextCharacterStyleDefinition}{wxrichtextcharacterstyledefinition}}{Definition of character styling.} \twocolitem{\helpref{wxRichTextCharacterStyleDefinition}{wxrichtextcharacterstyledefinition}}{Definition of character styling.}
\twocolitem{\helpref{wxRichTextParagraphStyleDefinition}{wxrichtextparagraphstyledefinition}}{Definition of paragraph styling.} \twocolitem{\helpref{wxRichTextParagraphStyleDefinition}{wxrichtextparagraphstyledefinition}}{Definition of paragraph styling.}
\twocolitem{\helpref{wxRichTextListStyleDefinition}{wxrichtextliststyledefinition}}{Definition of list styling.} \twocolitem{\helpref{wxRichTextListStyleDefinition}{wxrichtextliststyledefinition}}{Definition of list styling.}

View File

@@ -328,7 +328,6 @@
\input renderer.tex \input renderer.tex
\input rendver.tex \input rendver.tex
\input richtextattr.tex
\input richtextbuffer.tex \input richtextbuffer.tex
\input richtextcharacterstyledefinition.tex \input richtextcharacterstyledefinition.tex
\input richtextctrl.tex \input richtextctrl.tex
@@ -415,7 +414,6 @@
\input tempfile.tex \input tempfile.tex
\input tempfilestrm.tex \input tempfilestrm.tex
\input textattr.tex \input textattr.tex
\input textattrex.tex
\input text.tex \input text.tex
\input txtdatob.tex \input txtdatob.tex
\input txtdrptg.tex \input txtdrptg.tex

View File

@@ -1,880 +0,0 @@
\section{\class{wxRichTextAttr}}\label{wxrichtextattr}
wxRichTextAttr represents the character and paragraph attributes, or style,
for a range of text in a \helpref{wxRichTextCtrl}{wxrichtextctrl}. This class
is specific to wxRichTextCtrl, although you can also use the
standard \helpref{wxTextAttr}{wxtextattr} class with wxRichTextCtrl.
When setting up a wxRichTextAttr object, pass a bitlist mask to \helpref{SetFlags}{wxrichtextattrsetflags} 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 \helpref{wxTextAttr}{wxtextattr} or \helpref{wxTextAttrEx}{wxtextattrex} object.
\wxheading{Derived from}
No base class
\wxheading{Include files}
<wx/richtext/richtextbuffer.h>
\wxheading{Library}
\helpref{wxRichtext}{librarieslist}
\wxheading{Constants}
The following values can be passed to wxRichTextAttr::SetAlignment to determine
paragraph alignment.
{\small
\begin{verbatim}
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
\end{verbatim}
}
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.
{\small
\begin{verbatim}
// Standard wxTextAttr constants
#define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
#define wxTEXT_ATTR_FONT_FACE 0x00000004
#define wxTEXT_ATTR_FONT_SIZE 0x00000008
#define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
#define wxTEXT_ATTR_FONT_ITALIC 0x00000020
#define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
#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 0x00000080
#define wxTEXT_ATTR_LEFT_INDENT 0x00000100
#define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
#define wxTEXT_ATTR_TABS 0x00000400
// 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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
\end{verbatim}
}
The following styles can be passed to wxRichTextAttr::SetBulletStyle:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Of these, wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is unimplemented.
The following constants can be passed to wxRichTextAttr::SetLineSpacing:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
The following styles can be passed to wxTextAttrEx::SetTextEffects:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
Of these, only wxTEXT\_ATTR\_EFFECT\_CAPITALS and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH are implemented.
\wxheading{See also}
\helpref{wxTextAttr}{wxtextattr}, \helpref{wxTextAttrEx}{wxtextattrex}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxRichTextAttr::wxRichTextAttr}\label{wxrichtextattrwxrichtextattr}
\func{}{wxRichTextAttr}{\void}
\func{}{wxRichTextAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour}, \param{wxTextAttrAlignment }{alignment = wxTEXT\_ALIGNMENT\_DEFAULT}}
\func{}{wxRichTextAttr}{\param{const wxTextAttrEx\& }{attr}}
Constructors.
\membersection{wxRichTextAttr::Apply}\label{wxrichtextattrapply}
\func{bool}{Combine}{\param{const wxRichTextAttrEx\& }{style}, \param{const wxRichTextAttrEx* }{compareWith = NULL}}
Applies the attributes in {\it style} to the original object, but not those attributes from {\it style} that are the same as those in {\it compareWith} (if passed).
See also \helpref{wxRichTextAttr::Combine}{wxrichtextattrcombine} for a function that does almost the same but returns a new object instead of modifying the original object.
\membersection{wxRichTextAttr::Combine}\label{wxrichtextattrcombine}
\constfunc{wxRichTextAttr}{Combine}{\param{const wxRichTextAttrEx\& }{style}, \param{const wxRichTextAttrEx* }{compareWith = NULL}}
Combines 'this' with {\it style}, but not applying attributes from {\it style} that are the same as those in {\it compareWith} (if passed).
A wxRichTextAttr object is returned and the original object is not changed.
See also \helpref{wxRichTextAttr::Apply}{wxrichtextattrapply} for a function that does almost the same but modifies the original object instead of returning a new one.
\membersection{wxRichTextAttr::CreateFont}\label{wxrichtextattrcreatefont}
\constfunc{wxFont}{CreateFont}{\void}
Creates a font from the font attributes.
\membersection{wxRichTextAttr::GetAlignment}\label{wxrichtextattrgetalignment}
\constfunc{wxTextAttrAlignment}{GetAlignment}{\void}
Returns the alignment flags.
See \helpref{wxRichTextAttr::SetAlignment}{wxrichtextattrsetalignment} for a list of available styles.
\membersection{wxRichTextAttr::GetBackgroundColour}\label{wxrichtextattrgetbackgroundcolour}
\constfunc{const wxColour\&}{GetBackgroundColour}{\void}
Returns the background colour.
\membersection{wxRichTextAttr::GetBulletFont}\label{wxrichtextattrgetbulletfont}
\constfunc{const wxString\&}{GetBulletFont}{\void}
Returns a string containing the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxRichTextAttr::GetBulletName}\label{wxrichtextattrgetbulletname}
\constfunc{const wxString\&}{GetBulletName}{\void}
Returns the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
Currently the following standard bullet names are supported:
\begin{itemize}\itemsep=0pt
\item {\tt standard/circle}
\item {\tt standard/square}
\item {\tt standard/diamond}
\item {\tt standard/triangle}
\end{itemize}
If you wish your application to support further bullet graphics, you can derive a
class from wxRichTextRenderer or wxRichTextStdRenderer, override {\tt DrawStandardBullet} and {\tt EnumerateStandardBulletNames}, and
set an instance of the class using \helpref{wxRichTextBuffer::SetRenderer}{wxrichtextbuffersetrenderer}.
\membersection{wxRichTextAttr::GetBulletNumber}\label{wxrichtextattrgetbulletnumber}
\constfunc{int}{GetBulletNumber}{\void}
Returns the bullet number.
\membersection{wxRichTextAttr::GetBulletStyle}\label{wxrichtextattrgetbulletstyle}
\constfunc{int}{GetBulletStyle}{\void}
Returns the bullet style.
See \helpref{wxRichTextAttr::SetBulletStyle}{wxrichtextattrsetbulletstyle} for a list of available styles.
\membersection{wxRichTextAttr::GetBulletText}\label{wxrichtextattrgetbullettext}
\constfunc{const wxString\&}{GetBulletText}{\void}
Returns the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxRichTextAttr::GetCharacterStyleName}\label{wxrichtextattrgetcharacterstylename}
\constfunc{const wxString\&}{GetCharacterStyleName}{\void}
Returns the name of the character style.
\membersection{wxRichTextAttr::GetFlags}\label{wxrichtextattrgetflags}
\constfunc{long}{GetFlags}{\void}
Returns flags indicating which attributes are applicable.
See \helpref{wxRichTextAttr::SetFlags}{wxrichtextattrsetflags} for a list of available flags.
\membersection{wxRichTextAttr::GetFontAttributes}\label{wxrichtextattrgetfontattributes}
\func{bool}{GetFontAttributes}{\param{const wxFont\& }{font}}
Sets the font attributes from the given font.
\membersection{wxRichTextAttr::GetFontFaceName}\label{wxrichtextattrgetfontfacename}
\constfunc{const wxString\&}{GetFontFaceName}{\void}
Returns the font face name.
\membersection{wxRichTextAttr::GetFontSize}\label{wxrichtextattrgetfontsize}
\constfunc{int}{GetFontSize}{\void}
Returns the font size in points.
\membersection{wxRichTextAttr::GetFontStyle}\label{wxrichtextattrgetfontstyle}
\constfunc{int}{GetFontStyle}{\void}
Returns the font style.
\membersection{wxRichTextAttr::GetFontUnderlined}\label{wxrichtextattrgetfontunderlined}
\constfunc{bool}{GetFontUnderlined}{\void}
Returns \true if the font is underlined.
\membersection{wxRichTextAttr::GetFontWeight}\label{wxrichtextattrgetfontweight}
\constfunc{int}{GetFontWeight}{\void}
Returns the font weight.
\membersection{wxRichTextAttr::GetLeftIndent}\label{wxrichtextattrgetleftindent}
\constfunc{long}{GetLeftIndent}{\void}
Returns the left indent in tenths of a millimetre.
\membersection{wxRichTextAttr::GetLeftSubIndent}\label{wxrichtextattrgetleftsubindent}
\constfunc{long}{GetLeftSubIndent}{\void}
Returns the left sub-indent in tenths of a millimetre.
\membersection{wxRichTextAttr::GetLineSpacing}\label{wxrichtextattrgetlinespacing}
\constfunc{int}{GetLineSpacing}{\void}
Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
\membersection{wxRichTextAttr::GetListStyleName}\label{wxrichtextattrgetliststylename}
\constfunc{const wxString\&}{GetListStyleName}{\void}
Returns the name of the list style.
\membersection{wxRichTextAttr::GetOutlineLevel}\label{wxrichtextattrgetoutlinelevel}
\constfunc{bool}{GetOutlineLevel}{\void}
Returns the outline level.
\membersection{wxRichTextAttr::GetParagraphSpacingAfter}\label{wxrichtextattrgetparagraphspacingafter}
\constfunc{int}{GetParagraphSpacingAfter}{\void}
Returns the space in tenths of a millimeter after the paragraph.
\membersection{wxRichTextAttr::GetParagraphSpacingBefore}\label{wxrichtextattrgetparagraphspacingbefore}
\constfunc{int}{GetParagraphSpacingBefore}{\void}
Returns the space in tenths of a millimeter before the paragraph.
\membersection{wxRichTextAttr::GetParagraphStyleName}\label{wxrichtextattrgetparagraphstylename}
\constfunc{const wxString\&}{GetParagraphStyleName}{\void}
Returns the name of the paragraph style.
\membersection{wxRichTextAttr::GetRightIndent}\label{wxrichtextattrgetrightindent}
\constfunc{long}{GetRightIndent}{\void}
Returns the right indent in tenths of a millimeter.
\membersection{wxRichTextAttr::GetTabs}\label{wxrichtextattrgettabs}
\constfunc{const wxArrayInt\&}{GetTabs}{\void}
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.
\membersection{wxRichTextAttr::GetTextColour}\label{wxrichtextattrgettextcolour}
\constfunc{const wxColour\&}{GetTextColour}{\void}
Returns the text foreground colour.
\membersection{wxRichTextAttr::GetTextEffectFlags}\label{wxrichtextattrgettexteffectflags}
\constfunc{int}{GetTextEffectFlags}{\void}
Returns the text effect bits of interest. See \helpref{wxRichTextAttr::SetFlags}{wxrichtextattrsetflags} for further information.
\membersection{wxRichTextAttr::GetTextEffects}\label{wxrichtextattrgettexteffects}
\constfunc{int}{GetTextEffects}{\void}
Returns the text effects, a bit list of styles. See \helpref{wxRichTextAttr::SetTextEffects}{wxrichtextattrsettexteffects} for
details.
\membersection{wxRichTextAttr::GetURL}\label{wxrichtextattrgeturl}
\constfunc{const wxString\&}{GetURL}{\void}
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.
\membersection{wxRichTextAttr::HasAlignment}\label{wxrichtextattrhasalignment}
\constfunc{bool}{HasAlignment}{\void}
Returns \true if the attribute object specifies alignment.
\membersection{wxRichTextAttr::HasBackgroundColour}\label{wxrichtextattrhasbackgroundcolour}
\constfunc{bool}{HasBackgroundColour}{\void}
Returns \true if the attribute object specifies a background colour.
\membersection{wxRichTextAttr::HasBulletName}\label{wxrichtextattrhasbulletname}
\constfunc{bool}{HasBulletName}{\void}
Returns \true if the attribute object specifies a standard bullet name.
\membersection{wxRichTextAttr::HasBulletNumber}\label{wxrichtextattrhasbulletnumber}
\constfunc{bool}{HasBulletNumber}{\void}
Returns \true if the attribute object specifies a bullet number.
\membersection{wxRichTextAttr::HasBulletStyle}\label{wxrichtextattrhasbulletstyle}
\constfunc{bool}{HasBulletStyle}{\void}
Returns \true if the attribute object specifies a bullet style.
\membersection{wxRichTextAttr::HasBulletText}\label{wxrichtextattrhasbullettext}
\constfunc{bool}{HasBulletText}{\void}
Returns \true if the attribute object specifies bullet text (usually specifying a symbol).
\membersection{wxRichTextAttr::HasCharacterStyleName}\label{wxrichtextattrhascharacterstylename}
\constfunc{bool}{HasCharacterStyleName}{\void}
Returns \true if the attribute object specifies a character style name.
\membersection{wxRichTextAttr::HasFontFaceName}\label{wxrichtextattrhasfontfacename}
\constfunc{bool}{HasFontFaceName}{\void}
Returns \true if the attribute object specifies a font face name.
\membersection{wxRichTextAttr::HasFlag}\label{wxrichtextattrhasflag}
\constfunc{bool}{HasFlag}{\param{long }{flag}}
Returns \true if the {\it flag} is present in the attribute object's flag bitlist.
\membersection{wxRichTextAttr::HasFont}\label{wxrichtextattrhasfont}
\constfunc{bool}{HasFont}{\void}
Returns \true if the attribute object specifies any font attributes.
\membersection{wxRichTextAttr::HasFontItalic}\label{wxrichtextattrhasfontitalic}
\constfunc{bool}{HasFontItalic}{\void}
Returns \true if the attribute object specifies italic style.
\membersection{wxRichTextAttr::HasLeftIndent}\label{wxrichtextattrhasleftindent}
\constfunc{bool}{HasLeftIndent}{\void}
Returns \true if the attribute object specifies a left indent.
\membersection{wxRichTextAttr::HasLineSpacing}\label{wxrichtextattrhaslinespacing}
\constfunc{bool}{HasLineSpacing}{\void}
Returns \true if the attribute object specifies line spacing.
\membersection{wxRichTextAttr::HasListStyleName}\label{wxrichtextattrhasliststylename}
\constfunc{bool}{HasListStyleName}{\void}
Returns \true if the attribute object specifies a list style name.
\membersection{wxRichTextAttr::HasOutlineLevel}\label{wxrichtextattrhasoutlinelevel}
\constfunc{bool}{HasOutlineLevel}{\void}
Returns \true if the attribute object specifies an outline level.
\membersection{wxRichTextAttr::HasPageBreak}\label{wxrichtextattrhaspagebreak}
\constfunc{bool}{HasPageBreak}{\void}
Returns \true if the attribute object specifies a page break before this paragraph.
\membersection{wxRichTextAttr::HasParagraphSpacingAfter}\label{wxrichtextattrhasparagraphspacingafter}
\constfunc{bool}{HasParagraphSpacingAfter}{\void}
Returns \true if the attribute object specifies spacing after a paragraph.
\membersection{wxRichTextAttr::HasParagraphSpacingBefore}\label{wxrichtextattrhasparagraphspacingbefore}
\constfunc{bool}{HasParagraphSpacingBefore}{\void}
Returns \true if the attribute object specifies spacing before a paragraph.
\membersection{wxRichTextAttr::HasParagraphStyleName}\label{wxrichtextattrhasparagraphstylename}
\constfunc{bool}{HasParagraphStyleName}{\void}
Returns \true if the attribute object specifies a paragraph style name.
\membersection{wxRichTextAttr::HasRightIndent}\label{wxrichtextattrhasrightindent}
\constfunc{bool}{HasRightIndent}{\void}
Returns \true if the attribute object specifies a right indent.
\membersection{wxRichTextAttr::HasFontSize}\label{wxrichtextattrhasfontsize}
\constfunc{bool}{HasFontSize}{\void}
Returns \true if the attribute object specifies a font point size.
\membersection{wxRichTextAttr::HasTabs}\label{wxrichtextattrhastabs}
\constfunc{bool}{HasTabs}{\void}
Returns \true if the attribute object specifies tab stops.
\membersection{wxRichTextAttr::HasTextColour}\label{wxrichtextattrhastextcolour}
\constfunc{bool}{HasTextColour}{\void}
Returns \true if the attribute object specifies a text foreground colour.
\membersection{wxRichTextAttr::HasTextEffects}\label{wxrichtextattrhastexteffects}
\constfunc{bool}{HasTextEffects}{\void}
Returns \true if the attribute object specifies text effects.
\membersection{wxRichTextAttr::HasFontUnderlined}\label{wxrichtextattrhasfontunderlined}
\constfunc{bool}{HasFontUnderlined}{\void}
Returns \true if the attribute object specifies either underlining or no underlining.
\membersection{wxRichTextAttr::HasURL}\label{wxrichtextattrhasurl}
\constfunc{bool}{HasURL}{\void}
Returns \true if the attribute object specifies a URL.
\membersection{wxRichTextAttr::HasFontWeight}\label{wxrichtextattrhasfontweight}
\constfunc{bool}{HasFontWeight}{\void}
Returns \true if the attribute object specifies font weight (bold, light or normal).
\membersection{wxRichTextAttr::IsCharacterStyle}\label{wxrichtextattrischaracterstyle}
\constfunc{bool}{IsCharacterStyle}{\void}
Returns \true if the object represents a character style, that is,
the flags specify a font or a text background or foreground colour.
\membersection{wxRichTextAttr::IsDefault}\label{wxrichtextattrisdefault}
\constfunc{bool}{IsDefault}{\void}
Returns \false if we have any attributes set, \true otherwise.
\membersection{wxRichTextAttr::IsParagraphStyle}\label{wxrichtextattrisparagraphstyle}
\constfunc{bool}{IsParagraphStyle}{\void}
Returns \true if the object represents a paragraph style, that is,
the flags specify alignment, indentation, tabs, paragraph spacing, or
bullet style.
\membersection{wxRichTextAttr::SetAlignment}\label{wxrichtextattrsetalignment}
\func{void}{SetAlignment}{\param{wxTextAttrAlignment }{alignment}}
Sets the paragraph alignment. These are the possible values for {\it alignment}:
{\small
\begin{verbatim}
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
\end{verbatim}
}
Of these, wxTEXT\_ALIGNMENT\_JUSTIFIED is unimplemented. In future justification may be supported
when printing or previewing, only.
\membersection{wxRichTextAttr::SetBackgroundColour}\label{wxrichtextattrsetbackgroundcolour}
\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}}
Sets the background colour.
\membersection{wxRichTextAttr::SetBulletFont}\label{wxrichtextattrsetbulletfont}
\func{void}{SetBulletFont}{\param{const wxString\& }{font}}
Sets the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxRichTextAttr::SetBulletName}\label{wxrichtextattrsetbulletname}
\func{void}{SetBulletName}{\param{const wxString\& }{name}}
Sets the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
See \helpref{wxRichTextAttr::GetBulletName}{wxrichtextattrgetbulletname} for a list
of supported names, and how to expand the range of supported types.
\membersection{wxRichTextAttr::SetBulletNumber}\label{wxrichtextattrsetbulletnumber}
\func{void}{SetBulletNumber}{\param{int }{n}}
Sets the bullet number.
\membersection{wxRichTextAttr::SetBulletStyle}\label{wxrichtextattrsetbulletstyle}
\func{void}{SetBulletStyle}{\param{int }{style}}
Sets the bullet style. The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Currently wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is not supported.
\membersection{wxRichTextAttr::SetBulletText}\label{wxrichtextattrsetbullettext}
\func{void}{SetBulletText}{\param{const wxString& }{text}}
Sets the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxRichTextAttr::SetCharacterStyleName}\label{wxrichtextattrsetcharacterstylename}
\func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
Sets the character style name.
\membersection{wxRichTextAttr::SetFlags}\label{wxrichtextattrsetflags}
\func{void}{SetFlags}{\param{long }{flags}}
Sets the flags determining which styles are being specified. The following
flags can be passed in a bitlist:
{\small
\begin{verbatim}
// Standard wxTextAttr constants
#define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
#define wxTEXT_ATTR_FONT_FACE 0x00000004
#define wxTEXT_ATTR_FONT_SIZE 0x00000008
#define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
#define wxTEXT_ATTR_FONT_ITALIC 0x00000020
#define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
#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 0x00000080
#define wxTEXT_ATTR_LEFT_INDENT 0x00000100
#define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
#define wxTEXT_ATTR_TABS 0x00000400
// 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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
\end{verbatim}
}
\membersection{wxRichTextAttr::SetFontFaceName}\label{wxrichtextattrsetfontfacename}
\func{void}{SetFontFaceName}{\param{const wxString\& }{faceName}}
Sets the paragraph alignment.
\membersection{wxRichTextAttr::SetFontSize}\label{wxrichtextattrsetfontsize}
\func{void}{SetFontSize}{\param{int }{pointSize}}
Sets the font size in points.
\membersection{wxRichTextAttr::SetFontStyle}\label{wxrichtextattrsetfontstyle}
\func{void}{SetFontStyle}{\param{int }{fontStyle}}
Sets the font style (normal, italic or slanted).
\membersection{wxRichTextAttr::SetFontUnderlined}\label{wxrichtextattrsetfontunderlined}
\func{void}{SetFontUnderlined}{\param{bool }{underlined}}
Sets the font underlining.
\membersection{wxRichTextAttr::SetFontWeight}\label{wxrichtextattrsetfontweight}
\func{void}{SetFontWeight}{\param{int }{fontWeight}}
Sets the font weight.
\membersection{wxRichTextAttr::SetLeftIndent}\label{wxrichtextattrsetleftindent}
\func{void}{SetLeftIndent}{\param{int }{indent}, \param{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.
\membersection{wxRichTextAttr::SetLineSpacing}\label{wxrichtextattrsetlinespacing}
\func{void}{SetLineSpacing}{\param{int }{spacing}}
Sets the line spacing. {\it 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:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
\membersection{wxRichTextAttr::SetListStyleName}\label{wxrichtextattrsetliststylename}
\func{void}{SetListStyleName}{\param{const wxString\& }{name}}
Sets the list style name.
\membersection{wxRichTextAttr::SetOutlineLevel}\label{wxrichtextattrsetoutlinelevel}
\func{void}{SetOutlineLevel}{\param{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.
\membersection{wxRichTextAttr::SetPageBreak}\label{wxrichtextattrsetpagebreak}
\func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}}
Specifies a page break before this paragraph.
\membersection{wxRichTextAttr::SetParagraphSpacingAfter}\label{wxrichtextattrsetparagraphspacingafter}
\func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
Sets the spacing after a paragraph, in tenths of a millimetre.
\membersection{wxRichTextAttr::SetParagraphSpacingBefore}\label{wxrichtextattrsetparagraphspacingbefore}
\func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
Sets the spacing before a paragraph, in tenths of a millimetre.
\membersection{wxRichTextAttr::SetParagraphStyleName}\label{wxrichtextattrsetparagraphstylename}
\func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
Sets the name of the paragraph style.
\membersection{wxRichTextAttr::SetRightIndent}\label{wxrichtextattrsetrightindent}
\func{void}{SetRightIndent}{\param{int }{indent}}
Sets the right indent in tenths of a millimetre.
\membersection{wxRichTextAttr::SetTabs}\label{wxrichtextattrsettabs}
\func{void}{SetTabs}{\param{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.
\membersection{wxRichTextAttr::SetTextColour}\label{wxrichtextattrsettextcolour}
\func{void}{SetTextColour}{\param{const wxColour\& }{colText}}
Sets the text foreground colout.
\membersection{wxRichTextAttr::SetTextEffectFlags}\label{wxrichtextattrsettexteffectflags}
\func{void}{SetTextEffectFlags}{\param{int }{flags}}
Sets the text effect bits of interest. You should also pass wxTEXT\_ATTR\_EFFECTS to \helpref{wxRichTextAttr::SetFlags}{wxrichtextattrsetflags}.
See \helpref{wxRichTextAttr::SetFlags}{wxrichtextattrsetflags} for further information.
\membersection{wxRichTextAttr::SetTextEffects}\label{wxrichtextattrsettexteffects}
\func{void}{SetTextEffects}{\param{int }{effects}}
Sets the text effects, a bit list of styles.
The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
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 \helpref{wxRichTextAttr::SetFlags}{wxrichtextattrsetflags}, and call\rtfsp
\helpref{wxRichTextAttr::SetTextEffectFlags}{wxrichtextattrsettexteffectflags} with the styles (taken from the
above set) that you are interested in setting.
\membersection{wxRichTextAttr::SetURL}\label{wxrichtextattrseturl}
\func{void}{SetURL}{\param{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.
\membersection{wxRichTextAttr::operator=}\label{wxrichtextattroperatorassign}
\func{void operator}{operator=}{\param{const wxTextAttrEx\& }{attr}}
Assignment from a \helpref{wxTextAttrEx}{wxtextattr} object.
\func{void operator}{operator=}{\param{const wxRichTextAttr\& }{attr}}
Assignment from a \helpref{wxRichTextAttr}{wxrichtextattr} object.
\membersection{wxRichTextAttr::wxTextAttrEx}\label{wxrichtextattrwxtextattrex}
\constfunc{operator}{wxTextAttrEx}{\void}
Makes a \helpref{wxTextAttrEx}{wxtextattrex} object from this object.

View File

@@ -18,7 +18,7 @@ wxRichTextParagraphLayoutBox
\wxheading{See also} \wxheading{See also}
\helpref{wxTextAttr}{wxtextattr}, \helpref{wxTextAttrEx}{wxtextattrex}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl} \helpref{wxTextAttr}{wxtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
@@ -209,7 +209,7 @@ Begins a right indent, specified in tenths of a millimetre.
\membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle} \membersection{wxRichTextBuffer::BeginStyle}\label{wxrichtextbufferbeginstyle}
\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}} \func{bool}{BeginStyle}{\param{const wxTextAttr\& }{style}}
Begins using a specified style. Begins using a specified style.
@@ -481,7 +481,7 @@ Finds a handler by filename or, if supplied, type.
\membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle} \membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle}
\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void} \constfunc{const wxTextAttr\&}{GetBasicStyle}{\void}
Gets the basic (overall) style. This is the style of the whole Gets the basic (overall) style. This is the style of the whole
buffer before further styles are applied, unlike the default style, which buffer before further styles are applied, unlike the default style, which
@@ -503,7 +503,7 @@ initialized.
\membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle} \membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle}
\constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void} \constfunc{const wxTextAttr\&}{GetDefaultStyle}{\void}
Returns the current default style, affecting the style currently being applied (for example, setting the default Returns the current default style, affecting the style currently being applied (for example, setting the default
style to bold will cause subsequently inserted text to be bold). style to bold will cause subsequently inserted text to be bold).
@@ -530,9 +530,7 @@ Returns the object to be used to render certain aspects of the content, such as
\membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle} \membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
Gets the attributes at the given position. Gets the attributes at the given position.
@@ -542,7 +540,7 @@ or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextbuffergetun
\membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange} \membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange}
\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}} \func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttr\& }{style}}
This function gets a style representing the common, combined attributes in the given range. This function gets a style representing the common, combined attributes in the given range.
Attributes which have different values within the specified range will not be included the style Attributes which have different values within the specified range will not be included the style
@@ -577,9 +575,7 @@ Get the size of the style stack, for example to check correct nesting.
\membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle} \membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle}
\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
Gets the attributes at the given position. Gets the attributes at the given position.
@@ -749,9 +745,7 @@ Saves content to a file.
\membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle} \membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle}
\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} \func{void}{SetBasicStyle}{\param{const wxTextAttr\& }{style}}
\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
Sets the basic (overall) style. This is the style of the whole Sets the basic (overall) style. This is the style of the whole
buffer before further styles are applied, unlike the default style, which buffer before further styles are applied, unlike the default style, which
@@ -760,7 +754,7 @@ style to bold will cause subsequently inserted text to be bold).
\membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle} \membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle}
\func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}} \func{void}{SetDefaultStyle}{\param{const wxTextAttr\& }{style}}
Sets the default style, affecting the style currently being applied (for example, setting the default Sets the default style, affecting the style currently being applied (for example, setting the default
style to bold will cause subsequently inserted text to be bold). style to bold will cause subsequently inserted text to be bold).
@@ -796,9 +790,7 @@ overriding one or more virtual functions, and setting an instance of the class u
\membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle} \membersection{wxRichTextBuffer::SetStyle}\label{wxrichtextbuffersetstyle}
\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
Sets the attributes for the given range. Pass flags to determine how the attributes are set. Sets the attributes for the given range. Pass flags to determine how the attributes are set.

View File

@@ -65,7 +65,7 @@ Sets the insertion point to the end of the buffer and writes the text.
Applies the given alignment to the selection (undoable). Applies the given alignment to the selection (undoable).
For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}. For alignment values, see \helpref{wxTextAttr}{wxtextattr}.
\membersection{wxRichTextCtrl::ApplyBoldToSelection}\label{wxrichtextctrlapplyboldtoselection} \membersection{wxRichTextCtrl::ApplyBoldToSelection}\label{wxrichtextctrlapplyboldtoselection}
@@ -113,7 +113,7 @@ Returns \true if undo commands are being batched.
Begins using alignment Begins using alignment
For alignment values, see \helpref{wxTextAttrEx}{wxtextattrex}. For alignment values, see \helpref{wxTextAttr}{wxtextattr}.
\membersection{wxRichTextCtrl::BeginBatchUndo}\label{wxrichtextctrlbeginbatchundo} \membersection{wxRichTextCtrl::BeginBatchUndo}\label{wxrichtextctrlbeginbatchundo}
@@ -249,7 +249,7 @@ Begins a right indent, specified in tenths of a millimetre.
\membersection{wxRichTextCtrl::BeginStyle}\label{wxrichtextctrlbeginstyle} \membersection{wxRichTextCtrl::BeginStyle}\label{wxrichtextctrlbeginstyle}
\func{bool}{BeginStyle}{\param{const wxTextAttrEx\& }{style}} \func{bool}{BeginStyle}{\param{const wxTextAttr\& }{style}}
Begins applying a style. Begins applying a style.
@@ -551,7 +551,7 @@ refresh the control.
\membersection{wxRichTextCtrl::GetBasicStyle}\label{wxrichtextctrlgetbasicstyle} \membersection{wxRichTextCtrl::GetBasicStyle}\label{wxrichtextctrlgetbasicstyle}
\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void} \constfunc{const wxTextAttr\&}{GetBasicStyle}{\void}
Gets the basic (overall) style. This is the style of the whole Gets the basic (overall) style. This is the style of the whole
buffer before further styles are applied, unlike the default style, which buffer before further styles are applied, unlike the default style, which
@@ -584,13 +584,12 @@ Returns the caret height and position for the given character position
Gets the command processor associated with the control's buffer. Gets the command processor associated with the control's buffer.
\membersection{wxRichTextCtrl::GetDefaultStyleEx}\label{wxrichtextctrlgetdefaultstyleex} \membersection{wxRichTextCtrl::GetDefaultStyle}\label{wxrichtextctrlgetdefaultstyle}
\constfunc{const wxTextAttrEx\&}{GetDefaultStyleEx}{\void} \constfunc{const wxTextAttr\&}{GetDefaultStyle}{\void}
Returns the current default style, which can be used to change how subsequently inserted Returns the current default style, which can be used to change how subsequently inserted
text is displayed. When wxTextAttrEx is merged with wxTextAttr, this function text is displayed.
will become GetDefaultStyle.
\membersection{wxRichTextCtrl::GetDelayedLayoutThreshold}\label{wxrichtextctrlgetdelayedlayoutthreshold} \membersection{wxRichTextCtrl::GetDelayedLayoutThreshold}\label{wxrichtextctrlgetdelayedlayoutthreshold}
@@ -692,14 +691,9 @@ Returns the text within the current selection range, if any.
\membersection{wxRichTextCtrl::GetStyle}\label{wxrichtextctrlgetstyle} \membersection{wxRichTextCtrl::GetStyle}\label{wxrichtextctrlgetstyle}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}} \func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient Gets the attributes at the given position.
because it does not use wxFont objects.
This function gets the combined style - that is, the style you see on the screen as a result This function gets the combined style - that is, the style you see on the screen as a result
of combining base style, paragraph style and character style attributes. To get the character of combining base style, paragraph style and character style attributes. To get the character
@@ -707,9 +701,7 @@ or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextctrlgetunco
\membersection{wxRichTextCtrl::GetStyleForRange}\label{wxrichtextctrlgetstyleforrange} \membersection{wxRichTextCtrl::GetStyleForRange}\label{wxrichtextctrlgetstyleforrange}
\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\& }{range}, \param{wxRichTextAttr\& }{style}} \func{bool}{GetStyleForRange}{\param{const wxRichTextRange\& }{range}, \param{wxTextAttr\& }{style}}
\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\& }{range}, \param{wxTextAttrEx\& }{style}}
Gets the attributes common to the specified range. Attributes that differ in value within the range will Gets the attributes common to the specified range. Attributes that differ in value within the range will
not be included in {\it style}'s flags. not be included in {\it style}'s flags.
@@ -723,14 +715,9 @@ character and paragraph styles to be applied.
\membersection{wxRichTextCtrl::GetUncombinedStyle}\label{wxrichtextctrlgetuncombinedstyle} \membersection{wxRichTextCtrl::GetUncombinedStyle}\label{wxrichtextctrlgetuncombinedstyle}
\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}}
\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}}
\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}} \func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}}
Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient Gets the attributes at the given position.
because it does not use wxFont objects.
This function gets the {\it uncombined style} - that is, the attributes associated with the This function gets the {\it uncombined style} - that is, the attributes associated with the
paragraph or character content, and not necessarily the combined attributes you see on the paragraph or character content, and not necessarily the combined attributes you see on the
@@ -756,9 +743,7 @@ if this is the case.
\membersection{wxRichTextCtrl::HasCharacterAttributes}\label{wxrichtextctrlhascharacterattributes} \membersection{wxRichTextCtrl::HasCharacterAttributes}\label{wxrichtextctrlhascharacterattributes}
\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}} \constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}}
\constfunc{bool}{HasCharacterAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}}
Test if this whole range has character attributes of the specified kind. If any Test if this whole range has character attributes of the specified kind. If any
of the attributes are different within the range, the test fails. You of the attributes are different within the range, the test fails. You
@@ -767,9 +752,7 @@ flags indicating which attributes are of interest.
\membersection{wxRichTextCtrl::HasParagraphAttributes}\label{wxrichtextctrlhasparagraphattributes} \membersection{wxRichTextCtrl::HasParagraphAttributes}\label{wxrichtextctrlhasparagraphattributes}
\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}} \constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}}
\constfunc{bool}{HasParagraphAttributes}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}}
Test if this whole range has paragraph attributes of the specified kind. If any Test if this whole range has paragraph attributes of the specified kind. If any
of the attributes are different within the range, the test fails. You of the attributes are different within the range, the test fails. You
@@ -820,7 +803,7 @@ bool wxRichTextCtrl::IsSelectionBold()
{ {
if (HasSelection()) if (HasSelection())
{ {
wxRichTextAttr attr; wxTextAttr attr;
wxRichTextRange range = GetInternalSelectionRange(); wxRichTextRange range = GetInternalSelectionRange();
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(wxBOLD); attr.SetFontWeight(wxBOLD);
@@ -831,7 +814,7 @@ bool wxRichTextCtrl::IsSelectionBold()
{ {
// If no selection, then we need to combine current style with default style // If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing. // to see what the effect would be if we started typing.
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
long pos = GetAdjustedCaretPosition(GetCaretPosition()); long pos = GetAdjustedCaretPosition(GetCaretPosition());
@@ -1252,7 +1235,7 @@ Cancels any selection.
\membersection{wxRichTextCtrl::SetAndShowDefaultStyle}\label{wxrichtextctrlsetandshowdefaultstyle} \membersection{wxRichTextCtrl::SetAndShowDefaultStyle}\label{wxrichtextctrlsetandshowdefaultstyle}
\func{void}{SetAndShowDefaultStyle}{\param{const wxRichTextAttr\& }{attr}} \func{void}{SetAndShowDefaultStyle}{\param{const wxTextAttr\& }{attr}}
Sets {\it attr} as the default style and tells the control that the UI should reflect Sets {\it attr} as the default style and tells the control that the UI should reflect
this attribute until the user moves the caret. this attribute until the user moves the caret.
@@ -1261,9 +1244,7 @@ See also \helpref{IsDefaultStyleShowing}{wxrichtextctrlisdefaultstyleshowing}.
\membersection{wxRichTextCtrl::SetBasicStyle}\label{wxrichtextctrlsetbasicstyle} \membersection{wxRichTextCtrl::SetBasicStyle}\label{wxrichtextctrlsetbasicstyle}
\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} \func{void}{SetBasicStyle}{\param{const wxTextAttr\& }{style}}
\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}}
Sets the basic (overall) style. This is the style of the whole Sets the basic (overall) style. This is the style of the whole
buffer before further styles are applied, unlike the default style, which buffer before further styles are applied, unlike the default style, which
@@ -1279,7 +1260,7 @@ A value of -1 means the caret is at the start of the buffer.
\membersection{wxRichTextCtrl::SetDefaultStyle}\label{wxrichtextctrlsetdefaultstyle} \membersection{wxRichTextCtrl::SetDefaultStyle}\label{wxrichtextctrlsetdefaultstyle}
\func{bool}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}} \func{bool}{SetDefaultStyle}{\param{const wxTextAttr\& }{style}}
Sets the current default style, which can be used to change how subsequently inserted Sets the current default style, which can be used to change how subsequently inserted
text is displayed. text is displayed.
@@ -1373,28 +1354,22 @@ So, for example, to set the selection for a character at position 5, use the ran
\membersection{wxRichTextCtrl::SetStyle}\label{wxrichtextctrlsetstyle} \membersection{wxRichTextCtrl::SetStyle}\label{wxrichtextctrlsetstyle}
\func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}} \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}}
\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}}
\func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}} \func{bool}{SetStyle}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}}
Sets the attributes for the given range. The wxRichTextAttr version is more efficient Sets the attributes for the given range.
because it does not use wxFont objects.
The end point of range is specified as the last character position of the span of text, plus one. The end point of range is specified as the last character position of the span of text, plus one.
So, for example, to set the style for a character at position 5, use the range (5,6). So, for example, to set the style for a character at position 5, use the range (5,6).
\membersection{wxRichTextCtrl::SetStyleEx}\label{wxrichtextctrlsetstyleex} \membersection{wxRichTextCtrl::SetStyleEx}\label{wxrichtextctrlsetstyleex}
\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} \func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
\func{bool}{SetStyleEx}{\param{const wxRichTextRange\& }{range}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} \func{bool}{SetStyleEx}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttr\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}}
\func{bool}{SetStyleEx}{\param{long }{start}, \param{long }{end}, \param{const wxTextAttrEx\& }{style}, \param{int }{flags $=$ wxRICHTEXT\_SETSTYLE\_WITH\_UNDO}} Sets the attributes for the given range, passing flags to determine how the attributes are set.
Sets the attributes for the given range, passing flags to determine how the attributes are set. The wxRichTextAttr version is more efficient
because it does not use wxFont objects.
The end point of range is specified as the last character position of the span of text, plus one. The end point of range is specified as the last character position of the span of text, plus one.
So, for example, to set the style for a character at position 5, use the range (5,6). So, for example, to set the style for a character at position 5, use the range (5,6).

View File

@@ -102,9 +102,9 @@ Creation: see \helpref{the constructor}{wxrichtextformattingdialog} for details
\membersection{wxRichTextFormattingDialog::GetAttributes}\label{wxrichtextformattingdialoggetattributes} \membersection{wxRichTextFormattingDialog::GetAttributes}\label{wxrichtextformattingdialoggetattributes}
\constfunc{const wxTextAttrEx\&}{GetAttributes}{\void} \constfunc{const wxTextAttr\&}{GetAttributes}{\void}
\func{wxTextAttrEx\&}{GetAttributes}{\void} \func{wxTextAttr\&}{GetAttributes}{\void}
Gets the attributes being edited. Gets the attributes being edited.
@@ -116,7 +116,7 @@ Helper for pages to get the top-level dialog.
\membersection{wxRichTextFormattingDialog::GetDialogAttributes}\label{wxrichtextformattingdialoggetdialogattributes} \membersection{wxRichTextFormattingDialog::GetDialogAttributes}\label{wxrichtextformattingdialoggetdialogattributes}
\func{wxTextAttrEx*}{GetDialogAttributes}{\param{wxWindow* }{win}} \func{wxTextAttr*}{GetDialogAttributes}{\param{wxWindow* }{win}}
Helper for pages to get the attributes. Helper for pages to get the attributes.
@@ -159,7 +159,7 @@ Gets the associated style sheet, if any.
\membersection{wxRichTextFormattingDialog::SetAttributes}\label{wxrichtextformattingdialogsetattributes} \membersection{wxRichTextFormattingDialog::SetAttributes}\label{wxrichtextformattingdialogsetattributes}
\func{void}{SetAttributes}{\param{const wxTextAttrEx\& }{attr}} \func{void}{SetAttributes}{\param{const wxTextAttr\& }{attr}}
Sets the attributes to be edited. Sets the attributes to be edited.
@@ -178,7 +178,7 @@ Sets the image list associated with the dialog's property sheet.
\membersection{wxRichTextFormattingDialog::SetStyle}\label{wxrichtextformattingdialogsetstyle} \membersection{wxRichTextFormattingDialog::SetStyle}\label{wxrichtextformattingdialogsetstyle}
\func{bool}{SetStyle}{\param{const wxTextAttrEx\& }{style}, \param{bool }{update = true}} \func{bool}{SetStyle}{\param{const wxTextAttr\& }{style}, \param{bool }{update = true}}
Sets the attributes and optionally updates the display, if {\it update} is \true. Sets the attributes and optionally updates the display, if {\it update} is \true.

View File

@@ -43,7 +43,7 @@ Destructor.
\membersection{wxRichTextListStyleDefinition::CombineWithParagraphStyle}\label{wxrichtextliststyledefinitioncombinewithparagraphstyle} \membersection{wxRichTextListStyleDefinition::CombineWithParagraphStyle}\label{wxrichtextliststyledefinitioncombinewithparagraphstyle}
\func{wxRichTextAttr}{CombineWithParagraphStyle}{\param{int }{indent}, \param{const wxRichTextAttr\&}{ paraStyle}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}} \func{wxTextAttr}{CombineWithParagraphStyle}{\param{int }{indent}, \param{const wxTextAttr\&}{ paraStyle}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}}
This function combines the given paragraph style with the list style's base attributes and level style matching the given indent, returning the combined attributes. This function combines the given paragraph style with the list style's base attributes and level style matching the given indent, returning the combined attributes.
If {\it styleSheet} is specified, the base style for this definition will also be included in the result. If {\it styleSheet} is specified, the base style for this definition will also be included in the result.
@@ -56,21 +56,21 @@ This function finds the level (from 0 to 9) whose indentation attribute mostly c
\membersection{wxRichTextListStyleDefinition::GetCombinedStyle}\label{wxrichtextliststyledefinitiongetcombinedstyle} \membersection{wxRichTextListStyleDefinition::GetCombinedStyle}\label{wxrichtextliststyledefinitiongetcombinedstyle}
\constfunc{wxRichTextAttr}{GetCombinedStyle}{\param{int }{indent}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}} \constfunc{wxTextAttr}{GetCombinedStyle}{\param{int }{indent}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}}
This function combines the list style's base attributes and the level style matching the given indent, returning the combined attributes. This function combines the list style's base attributes and the level style matching the given indent, returning the combined attributes.
If {\it styleSheet} is specified, the base style for this definition will also be included in the result. If {\it styleSheet} is specified, the base style for this definition will also be included in the result.
\membersection{wxRichTextListStyleDefinition::GetCombinedStyleForLevel}\label{wxrichtextliststyledefinitioncombinewithparagraphstyleforlevel} \membersection{wxRichTextListStyleDefinition::GetCombinedStyleForLevel}\label{wxrichtextliststyledefinitioncombinewithparagraphstyleforlevel}
\constfunc{wxRichTextAttr}{GetCombinedStyleLevel}{\param{int }{level}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}} \constfunc{wxTextAttr}{GetCombinedStyleLevel}{\param{int }{level}, \param{wxRichTextStyleSheet*}{ styleSheet = NULL}}
This function combines the list style's base attributes and the style for the specified level, returning the combined attributes. This function combines the list style's base attributes and the style for the specified level, returning the combined attributes.
If {\it styleSheet} is specified, the base style for this definition will also be included in the result. If {\it styleSheet} is specified, the base style for this definition will also be included in the result.
\membersection{wxRichTextListStyleDefinition::GetLevelAttributes}\label{wxrichtextliststyledefinitiongetlevelattributes} \membersection{wxRichTextListStyleDefinition::GetLevelAttributes}\label{wxrichtextliststyledefinitiongetlevelattributes}
\constfunc{const wxRichTextAttr*}{GetLevelAttributes}{\param{int }{level}} \constfunc{const wxTextAttr*}{GetLevelAttributes}{\param{int }{level}}
Returns the style for the given level. {\it level} is a number between 0 and 9. Returns the style for the given level. {\it level} is a number between 0 and 9.
@@ -90,11 +90,11 @@ Returns \true if the given level has numbered list attributes.
\membersection{wxRichTextListStyleDefinition::SetLevelAttributes}\label{wxrichtextliststyledefinitionsetlevelattributes} \membersection{wxRichTextListStyleDefinition::SetLevelAttributes}\label{wxrichtextliststyledefinitionsetlevelattributes}
\func{void}{SetLevelAttributes}{\param{int }{level}, \param{const wxRichTextAttr\&}{ attr}} \func{void}{SetLevelAttributes}{\param{int }{level}, \param{const wxTextAttr\&}{ attr}}
\func{void}{SetLevelAttributes}{\param{int }{level}, \param{int}{ leftIndent}, \param{int}{ leftSubIndent}, \param{int}{ bulletStyle}, \param{const wxString\&}{ bulletSymbol = wxEmptyString}} \func{void}{SetLevelAttributes}{\param{int }{level}, \param{int}{ leftIndent}, \param{int}{ leftSubIndent}, \param{int}{ bulletStyle}, \param{const wxString\&}{ bulletSymbol = wxEmptyString}}
Sets the style for the given level. {\it level} is a number between 0 and 9. Sets the style for the given level. {\it level} is a number between 0 and 9.
The first and most flexible form uses a wxRichTextAttr object, while the second form is for convenient setting of the most commonly-used attributes. The first and most flexible form uses a wxTextAttr object, while the second form is for convenient setting of the most commonly-used attributes.

View File

@@ -2,8 +2,7 @@
{\bf Major classes:} \helpref{wxRichTextCtrl}{wxrichtextctrl}, \helpref{wxRichTextBuffer}{wxrichtextbuffer}, \helpref{wxRichTextEvent}{wxrichtextevent} {\bf Major classes:} \helpref{wxRichTextCtrl}{wxrichtextctrl}, \helpref{wxRichTextBuffer}{wxrichtextbuffer}, \helpref{wxRichTextEvent}{wxrichtextevent}
{\bf Helper classes:} \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxTextAttrEx}{wxtextattrex}, {\bf Helper classes:} \helpref{wxTextAttr}{wxtextattr}, \helpref{wxRichTextRange}{wxrichtextrange}
\helpref{wxRichTextRange}{wxrichtextrange}
{\bf File handler classes:} \helpref{wxRichTextFileHandler}{wxrichtextfilehandler}, \helpref{wxRichTextHTMLHandler}{wxrichtexthtmlhandler}, {\bf File handler classes:} \helpref{wxRichTextFileHandler}{wxrichtextfilehandler}, \helpref{wxRichTextHTMLHandler}{wxrichtexthtmlhandler},
\helpref{wxRichTextXMLHandler}{wxrichtextxmlhandler} \helpref{wxRichTextXMLHandler}{wxrichtextxmlhandler}
@@ -186,7 +185,7 @@ The following code is taken from the sample, and adds text and styles to a rich
tabs.Add(600); tabs.Add(600);
tabs.Add(800); tabs.Add(800);
tabs.Add(1000); tabs.Add(1000);
wxTextAttrEx attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_TABS); attr.SetFlags(wxTEXT_ATTR_TABS);
attr.SetTabs(tabs); attr.SetTabs(tabs);
r.SetDefaultStyle(attr); r.SetDefaultStyle(attr);
@@ -220,14 +219,7 @@ be processed by the control rather than being used for navigation between contro
\subsubsection{wxRichTextCtrl and styles} \subsubsection{wxRichTextCtrl and styles}
Styling attributes are represented by three classes: \helpref{wxTextAttr}{wxtextattr}, \helpref{wxTextAttrEx}{wxtextattrex} and \helpref{wxRichTextAttr}{wxrichtextattr}. Styling attributes are represented by \helpref{wxTextAttr}{wxtextattr}.
wxTextAttr is shared across all controls that are derived from wxTextCtrlBase and
can store basic character and paragraph attributes. wxTextAttrEx derives
from wxTextAttr and adds some further attributes that are only supported
by wxRichTextCtrl. Finally, wxRichTextAttr is a more efficient version
of wxTextAttrEx that doesn't use a wxFont object and can be used to
query styles more quickly. wxTextAttrEx and wxRichTextAttr are largely
interchangeable and have suitable conversion operators between them.
When setting a style, the flags of the attribute object determine which When setting a style, the flags of the attribute object determine which
attributes are applied. When querying a style, the passed flags are ignored attributes are applied. When querying a style, the passed flags are ignored
@@ -348,7 +340,7 @@ always has one such buffer.
The content is represented by a hierarchy of objects, all derived from The content is represented by a hierarchy of objects, all derived from
wxRichTextObject. An object might be an image, a fragment of text, a paragraph, wxRichTextObject. An object might be an image, a fragment of text, a paragraph,
or a whole buffer. Objects store a wxTextAttrEx containing style information; or a whole buffer. Objects store a wxTextAttr containing style information;
a paragraph object can contain both paragraph and character information, but a paragraph object can contain both paragraph and character information, but
content objects such as text can only store character information. The final content objects such as text can only store character information. The final
style displayed in the control or in a printout is a combination of base style displayed in the control or in a printout is a combination of base
@@ -375,7 +367,7 @@ A paragraph of pure text with the same style contains just one further
object, a wxRichTextPlainText object. When styling is applied to part of object, a wxRichTextPlainText object. When styling is applied to part of
this object, the object is decomposed into separate objects, one object this object, the object is decomposed into separate objects, one object
for each different character style. So each object within a paragraph always has for each different character style. So each object within a paragraph always has
just one wxTextAttrEx object to denote its character style. Of course, this can just one wxTextAttr object to denote its character style. Of course, this can
lead to fragmentation after a lot of edit operations, potentially leading lead to fragmentation after a lot of edit operations, potentially leading
to several objects with the same style where just one would do. So to several objects with the same style where just one would do. So
a Defragment function is called when updating the control's display, to ensure that a Defragment function is called when updating the control's display, to ensure that

View File

@@ -50,15 +50,15 @@ Returns the style name.
\membersection{wxRichTextStyleDefinition::GetStyle}\label{wxrichtextstyledefinitiongetstyle} \membersection{wxRichTextStyleDefinition::GetStyle}\label{wxrichtextstyledefinitiongetstyle}
\func{wxRichTextAttr\&}{GetStyle}{\void} \func{wxTextAttr\&}{GetStyle}{\void}
\constfunc{const wxRichTextAttr\&}{GetStyle}{\void} \constfunc{const wxTextAttr\&}{GetStyle}{\void}
Returns the attributes associated with this style. Returns the attributes associated with this style.
\membersection{wxRichTextStyleDefinition::GetStyleMergedWithBase}\label{wxrichtextstyledefinitiongetstylemergedwithbase} \membersection{wxRichTextStyleDefinition::GetStyleMergedWithBase}\label{wxrichtextstyledefinitiongetstylemergedwithbase}
\constfunc{wxRichTextAttr}{GetStyleMergedWithBase}{\param{wxRichTextStyleSheet*}{ sheet}} \constfunc{wxTextAttr}{GetStyleMergedWithBase}{\param{wxRichTextStyleSheet*}{ sheet}}
Returns the style attributes combined with the attributes of the specified base style, if any. This function works recursively. Returns the style attributes combined with the attributes of the specified base style, if any. This function works recursively.
@@ -82,7 +82,7 @@ Sets the name of the style.
\membersection{wxRichTextStyleDefinition::SetStyle}\label{wxrichtextstyledefinitionsetstyle} \membersection{wxRichTextStyleDefinition::SetStyle}\label{wxrichtextstyledefinitionsetstyle}
\func{void}{SetStyle}{\param{const wxRichTextAttr\& }{style}} \func{void}{SetStyle}{\param{const wxTextAttr\& }{style}}
Sets the attributes for this style. Sets the attributes for this style.

View File

@@ -54,7 +54,7 @@ Returns \true.
\membersection{wxRichTextXMLHandler::CreateStyle}\label{wxrichtextxmlhandlercreatestyle} \membersection{wxRichTextXMLHandler::CreateStyle}\label{wxrichtextxmlhandlercreatestyle}
\func{wxString}{CreateStyle}{\param{const wxTextAttrEx\& }{attr}, \param{bool }{isPara = false}} \func{wxString}{CreateStyle}{\param{const wxTextAttr\& }{attr}, \param{bool }{isPara = false}}
Creates XML code for a given character or paragraph style. Creates XML code for a given character or paragraph style.
@@ -96,7 +96,7 @@ Helper function: gets a named parameter from the XML node.
\membersection{wxRichTextXMLHandler::GetStyle}\label{wxrichtextxmlhandlergetstyle} \membersection{wxRichTextXMLHandler::GetStyle}\label{wxrichtextxmlhandlergetstyle}
\func{bool}{GetStyle}{\param{wxTextAttrEx\& }{attr}, \param{wxXmlNode* }{node}, \param{bool }{isPara = false}} \func{bool}{GetStyle}{\param{wxTextAttr\& }{attr}, \param{wxXmlNode* }{node}, \param{bool }{isPara = false}}
Helper function: gets style parameters from the given XML node. Helper function: gets style parameters from the given XML node.

View File

@@ -26,7 +26,7 @@ rich text control in either the current font or specified font.
\begin{verbatim} \begin{verbatim}
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL); wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
wxTextAttrEx attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT); attr.SetFlags(wxTEXT_ATTR_FONT);
ctrl->GetStyle(ctrl->GetInsertionPoint(), attr); ctrl->GetStyle(ctrl->GetInsertionPoint(), attr);

View File

@@ -1,13 +1,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%% wxTextAttr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxTextAttr}}\label{wxtextattr} \section{\class{wxTextAttr}}\label{wxtextattr}
wxTextAttr represents the character and paragraph attributes, or style, for a range of text in a\rtfsp wxTextAttr represents the character and paragraph attributes, or style,
\helpref{wxTextCtrl}{wxtextctrl}. for a range of text in a \helpref{wxTextCtrl}{wxtextctrl} or \helpref{wxRichTextCtrl}{wxrichtextctrl}.
When setting up a wxTextAttr object, pass a bitlist mask to SetFlags to indicate When setting up a wxTextAttr object, pass a bitlist mask to \helpref{SetFlags}{wxtextattrsetflags} to
which style elements should be changed. As a convenience, when you call a indicate which style elements should be changed. As a convenience, when you call a setter such
setter such as SetFont, the relevant bit will be set. as SetFont, the relevant bit will be set.
\wxheading{Derived from} \wxheading{Derived from}
@@ -21,20 +19,9 @@ No base class
\helpref{wxCore}{librarieslist} \helpref{wxCore}{librarieslist}
\wxheading{Typedefs}
\texttt{wxTextPos} is the type containing the index of a position in a text
control. \texttt{wxTextCoord} contains the index of a column or a row in the
control.
Note that although both of these types should probably have been unsigned, due
to backwards compatibility reasons, are defined as \texttt{long} currently.
Their use (instead of plain \texttt{long}) is still encouraged as it makes the
code more readable.
\wxheading{Constants} \wxheading{Constants}
The following values can be passed to SetAlignment to determine The following values can be passed to wxTextAttr::SetAlignment to determine
paragraph alignment. paragraph alignment.
{\small {\small
@@ -51,165 +38,532 @@ enum wxTextAttrAlignment
\end{verbatim} \end{verbatim}
} }
These values are passed in a bitlist to SetFlags to determine 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 wxTextAttr::SetFlags to determine
what attributes will be considered when setting the attributes what attributes will be considered when setting the attributes
for a text control. for a text control.
{\small {\small
\begin{verbatim} \begin{verbatim}
#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 // Standard wxTextAttr constants
#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002
#define wxTEXT_ATTR_FONT_FACE 0x0004 #define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
#define wxTEXT_ATTR_FONT_SIZE 0x0008 #define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 #define wxTEXT_ATTR_FONT_FACE 0x00000004
#define wxTEXT_ATTR_FONT_ITALIC 0x0020 #define wxTEXT_ATTR_FONT_SIZE 0x00000008
#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 #define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
#define wxTEXT_ATTR_FONT_ITALIC 0x00000020
#define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
#define wxTEXT_ATTR_FONT_ENCODING 0x02000000
#define wxTEXT_ATTR_FONT \ #define wxTEXT_ATTR_FONT \
wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \ wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT \
| wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING
#define wxTEXT_ATTR_ALIGNMENT 0x0080 #define wxTEXT_ATTR_ALIGNMENT 0x00000080
#define wxTEXT_ATTR_LEFT_INDENT 0x0100 #define wxTEXT_ATTR_LEFT_INDENT 0x00000100
#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 #define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
#define wxTEXT_ATTR_TABS 0x0400 #define wxTEXT_ATTR_TABS 0x00000400
// 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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
\end{verbatim} \end{verbatim}
} }
The following styles can be passed to wxTextAttr::SetBulletStyle:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Of these, wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is unimplemented.
The following constants can be passed to wxTextAttr::SetLineSpacing:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
The following styles can be passed to wxTextAttr::SetTextEffects:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
Of these, only wxTEXT\_ATTR\_EFFECT\_CAPITALS and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH are implemented.
\wxheading{See also}
\helpref{wxTextCtrl}{wxtextctrl}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxTextAttr::wxTextAttr}\label{wxtextattrwxtextattr}
\membersection{wxTextAttr::wxTextAttr}\label{wxtextattrctor}
\func{}{wxTextAttr}{\void} \func{}{wxTextAttr}{\void}
\func{}{wxTextAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour}, \func{}{wxTextAttr}{\param{const wxColour\& }{colText}, \param{const wxColour\& }{colBack = wxNullColour}, \param{const wxFont\& }{font = wxNullFont}, \param{wxTextAttrAlignment }{alignment = wxTEXT\_ALIGNMENT\_DEFAULT}}
\param{const wxFont\& }{font = wxNullFont}, \param{wxTextAttrAlignment }{alignment = wxTEXT\_ALIGNMENT\_DEFAULT}}
The constructors initialize one or more of the text foreground colour, background \func{}{wxTextAttr}{\param{const wxTextAttr\& }{attr}}
colour, font, and alignment. The values not initialized in the constructor can be set
later, otherwise \helpref{wxTextCtrl::SetStyle}{wxtextctrlsetstyle} will use
the default values for them.
Constructors.
\membersection{wxTextAttr::Apply}\label{wxtextattrapply}
\func{bool}{Apply}{\param{const wxTextAttr\& }{style}, \param{const wxTextAttr* }{compareWith = NULL}}
Applies the attributes in {\it style} to the original object, but not those attributes from {\it style} that are the same as those in {\it compareWith} (if passed).
\membersection{wxTextAttr::CreateFont}\label{wxtextattrcreatefont}
\constfunc{wxFont}{CreateFont}{\void}
Creates a font from the font attributes.
\membersection{wxTextAttr::GetAlignment}\label{wxtextattrgetalignment} \membersection{wxTextAttr::GetAlignment}\label{wxtextattrgetalignment}
\constfunc{wxTextAttrAlignment}{GetAlignment}{\void} \constfunc{wxTextAttrAlignment}{GetAlignment}{\void}
Returns the paragraph alignment. Returns the alignment flags.
See \helpref{wxTextAttr::SetAlignment}{wxtextattrsetalignment} for a list of available styles.
\membersection{wxTextAttr::GetBackgroundColour}\label{wxtextattrgetbackgroundcolour} \membersection{wxTextAttr::GetBackgroundColour}\label{wxtextattrgetbackgroundcolour}
\constfunc{const wxColour\&}{GetBackgroundColour}{\void} \constfunc{const wxColour\&}{GetBackgroundColour}{\void}
Return the background colour specified by this attribute. Returns the background colour.
\membersection{wxTextAttr::GetBulletFont}\label{wxtextattrgetbulletfont}
\constfunc{const wxString\&}{GetBulletFont}{\void}
Returns a string containing the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxTextAttr::GetBulletName}\label{wxtextattrgetbulletname}
\constfunc{const wxString\&}{GetBulletName}{\void}
Returns the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
Currently the following standard bullet names are supported:
\begin{itemize}\itemsep=0pt
\item {\tt standard/circle}
\item {\tt standard/square}
\item {\tt standard/diamond}
\item {\tt standard/triangle}
\end{itemize}
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 {\tt DrawStandardBullet} and {\tt EnumerateStandardBulletNames}, and
set an instance of the class using \helpref{wxRichTextBuffer::SetRenderer}{wxrichtextbuffersetrenderer}.
\membersection{wxTextAttr::GetBulletNumber}\label{wxtextattrgetbulletnumber}
\constfunc{int}{GetBulletNumber}{\void}
Returns the bullet number.
\membersection{wxTextAttr::GetBulletStyle}\label{wxtextattrgetbulletstyle}
\constfunc{int}{GetBulletStyle}{\void}
Returns the bullet style.
See \helpref{wxTextAttr::SetBulletStyle}{wxtextattrsetbulletstyle} for a list of available styles.
\membersection{wxTextAttr::GetBulletText}\label{wxtextattrgetbullettext}
\constfunc{const wxString\&}{GetBulletText}{\void}
Returns the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxTextAttr::GetCharacterStyleName}\label{wxtextattrgetcharacterstylename}
\constfunc{const wxString\&}{GetCharacterStyleName}{\void}
Returns the name of the character style.
\membersection{wxTextAttr::GetFlags}\label{wxtextattrgetflags}
\constfunc{long}{GetFlags}{\void}
Returns flags indicating which attributes are applicable.
See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for a list of available flags.
\membersection{wxTextAttr::GetFont}\label{wxtextattrgetfont} \membersection{wxTextAttr::GetFont}\label{wxtextattrgetfont}
\constfunc{const wxFont\&}{GetFont}{\void} \constfunc{wxFont}{GetFont}{\void}
Return the text font specified by this attribute. 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.
\membersection{wxTextAttr::GetFontAttributes}\label{wxtextattrgetfontattributes}
\func{bool}{GetFontAttributes}{\param{const wxFont\& }{font}, \param{int}{ flags = wxTEXT\_ATTR\_FONT}}
Gets the font attributes from the given font, using only the attributes specified by {\it flags}.
\membersection{wxTextAttr::GetFontEncoding}\label{wxtextattrgetfontencoding}
\constfunc{wxFontEncoding}{GetFontEncoding}{\void}
Returns the font encoding.
\membersection{wxTextAttr::GetFontFaceName}\label{wxtextattrgetfontfacename}
\constfunc{const wxString\&}{GetFontFaceName}{\void}
Returns the font face name.
\membersection{wxTextAttr::GetFontSize}\label{wxtextattrgetfontsize}
\constfunc{int}{GetFontSize}{\void}
Returns the font size in points.
\membersection{wxTextAttr::GetFontStyle}\label{wxtextattrgetfontstyle}
\constfunc{int}{GetFontStyle}{\void}
Returns the font style.
\membersection{wxTextAttr::GetFontUnderlined}\label{wxtextattrgetfontunderlined}
\constfunc{bool}{GetFontUnderlined}{\void}
Returns \true if the font is underlined.
\membersection{wxTextAttr::GetFontWeight}\label{wxtextattrgetfontweight}
\constfunc{int}{GetFontWeight}{\void}
Returns the font weight.
\membersection{wxTextAttr::GetLeftIndent}\label{wxtextattrgetleftindent} \membersection{wxTextAttr::GetLeftIndent}\label{wxtextattrgetleftindent}
\constfunc{int}{GetLeftIndent}{\void} \constfunc{long}{GetLeftIndent}{\void}
Returns the left indent in tenths of a millimetre. Returns the left indent in tenths of a millimetre.
\membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent} \membersection{wxTextAttr::GetLeftSubIndent}\label{wxtextattrgetleftsubindent}
\constfunc{int}{GetLeftSubIndent}{\void} \constfunc{long}{GetLeftSubIndent}{\void}
Returns the left sub indent for all lines but the first line in a paragraph in Returns the left sub-indent in tenths of a millimetre.
tenths of a millimetre.
\membersection{wxTextAttr::GetLineSpacing}\label{wxtextattrgetlinespacing}
\constfunc{int}{GetLineSpacing}{\void}
Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
\membersection{wxTextAttr::GetListStyleName}\label{wxtextattrgetliststylename}
\constfunc{const wxString\&}{GetListStyleName}{\void}
Returns the name of the list style.
\membersection{wxTextAttr::GetOutlineLevel}\label{wxtextattrgetoutlinelevel}
\constfunc{bool}{GetOutlineLevel}{\void}
Returns the outline level.
\membersection{wxTextAttr::GetParagraphSpacingAfter}\label{wxtextattrgetparagraphspacingafter}
\constfunc{int}{GetParagraphSpacingAfter}{\void}
Returns the space in tenths of a millimeter after the paragraph.
\membersection{wxTextAttr::GetParagraphSpacingBefore}\label{wxtextattrgetparagraphspacingbefore}
\constfunc{int}{GetParagraphSpacingBefore}{\void}
Returns the space in tenths of a millimeter before the paragraph.
\membersection{wxTextAttr::GetParagraphStyleName}\label{wxtextattrgetparagraphstylename}
\constfunc{const wxString\&}{GetParagraphStyleName}{\void}
Returns the name of the paragraph style.
\membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent} \membersection{wxTextAttr::GetRightIndent}\label{wxtextattrgetrightindent}
\constfunc{int}{GetRightIndent}{\void} \constfunc{long}{GetRightIndent}{\void}
Returns the right indent in tenths of a millimetre.
Returns the right indent in tenths of a millimeter.
\membersection{wxTextAttr::GetTabs}\label{wxtextattrgettabs} \membersection{wxTextAttr::GetTabs}\label{wxtextattrgettabs}
\constfunc{const wxArrayInt\&}{GetTabs}{\void} \constfunc{const wxArrayInt\&}{GetTabs}{\void}
Returns the array of integers representing the tab stops. Each Returns an array of tab stops, each expressed in tenths of a millimeter. Each stop
array element specifies the tab stop in tenths of a millimetre. is measured from the left margin and therefore each value must be larger than the last.
\membersection{wxTextAttr::GetTextColour}\label{wxtextattrgettextcolour} \membersection{wxTextAttr::GetTextColour}\label{wxtextattrgettextcolour}
\constfunc{const wxColour\&}{GetTextColour}{\void} \constfunc{const wxColour\&}{GetTextColour}{\void}
Return the text colour specified by this attribute. Returns the text foreground colour.
\membersection{wxTextAttr::GetTextEffectFlags}\label{wxtextattrgettexteffectflags}
\constfunc{int}{GetTextEffectFlags}{\void}
Returns the text effect bits of interest. See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for further information.
\membersection{wxTextAttr::GetTextEffects}\label{wxtextattrgettexteffects}
\constfunc{int}{GetTextEffects}{\void}
Returns the text effects, a bit list of styles. See \helpref{wxTextAttr::SetTextEffects}{wxtextattrsettexteffects} for
details.
\membersection{wxTextAttr::GetURL}\label{wxtextattrgeturl}
\constfunc{const wxString\&}{GetURL}{\void}
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.
\membersection{wxTextAttr::HasAlignment}\label{wxtextattrhasalignment} \membersection{wxTextAttr::HasAlignment}\label{wxtextattrhasalignment}
\constfunc{bool}{HasAlignment}{\void} \constfunc{bool}{HasAlignment}{\void}
Returns {\tt true} if this style specifies the text alignment. Returns \true if the attribute object specifies alignment.
\membersection{wxTextAttr::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour} \membersection{wxTextAttr::HasBackgroundColour}\label{wxtextattrhasbackgroundcolour}
\constfunc{bool}{HasBackgroundColour}{\void} \constfunc{bool}{HasBackgroundColour}{\void}
Returns {\tt true} if this style specifies the background colour to use. Returns \true if the attribute object specifies a background colour.
\membersection{wxTextAttr::HasBulletName}\label{wxtextattrhasbulletname}
\constfunc{bool}{HasBulletName}{\void}
Returns \true if the attribute object specifies a standard bullet name.
\membersection{wxTextAttr::HasBulletNumber}\label{wxtextattrhasbulletnumber}
\constfunc{bool}{HasBulletNumber}{\void}
Returns \true if the attribute object specifies a bullet number.
\membersection{wxTextAttr::HasBulletStyle}\label{wxtextattrhasbulletstyle}
\constfunc{bool}{HasBulletStyle}{\void}
Returns \true if the attribute object specifies a bullet style.
\membersection{wxTextAttr::HasBulletText}\label{wxtextattrhasbullettext}
\constfunc{bool}{HasBulletText}{\void}
Returns \true if the attribute object specifies bullet text (usually specifying a symbol).
\membersection{wxTextAttr::HasCharacterStyleName}\label{wxtextattrhascharacterstylename}
\constfunc{bool}{HasCharacterStyleName}{\void}
Returns \true if the attribute object specifies a character style name.
\membersection{wxTextAttr::HasFontEncoding}\label{wxtextattrhasfontencoding}
\constfunc{bool}{HasFontEncoding}{\void}
Returns \true if the attribute object specifies an encoding.
\membersection{wxTextAttr::HasFontFaceName}\label{wxtextattrhasfontfacename}
\constfunc{bool}{HasFontFaceName}{\void}
Returns \true if the attribute object specifies a font face name.
\membersection{wxTextAttr::HasFlag}\label{wxtextattrhasflag}
\constfunc{bool}{HasFlag}{\param{long }{flag}}
Returns \true if the {\it flag} is present in the attribute object's flag bitlist.
\membersection{wxTextAttr::HasFont}\label{wxtextattrhasfont} \membersection{wxTextAttr::HasFont}\label{wxtextattrhasfont}
\constfunc{bool}{HasFont}{\void} \constfunc{bool}{HasFont}{\void}
Returns {\tt true} if this style specifies the font to use. Returns \true if the attribute object specifies any font attributes.
\membersection{wxTextAttr::HasFontItalic}\label{wxtextattrhasfontitalic}
\constfunc{bool}{HasFontItalic}{\void}
Returns \true if the attribute object specifies italic style.
\membersection{wxTextAttr::HasFontUnderlined}\label{wxtextattrhasfontunderlined}
\constfunc{bool}{HasFontUnderlined}{\void}
Returns \true if the attribute object specifies either underlining or no underlining.
\membersection{wxTextAttr::HasURL}\label{wxtextattrhasurl}
\constfunc{bool}{HasURL}{\void}
Returns \true if the attribute object specifies a URL.
\membersection{wxTextAttr::HasFontWeight}\label{wxtextattrhasfontweight}
\constfunc{bool}{HasFontWeight}{\void}
Returns \true if the attribute object specifies font weight (bold, light or normal).
\membersection{wxTextAttr::HasLeftIndent}\label{wxtextattrhasleftindent} \membersection{wxTextAttr::HasLeftIndent}\label{wxtextattrhasleftindent}
\constfunc{bool}{HasLeftIndent}{\void} \constfunc{bool}{HasLeftIndent}{\void}
Returns {\tt true} if this style specifies the left indent. Returns \true if the attribute object specifies a left indent.
\membersection{wxTextAttr::HasLineSpacing}\label{wxtextattrhaslinespacing}
\constfunc{bool}{HasLineSpacing}{\void}
Returns \true if the attribute object specifies line spacing.
\membersection{wxTextAttr::HasListStyleName}\label{wxtextattrhasliststylename}
\constfunc{bool}{HasListStyleName}{\void}
Returns \true if the attribute object specifies a list style name.
\membersection{wxTextAttr::HasOutlineLevel}\label{wxtextattrhasoutlinelevel}
\constfunc{bool}{HasOutlineLevel}{\void}
Returns \true if the attribute object specifies an outline level.
\membersection{wxTextAttr::HasPageBreak}\label{wxtextattrhaspagebreak}
\constfunc{bool}{HasPageBreak}{\void}
Returns \true if the attribute object specifies a page break before this paragraph.
\membersection{wxTextAttr::HasParagraphSpacingAfter}\label{wxtextattrhasparagraphspacingafter}
\constfunc{bool}{HasParagraphSpacingAfter}{\void}
Returns \true if the attribute object specifies spacing after a paragraph.
\membersection{wxTextAttr::HasParagraphSpacingBefore}\label{wxtextattrhasparagraphspacingbefore}
\constfunc{bool}{HasParagraphSpacingBefore}{\void}
Returns \true if the attribute object specifies spacing before a paragraph.
\membersection{wxTextAttr::HasParagraphStyleName}\label{wxtextattrhasparagraphstylename}
\constfunc{bool}{HasParagraphStyleName}{\void}
Returns \true if the attribute object specifies a paragraph style name.
\membersection{wxTextAttr::HasRightIndent}\label{wxtextattrhasrightindent} \membersection{wxTextAttr::HasRightIndent}\label{wxtextattrhasrightindent}
\constfunc{bool}{HasRightIndent}{\void} \constfunc{bool}{HasRightIndent}{\void}
Returns {\tt true} if this style specifies the right indent. Returns \true if the attribute object specifies a right indent.
\membersection{wxTextAttr::HasFontSize}\label{wxtextattrhasfontsize}
\constfunc{bool}{HasFontSize}{\void}
Returns \true if the attribute object specifies a font point size.
\membersection{wxTextAttr::HasTabs}\label{wxtextattrhastabs} \membersection{wxTextAttr::HasTabs}\label{wxtextattrhastabs}
\constfunc{bool}{HasTabs}{\void} \constfunc{bool}{HasTabs}{\void}
Returns {\tt true} if this style specifies any tabstobs. Returns \true if the attribute object specifies tab stops.
\membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour} \membersection{wxTextAttr::HasTextColour}\label{wxtextattrhastextcolour}
\constfunc{bool}{HasTextColour}{\void} \constfunc{bool}{HasTextColour}{\void}
Returns {\tt true} if this style specifies the foreground colour to use. Returns \true if the attribute object specifies a text foreground colour.
\membersection{wxTextAttr::HasTextEffects}\label{wxtextattrhastexteffects}
\membersection{wxTextAttr::GetFlags}\label{wxtextattrgetflags} \constfunc{bool}{HasTextEffects}{\void}
\func{long}{GetFlags}{\void} Returns \true if the attribute object specifies text effects.
Returns a bitlist indicating which attributes will be set. \membersection{wxTextAttr::IsCharacterStyle}\label{wxtextattrischaracterstyle}
\constfunc{bool}{IsCharacterStyle}{\void}
Returns \true if the object represents a character style, that is,
the flags specify a font or a text background or foreground colour.
\membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault} \membersection{wxTextAttr::IsDefault}\label{wxtextattrisdefault}
\constfunc{bool}{IsDefault}{\void} \constfunc{bool}{IsDefault}{\void}
Returns {\tt true} if this style specifies any non-default attributes. Returns \false if we have any attributes set, \true otherwise.
\membersection{wxTextAttr::IsParagraphStyle}\label{wxtextattrisparagraphstyle}
\constfunc{bool}{IsParagraphStyle}{\void}
Returns \true if the object represents a paragraph style, that is,
the flags specify alignment, indentation, tabs, paragraph spacing, or
bullet style.
\membersection{wxTextAttr::Merge}\label{wxtextattrmerge} \membersection{wxTextAttr::Merge}\label{wxtextattrmerge}
@@ -227,40 +581,251 @@ result.
\membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment} \membersection{wxTextAttr::SetAlignment}\label{wxtextattrsetalignment}
\func{void}{SetAlignment}{\param{wxTextAttrAlignment}{ alignment}} \func{void}{SetAlignment}{\param{wxTextAttrAlignment }{alignment}}
Sets the paragraph alignment. Sets the paragraph alignment. These are the possible values for {\it alignment}:
{\small
\begin{verbatim}
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
\end{verbatim}
}
Of these, wxTEXT\_ALIGNMENT\_JUSTIFIED is unimplemented. In future justification may be supported
when printing or previewing, only.
\membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour} \membersection{wxTextAttr::SetBackgroundColour}\label{wxtextattrsetbackgroundcolour}
\func{void}{SetBackgroundColour}{\param{const wxColour\& }{colour}} \func{void}{SetBackgroundColour}{\param{const wxColour\& }{colBack}}
Sets the background colour. Sets the background colour.
\membersection{wxTextAttr::SetBulletFont}\label{wxtextattrsetbulletfont}
\func{void}{SetBulletFont}{\param{const wxString\& }{font}}
Sets the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxTextAttr::SetBulletName}\label{wxtextattrsetbulletname}
\func{void}{SetBulletName}{\param{const wxString\& }{name}}
Sets the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
See \helpref{wxTextAttr::GetBulletName}{wxtextattrgetbulletname} for a list
of supported names, and how to expand the range of supported types.
\membersection{wxTextAttr::SetBulletNumber}\label{wxtextattrsetbulletnumber}
\func{void}{SetBulletNumber}{\param{int }{n}}
Sets the bullet number.
\membersection{wxTextAttr::SetBulletStyle}\label{wxtextattrsetbulletstyle}
\func{void}{SetBulletStyle}{\param{int }{style}}
Sets the bullet style. The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Currently wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is not supported.
\membersection{wxTextAttr::SetBulletText}\label{wxtextattrsetbullettext}
\func{void}{SetBulletText}{\param{const wxString& }{text}}
Sets the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxTextAttr::SetCharacterStyleName}\label{wxtextattrsetcharacterstylename}
\func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
Sets the character style name.
\membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags} \membersection{wxTextAttr::SetFlags}\label{wxtextattrsetflags}
\func{void}{SetFlags}{\param{long}{ flags}} \func{void}{SetFlags}{\param{long }{flags}}
Pass a bitlist indicating which attributes will be set. Sets the flags determining which styles are being specified. The following
flags can be passed in a bitlist:
{\small
\begin{verbatim}
// Standard wxTextAttr constants
#define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
#define wxTEXT_ATTR_FONT_FACE 0x00000004
#define wxTEXT_ATTR_FONT_SIZE 0x00000008
#define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
#define wxTEXT_ATTR_FONT_ITALIC 0x00000020
#define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
#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 0x00000080
#define wxTEXT_ATTR_LEFT_INDENT 0x00000100
#define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
#define wxTEXT_ATTR_TABS 0x00000400
// 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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
\end{verbatim}
}
\membersection{wxTextAttr::SetFont}\label{wxtextattrsetfont} \membersection{wxTextAttr::SetFont}\label{wxtextattrsetfont}
\func{void}{SetFont}{\param{const wxFont\&}{ font}} \func{void}{SetFont}{\param{const wxFont\&}{ font}}
Sets the text font. Sets the attributes for the given font. Note that wxTextAttr does not store an actual wxFont object.
\membersection{wxTextAttr::SetFontEncoding}\label{wxtextattrsetfontencoding}
\func{void}{SetFontEncoding}{\param{wxFontEncoding }{encoding}}
Sets the font encoding.
\membersection{wxTextAttr::SetFontFaceName}\label{wxtextattrsetfontfacename}
\func{void}{SetFontFaceName}{\param{const wxString\& }{faceName}}
Sets the paragraph alignment.
\membersection{wxTextAttr::SetFontSize}\label{wxtextattrsetfontsize}
\func{void}{SetFontSize}{\param{int }{pointSize}}
Sets the font size in points.
\membersection{wxTextAttr::SetFontStyle}\label{wxtextattrsetfontstyle}
\func{void}{SetFontStyle}{\param{int }{fontStyle}}
Sets the font style (normal, italic or slanted).
\membersection{wxTextAttr::SetFontUnderlined}\label{wxtextattrsetfontunderlined}
\func{void}{SetFontUnderlined}{\param{bool }{underlined}}
Sets the font underlining.
\membersection{wxTextAttr::SetFontWeight}\label{wxtextattrsetfontweight}
\func{void}{SetFontWeight}{\param{int }{fontWeight}}
Sets the font weight.
\membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent} \membersection{wxTextAttr::SetLeftIndent}\label{wxtextattrsetleftindent}
\func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}} \func{void}{SetLeftIndent}{\param{int }{indent}, \param{int }{subIndent = 0}}
Sets the left indent in tenths of a millimetre. Sets the left indent and left subindent in tenths of a millimetre.
subIndent sets the indent for all lines but the first line in a paragraph
relative to the first line.
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.
\membersection{wxTextAttr::SetLineSpacing}\label{wxtextattrsetlinespacing}
\func{void}{SetLineSpacing}{\param{int }{spacing}}
Sets the line spacing. {\it 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:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
\membersection{wxTextAttr::SetListStyleName}\label{wxtextattrsetliststylename}
\func{void}{SetListStyleName}{\param{const wxString\& }{name}}
Sets the list style name.
\membersection{wxTextAttr::SetOutlineLevel}\label{wxtextattrsetoutlinelevel}
\func{void}{SetOutlineLevel}{\param{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.
\membersection{wxTextAttr::SetPageBreak}\label{wxtextattrsetpagebreak}
\func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}}
Specifies a page break before this paragraph.
\membersection{wxTextAttr::SetParagraphSpacingAfter}\label{wxtextattrsetparagraphspacingafter}
\func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
Sets the spacing after a paragraph, in tenths of a millimetre.
\membersection{wxTextAttr::SetParagraphSpacingBefore}\label{wxtextattrsetparagraphspacingbefore}
\func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
Sets the spacing before a paragraph, in tenths of a millimetre.
\membersection{wxTextAttr::SetParagraphStyleName}\label{wxtextattrsetparagraphstylename}
\func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
Sets the name of the paragraph style.
\membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent} \membersection{wxTextAttr::SetRightIndent}\label{wxtextattrsetrightindent}
@@ -268,18 +833,69 @@ relative to the first line.
Sets the right indent in tenths of a millimetre. Sets the right indent in tenths of a millimetre.
\membersection{wxTextAttr::SetTabs}\label{wxtextattrsettabs} \membersection{wxTextAttr::SetTabs}\label{wxtextattrsettabs}
\func{void}{SetTabs}{\param{const wxArrayInt\&}{ tabs}} \func{void}{SetTabs}{\param{const wxArrayInt\& }{tabs}}
Sets the array of integers representing the tab stops. Each
array element specifies the tab stop 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.
\membersection{wxTextAttr::SetTextColour}\label{wxtextattrsettextcolour} \membersection{wxTextAttr::SetTextColour}\label{wxtextattrsettextcolour}
\func{void}{SetTextColour}{\param{const wxColour\& }{colour}} \func{void}{SetTextColour}{\param{const wxColour\& }{colText}}
Sets the text colour. Sets the text foreground colout.
\membersection{wxTextAttr::SetTextEffectFlags}\label{wxtextattrsettexteffectflags}
\func{void}{SetTextEffectFlags}{\param{int }{flags}}
Sets the text effect bits of interest. You should also pass wxTEXT\_ATTR\_EFFECTS to \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}.
See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for further information.
\membersection{wxTextAttr::SetTextEffects}\label{wxtextattrsettexteffects}
\func{void}{SetTextEffects}{\param{int }{effects}}
Sets the text effects, a bit list of styles.
The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
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 \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}, and call\rtfsp
\helpref{wxTextAttr::SetTextEffectFlags}{wxtextattrsettexteffectflags} with the styles (taken from the
above set) that you are interested in setting.
\membersection{wxTextAttr::SetURL}\label{wxtextattrseturl}
\func{void}{SetURL}{\param{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.
\membersection{wxTextAttr::operator=}\label{wxtextattroperatorassign}
\func{void operator}{operator=}{\param{const wxTextAttr\& }{attr}}
Assignment from a \helpref{wxTextAttr}{wxtextattr} object.

View File

@@ -1,555 +0,0 @@
\section{\class{wxTextAttrEx}}\label{wxtextattrex}
wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes.
Currently it is only used with \helpref{wxRichTextCtrl}{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, \helpref{wxRichTextAttr}{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 \helpref{wxTextAttr}{wxtextattr} for
the remaining functions.
\wxheading{Derived from}
\helpref{wxTextAttr}{wxtextattr}
\wxheading{Include files}
<wx/richtext/richtextbuffer.h>
\wxheading{Library}
\helpref{wxRichtext}{librarieslist}
\wxheading{Constants}
The following values can be passed to SetAlignment to determine
paragraph alignment.
{\small
\begin{verbatim}
enum wxTextAttrAlignment
{
wxTEXT_ALIGNMENT_DEFAULT,
wxTEXT_ALIGNMENT_LEFT,
wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_CENTER = wxTEXT_ALIGNMENT_CENTRE,
wxTEXT_ALIGNMENT_RIGHT,
wxTEXT_ALIGNMENT_JUSTIFIED
};
\end{verbatim}
}
These values are passed in a bitlist to SetFlags to determine
what attributes will be considered when setting the attributes
for a text control.
{\small
\begin{verbatim}
// 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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
\end{verbatim}
}
The following styles can be passed to wxTextAttrEx::SetBulletStyle:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Of these, wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is unimplemented.
The following constants can be passed to wxTextAttrEx::SetLineSpacing:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
The following styles can be passed to wxTextAttrEx::SetTextEffects:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
Of these, only wxTEXT\_ATTR\_EFFECT\_CAPITALS and wxTEXT\_ATTR\_EFFECT\_STRIKETHROUGH are implemented.
\wxheading{See also}
\helpref{wxTextAttr}{wxtextattr}, \helpref{wxRichTextAttr}{wxrichtextattr}, \helpref{wxRichTextCtrl}{wxrichtextctrl}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxTextAttrEx::wxTextAttrEx}\label{wxtextattrexwxtextattrex}
\func{}{wxTextAttrEx}{\void}
\func{}{wxTextAttrEx}{\param{const wxTextAttrEx\& }{attr}}
Constructors.
\membersection{wxTextAttrEx::GetBulletFont}\label{wxtextattrexgetbulletfont}
\constfunc{const wxString\&}{GetBulletFont}{\void}
Returns a string containing the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxTextAttrEx::GetBulletName}\label{wxtextattrexgetbulletname}
\constfunc{const wxString\&}{GetBulletName}{\void}
Returns the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
Currently the following standard bullet names are supported:
\begin{itemize}\itemsep=0pt
\item {\tt standard/circle}
\item {\tt standard/square}
\item {\tt standard/diamond}
\item {\tt standard/triangle}
\end{itemize}
If you wish your application to support further bullet graphics, you can derive a
class from wxRichTextRenderer or wxRichTextStdRenderer, override {\tt DrawStandardBullet} and {\tt EnumerateStandardBulletNames}, and
set an instance of the class using \helpref{wxRichTextBuffer::SetRenderer}{wxrichtextbuffersetrenderer}.
\membersection{wxTextAttrEx::GetBulletNumber}\label{wxtextattrexgetbulletnumber}
\constfunc{int}{GetBulletNumber}{\void}
Returns the bullet number.
\membersection{wxTextAttrEx::GetBulletStyle}\label{wxtextattrexgetbulletstyle}
\constfunc{int}{GetBulletStyle}{\void}
Returns the bullet style.
See \helpref{wxTextAttrEx::SetBulletStyle}{wxtextattrexsetbulletstyle} for a list of available styles.
\membersection{wxTextAttrEx::GetBulletText}\label{wxtextattrexgetbullettext}
\constfunc{const wxString\&}{GetBulletText}{\void}
Returns the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxTextAttrEx::GetCharacterStyleName}\label{wxtextattrexgetcharacterstylename}
\constfunc{const wxString\&}{GetCharacterStyleName}{\void}
Returns the name of the character style.
\membersection{wxTextAttrEx::GetLineSpacing}\label{wxtextattrexgetlinespacing}
\constfunc{int}{GetLineSpacing}{\void}
Returns the line spacing value, one of wxTEXT\_ATTR\_LINE\_SPACING\_NORMAL,
wxTEXT\_ATTR\_LINE\_SPACING\_HALF, and wxTEXT\_ATTR\_LINE\_SPACING\_TWICE.
\membersection{wxTextAttrEx::GetListStyleName}\label{wxtextattrexgetliststylename}
\constfunc{const wxString\&}{GetListStyleName}{\void}
Returns the name of the list style.
\membersection{wxTextAttrEx::GetOutlineLevel}\label{wxtextattrexgetoutlinelevel}
\constfunc{bool}{GetOutlineLevel}{\void}
Returns the outline level.
\membersection{wxTextAttrEx::GetParagraphSpacingAfter}\label{wxtextattrexgetparagraphspacingafter}
\constfunc{int}{GetParagraphSpacingAfter}{\void}
Returns the space in tenths of a millimeter after the paragraph.
\membersection{wxTextAttrEx::GetParagraphSpacingBefore}\label{wxtextattrexgetparagraphspacingbefore}
\constfunc{int}{GetParagraphSpacingBefore}{\void}
Returns the space in tenths of a millimeter before the paragraph.
\membersection{wxTextAttrEx::GetParagraphStyleName}\label{wxtextattrexgetparagraphstylename}
\constfunc{const wxString\&}{GetParagraphStyleName}{\void}
Returns the name of the paragraph style.
\membersection{wxTextAttrEx::GetTextEffectFlags}\label{wxtextattrexgettexteffectflags}
\constfunc{int}{GetTextEffectFlags}{\void}
Returns the text effect bits of interest. See \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags} for further information.
\membersection{wxTextAttrEx::GetTextEffects}\label{wxtextattrexgettexteffects}
\constfunc{int}{GetTextEffects}{\void}
Returns the text effects, a bit list of styles. See \helpref{wxTextAttrEx::SetTextEffects}{wxtextattrexsettexteffects} for
details.
\membersection{wxTextAttrEx::GetURL}\label{wxtextattrexgeturl}
\constfunc{const wxString\&}{GetURL}{\void}
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.
\membersection{wxTextAttrEx::HasBulletName}\label{wxtextattrexhasbulletname}
\constfunc{bool}{HasBulletName}{\void}
Returns \true if the attribute object specifies a standard bullet name.
\membersection{wxTextAttrEx::HasBulletNumber}\label{wxtextattrexhasbulletnumber}
\constfunc{bool}{HasBulletNumber}{\void}
Returns \true if the attribute object specifies a bullet number.
\membersection{wxTextAttrEx::HasBulletStyle}\label{wxtextattrexhasbulletstyle}
\constfunc{bool}{HasBulletStyle}{\void}
Returns \true if the attribute object specifies a bullet style.
\membersection{wxTextAttrEx::HasBulletText}\label{wxtextattrexhasbullettext}
\constfunc{bool}{HasBulletText}{\void}
Returns \true if the attribute object specifies bullet text (usually containing a symbol).
\membersection{wxTextAttrEx::HasCharacterStyleName}\label{wxtextattrexhascharacterstylename}
\constfunc{bool}{HasCharacterStyleName}{\void}
Returns \true if the attribute object specifies a character style name.
\membersection{wxTextAttrEx::HasLineSpacing}\label{wxtextattrexhaslinespacing}
\constfunc{bool}{HasLineSpacing}{\void}
Returns \true if the attribute object specifies line spacing.
\membersection{wxTextAttrEx::HasListStyleName}\label{wxtextattrexhasliststylename}
\constfunc{bool}{HasListStyleName}{\void}
Returns \true if the attribute object specifies a list style name.
\membersection{wxTextAttrEx::HasOutlineLevel}\label{wxtextattrexhasoutlinelevel}
\constfunc{bool}{HasOutlineLevel}{\void}
Returns \true if the attribute object specifies an outline level.
\membersection{wxTextAttrEx::HasPageBreak}\label{wxtextattrexhaspagebreak}
\constfunc{bool}{HasPageBreak}{\void}
Returns \true if the attribute object specifies a page break before this paragraph.
\membersection{wxTextAttrEx::HasParagraphSpacingAfter}\label{wxtextattrexhasparagraphspacingafter}
\constfunc{bool}{HasParagraphSpacingAfter}{\void}
Returns \true if the attribute object specifies spacing after a paragraph.
\membersection{wxTextAttrEx::HasParagraphSpacingBefore}\label{wxtextattrexhasparagraphspacingbefore}
\constfunc{bool}{HasParagraphSpacingBefore}{\void}
Returns \true if the attribute object specifies spacing before a paragraph.
\membersection{wxTextAttrEx::HasParagraphStyleName}\label{wxtextattrexhasparagraphstylename}
\constfunc{bool}{HasParagraphStyleName}{\void}
Returns \true if the attribute object specifies a paragraph style name.
\membersection{wxTextAttrEx::HasTextEffects}\label{wxtextattrexhastexteffects}
\constfunc{bool}{HasTextEffects}{\void}
Returns \true if the attribute object specifies text effects.
\membersection{wxTextAttrEx::HasURL}\label{wxtextattrexhasurl}
\constfunc{bool}{HasURL}{\void}
Returns \true if the attribute object specifies a URL.
\membersection{wxTextAttrEx::Init}\label{wxtextattrexinit}
\func{void}{Init}{\void}
Initialises this object.
\membersection{wxTextAttrEx::IsCharacterStyle}\label{wxtextattrexischaracterstyle}
\constfunc{bool}{IsCharacterStyle}{\void}
Returns \true if the object represents a character style, that is,
the flags specify a font or a text background or foreground colour.
\membersection{wxTextAttrEx::IsDefault}\label{wxtextattrexisdefault}
\constfunc{bool}{IsDefault}{\void}
Returns \false if we have any attributes set, \true otherwise.
\membersection{wxTextAttrEx::IsParagraphStyle}\label{wxtextattrexisparagraphstyle}
\constfunc{bool}{IsParagraphStyle}{\void}
Returns \true if the object represents a paragraph style, that is,
the flags specify alignment, indentation, tabs, paragraph spacing, or
bullet style.
\membersection{wxTextAttrEx::SetBulletFont}\label{wxtextattrexsetbulletfont}
\func{void}{SetBulletFont}{\param{const wxString\& }{font}}
Sets the name of the font associated with the bullet symbol.
Only valid for attributes with wxTEXT\_ATTR\_BULLET\_SYMBOL.
\membersection{wxTextAttrEx::SetBulletNumber}\label{wxtextattrexsetbulletnumber}
\func{void}{SetBulletNumber}{\param{int }{n}}
Sets the bullet number.
\membersection{wxTextAttrEx::SetBulletName}\label{wxtextattrexsetbulletname}
\func{void}{SetBulletName}{\param{const wxString\& }{name}}
Sets the standard bullet name, applicable if the bullet style is wxTEXT\_ATTR\_BULLET\_STYLE\_STANDARD.
See \helpref{wxTextAttrEx::GetBulletName}{wxtextattrexgetbulletname} for a list
of supported names, and how to expand the range of supported types.
\membersection{wxTextAttrEx::SetBulletStyle}\label{wxtextattrexsetbulletstyle}
\func{void}{SetBulletStyle}{\param{int }{style}}
Sets the bullet style. The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
\end{verbatim}
}
Currently wxTEXT\_ATTR\_BULLET\_STYLE\_BITMAP is not supported.
\membersection{wxTextAttrEx::SetBulletText}\label{wxtextattrexsetbullettext}
\func{void}{SetBulletText}{\param{const wxString\& }{text}}
Sets the bullet text, which could be a symbol, or (for example) cached outline text.
\membersection{wxTextAttrEx::SetCharacterStyleName}\label{wxtextattrexsetcharacterstylename}
\func{void}{SetCharacterStyleName}{\param{const wxString\& }{name}}
Sets the character style name.
\membersection{wxTextAttrEx::SetLineSpacing}\label{wxtextattrexsetlinespacing}
\func{void}{SetLineSpacing}{\param{int }{spacing}}
Sets the line spacing. {\it 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:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
\end{verbatim}
}
\membersection{wxTextAttrEx::SetListStyleName}\label{wxtextattrexsetliststylename}
\func{void}{SetListStyleName}{\param{const wxString\& }{name}}
Sets the list style name.
\membersection{wxTextAttrEx::SetOutlineLevel}\label{wxtextattrexsetoutlinelevel}
\func{void}{SetOutlineLevel}{\param{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.
\membersection{wxTextAttrEx::SetPageBreak}\label{wxtextattrexsetpagebreak}
\func{void}{SetPageBreak}{\param{bool}{ pageBreak = true}}
Specifies a page break before this paragraph.
\membersection{wxTextAttrEx::SetParagraphSpacingAfter}\label{wxtextattrexsetparagraphspacingafter}
\func{void}{SetParagraphSpacingAfter}{\param{int }{spacing}}
Sets the spacing after a paragraph, in tenths of a millimetre.
\membersection{wxTextAttrEx::SetParagraphSpacingBefore}\label{wxtextattrexsetparagraphspacingbefore}
\func{void}{SetParagraphSpacingBefore}{\param{int }{spacing}}
Sets the spacing before a paragraph, in tenths of a millimetre.
\membersection{wxTextAttrEx::SetParagraphStyleName}\label{wxtextattrexsetparagraphstylename}
\func{void}{SetParagraphStyleName}{\param{const wxString\& }{name}}
Sets the name of the paragraph style.
\membersection{wxTextAttrEx::SetTextEffectFlags}\label{wxtextattrexsettexteffectflags}
\func{void}{SetTextEffectFlags}{\param{int }{flags}}
Sets the text effect bits of interest. You should also pass wxTEXT\_ATTR\_EFFECTS to \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}.
\membersection{wxTextAttrEx::SetTextEffects}\label{wxtextattrexsettexteffects}
\func{void}{SetTextEffects}{\param{int }{effects}}
Sets the text effects, a bit list of styles.
The following styles can be passed:
{\small
\begin{verbatim}
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
\end{verbatim}
}
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 \helpref{wxTextAttr::SetFlags}{wxtextattrsetflags}, and call\rtfsp
\helpref{wxTextAttrEx::SetTextEffectFlags}{wxtextattrexsettexteffectflags} with the styles (taken from the
above set) that you are interested in setting.
\membersection{wxTextAttrEx::SetURL}\label{wxtextattrexseturl}
\func{void}{SetURL}{\param{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.
\membersection{wxTextAttrEx::operator=}\label{wxtextattrexoperatorassign}
\func{void operator}{operator=}{\param{const wxTextAttr\& }{attr}}
Assignment from a wxTextAttr object.
\func{void operator}{operator=}{\param{const wxTextAttrEx\& }{attr}}
Assignment from a wxTextAttrEx object.

View File

@@ -70,6 +70,10 @@
#include "wx/dataobj.h" #include "wx/dataobj.h"
#endif #endif
// Compatibility
#define wxRichTextAttr wxTextAttr
#define wxTextAttrEx wxTextAttr
/*! /*!
* Special characters * Special characters
*/ */
@@ -99,7 +103,6 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextLine;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextParagraph;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextFileHandler;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextStyleSheet;
class WXDLLIMPEXP_FWD_RICHTEXT wxTextAttrEx;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextListStyleDefinition;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextEvent;
class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer; class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextRenderer;
@@ -194,86 +197,36 @@ class WXDLLIMPEXP_FWD_RICHTEXT wxRichTextBuffer;
#define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01 #define wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE 0x01
/*! /*!
* Extra formatting flags not in wxTextAttr * wxRichTextFontTable
* Manages quick access to a pool of fonts for rendering rich text
*/ */
#define wxTEXT_ATTR_PARA_SPACING_AFTER 0x00000800 class WXDLLIMPEXP_RICHTEXT wxRichTextFontTable: public wxObject
#define wxTEXT_ATTR_PARA_SPACING_BEFORE 0x00001000 {
#define wxTEXT_ATTR_LINE_SPACING 0x00002000 public:
#define wxTEXT_ATTR_CHARACTER_STYLE_NAME 0x00004000 wxRichTextFontTable();
#define wxTEXT_ATTR_PARAGRAPH_STYLE_NAME 0x00008000
#define wxTEXT_ATTR_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
/*! wxRichTextFontTable(const wxRichTextFontTable& table);
* Styles for wxTextAttrEx::SetBulletStyle virtual ~wxRichTextFontTable();
*/
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000 bool IsOk() const { return m_refData != NULL; }
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000 wxFont FindFont(const wxTextAttr& fontSpec);
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000 void Clear();
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
/*! void operator= (const wxRichTextFontTable& table);
* Styles for wxTextAttrEx::SetTextEffects bool operator == (const wxRichTextFontTable& table) const;
*/ bool operator != (const wxRichTextFontTable& table) const { return !(*this == table); }
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000 protected:
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
/*! DECLARE_DYNAMIC_CLASS(wxRichTextFontTable)
* Line spacing values };
*/
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
/*!
* Character and paragraph combined styles
*/
#define wxTEXT_ATTR_CHARACTER (wxTEXT_ATTR_FONT|wxTEXT_ATTR_EFFECTS|wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL)
#define wxTEXT_ATTR_PARAGRAPH (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL)
#define wxTEXT_ATTR_ALL (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
/*! /*!
* wxRichTextRange class declaration * wxRichTextRange class declaration
* This stores beginning and end positions for a range of data. * This stores beginning and end positions for a range of data.
* TODO: consider renaming wxTextRange and using for all text controls.
*/ */
class WXDLLIMPEXP_RICHTEXT wxRichTextRange class WXDLLIMPEXP_RICHTEXT wxRichTextRange
@@ -335,331 +288,6 @@ protected:
#define wxRICHTEXT_ALL wxRichTextRange(-2, -2) #define wxRICHTEXT_ALL wxRichTextRange(-2, -2)
#define wxRICHTEXT_NONE wxRichTextRange(-1, -1) #define wxRICHTEXT_NONE wxRichTextRange(-1, -1)
/*!
* wxTextAttrEx is an extended version of wxTextAttr with more paragraph attributes.
*/
class WXDLLIMPEXP_RICHTEXT wxTextAttrEx: public wxTextAttr
{
public:
// ctors
wxTextAttrEx(const wxTextAttrEx& attr);
wxTextAttrEx(const wxTextAttr& attr) { Init(); (*this) = attr; }
wxTextAttrEx() { Init(); }
// Initialise this object
void Init();
// Copy
void Copy(const wxTextAttrEx& attr);
// Assignment from a wxTextAttrEx object
void operator= (const wxTextAttrEx& attr);
// Assignment from a wxTextAttr object
void operator= (const wxTextAttr& attr);
// Equality test
bool operator== (const wxTextAttrEx& attr) const;
// setters
void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_CHARACTER_STYLE_NAME); }
void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_PARAGRAPH_STYLE_NAME); }
void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_AFTER); }
void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_PARA_SPACING_BEFORE); }
void SetLineSpacing(int spacing) { m_lineSpacing = spacing; SetFlags(GetFlags() | wxTEXT_ATTR_LINE_SPACING); }
void SetBulletStyle(int style) { m_bulletStyle = style; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_STYLE); }
void SetBulletNumber(int n) { m_bulletNumber = n; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NUMBER); }
void SetBulletText(const wxString& text) { m_bulletText = text; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_TEXT); }
void SetBulletName(const wxString& name) { m_bulletName = name; SetFlags(GetFlags() | wxTEXT_ATTR_BULLET_NAME); }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetURL(const wxString& url) { m_urlTarget = url; SetFlags(GetFlags() | wxTEXT_ATTR_URL); }
void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
const wxString& GetListStyleName() const { return m_listStyleName; }
int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
int GetLineSpacing() const { return m_lineSpacing; }
int GetBulletStyle() const { return m_bulletStyle; }
int GetBulletNumber() const { return m_bulletNumber; }
const wxString& GetBulletText() const { return m_bulletText; }
const wxString& GetBulletName() const { return m_bulletName; }
const wxString& GetBulletFont() const { return m_bulletFont; }
const wxString& GetURL() const { return m_urlTarget; }
int GetTextEffects() const { return m_textEffects; }
int GetTextEffectFlags() const { return m_textEffectFlags; }
int GetOutlineLevel() const { return m_outlineLevel; }
bool HasFontWeight() const { return (GetFlags() & wxTEXT_ATTR_FONT_WEIGHT) != 0; }
bool HasFontSize() const { return (GetFlags() & wxTEXT_ATTR_FONT_SIZE) != 0; }
bool HasFontItalic() const { return (GetFlags() & wxTEXT_ATTR_FONT_ITALIC) != 0; }
bool HasFontUnderlined() const { return (GetFlags() & wxTEXT_ATTR_FONT_UNDERLINE) != 0; }
bool HasFontFaceName() const { return (GetFlags() & wxTEXT_ATTR_FONT_FACE) != 0; }
bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); }
bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); }
bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); }
bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); }
bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); }
bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); }
bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); }
bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
// Is this a character style?
bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); }
bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); }
// returns false if we have any attributes set, true otherwise
bool IsDefault() const
{
return (GetFlags() == 0);
}
// return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set
static wxTextAttrEx CombineEx(const wxTextAttrEx& attr,
const wxTextAttrEx& attrDef,
const wxTextCtrlBase *text);
private:
// Paragraph styles
int m_paragraphSpacingAfter;
int m_paragraphSpacingBefore;
int m_lineSpacing;
int m_bulletStyle;
int m_bulletNumber;
int m_textEffects;
int m_textEffectFlags;
int m_outlineLevel;
wxString m_bulletText;
wxString m_bulletFont;
wxString m_bulletName;
wxString m_urlTarget;
// Character style
wxString m_characterStyleName;
// Paragraph style
wxString m_paragraphStyleName;
// List style
wxString m_listStyleName;
};
/*!
* wxRichTextAttr stores attributes without a wxFont object, so is a much more
* efficient way to query styles.
*/
class WXDLLIMPEXP_RICHTEXT wxRichTextAttr
{
public:
// ctors
wxRichTextAttr(const wxTextAttrEx& attr);
wxRichTextAttr(const wxRichTextAttr& attr);
wxRichTextAttr() { Init(); }
wxRichTextAttr(const wxColour& colText,
const wxColour& colBack = wxNullColour,
wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
// Initialise this object.
void Init();
// Copy
void Copy(const wxRichTextAttr& attr);
// Assignment from a wxRichTextAttr object.
void operator= (const wxRichTextAttr& attr);
// Assignment from a wxTextAttrEx object.
void operator= (const wxTextAttrEx& attr);
// Equality test
bool operator== (const wxRichTextAttr& attr) const;
// Making a wxTextAttrEx object.
operator wxTextAttrEx () const ;
// Create font from font attributes.
wxFont CreateFont() const;
// Get attributes from font.
bool GetFontAttributes(const wxFont& font);
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; }
void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
void SetFlags(long flags) { m_flags = flags; }
void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; }
void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; }
void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; }
void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; }
void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; }
void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; }
void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; }
void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
const wxArrayInt& GetTabs() const { return m_tabs; }
long GetLeftIndent() const { return m_leftIndent; }
long GetLeftSubIndent() const { return m_leftSubIndent; }
long GetRightIndent() const { return m_rightIndent; }
long GetFlags() const { return m_flags; }
int GetFontSize() const { return m_fontSize; }
int GetFontStyle() const { return m_fontStyle; }
int GetFontWeight() const { return m_fontWeight; }
bool GetFontUnderlined() const { return m_fontUnderlined; }
const wxString& GetFontFaceName() const { return m_fontFaceName; }
const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
const wxString& GetListStyleName() const { return m_listStyleName; }
int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
int GetLineSpacing() const { return m_lineSpacing; }
int GetBulletStyle() const { return m_bulletStyle; }
int GetBulletNumber() const { return m_bulletNumber; }
const wxString& GetBulletText() const { return m_bulletText; }
const wxString& GetBulletFont() const { return m_bulletFont; }
const wxString& GetBulletName() const { return m_bulletName; }
const wxString& GetURL() const { return m_urlTarget; }
int GetTextEffects() const { return m_textEffects; }
int GetTextEffectFlags() const { return m_textEffectFlags; }
int GetOutlineLevel() const { return m_outlineLevel; }
// accessors
bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) || ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; }
bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; }
bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; }
bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; }
bool HasFontWeight() const { return (m_flags & wxTEXT_ATTR_FONT_WEIGHT) != 0; }
bool HasFontSize() const { return (m_flags & wxTEXT_ATTR_FONT_SIZE) != 0; }
bool HasFontItalic() const { return (m_flags & wxTEXT_ATTR_FONT_ITALIC) != 0; }
bool HasFontUnderlined() const { return (m_flags & wxTEXT_ATTR_FONT_UNDERLINE) != 0; }
bool HasFontFaceName() const { return (m_flags & wxTEXT_ATTR_FONT_FACE) != 0; }
bool HasFont() const { return (m_flags & (wxTEXT_ATTR_FONT)) != 0; }
bool HasParagraphSpacingAfter() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_AFTER) != 0; }
bool HasParagraphSpacingBefore() const { return (m_flags & wxTEXT_ATTR_PARA_SPACING_BEFORE) != 0; }
bool HasLineSpacing() const { return (m_flags & wxTEXT_ATTR_LINE_SPACING) != 0; }
bool HasCharacterStyleName() const { return (m_flags & wxTEXT_ATTR_CHARACTER_STYLE_NAME) != 0 && !m_characterStyleName.IsEmpty(); }
bool HasParagraphStyleName() const { return (m_flags & wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) != 0 && !m_paragraphStyleName.IsEmpty(); }
bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
bool HasBulletStyle() const { return (m_flags & wxTEXT_ATTR_BULLET_STYLE) != 0; }
bool HasBulletNumber() const { return (m_flags & wxTEXT_ATTR_BULLET_NUMBER) != 0; }
bool HasBulletText() const { return (m_flags & wxTEXT_ATTR_BULLET_TEXT) != 0; }
bool HasBulletName() const { return (m_flags & wxTEXT_ATTR_BULLET_NAME) != 0; }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
// Is this a character style?
bool IsCharacterStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_CHARACTER)); }
bool IsParagraphStyle() const { return (0 != (GetFlags() & wxTEXT_ATTR_PARAGRAPH)); }
// returns false if we have any attributes set, true otherwise
bool IsDefault() const
{
return GetFlags() == 0;
}
// Merges the given attributes. Does not affect 'this'. If compareWith
// is non-NULL, then it will be used to mask out those attributes that are the same in style
// and compareWith, for situations where we don't want to explicitly set inherited attributes.
bool Apply(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL);
// Merges the given attributes and returns the result. Does not affect 'this'. If compareWith
// is non-NULL, then it will be used to mask out those attributes that are the same in style
// and compareWith, for situations where we don't want to explicitly set inherited attributes.
wxRichTextAttr Combine(const wxRichTextAttr& style, const wxRichTextAttr* compareWith = NULL) const;
private:
long m_flags;
// Paragraph styles
wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm
int m_leftIndent; // left indent in 1/10 mm
int m_leftSubIndent; // left indent for all but the first
// line in a paragraph relative to the
// first line, in 1/10 mm
int m_rightIndent; // right indent in 1/10 mm
wxTextAttrAlignment m_textAlignment;
int m_paragraphSpacingAfter;
int m_paragraphSpacingBefore;
int m_lineSpacing;
int m_bulletStyle;
int m_bulletNumber;
int m_textEffects;
int m_textEffectFlags;
int m_outlineLevel;
wxString m_bulletText;
wxString m_bulletFont;
wxString m_bulletName;
wxString m_urlTarget;
// Character styles
wxColour m_colText,
m_colBack;
int m_fontSize;
int m_fontStyle;
int m_fontWeight;
bool m_fontUnderlined;
wxString m_fontFaceName;
// Character style
wxString m_characterStyleName;
// Paragraph style
wxString m_paragraphStyleName;
// List style
wxString m_listStyleName;
};
/*! /*!
* wxRichTextObject class declaration * wxRichTextObject class declaration
* This is the base for drawable objects. * This is the base for drawable objects.
@@ -766,9 +394,9 @@ public:
virtual int GetBottomMargin() const { return m_bottomMargin; } virtual int GetBottomMargin() const { return m_bottomMargin; }
/// Set attributes object /// Set attributes object
void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } void SetAttributes(const wxTextAttr& attr) { m_attributes = attr; }
const wxTextAttrEx& GetAttributes() const { return m_attributes; } const wxTextAttr& GetAttributes() const { return m_attributes; }
wxTextAttrEx& GetAttributes() { return m_attributes; } wxTextAttr& GetAttributes() { return m_attributes; }
/// Set/get stored descent /// Set/get stored descent
void SetDescent(int descent) { m_descent = descent; } void SetDescent(int descent) { m_descent = descent; }
@@ -812,7 +440,7 @@ protected:
int m_bottomMargin; int m_bottomMargin;
/// Attributes /// Attributes
wxTextAttrEx m_attributes; wxTextAttr m_attributes;
}; };
WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT ); WX_DECLARE_LIST_WITH_DECL( wxRichTextObject, wxRichTextObjectList, class WXDLLIMPEXP_RICHTEXT );
@@ -1000,13 +628,13 @@ public:
virtual void Reset(); virtual void Reset();
/// Convenience function to add a paragraph of text /// Convenience function to add a paragraph of text
virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL); virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttr* paraStyle = NULL);
/// Convenience function to add an image /// Convenience function to add an image
virtual wxRichTextRange AddImage(const wxImage& image, wxTextAttrEx* paraStyle = NULL); virtual wxRichTextRange AddImage(const wxImage& image, wxTextAttr* paraStyle = NULL);
/// Adds multiple paragraphs, based on newlines. /// Adds multiple paragraphs, based on newlines.
virtual wxRichTextRange AddParagraphs(const wxString& text, wxTextAttrEx* paraStyle = NULL); virtual wxRichTextRange AddParagraphs(const wxString& text, wxTextAttr* paraStyle = NULL);
/// Get the line at the given position. If caretPosition is true, the position is /// Get the line at the given position. If caretPosition is true, the position is
/// a caret position, which is normally a smaller number. /// a caret position, which is normally a smaller number.
@@ -1060,28 +688,25 @@ public:
virtual bool PositionToXY(long pos, long* x, long* y) const; virtual bool PositionToXY(long pos, long* x, long* y) const;
/// Set text attributes: character and/or paragraph styles. /// Set text attributes: character and/or paragraph styles.
virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
/// Get the conbined text attributes for this position. /// Get the conbined text attributes for this position.
virtual bool GetStyle(long position, wxTextAttrEx& style); virtual bool GetStyle(long position, wxTextAttr& style);
virtual bool GetStyle(long position, wxRichTextAttr& style);
/// Get the content (uncombined) attributes for this position. /// Get the content (uncombined) attributes for this position.
virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style); virtual bool GetUncombinedStyle(long position, wxTextAttr& style);
virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
/// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and /// Implementation helper for GetStyle. If combineStyles is true, combine base, paragraph and
/// context attributes. /// context attributes.
virtual bool DoGetStyle(long position, wxTextAttrEx& style, bool combineStyles = true); virtual bool DoGetStyle(long position, wxTextAttr& style, bool combineStyles = true);
/// Get the combined style for a range - if any attribute is different within the range, /// Get the combined style for a range - if any attribute is different within the range,
/// that attribute is not present within the flags /// that attribute is not present within the flags
virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style); virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
/// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of /// Combines 'style' with 'currentStyle' for the purpose of summarising the attributes of a range of
/// content. /// content.
bool CollectStyle(wxTextAttrEx& currentStyle, const wxTextAttrEx& style, long& multipleStyleAttributes, int& multipleTextEffectAttributes); bool CollectStyle(wxTextAttr& currentStyle, const wxTextAttr& style, long& multipleStyleAttributes, int& multipleTextEffectAttributes);
/// Set list style /// Set list style
virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool SetListStyle(const wxRichTextRange& range, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
@@ -1105,21 +730,19 @@ public:
virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1); virtual bool DoNumberList(const wxRichTextRange& range, const wxRichTextRange& promotionRange, int promoteBy, wxRichTextListStyleDefinition* def, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO, int startFrom = 1, int specifiedLevel = -1);
/// Fills in the attributes for numbering a paragraph after previousParagraph. /// Fills in the attributes for numbering a paragraph after previousParagraph.
virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxRichTextAttr& attr) const; virtual bool FindNextParagraphNumber(wxRichTextParagraph* previousParagraph, wxTextAttr& attr) const;
/// Test if this whole range has character attributes of the specified kind. If any /// Test if this whole range has character attributes of the specified kind. If any
/// of the attributes are different within the range, the test fails. You /// of the attributes are different within the range, the test fails. You
/// can use this to implement, for example, bold button updating. style must have /// can use this to implement, for example, bold button updating. style must have
/// flags indicating which attributes are of interest. /// flags indicating which attributes are of interest.
virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttr& style) const;
virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
/// Test if this whole range has paragraph attributes of the specified kind. If any /// Test if this whole range has paragraph attributes of the specified kind. If any
/// of the attributes are different within the range, the test fails. You /// of the attributes are different within the range, the test fails. You
/// can use this to implement, for example, centering button updating. style must have /// can use this to implement, for example, centering button updating. style must have
/// flags indicating which attributes are of interest. /// flags indicating which attributes are of interest.
virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const; virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttr& style) const;
virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const;
/// Clone /// Clone
virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); } virtual wxRichTextObject* Clone() const { return new wxRichTextParagraphLayoutBox(*this); }
@@ -1149,17 +772,16 @@ public:
/// Set default style for new content. Setting it to a default attribute /// Set default style for new content. Setting it to a default attribute
/// makes new content take on the 'basic' style. /// makes new content take on the 'basic' style.
virtual bool SetDefaultStyle(const wxTextAttrEx& style); virtual bool SetDefaultStyle(const wxTextAttr& style);
/// Get default style /// Get default style
virtual const wxTextAttrEx& GetDefaultStyle() const { return m_defaultAttributes; } virtual const wxTextAttr& GetDefaultStyle() const { return m_defaultAttributes; }
/// Set basic (overall) style /// Set basic (overall) style
virtual void SetBasicStyle(const wxTextAttrEx& style) { m_attributes = style; } virtual void SetBasicStyle(const wxTextAttr& style) { m_attributes = style; }
virtual void SetBasicStyle(const wxRichTextAttr& style) { m_attributes = style; }
/// Get basic (overall) style /// Get basic (overall) style
virtual const wxTextAttrEx& GetBasicStyle() const { return m_attributes; } virtual const wxTextAttr& GetBasicStyle() const { return m_attributes; }
/// Invalidate the buffer. With no argument, invalidates whole buffer. /// Invalidate the buffer. With no argument, invalidates whole buffer.
void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL); void Invalidate(const wxRichTextRange& invalidRange = wxRICHTEXT_ALL);
@@ -1169,7 +791,7 @@ public:
protected: protected:
wxRichTextCtrl* m_ctrl; wxRichTextCtrl* m_ctrl;
wxTextAttrEx m_defaultAttributes; wxTextAttr m_defaultAttributes;
/// The invalidated range that will need full layout /// The invalidated range that will need full layout
wxRichTextRange m_invalidRange; wxRichTextRange m_invalidRange;
@@ -1271,8 +893,8 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextParagraph: public wxRichTextBox
public: public:
// Constructors // Constructors
wxRichTextParagraph(wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); wxRichTextParagraph(wxRichTextObject* parent = NULL, wxTextAttr* style = NULL);
wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttrEx* paraStyle = NULL, wxTextAttrEx* charStyle = NULL); wxRichTextParagraph(const wxString& text, wxRichTextObject* parent = NULL, wxTextAttr* paraStyle = NULL, wxTextAttr* charStyle = NULL);
virtual ~wxRichTextParagraph(); virtual ~wxRichTextParagraph();
wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextBox() { Copy(obj); } wxRichTextParagraph(const wxRichTextParagraph& obj): wxRichTextBox() { Copy(obj); }
@@ -1317,7 +939,7 @@ public:
// Implementation // Implementation
/// Apply paragraph styles such as centering to the wrapped lines /// Apply paragraph styles such as centering to the wrapped lines
virtual void ApplyParagraphStyle(const wxTextAttrEx& attr, const wxRect& rect); virtual void ApplyParagraphStyle(const wxTextAttr& attr, const wxRect& rect);
/// Insert text at the given position /// Insert text at the given position
virtual bool InsertText(long pos, const wxString& text); virtual bool InsertText(long pos, const wxString& text);
@@ -1354,10 +976,10 @@ public:
/// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically /// Get combined attributes of the base style, paragraph style and character style. We use this to dynamically
/// retrieve the actual style. /// retrieve the actual style.
wxTextAttrEx GetCombinedAttributes(const wxTextAttrEx& contentStyle) const; wxTextAttr GetCombinedAttributes(const wxTextAttr& contentStyle) const;
/// Get combined attributes of the base style and paragraph style. /// Get combined attributes of the base style and paragraph style.
wxTextAttrEx GetCombinedAttributes() const; wxTextAttr GetCombinedAttributes() const;
/// Get the first position from pos that has a line break character. /// Get the first position from pos that has a line break character.
long GetFirstLineBreakPosition(long pos); long GetFirstLineBreakPosition(long pos);
@@ -1390,7 +1012,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextPlainText: public wxRichTextObject
public: public:
// Constructors // Constructors
wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxTextAttrEx* style = NULL); wxRichTextPlainText(const wxString& text = wxEmptyString, wxRichTextObject* parent = NULL, wxTextAttr* style = NULL);
wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); } wxRichTextPlainText(const wxRichTextPlainText& obj): wxRichTextObject() { Copy(obj); }
// Overrideables // Overrideables
@@ -1450,7 +1072,7 @@ public:
/// Clone /// Clone
virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); } virtual wxRichTextObject* Clone() const { return new wxRichTextPlainText(*this); }
private: private:
bool DrawTabbedString(wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected); bool DrawTabbedString(wxDC& dc, const wxTextAttr& attr, const wxRect& rect, wxString& str, wxCoord& x, wxCoord& y, bool selected);
protected: protected:
wxString m_text; wxString m_text;
@@ -1551,8 +1173,8 @@ public:
// Constructors // Constructors
wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { } wxRichTextImage(wxRichTextObject* parent = NULL): wxRichTextObject(parent) { }
wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); wxRichTextImage(const wxImage& image, wxRichTextObject* parent = NULL, wxTextAttr* charStyle = NULL);
wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttrEx* charStyle = NULL); wxRichTextImage(const wxRichTextImageBlock& imageBlock, wxRichTextObject* parent = NULL, wxTextAttr* charStyle = NULL);
wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); } wxRichTextImage(const wxRichTextImage& obj): wxRichTextObject() { Copy(obj); }
// Overrideables // Overrideables
@@ -1639,6 +1261,11 @@ public:
/// Pop style sheet from top of stack /// Pop style sheet from top of stack
wxRichTextStyleSheet* PopStyleSheet(); wxRichTextStyleSheet* PopStyleSheet();
/// Set/get table storing fonts
wxRichTextFontTable& GetFontTable() { return m_fontTable; }
const wxRichTextFontTable& GetFontTable() const { return m_fontTable; }
void SetFontTable(const wxRichTextFontTable& table) { m_fontTable = table; }
// Operations // Operations
/// Initialisation /// Initialisation
@@ -1666,7 +1293,7 @@ public:
int GetHandlerFlags() const { return m_handlerFlags; } int GetHandlerFlags() const { return m_handlerFlags; }
/// Convenience function to add a paragraph of text /// Convenience function to add a paragraph of text
virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttrEx* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); } virtual wxRichTextRange AddParagraph(const wxString& text, wxTextAttr* paraStyle = NULL) { Modify(); return wxRichTextParagraphLayoutBox::AddParagraph(text, paraStyle); }
/// Begin collapsing undo/redo commands. Note that this may not work properly /// Begin collapsing undo/redo commands. Note that this may not work properly
/// if combining commands that delete or insert content, changing ranges for /// if combining commands that delete or insert content, changing ranges for
@@ -1707,7 +1334,7 @@ public:
virtual bool CanPasteFromClipboard() const; virtual bool CanPasteFromClipboard() const;
/// Begin using a style /// Begin using a style
virtual bool BeginStyle(const wxTextAttrEx& style); virtual bool BeginStyle(const wxTextAttr& style);
/// End the style /// End the style
virtual bool EndStyle(); virtual bool EndStyle();
@@ -1874,7 +1501,7 @@ public:
/// Get the style that is appropriate for a new paragraph at this position. /// Get the style that is appropriate for a new paragraph at this position.
/// If the previous paragraph has a paragraph style name, look up the next-paragraph /// If the previous paragraph has a paragraph style name, look up the next-paragraph
/// style. /// style.
wxRichTextAttr GetStyleForNewParagraph(long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const; wxTextAttr GetStyleForNewParagraph(long pos, bool caretPosition = false, bool lookUpNewParaStyle=false) const;
/// Dumps contents of buffer for debugging purposes /// Dumps contents of buffer for debugging purposes
virtual void Dump(); virtual void Dump();
@@ -1938,6 +1565,9 @@ protected:
/// Command processor /// Command processor
wxCommandProcessor* m_commandProcessor; wxCommandProcessor* m_commandProcessor;
/// Table storing fonts
wxRichTextFontTable m_fontTable;
/// Has been modified? /// Has been modified?
bool m_modified; bool m_modified;
@@ -2265,13 +1895,13 @@ public:
virtual ~wxRichTextRenderer() {} virtual ~wxRichTextRenderer() {}
/// Draw a standard bullet, as specified by the value of GetBulletName /// Draw a standard bullet, as specified by the value of GetBulletName
virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect) = 0;
/// Draw a bullet that can be described by text, such as numbered or symbol bullets /// Draw a bullet that can be described by text, such as numbered or symbol bullets
virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text) = 0; virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect, const wxString& text) = 0;
/// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect) = 0; virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect) = 0;
/// Enumerate the standard bullet names currently supported /// Enumerate the standard bullet names currently supported
virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0; virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames) = 0;
@@ -2287,13 +1917,13 @@ public:
wxRichTextStdRenderer() {} wxRichTextStdRenderer() {}
/// Draw a standard bullet, as specified by the value of GetBulletName /// Draw a standard bullet, as specified by the value of GetBulletName
virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); virtual bool DrawStandardBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect);
/// Draw a bullet that can be described by text, such as numbered or symbol bullets /// Draw a bullet that can be described by text, such as numbered or symbol bullets
virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect, const wxString& text); virtual bool DrawTextBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect, const wxString& text);
/// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName /// Draw a bitmap bullet, where the bullet bitmap is specified by the value of GetBulletName
virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttrEx& attr, const wxRect& rect); virtual bool DrawBitmapBullet(wxRichTextParagraph* paragraph, wxDC& dc, const wxTextAttr& attr, const wxRect& rect);
/// Enumerate the standard bullet names currently supported /// Enumerate the standard bullet names currently supported
virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames); virtual bool EnumerateStandardBulletNames(wxArrayString& bulletNames);
@@ -2310,22 +1940,18 @@ inline bool wxRichTextHasStyle(int flags, int style)
} }
/// Compare two attribute objects /// Compare two attribute objects
WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2); WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttr& attr1, const wxTextAttr& attr2);
WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttr& attr1, const wxRichTextAttr& attr2); WXDLLIMPEXP_RICHTEXT bool wxTextAttrEq(const wxTextAttr& attr1, const wxTextAttr& attr2);
/// Compare two attribute objects, but take into account the flags /// Compare two attribute objects, but take into account the flags
/// specifying attributes of interest. /// specifying attributes of interest.
WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxTextAttrEx& attr2, int flags); WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttr& attr1, const wxTextAttr& attr2, int flags);
WXDLLIMPEXP_RICHTEXT bool wxTextAttrEqPartial(const wxTextAttrEx& attr1, const wxRichTextAttr& attr2, int flags);
/// Apply one style to another /// Apply one style to another
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxTextAttrEx& style); WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttr& destStyle, const wxTextAttr& style, wxTextAttr* compareWith = NULL);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxTextAttrEx& style);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);
WXDLLIMPEXP_RICHTEXT bool wxRichTextApplyStyle(wxRichTextAttr& destStyle, const wxRichTextAttr& style, wxRichTextAttr* compareWith = NULL);
// Remove attributes // Remove attributes
WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxTextAttrEx& destStyle, const wxRichTextAttr& style); WXDLLIMPEXP_RICHTEXT bool wxRichTextRemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style);
/// Combine two bitlists /// Combine two bitlists
WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB); WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
@@ -2334,14 +1960,11 @@ WXDLLIMPEXP_RICHTEXT bool wxRichTextCombineBitlists(int& valueA, int valueB, int
WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags); WXDLLIMPEXP_RICHTEXT bool wxRichTextBitlistsEqPartial(int valueA, int valueB, int flags);
/// Split into paragraph and character styles /// Split into paragraph and character styles
WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxTextAttrEx& style, wxTextAttrEx& parStyle, wxTextAttrEx& charStyle); WXDLLIMPEXP_RICHTEXT bool wxRichTextSplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle);
/// Compare tabs /// Compare tabs
WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2); WXDLLIMPEXP_RICHTEXT bool wxRichTextTabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
/// Set the font without changing the font attributes
WXDLLIMPEXP_RICHTEXT void wxSetFontPreservingStyles(wxTextAttr& attr, const wxFont& font);
/// Convert a decimal to Roman numerals /// Convert a decimal to Roman numerals
WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n); WXDLLIMPEXP_RICHTEXT wxString wxRichTextDecimalToRoman(long n);

View File

@@ -73,7 +73,7 @@ public:
virtual bool TransferDataToWindow(); virtual bool TransferDataToWindow();
/// Gets the attributes associated with the main formatting dialog /// Gets the attributes associated with the main formatting dialog
wxTextAttrEx* GetAttributes(); wxTextAttr* GetAttributes();
/// Update for symbol-related controls /// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event ); void OnSymbolUpdate( wxUpdateUIEvent& event );

View File

@@ -179,33 +179,23 @@ public:
// methods allow to apply the given text style to the given selection or to // methods allow to apply the given text style to the given selection or to
// set/get the style which will be used for all appended text // set/get the style which will be used for all appended text
virtual bool SetStyle(long start, long end, const wxTextAttr& style); virtual bool SetStyle(long start, long end, const wxTextAttr& style);
virtual bool SetStyle(long start, long end, const wxTextAttrEx& style); virtual bool SetStyle(const wxRichTextRange& range, const wxTextAttr& style);
virtual bool SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style);
virtual bool GetStyle(long position, wxTextAttr& style); virtual bool GetStyle(long position, wxTextAttr& style);
virtual bool GetStyle(long position, wxTextAttrEx& style);
virtual bool GetStyle(long position, wxRichTextAttr& style);
// get the common set of styles for the range // get the common set of styles for the range
virtual bool GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style); virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style);
virtual bool GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style);
// extended style setting operation with flags including: // extended style setting operation with flags including:
// wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY, wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY
// see richtextbuffer.h for more details. // see richtextbuffer.h for more details.
virtual bool SetStyleEx(long start, long end, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO); virtual bool SetStyleEx(const wxRichTextRange& range, const wxTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
virtual bool SetStyleEx(const wxRichTextRange& range, const wxTextAttrEx& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
virtual bool SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
/// Get the content (uncombined) attributes for this position. /// Get the content (uncombined) attributes for this position.
virtual bool GetUncombinedStyle(long position, wxTextAttr& style); virtual bool GetUncombinedStyle(long position, wxTextAttr& style);
virtual bool GetUncombinedStyle(long position, wxTextAttrEx& style);
virtual bool GetUncombinedStyle(long position, wxRichTextAttr& style);
virtual bool SetDefaultStyle(const wxTextAttrEx& style);
virtual bool SetDefaultStyle(const wxTextAttr& style); virtual bool SetDefaultStyle(const wxTextAttr& style);
// TODO: change to GetDefaultStyle if we merge wxTextAttr and wxTextAttrEx virtual const wxTextAttr& GetDefaultStyleEx() const { return GetDefaultStyle(); }
virtual const wxTextAttrEx& GetDefaultStyleEx() const;
virtual const wxTextAttr& GetDefaultStyle() const; virtual const wxTextAttr& GetDefaultStyle() const;
/// Set list style /// Set list style
@@ -307,14 +297,12 @@ public:
virtual bool LineBreak(); virtual bool LineBreak();
/// Set basic (overall) style /// Set basic (overall) style
virtual void SetBasicStyle(const wxTextAttrEx& style) { GetBuffer().SetBasicStyle(style); } virtual void SetBasicStyle(const wxTextAttr& style) { GetBuffer().SetBasicStyle(style); }
virtual void SetBasicStyle(const wxRichTextAttr& style) { GetBuffer().SetBasicStyle(style); }
/// Get basic (overall) style /// Get basic (overall) style
virtual const wxTextAttrEx& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); } virtual const wxTextAttr& GetBasicStyle() const { return GetBuffer().GetBasicStyle(); }
/// Begin using a style virtual bool BeginStyle(const wxTextAttr& style) { return GetBuffer().BeginStyle(style); }
virtual bool BeginStyle(const wxTextAttrEx& style) { return GetBuffer().BeginStyle(style); }
/// End the style /// End the style
virtual bool EndStyle() { return GetBuffer().EndStyle(); } virtual bool EndStyle() { return GetBuffer().EndStyle(); }
@@ -535,11 +523,7 @@ public:
/// of the attributes are different within the range, the test fails. You /// of the attributes are different within the range, the test fails. You
/// can use this to implement, for example, bold button updating. style must have /// can use this to implement, for example, bold button updating. style must have
/// flags indicating which attributes are of interest. /// flags indicating which attributes are of interest.
virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxTextAttr& style) const
{
return GetBuffer().HasCharacterAttributes(range.ToInternal(), style);
}
virtual bool HasCharacterAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
{ {
return GetBuffer().HasCharacterAttributes(range.ToInternal(), style); return GetBuffer().HasCharacterAttributes(range.ToInternal(), style);
} }
@@ -548,11 +532,7 @@ public:
/// of the attributes are different within the range, the test fails. You /// of the attributes are different within the range, the test fails. You
/// can use this to implement, for example, centering button updating. style must have /// can use this to implement, for example, centering button updating. style must have
/// flags indicating which attributes are of interest. /// flags indicating which attributes are of interest.
virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttrEx& style) const virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxTextAttr& style) const
{
return GetBuffer().HasParagraphAttributes(range.ToInternal(), style);
}
virtual bool HasParagraphAttributes(const wxRichTextRange& range, const wxRichTextAttr& style) const
{ {
return GetBuffer().HasParagraphAttributes(range.ToInternal(), style); return GetBuffer().HasParagraphAttributes(range.ToInternal(), style);
} }
@@ -767,7 +747,7 @@ public:
/// Convenience function that tells the control to start reflecting the default /// Convenience function that tells the control to start reflecting the default
/// style, since the user is changing it. /// style, since the user is changing it.
void SetAndShowDefaultStyle(const wxRichTextAttr& attr) void SetAndShowDefaultStyle(const wxTextAttr& attr)
{ {
SetDefaultStyle(attr); SetDefaultStyle(attr);
SetCaretPositionForDefaultStyle(GetCaretPosition()); SetCaretPositionForDefaultStyle(GetCaretPosition());

View File

@@ -75,7 +75,7 @@ public:
void OnColourClicked( wxCommandEvent& event ); void OnColourClicked( wxCommandEvent& event );
/// Gets the attributes associated with the main formatting dialog /// Gets the attributes associated with the main formatting dialog
wxTextAttrEx* GetAttributes(); wxTextAttr* GetAttributes();
////@begin wxRichTextFontPage event handler declarations ////@begin wxRichTextFontPage event handler declarations

View File

@@ -138,7 +138,7 @@ public:
virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range); virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range);
/// Set the attributes and optionally update the display /// Set the attributes and optionally update the display
virtual bool SetStyle(const wxTextAttrEx& style, bool update = true); virtual bool SetStyle(const wxTextAttr& style, bool update = true);
/// Set the style definition and optionally update the display /// Set the style definition and optionally update the display
virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true); virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef, wxRichTextStyleSheet* sheet, bool update = true);
@@ -156,9 +156,9 @@ public:
virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE); virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE);
/// Gets and sets the attributes /// Gets and sets the attributes
const wxTextAttrEx& GetAttributes() const { return m_attributes; } const wxTextAttr& GetAttributes() const { return m_attributes; }
wxTextAttrEx& GetAttributes() { return m_attributes; } wxTextAttr& GetAttributes() { return m_attributes; }
void SetAttributes(const wxTextAttrEx& attr) { m_attributes = attr; } void SetAttributes(const wxTextAttr& attr) { m_attributes = attr; }
/// Transfers the data and from to the window /// Transfers the data and from to the window
virtual bool TransferDataToWindow(); virtual bool TransferDataToWindow();
@@ -183,7 +183,7 @@ public:
static wxRichTextFormattingDialog* GetDialog(wxWindow* win); static wxRichTextFormattingDialog* GetDialog(wxWindow* win);
/// Helper for pages to get the attributes /// Helper for pages to get the attributes
static wxTextAttrEx* GetDialogAttributes(wxWindow* win); static wxTextAttr* GetDialogAttributes(wxWindow* win);
/// Helper for pages to get the style /// Helper for pages to get the style
static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win); static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
@@ -200,7 +200,7 @@ public:
protected: protected:
wxImageList* m_imageList; wxImageList* m_imageList;
wxTextAttrEx m_attributes; wxTextAttr m_attributes;
wxRichTextStyleDefinition* m_styleDefinition; wxRichTextStyleDefinition* m_styleDefinition;
wxRichTextStyleSheet* m_styleSheet; wxRichTextStyleSheet* m_styleSheet;
wxArrayInt m_pageIds; // mapping of book control indexes to page ids wxArrayInt m_pageIds; // mapping of book control indexes to page ids

View File

@@ -77,15 +77,15 @@ protected:
virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream); virtual bool DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream& stream);
/// Output character formatting /// Output character formatting
void BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); void BeginCharacterFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, const wxTextAttr& paraStyle, wxTextOutputStream& stream );
void EndCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& paraStyle, wxTextOutputStream& stream ); void EndCharacterFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, const wxTextAttr& paraStyle, wxTextOutputStream& stream );
/// Output paragraph formatting /// Output paragraph formatting
void BeginParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); void BeginParagraphFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, wxTextOutputStream& stream);
void EndParagraphFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, wxTextOutputStream& stream); void EndParagraphFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, wxTextOutputStream& stream);
/// Output font tag /// Output font tag
void OutputFont(const wxTextAttrEx& style, wxTextOutputStream& stream); void OutputFont(const wxTextAttr& style, wxTextOutputStream& stream);
/// Closes lists to level (-1 means close all) /// Closes lists to level (-1 means close all)
void CloseLists(int level, wxTextOutputStream& str); void CloseLists(int level, wxTextOutputStream& str);
@@ -103,13 +103,13 @@ protected:
const wxChar* GetMimeType(int imageType); const wxChar* GetMimeType(int imageType);
/// Gets the html equivalent of the specified value /// Gets the html equivalent of the specified value
wxString GetAlignment(const wxTextAttrEx& thisStyle); wxString GetAlignment(const wxTextAttr& thisStyle);
/// Generates &nbsp; array for indentations /// Generates &nbsp; array for indentations
wxString SymbolicIndent(long indent); wxString SymbolicIndent(long indent);
/// Finds the html equivalent of the specified bullet /// Finds the html equivalent of the specified bullet
int TypeOfList(const wxTextAttrEx& thisStyle, wxString& tag); int TypeOfList(const wxTextAttr& thisStyle, wxString& tag);
#endif #endif
// Data members // Data members

View File

@@ -71,7 +71,7 @@ public:
void UpdatePreview(); void UpdatePreview();
/// Gets the attributes associated with the main formatting dialog /// Gets the attributes associated with the main formatting dialog
wxTextAttrEx* GetAttributes(); wxTextAttr* GetAttributes();
////@begin wxRichTextIndentsSpacingPage event handler declarations ////@begin wxRichTextIndentsSpacingPage event handler declarations

View File

@@ -65,7 +65,7 @@ public:
virtual bool TransferDataToWindow(); virtual bool TransferDataToWindow();
/// Get attributes for selected level /// Get attributes for selected level
wxRichTextAttr* GetAttributesForSelection(); wxTextAttr* GetAttributesForSelection();
/// Update for symbol-related controls /// Update for symbol-related controls
void OnSymbolUpdate( wxUpdateUIEvent& event ); void OnSymbolUpdate( wxUpdateUIEvent& event );

View File

@@ -52,7 +52,7 @@ public:
virtual bool TransferDataToWindow(); virtual bool TransferDataToWindow();
/// Gets the attributes associated with the main formatting dialog /// Gets the attributes associated with the main formatting dialog
wxTextAttrEx* GetAttributes(); wxTextAttr* GetAttributes();
////@begin wxRichTextStylePage event handler declarations ////@begin wxRichTextStylePage event handler declarations

View File

@@ -94,18 +94,18 @@ public:
const wxString& GetBaseStyle() const { return m_baseStyle; } const wxString& GetBaseStyle() const { return m_baseStyle; }
/// Sets and gets the style /// Sets and gets the style
void SetStyle(const wxRichTextAttr& style) { m_style = style; } void SetStyle(const wxTextAttr& style) { m_style = style; }
const wxRichTextAttr& GetStyle() const { return m_style; } const wxTextAttr& GetStyle() const { return m_style; }
wxRichTextAttr& GetStyle() { return m_style; } wxTextAttr& GetStyle() { return m_style; }
/// Gets the style combined with the base style /// Gets the style combined with the base style
virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const; virtual wxTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
protected: protected:
wxString m_name; wxString m_name;
wxString m_baseStyle; wxString m_baseStyle;
wxString m_description; wxString m_description;
wxRichTextAttr m_style; wxTextAttr m_style;
}; };
/*! /*!
@@ -206,9 +206,9 @@ public:
virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); } virtual wxRichTextStyleDefinition* Clone() const { return new wxRichTextListStyleDefinition(*this); }
/// Sets/gets the attributes for the given level /// Sets/gets the attributes for the given level
void SetLevelAttributes(int i, const wxRichTextAttr& attr); void SetLevelAttributes(int i, const wxTextAttr& attr);
wxRichTextAttr* GetLevelAttributes(int i); wxTextAttr* GetLevelAttributes(int i);
const wxRichTextAttr* GetLevelAttributes(int i) const; const wxTextAttr* GetLevelAttributes(int i) const;
/// Convenience function for setting the major attributes for a list level specification /// Convenience function for setting the major attributes for a list level specification
void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString); void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
@@ -218,15 +218,15 @@ public:
/// Combine the base and list style with a paragraph style, using the given indent (from which /// Combine the base and list style with a paragraph style, using the given indent (from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL); wxTextAttr CombineWithParagraphStyle(int indent, const wxTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet = NULL);
/// Combine the base and list style, using the given indent (from which /// Combine the base and list style, using the given indent (from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL); wxTextAttr GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet = NULL);
/// Combine the base and list style, using the given level from which /// Combine the base and list style, using the given level from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL); wxTextAttr GetCombinedStyleForLevel(int level, wxRichTextStyleSheet* styleSheet = NULL);
/// Gets the number of available levels /// Gets the number of available levels
int GetLevelCount() const { return 10; } int GetLevelCount() const { return 10; }
@@ -237,7 +237,7 @@ public:
protected: protected:
/// The styles for each level (up to 10) /// The styles for each level (up to 10)
wxRichTextAttr m_levelStyles[10]; wxTextAttr m_levelStyles[10];
}; };
/*! /*!

View File

@@ -69,7 +69,7 @@ public:
virtual void SortTabs(); virtual void SortTabs();
/// Gets the attributes associated with the main formatting dialog /// Gets the attributes associated with the main formatting dialog
wxTextAttrEx* GetAttributes(); wxTextAttr* GetAttributes();
////@begin wxRichTextTabsPage event handler declarations ////@begin wxRichTextTabsPage event handler declarations

View File

@@ -45,10 +45,10 @@ public:
bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node); bool ImportStyleDefinition(wxRichTextStyleSheet* sheet, wxXmlNode* node);
/// Create style parameters /// Create style parameters
wxString CreateStyle(const wxTextAttrEx& attr, bool isPara = false); wxString CreateStyle(const wxTextAttr& attr, bool isPara = false);
/// Get style parameters /// Get style parameters
bool GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara = false); bool GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPara = false);
#endif #endif
/// Can we save using this handler? /// Can we save using this handler?

View File

@@ -160,20 +160,95 @@ enum wxTextAttrAlignment
// Flags to indicate which attributes are being applied // Flags to indicate which attributes are being applied
#define wxTEXT_ATTR_TEXT_COLOUR 0x0001 #define wxTEXT_ATTR_TEXT_COLOUR 0x00000001
#define wxTEXT_ATTR_BACKGROUND_COLOUR 0x0002 #define wxTEXT_ATTR_BACKGROUND_COLOUR 0x00000002
#define wxTEXT_ATTR_FONT_FACE 0x0004 #define wxTEXT_ATTR_FONT_FACE 0x00000004
#define wxTEXT_ATTR_FONT_SIZE 0x0008 #define wxTEXT_ATTR_FONT_SIZE 0x00000008
#define wxTEXT_ATTR_FONT_WEIGHT 0x0010 #define wxTEXT_ATTR_FONT_WEIGHT 0x00000010
#define wxTEXT_ATTR_FONT_ITALIC 0x0020 #define wxTEXT_ATTR_FONT_ITALIC 0x00000020
#define wxTEXT_ATTR_FONT_UNDERLINE 0x0040 #define wxTEXT_ATTR_FONT_UNDERLINE 0x00000040
#define wxTEXT_ATTR_FONT_ENCODING 0x02000000
#define wxTEXT_ATTR_FONT \ #define wxTEXT_ATTR_FONT \
( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \ ( wxTEXT_ATTR_FONT_FACE | wxTEXT_ATTR_FONT_SIZE | wxTEXT_ATTR_FONT_WEIGHT | \
wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE ) wxTEXT_ATTR_FONT_ITALIC | wxTEXT_ATTR_FONT_UNDERLINE | wxTEXT_ATTR_FONT_ENCODING )
#define wxTEXT_ATTR_ALIGNMENT 0x0080 #define wxTEXT_ATTR_ALIGNMENT 0x00000080
#define wxTEXT_ATTR_LEFT_INDENT 0x0100 #define wxTEXT_ATTR_LEFT_INDENT 0x00000100
#define wxTEXT_ATTR_RIGHT_INDENT 0x0200 #define wxTEXT_ATTR_RIGHT_INDENT 0x00000200
#define wxTEXT_ATTR_TABS 0x0400 #define wxTEXT_ATTR_TABS 0x00000400
#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_LIST_STYLE_NAME 0x00010000
#define wxTEXT_ATTR_BULLET_STYLE 0x00020000
#define wxTEXT_ATTR_BULLET_NUMBER 0x00040000
#define wxTEXT_ATTR_BULLET_TEXT 0x00080000
#define wxTEXT_ATTR_BULLET_NAME 0x00100000
#define wxTEXT_ATTR_URL 0x00200000
#define wxTEXT_ATTR_PAGE_BREAK 0x00400000
#define wxTEXT_ATTR_EFFECTS 0x00800000
#define wxTEXT_ATTR_OUTLINE_LEVEL 0x01000000
/*!
* Character and paragraph combined styles
*/
#define wxTEXT_ATTR_CHARACTER (wxTEXT_ATTR_FONT|wxTEXT_ATTR_FONT_ENCODING|wxTEXT_ATTR_EFFECTS|wxTEXT_ATTR_BACKGROUND_COLOUR|wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_CHARACTER_STYLE_NAME|wxTEXT_ATTR_URL)
#define wxTEXT_ATTR_PARAGRAPH (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_TABS|\
wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|wxTEXT_ATTR_LINE_SPACING|\
wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|\
wxTEXT_ATTR_PARAGRAPH_STYLE_NAME|wxTEXT_ATTR_LIST_STYLE_NAME|wxTEXT_ATTR_OUTLINE_LEVEL)
#define wxTEXT_ATTR_ALL (wxTEXT_ATTR_CHARACTER|wxTEXT_ATTR_PARAGRAPH)
/*!
* Styles for wxTextAttr::SetBulletStyle
*/
#define wxTEXT_ATTR_BULLET_STYLE_NONE 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ARABIC 0x00000001
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_UPPER 0x00000002
#define wxTEXT_ATTR_BULLET_STYLE_LETTERS_LOWER 0x00000004
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_UPPER 0x00000008
#define wxTEXT_ATTR_BULLET_STYLE_ROMAN_LOWER 0x00000010
#define wxTEXT_ATTR_BULLET_STYLE_SYMBOL 0x00000020
#define wxTEXT_ATTR_BULLET_STYLE_BITMAP 0x00000040
#define wxTEXT_ATTR_BULLET_STYLE_PARENTHESES 0x00000080
#define wxTEXT_ATTR_BULLET_STYLE_PERIOD 0x00000100
#define wxTEXT_ATTR_BULLET_STYLE_STANDARD 0x00000200
#define wxTEXT_ATTR_BULLET_STYLE_RIGHT_PARENTHESIS 0x00000400
#define wxTEXT_ATTR_BULLET_STYLE_OUTLINE 0x00000800
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_LEFT 0x00000000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_RIGHT 0x00001000
#define wxTEXT_ATTR_BULLET_STYLE_ALIGN_CENTRE 0x00002000
/*!
* Styles for wxTextAttr::SetTextEffects
*/
#define wxTEXT_ATTR_EFFECT_NONE 0x00000000
#define wxTEXT_ATTR_EFFECT_CAPITALS 0x00000001
#define wxTEXT_ATTR_EFFECT_SMALL_CAPITALS 0x00000002
#define wxTEXT_ATTR_EFFECT_STRIKETHROUGH 0x00000004
#define wxTEXT_ATTR_EFFECT_DOUBLE_STRIKETHROUGH 0x00000008
#define wxTEXT_ATTR_EFFECT_SHADOW 0x00000010
#define wxTEXT_ATTR_EFFECT_EMBOSS 0x00000020
#define wxTEXT_ATTR_EFFECT_OUTLINE 0x00000040
#define wxTEXT_ATTR_EFFECT_ENGRAVE 0x00000080
#define wxTEXT_ATTR_EFFECT_SUPERSCRIPT 0x00000100
#define wxTEXT_ATTR_EFFECT_SUBSCRIPT 0x00000200
/*!
* Line spacing values
*/
#define wxTEXT_ATTR_LINE_SPACING_NORMAL 10
#define wxTEXT_ATTR_LINE_SPACING_HALF 15
#define wxTEXT_ATTR_LINE_SPACING_TWICE 20
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTextAttr: a structure containing the visual attributes of a text // wxTextAttr: a structure containing the visual attributes of a text
@@ -184,14 +259,152 @@ class WXDLLEXPORT wxTextAttr
public: public:
// ctors // ctors
wxTextAttr() { Init(); } wxTextAttr() { Init(); }
wxTextAttr(const wxTextAttr& attr) { Init(); Copy(attr); }
wxTextAttr(const wxColour& colText, wxTextAttr(const wxColour& colText,
const wxColour& colBack = wxNullColour, const wxColour& colBack = wxNullColour,
const wxFont& font = wxNullFont, const wxFont& font = wxNullFont,
wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT); wxTextAttrAlignment alignment = wxTEXT_ALIGNMENT_DEFAULT);
// operations // Initialise this object.
void Init(); void Init();
// Copy
void Copy(const wxTextAttr& attr);
// Assignment
void operator= (const wxTextAttr& attr);
// Equality test
bool operator== (const wxTextAttr& attr) const;
// Partial equality test taking flags into account
bool EqPartial(const wxTextAttr& attr, int flags) const;
// Create font from font attributes.
wxFont CreateFont() const;
// Get attributes from font.
bool GetFontAttributes(const wxFont& font, int flags = wxTEXT_ATTR_FONT);
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
void SetFontSize(int pointSize) { m_fontSize = pointSize; m_flags |= wxTEXT_ATTR_FONT_SIZE; }
void SetFontStyle(int fontStyle) { m_fontStyle = fontStyle; m_flags |= wxTEXT_ATTR_FONT_ITALIC; }
void SetFontWeight(int fontWeight) { m_fontWeight = fontWeight; m_flags |= wxTEXT_ATTR_FONT_WEIGHT; }
void SetFontFaceName(const wxString& faceName) { m_fontFaceName = faceName; m_flags |= wxTEXT_ATTR_FONT_FACE; }
void SetFontUnderlined(bool underlined) { m_fontUnderlined = underlined; m_flags |= wxTEXT_ATTR_FONT_UNDERLINE; }
void SetFontEncoding(wxFontEncoding encoding) { m_fontEncoding = encoding; m_flags |= wxTEXT_ATTR_FONT_ENCODING; }
// Set font
void SetFont(const wxFont& font, int flags = wxTEXT_ATTR_FONT) { GetFontAttributes(font, flags); }
void SetFlags(long flags) { m_flags = flags; }
void SetCharacterStyleName(const wxString& name) { m_characterStyleName = name; m_flags |= wxTEXT_ATTR_CHARACTER_STYLE_NAME; }
void SetParagraphStyleName(const wxString& name) { m_paragraphStyleName = name; m_flags |= wxTEXT_ATTR_PARAGRAPH_STYLE_NAME; }
void SetListStyleName(const wxString& name) { m_listStyleName = name; SetFlags(GetFlags() | wxTEXT_ATTR_LIST_STYLE_NAME); }
void SetParagraphSpacingAfter(int spacing) { m_paragraphSpacingAfter = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_AFTER; }
void SetParagraphSpacingBefore(int spacing) { m_paragraphSpacingBefore = spacing; m_flags |= wxTEXT_ATTR_PARA_SPACING_BEFORE; }
void SetLineSpacing(int spacing) { m_lineSpacing = spacing; m_flags |= wxTEXT_ATTR_LINE_SPACING; }
void SetBulletStyle(int style) { m_bulletStyle = style; m_flags |= wxTEXT_ATTR_BULLET_STYLE; }
void SetBulletNumber(int n) { m_bulletNumber = n; m_flags |= wxTEXT_ATTR_BULLET_NUMBER; }
void SetBulletText(const wxString& text) { m_bulletText = text; m_flags |= wxTEXT_ATTR_BULLET_TEXT; }
void SetBulletFont(const wxString& bulletFont) { m_bulletFont = bulletFont; }
void SetBulletName(const wxString& name) { m_bulletName = name; m_flags |= wxTEXT_ATTR_BULLET_NAME; }
void SetURL(const wxString& url) { m_urlTarget = url; m_flags |= wxTEXT_ATTR_URL; }
void SetPageBreak(bool pageBreak = true) { SetFlags(pageBreak ? (GetFlags() | wxTEXT_ATTR_PAGE_BREAK) : (GetFlags() & ~wxTEXT_ATTR_PAGE_BREAK)); }
void SetTextEffects(int effects) { m_textEffects = effects; SetFlags(GetFlags() | wxTEXT_ATTR_EFFECTS); }
void SetTextEffectFlags(int effects) { m_textEffectFlags = effects; }
void SetOutlineLevel(int level) { m_outlineLevel = level; SetFlags(GetFlags() | wxTEXT_ATTR_OUTLINE_LEVEL); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
const wxArrayInt& GetTabs() const { return m_tabs; }
long GetLeftIndent() const { return m_leftIndent; }
long GetLeftSubIndent() const { return m_leftSubIndent; }
long GetRightIndent() const { return m_rightIndent; }
long GetFlags() const { return m_flags; }
int GetFontSize() const { return m_fontSize; }
int GetFontStyle() const { return m_fontStyle; }
int GetFontWeight() const { return m_fontWeight; }
bool GetFontUnderlined() const { return m_fontUnderlined; }
const wxString& GetFontFaceName() const { return m_fontFaceName; }
wxFontEncoding GetFontEncoding() const { return m_fontEncoding; }
wxFont GetFont() const { return CreateFont(); }
const wxString& GetCharacterStyleName() const { return m_characterStyleName; }
const wxString& GetParagraphStyleName() const { return m_paragraphStyleName; }
const wxString& GetListStyleName() const { return m_listStyleName; }
int GetParagraphSpacingAfter() const { return m_paragraphSpacingAfter; }
int GetParagraphSpacingBefore() const { return m_paragraphSpacingBefore; }
int GetLineSpacing() const { return m_lineSpacing; }
int GetBulletStyle() const { return m_bulletStyle; }
int GetBulletNumber() const { return m_bulletNumber; }
const wxString& GetBulletText() const { return m_bulletText; }
const wxString& GetBulletFont() const { return m_bulletFont; }
const wxString& GetBulletName() const { return m_bulletName; }
const wxString& GetURL() const { return m_urlTarget; }
int GetTextEffects() const { return m_textEffects; }
int GetTextEffectFlags() const { return m_textEffectFlags; }
int GetOutlineLevel() const { return m_outlineLevel; }
// accessors
bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) || HasFlag(wxTEXT_ATTR_ALIGNMENT) ; }
bool HasTabs() const { return HasFlag(wxTEXT_ATTR_TABS) ; }
bool HasLeftIndent() const { return HasFlag(wxTEXT_ATTR_LEFT_INDENT); }
bool HasRightIndent() const { return HasFlag(wxTEXT_ATTR_RIGHT_INDENT); }
bool HasFontWeight() const { return HasFlag(wxTEXT_ATTR_FONT_WEIGHT); }
bool HasFontSize() const { return HasFlag(wxTEXT_ATTR_FONT_SIZE); }
bool HasFontItalic() const { return HasFlag(wxTEXT_ATTR_FONT_ITALIC); }
bool HasFontUnderlined() const { return HasFlag(wxTEXT_ATTR_FONT_UNDERLINE); }
bool HasFontFaceName() const { return HasFlag(wxTEXT_ATTR_FONT_FACE); }
bool HasFontEncoding() const { return HasFlag(wxTEXT_ATTR_FONT_ENCODING); }
bool HasFont() const { return HasFlag(wxTEXT_ATTR_FONT); }
bool HasParagraphSpacingAfter() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_AFTER); }
bool HasParagraphSpacingBefore() const { return HasFlag(wxTEXT_ATTR_PARA_SPACING_BEFORE); }
bool HasLineSpacing() const { return HasFlag(wxTEXT_ATTR_LINE_SPACING); }
bool HasCharacterStyleName() const { return HasFlag(wxTEXT_ATTR_CHARACTER_STYLE_NAME) && !m_characterStyleName.IsEmpty(); }
bool HasParagraphStyleName() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) && !m_paragraphStyleName.IsEmpty(); }
bool HasListStyleName() const { return HasFlag(wxTEXT_ATTR_LIST_STYLE_NAME) || !m_listStyleName.IsEmpty(); }
bool HasBulletStyle() const { return HasFlag(wxTEXT_ATTR_BULLET_STYLE); }
bool HasBulletNumber() const { return HasFlag(wxTEXT_ATTR_BULLET_NUMBER); }
bool HasBulletText() const { return HasFlag(wxTEXT_ATTR_BULLET_TEXT); }
bool HasBulletName() const { return HasFlag(wxTEXT_ATTR_BULLET_NAME); }
bool HasURL() const { return HasFlag(wxTEXT_ATTR_URL); }
bool HasPageBreak() const { return HasFlag(wxTEXT_ATTR_PAGE_BREAK); }
bool HasTextEffects() const { return HasFlag(wxTEXT_ATTR_EFFECTS); }
bool HasTextEffect(int effect) const { return HasFlag(wxTEXT_ATTR_EFFECTS) && ((GetTextEffectFlags() & effect) != 0); }
bool HasOutlineLevel() const { return HasFlag(wxTEXT_ATTR_OUTLINE_LEVEL); }
bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
// Is this a character style?
bool IsCharacterStyle() const { return HasFlag(wxTEXT_ATTR_CHARACTER); }
bool IsParagraphStyle() const { return HasFlag(wxTEXT_ATTR_PARAGRAPH); }
// returns false if we have any attributes set, true otherwise
bool IsDefault() const
{
return GetFlags() == 0;
}
// Merges the given attributes. Does not affect 'this'. If compareWith
// is non-NULL, then it will be used to mask out those attributes that are the same in style
// and compareWith, for situations where we don't want to explicitly set inherited attributes.
bool Apply(const wxTextAttr& style, const wxTextAttr* compareWith = NULL);
// merges the attributes of the base and the overlay objects and returns // merges the attributes of the base and the overlay objects and returns
// the result; the parameter attributes take precedence // the result; the parameter attributes take precedence
// //
@@ -207,47 +420,6 @@ public:
*this = Merge(*this, overlay); *this = Merge(*this, overlay);
} }
// operators
void operator= (const wxTextAttr& attr);
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; m_flags |= wxTEXT_ATTR_TEXT_COLOUR; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; }
void SetFont(const wxFont& font, long flags = wxTEXT_ATTR_FONT) { m_font = font; m_flags |= flags; }
void SetAlignment(wxTextAttrAlignment alignment) { m_textAlignment = alignment; m_flags |= wxTEXT_ATTR_ALIGNMENT; }
void SetTabs(const wxArrayInt& tabs) { m_tabs = tabs; m_flags |= wxTEXT_ATTR_TABS; }
void SetLeftIndent(int indent, int subIndent = 0) { m_leftIndent = indent; m_leftSubIndent = subIndent; m_flags |= wxTEXT_ATTR_LEFT_INDENT; }
void SetRightIndent(int indent) { m_rightIndent = indent; m_flags |= wxTEXT_ATTR_RIGHT_INDENT; }
void SetFlags(long flags) { m_flags = flags; }
// accessors
bool HasTextColour() const { return m_colText.Ok() && HasFlag(wxTEXT_ATTR_TEXT_COLOUR) ; }
bool HasBackgroundColour() const { return m_colBack.Ok() && HasFlag(wxTEXT_ATTR_BACKGROUND_COLOUR) ; }
bool HasFont() const { return m_font.Ok() && HasFlag(wxTEXT_ATTR_FONT) ; }
bool HasAlignment() const { return (m_textAlignment != wxTEXT_ALIGNMENT_DEFAULT) || ((m_flags & wxTEXT_ATTR_ALIGNMENT) != 0) ; }
bool HasTabs() const { return (m_flags & wxTEXT_ATTR_TABS) != 0 ; }
bool HasLeftIndent() const { return (m_flags & wxTEXT_ATTR_LEFT_INDENT) != 0 ; }
bool HasRightIndent() const { return (m_flags & wxTEXT_ATTR_RIGHT_INDENT) != 0 ; }
bool HasFlag(long flag) const { return (m_flags & flag) != 0; }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }
wxTextAttrAlignment GetAlignment() const { return m_textAlignment; }
const wxArrayInt& GetTabs() const { return m_tabs; }
long GetLeftIndent() const { return m_leftIndent; }
long GetLeftSubIndent() const { return m_leftSubIndent; }
long GetRightIndent() const { return m_rightIndent; }
long GetFlags() const { return m_flags; }
// returns false if we have any attributes set, true otherwise
bool IsDefault() const
{
return !HasTextColour() && !HasBackgroundColour() && !HasFont() && !HasAlignment() &&
!HasTabs() && !HasLeftIndent() && !HasRightIndent() ;
}
// return the attribute having the valid font and colours: it uses the // return the attribute having the valid font and colours: it uses the
// attributes set in attr and falls back first to attrDefault and then to // attributes set in attr and falls back first to attrDefault and then to
// the text control font/colours for those attributes which are not set // the text control font/colours for those attributes which are not set
@@ -255,18 +427,64 @@ public:
const wxTextAttr& attrDef, const wxTextAttr& attrDef,
const wxTextCtrlBase *text); const wxTextCtrlBase *text);
// Compare tabs
static bool TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2);
// Remove attributes
static bool RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style);
// Combine two bitlists, specifying the bits of interest with separate flags.
static bool CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB);
// Compare two bitlists
static bool BitlistsEqPartial(int valueA, int valueB, int flags);
// Split into paragraph and character styles
static bool SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle);
private: private:
long m_flags; long m_flags;
wxColour m_colText,
m_colBack; // Paragraph styles
wxFont m_font;
wxTextAttrAlignment m_textAlignment;
wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm wxArrayInt m_tabs; // array of int: tab stops in 1/10 mm
int m_leftIndent; // left indent in 1/10 mm int m_leftIndent; // left indent in 1/10 mm
int m_leftSubIndent; // left indent for all but the first int m_leftSubIndent; // left indent for all but the first
// line in a paragraph relative to the // line in a paragraph relative to the
// first line, in 1/10 mm // first line, in 1/10 mm
int m_rightIndent; // right indent in 1/10 mm int m_rightIndent; // right indent in 1/10 mm
wxTextAttrAlignment m_textAlignment;
int m_paragraphSpacingAfter;
int m_paragraphSpacingBefore;
int m_lineSpacing;
int m_bulletStyle;
int m_bulletNumber;
int m_textEffects;
int m_textEffectFlags;
int m_outlineLevel;
wxString m_bulletText;
wxString m_bulletFont;
wxString m_bulletName;
wxString m_urlTarget;
wxFontEncoding m_fontEncoding;
// Character styles
wxColour m_colText,
m_colBack;
int m_fontSize;
int m_fontStyle;
int m_fontWeight;
bool m_fontUnderlined;
wxString m_fontFaceName;
// Character style
wxString m_characterStyleName;
// Paragraph style
wxString m_paragraphStyleName;
// List style
wxString m_listStyleName;
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -840,7 +840,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
tabs.Add(600); tabs.Add(600);
tabs.Add(800); tabs.Add(800);
tabs.Add(1000); tabs.Add(1000);
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_TABS); attr.SetFlags(wxTEXT_ATTR_TABS);
attr.SetTabs(tabs); attr.SetTabs(tabs);
r.SetDefaultStyle(attr); r.SetDefaultStyle(attr);
@@ -1184,7 +1184,7 @@ void MyFrame::OnUpdateFormat(wxUpdateUIEvent& event)
void MyFrame::OnIndentMore(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIndentMore(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT); attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1202,7 +1202,7 @@ void MyFrame::OnIndentMore(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnIndentLess(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIndentLess(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT); attr.SetFlags(wxTEXT_ATTR_LEFT_INDENT);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1222,7 +1222,7 @@ void MyFrame::OnIndentLess(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnLineSpacingHalf(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLineSpacingHalf(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING); attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1240,7 +1240,7 @@ void MyFrame::OnLineSpacingHalf(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnLineSpacingDouble(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLineSpacingDouble(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING); attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1258,7 +1258,7 @@ void MyFrame::OnLineSpacingDouble(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnLineSpacingSingle(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLineSpacingSingle(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_LINE_SPACING); attr.SetFlags(wxTEXT_ATTR_LINE_SPACING);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1276,7 +1276,7 @@ void MyFrame::OnLineSpacingSingle(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnParagraphSpacingMore(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnParagraphSpacingMore(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER); attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1294,7 +1294,7 @@ void MyFrame::OnParagraphSpacingMore(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnParagraphSpacingLess(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnParagraphSpacingLess(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER); attr.SetFlags(wxTEXT_ATTR_PARA_SPACING_AFTER);
if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr)) if (m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr))
@@ -1422,7 +1422,7 @@ void MyFrame::OnManageStyles(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnInsertSymbol(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnInsertSymbol(wxCommandEvent& WXUNUSED(event))
{ {
wxTextAttrEx attr; wxRichTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT); attr.SetFlags(wxTEXT_ATTR_FONT);
m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr); m_richTextCtrl->GetStyle(m_richTextCtrl->GetInsertionPoint(), attr);

View File

@@ -56,27 +56,26 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_MAXLEN)
IMPLEMENT_ABSTRACT_CLASS(wxTextCtrlBase, wxControl) IMPLEMENT_ABSTRACT_CLASS(wxTextCtrlBase, wxControl)
// ---------------------------------------------------------------------------- // ============================================================================
// style functions - not implemented here // wxTextAttr implementation
// ---------------------------------------------------------------------------- // ============================================================================
wxTextAttr::wxTextAttr(const wxColour& colText, wxTextAttr::wxTextAttr(const wxColour& colText,
const wxColour& colBack, const wxColour& colBack,
const wxFont& font, const wxFont& font,
wxTextAttrAlignment alignment) wxTextAttrAlignment alignment): m_textAlignment(alignment), m_colText(colText), m_colBack(colBack)
: m_colText(colText), m_colBack(colBack), m_font(font), m_textAlignment(alignment)
{ {
m_flags = 0; Init();
m_leftIndent = 0;
m_leftSubIndent = 0;
m_rightIndent = 0;
if (m_colText.Ok()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR; if (m_colText.Ok()) m_flags |= wxTEXT_ATTR_TEXT_COLOUR;
if (m_colBack.Ok()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR; if (m_colBack.Ok()) m_flags |= wxTEXT_ATTR_BACKGROUND_COLOUR;
if (m_font.Ok()) m_flags |= wxTEXT_ATTR_FONT;
if (alignment != wxTEXT_ALIGNMENT_DEFAULT) if (alignment != wxTEXT_ALIGNMENT_DEFAULT)
m_flags |= wxTEXT_ATTR_ALIGNMENT; m_flags |= wxTEXT_ATTR_ALIGNMENT;
GetFontAttributes(font);
} }
// Initialisation
void wxTextAttr::Init() void wxTextAttr::Init()
{ {
m_textAlignment = wxTEXT_ALIGNMENT_DEFAULT; m_textAlignment = wxTEXT_ALIGNMENT_DEFAULT;
@@ -84,6 +83,456 @@ void wxTextAttr::Init()
m_leftIndent = 0; m_leftIndent = 0;
m_leftSubIndent = 0; m_leftSubIndent = 0;
m_rightIndent = 0; m_rightIndent = 0;
m_fontSize = 12;
m_fontStyle = wxNORMAL;
m_fontWeight = wxNORMAL;
m_fontUnderlined = false;
m_fontEncoding = wxFONTENCODING_DEFAULT;
m_paragraphSpacingAfter = 0;
m_paragraphSpacingBefore = 0;
m_lineSpacing = 0;
m_bulletStyle = wxTEXT_ATTR_BULLET_STYLE_NONE;
m_textEffects = wxTEXT_ATTR_EFFECT_NONE;
m_textEffectFlags = wxTEXT_ATTR_EFFECT_NONE;
m_outlineLevel = 0;
m_bulletNumber = 0;
}
// Copy
void wxTextAttr::Copy(const wxTextAttr& attr)
{
m_colText = attr.m_colText;
m_colBack = attr.m_colBack;
m_textAlignment = attr.m_textAlignment;
m_leftIndent = attr.m_leftIndent;
m_leftSubIndent = attr.m_leftSubIndent;
m_rightIndent = attr.m_rightIndent;
m_tabs = attr.m_tabs;
m_flags = attr.m_flags;
m_fontSize = attr.m_fontSize;
m_fontStyle = attr.m_fontStyle;
m_fontWeight = attr.m_fontWeight;
m_fontUnderlined = attr.m_fontUnderlined;
m_fontFaceName = attr.m_fontFaceName;
m_fontEncoding = attr.m_fontEncoding;
m_textEffects = attr.m_textEffects;
m_textEffectFlags = attr.m_textEffectFlags;
m_paragraphSpacingAfter = attr.m_paragraphSpacingAfter;
m_paragraphSpacingBefore = attr.m_paragraphSpacingBefore;
m_lineSpacing = attr.m_lineSpacing;
m_characterStyleName = attr.m_characterStyleName;
m_paragraphStyleName = attr.m_paragraphStyleName;
m_listStyleName = attr.m_listStyleName;
m_bulletStyle = attr.m_bulletStyle;
m_bulletNumber = attr.m_bulletNumber;
m_bulletText = attr.m_bulletText;
m_bulletFont = attr.m_bulletFont;
m_bulletName = attr.m_bulletName;
m_outlineLevel = attr.m_outlineLevel;
m_urlTarget = attr.m_urlTarget;
}
// operators
void wxTextAttr::operator= (const wxTextAttr& attr)
{
Copy(attr);
}
// Equality test
bool wxTextAttr::operator== (const wxTextAttr& attr) const
{
return GetFlags() == attr.GetFlags() &&
GetTextColour() == attr.GetTextColour() &&
GetBackgroundColour() == attr.GetBackgroundColour() &&
GetAlignment() == attr.GetAlignment() &&
GetLeftIndent() == attr.GetLeftIndent() &&
GetLeftSubIndent() == attr.GetLeftSubIndent() &&
GetRightIndent() == attr.GetRightIndent() &&
TabsEq(GetTabs(), attr.GetTabs()) &&
GetParagraphSpacingAfter() == attr.GetParagraphSpacingAfter() &&
GetParagraphSpacingBefore() == attr.GetParagraphSpacingBefore() &&
GetLineSpacing() == attr.GetLineSpacing() &&
GetCharacterStyleName() == attr.GetCharacterStyleName() &&
GetParagraphStyleName() == attr.GetParagraphStyleName() &&
GetListStyleName() == attr.GetListStyleName() &&
GetBulletStyle() == attr.GetBulletStyle() &&
GetBulletText() == attr.GetBulletText() &&
GetBulletNumber() == attr.GetBulletNumber() &&
GetBulletFont() == attr.GetBulletFont() &&
GetBulletName() == attr.GetBulletName() &&
GetTextEffects() == attr.GetTextEffects() &&
GetTextEffectFlags() == attr.GetTextEffectFlags() &&
GetOutlineLevel() == attr.GetOutlineLevel() &&
GetFontSize() == attr.GetFontSize() &&
GetFontStyle() == attr.GetFontStyle() &&
GetFontWeight() == attr.GetFontWeight() &&
GetFontUnderlined() == attr.GetFontUnderlined() &&
GetFontFaceName() == attr.GetFontFaceName() &&
GetFontEncoding() == attr.GetFontEncoding() &&
GetURL() == attr.GetURL();
}
// Partial equality test taking flags into account
bool wxTextAttr::EqPartial(const wxTextAttr& attr, int flags) const
{
if ((flags & wxTEXT_ATTR_TEXT_COLOUR) && GetTextColour() != attr.GetTextColour())
return false;
if ((flags & wxTEXT_ATTR_BACKGROUND_COLOUR) && GetBackgroundColour() != attr.GetBackgroundColour())
return false;
if ((flags & wxTEXT_ATTR_FONT_FACE) &&
GetFontFaceName() != attr.GetFontFaceName())
return false;
if ((flags & wxTEXT_ATTR_FONT_SIZE) &&
GetFontSize() != attr.GetFontSize())
return false;
if ((flags & wxTEXT_ATTR_FONT_WEIGHT) &&
GetFontWeight() != attr.GetFontWeight())
return false;
if ((flags & wxTEXT_ATTR_FONT_ITALIC) &&
GetFontStyle() != attr.GetFontStyle())
return false;
if ((flags & wxTEXT_ATTR_FONT_UNDERLINE) &&
GetFontUnderlined() != attr.GetFontUnderlined())
return false;
if ((flags & wxTEXT_ATTR_FONT_ENCODING) &&
GetFontEncoding() != attr.GetFontEncoding())
return false;
if ((flags & wxTEXT_ATTR_URL) && GetURL() != attr.GetURL())
return false;
if ((flags & wxTEXT_ATTR_ALIGNMENT) && GetAlignment() != attr.GetAlignment())
return false;
if ((flags & wxTEXT_ATTR_LEFT_INDENT) &&
((GetLeftIndent() != attr.GetLeftIndent()) || (GetLeftSubIndent() != attr.GetLeftSubIndent())))
return false;
if ((flags & wxTEXT_ATTR_RIGHT_INDENT) &&
(GetRightIndent() != attr.GetRightIndent()))
return false;
if ((flags & wxTEXT_ATTR_PARA_SPACING_AFTER) &&
(GetParagraphSpacingAfter() != attr.GetParagraphSpacingAfter()))
return false;
if ((flags & wxTEXT_ATTR_PARA_SPACING_BEFORE) &&
(GetParagraphSpacingBefore() != attr.GetParagraphSpacingBefore()))
return false;
if ((flags & wxTEXT_ATTR_LINE_SPACING) &&
(GetLineSpacing() != attr.GetLineSpacing()))
return false;
if ((flags & wxTEXT_ATTR_CHARACTER_STYLE_NAME) &&
(GetCharacterStyleName() != attr.GetCharacterStyleName()))
return false;
if ((flags & wxTEXT_ATTR_PARAGRAPH_STYLE_NAME) &&
(GetParagraphStyleName() != attr.GetParagraphStyleName()))
return false;
if ((flags & wxTEXT_ATTR_LIST_STYLE_NAME) &&
(GetListStyleName() != attr.GetListStyleName()))
return false;
if ((flags & wxTEXT_ATTR_BULLET_STYLE) &&
(GetBulletStyle() != attr.GetBulletStyle()))
return false;
if ((flags & wxTEXT_ATTR_BULLET_NUMBER) &&
(GetBulletNumber() != attr.GetBulletNumber()))
return false;
if ((flags & wxTEXT_ATTR_BULLET_TEXT) &&
(GetBulletText() != attr.GetBulletText()) &&
(GetBulletFont() != attr.GetBulletFont()))
return false;
if ((flags & wxTEXT_ATTR_BULLET_NAME) &&
(GetBulletName() != attr.GetBulletName()))
return false;
if ((flags & wxTEXT_ATTR_TABS) &&
!TabsEq(GetTabs(), attr.GetTabs()))
return false;
if ((flags & wxTEXT_ATTR_PAGE_BREAK) &&
(HasPageBreak() != attr.HasPageBreak()))
return false;
if (flags & wxTEXT_ATTR_EFFECTS)
{
if (HasTextEffects() != attr.HasTextEffects())
return false;
if (!BitlistsEqPartial(GetTextEffects(), attr.GetTextEffects(), attr.GetTextEffectFlags()))
return false;
}
if ((flags & wxTEXT_ATTR_OUTLINE_LEVEL) &&
(GetOutlineLevel() != attr.GetOutlineLevel()))
return false;
return true;
}
// Create font from font attributes.
wxFont wxTextAttr::CreateFont() const
{
int fontSize = 10;
if (HasFontSize())
fontSize = GetFontSize();
int fontStyle = wxNORMAL;
if (HasFontItalic())
fontStyle = GetFontStyle();
int fontWeight = wxNORMAL;
if (HasFontWeight())
fontWeight = GetFontWeight();
bool underlined = false;
if (HasFontUnderlined())
underlined = GetFontUnderlined();
wxString fontFaceName;
if (HasFontFaceName())
fontFaceName = GetFontFaceName();
wxFontEncoding encoding = wxFONTENCODING_DEFAULT;
if (HasFontEncoding())
encoding = GetFontEncoding();
wxFont font(fontSize, wxDEFAULT, fontStyle, fontWeight, underlined, fontFaceName, encoding);
#ifdef __WXMAC__
font.SetNoAntiAliasing(true);
#endif
return font;
}
// Get attributes from font.
bool wxTextAttr::GetFontAttributes(const wxFont& font, int flags)
{
if (!font.Ok())
return false;
if (flags & wxTEXT_ATTR_FONT_SIZE)
m_fontSize = font.GetPointSize();
if (flags & wxTEXT_ATTR_FONT_ITALIC)
m_fontStyle = font.GetStyle();
if (flags & wxTEXT_ATTR_FONT_WEIGHT)
m_fontWeight = font.GetWeight();
if (flags & wxTEXT_ATTR_FONT_UNDERLINE)
m_fontUnderlined = font.GetUnderlined();
if (flags & wxTEXT_ATTR_FONT_FACE)
m_fontFaceName = font.GetFaceName();
if (flags & wxTEXT_ATTR_FONT_ENCODING)
m_fontEncoding = font.GetEncoding();
return true;
}
bool wxTextAttr::Apply(const wxTextAttr& style, const wxTextAttr* compareWith)
{
wxTextAttr& destStyle = (*this);
if (style.HasFontWeight())
{
if (!(compareWith && compareWith->HasFontWeight() && compareWith->GetFontWeight() == style.GetFontWeight()))
destStyle.SetFontWeight(style.GetFontWeight());
}
if (style.HasFontSize())
{
if (!(compareWith && compareWith->HasFontSize() && compareWith->GetFontSize() == style.GetFontSize()))
destStyle.SetFontSize(style.GetFontSize());
}
if (style.HasFontItalic())
{
if (!(compareWith && compareWith->HasFontItalic() && compareWith->GetFontStyle() == style.GetFontStyle()))
destStyle.SetFontStyle(style.GetFontStyle());
}
if (style.HasFontUnderlined())
{
if (!(compareWith && compareWith->HasFontUnderlined() && compareWith->GetFontUnderlined() == style.GetFontUnderlined()))
destStyle.SetFontUnderlined(style.GetFontUnderlined());
}
if (style.HasFontFaceName())
{
if (!(compareWith && compareWith->HasFontFaceName() && compareWith->GetFontFaceName() == style.GetFontFaceName()))
destStyle.SetFontFaceName(style.GetFontFaceName());
}
if (style.HasFontEncoding())
{
if (!(compareWith && compareWith->HasFontEncoding() && compareWith->GetFontEncoding() == style.GetFontEncoding()))
destStyle.SetFontEncoding(style.GetFontEncoding());
}
if (style.GetTextColour().Ok() && style.HasTextColour())
{
if (!(compareWith && compareWith->HasTextColour() && compareWith->GetTextColour() == style.GetTextColour()))
destStyle.SetTextColour(style.GetTextColour());
}
if (style.GetBackgroundColour().Ok() && style.HasBackgroundColour())
{
if (!(compareWith && compareWith->HasBackgroundColour() && compareWith->GetBackgroundColour() == style.GetBackgroundColour()))
destStyle.SetBackgroundColour(style.GetBackgroundColour());
}
if (style.HasAlignment())
{
if (!(compareWith && compareWith->HasAlignment() && compareWith->GetAlignment() == style.GetAlignment()))
destStyle.SetAlignment(style.GetAlignment());
}
if (style.HasTabs())
{
if (!(compareWith && compareWith->HasTabs() && TabsEq(compareWith->GetTabs(), style.GetTabs())))
destStyle.SetTabs(style.GetTabs());
}
if (style.HasLeftIndent())
{
if (!(compareWith && compareWith->HasLeftIndent() && compareWith->GetLeftIndent() == style.GetLeftIndent()
&& compareWith->GetLeftSubIndent() == style.GetLeftSubIndent()))
destStyle.SetLeftIndent(style.GetLeftIndent(), style.GetLeftSubIndent());
}
if (style.HasRightIndent())
{
if (!(compareWith && compareWith->HasRightIndent() && compareWith->GetRightIndent() == style.GetRightIndent()))
destStyle.SetRightIndent(style.GetRightIndent());
}
if (style.HasParagraphSpacingAfter())
{
if (!(compareWith && compareWith->HasParagraphSpacingAfter() && compareWith->GetParagraphSpacingAfter() == style.GetParagraphSpacingAfter()))
destStyle.SetParagraphSpacingAfter(style.GetParagraphSpacingAfter());
}
if (style.HasParagraphSpacingBefore())
{
if (!(compareWith && compareWith->HasParagraphSpacingBefore() && compareWith->GetParagraphSpacingBefore() == style.GetParagraphSpacingBefore()))
destStyle.SetParagraphSpacingBefore(style.GetParagraphSpacingBefore());
}
if (style.HasLineSpacing())
{
if (!(compareWith && compareWith->HasLineSpacing() && compareWith->GetLineSpacing() == style.GetLineSpacing()))
destStyle.SetLineSpacing(style.GetLineSpacing());
}
if (style.HasCharacterStyleName())
{
if (!(compareWith && compareWith->HasCharacterStyleName() && compareWith->GetCharacterStyleName() == style.GetCharacterStyleName()))
destStyle.SetCharacterStyleName(style.GetCharacterStyleName());
}
if (style.HasParagraphStyleName())
{
if (!(compareWith && compareWith->HasParagraphStyleName() && compareWith->GetParagraphStyleName() == style.GetParagraphStyleName()))
destStyle.SetParagraphStyleName(style.GetParagraphStyleName());
}
if (style.HasListStyleName())
{
if (!(compareWith && compareWith->HasListStyleName() && compareWith->GetListStyleName() == style.GetListStyleName()))
destStyle.SetListStyleName(style.GetListStyleName());
}
if (style.HasBulletStyle())
{
if (!(compareWith && compareWith->HasBulletStyle() && compareWith->GetBulletStyle() == style.GetBulletStyle()))
destStyle.SetBulletStyle(style.GetBulletStyle());
}
if (style.HasBulletText())
{
if (!(compareWith && compareWith->HasBulletText() && compareWith->GetBulletText() == style.GetBulletText()))
{
destStyle.SetBulletText(style.GetBulletText());
destStyle.SetBulletFont(style.GetBulletFont());
}
}
if (style.HasBulletNumber())
{
if (!(compareWith && compareWith->HasBulletNumber() && compareWith->GetBulletNumber() == style.GetBulletNumber()))
destStyle.SetBulletNumber(style.GetBulletNumber());
}
if (style.HasBulletName())
{
if (!(compareWith && compareWith->HasBulletName() && compareWith->GetBulletName() == style.GetBulletName()))
destStyle.SetBulletName(style.GetBulletName());
}
if (style.HasURL())
{
if (!(compareWith && compareWith->HasURL() && compareWith->GetURL() == style.GetURL()))
destStyle.SetURL(style.GetURL());
}
if (style.HasPageBreak())
{
if (!(compareWith && compareWith->HasPageBreak()))
destStyle.SetPageBreak();
}
if (style.HasTextEffects())
{
if (!(compareWith && compareWith->HasTextEffects() && compareWith->GetTextEffects() == style.GetTextEffects()))
{
int destBits = destStyle.GetTextEffects();
int destFlags = destStyle.GetTextEffectFlags();
int srcBits = style.GetTextEffects();
int srcFlags = style.GetTextEffectFlags();
CombineBitlists(destBits, srcBits, destFlags, srcFlags);
destStyle.SetTextEffects(destBits);
destStyle.SetTextEffectFlags(destFlags);
}
}
if (style.HasOutlineLevel())
{
if (!(compareWith && compareWith->HasOutlineLevel() && compareWith->GetOutlineLevel() == style.GetOutlineLevel()))
destStyle.SetOutlineLevel(style.GetOutlineLevel());
}
return true;
} }
/* static */ /* static */
@@ -143,19 +592,73 @@ wxTextAttr wxTextAttr::Combine(const wxTextAttr& attr,
return newAttr; return newAttr;
} }
void wxTextAttr::operator= (const wxTextAttr& attr) /// Compare tabs
bool wxTextAttr::TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2)
{ {
m_font = attr.m_font; if (tabs1.GetCount() != tabs2.GetCount())
m_colText = attr.m_colText; return false;
m_colBack = attr.m_colBack;
m_textAlignment = attr.m_textAlignment; size_t i;
m_leftIndent = attr.m_leftIndent; for (i = 0; i < tabs1.GetCount(); i++)
m_leftSubIndent = attr.m_leftSubIndent; {
m_rightIndent = attr.m_rightIndent; if (tabs1[i] != tabs2[i])
m_tabs = attr.m_tabs; return false;
m_flags = attr.m_flags; }
return true;
} }
// Remove attributes
bool wxTextAttr::RemoveStyle(wxTextAttr& destStyle, const wxTextAttr& style)
{
int flags = style.GetFlags();
int destFlags = destStyle.GetFlags();
destStyle.SetFlags(destFlags & ~flags);
return true;
}
/// Combine two bitlists, specifying the bits of interest with separate flags.
bool wxTextAttr::CombineBitlists(int& valueA, int valueB, int& flagsA, int flagsB)
{
// We want to apply B's bits to A, taking into account each's flags which indicate which bits
// are to be taken into account. A zero in B's bits should reset that bit in A but only if B's flags
// indicate it.
// First, reset the 0 bits from B. We make a mask so we're only dealing with B's zero
// bits at this point, ignoring any 1 bits in B or 0 bits in B that are not relevant.
int valueA2 = ~(~valueB & flagsB) & valueA;
// Now combine the 1 bits.
int valueA3 = (valueB & flagsB) | valueA2;
valueA = valueA3;
flagsA = (flagsA | flagsB);
return true;
}
/// Compare two bitlists
bool wxTextAttr::BitlistsEqPartial(int valueA, int valueB, int flags)
{
int relevantBitsA = valueA & flags;
int relevantBitsB = valueB & flags;
return (relevantBitsA != relevantBitsB);
}
/// Split into paragraph and character styles
bool wxTextAttr::SplitParaCharStyles(const wxTextAttr& style, wxTextAttr& parStyle, wxTextAttr& charStyle)
{
wxTextAttr defaultCharStyle1(style);
wxTextAttr defaultParaStyle1(style);
defaultCharStyle1.SetFlags(defaultCharStyle1.GetFlags()&wxTEXT_ATTR_CHARACTER);
defaultParaStyle1.SetFlags(defaultParaStyle1.GetFlags()&wxTEXT_ATTR_PARAGRAPH);
charStyle.Apply(defaultCharStyle1);
parStyle.Apply(defaultParaStyle1);
return true;
}
// apply styling to text range // apply styling to text range
bool wxTextCtrlBase::SetStyle(long WXUNUSED(start), long WXUNUSED(end), bool wxTextCtrlBase::SetStyle(long WXUNUSED(start), long WXUNUSED(end),

View File

@@ -84,7 +84,9 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
{ {
wxGtkTextRemoveTagsWithPrefix(text_buffer, "WXFONT", start, end); wxGtkTextRemoveTagsWithPrefix(text_buffer, "WXFONT", start, end);
PangoFontDescription *font_description = attr.GetFont().GetNativeFontInfo()->description; wxFont font(attr.GetFont());
PangoFontDescription *font_description = font.GetNativeFontInfo()->description;
wxGtkString font_string(pango_font_description_to_string(font_description)); wxGtkString font_string(pango_font_description_to_string(font_description));
g_snprintf(buf, sizeof(buf), "WXFONT %s", font_string.c_str()); g_snprintf(buf, sizeof(buf), "WXFONT %s", font_string.c_str());
tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ), tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ),
@@ -95,7 +97,7 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
NULL ); NULL );
gtk_text_buffer_apply_tag (text_buffer, tag, start, end); gtk_text_buffer_apply_tag (text_buffer, tag, start, end);
if (attr.GetFont().GetUnderlined()) if (font.GetUnderlined())
{ {
g_snprintf(buf, sizeof(buf), "WXFONTUNDERLINE"); g_snprintf(buf, sizeof(buf), "WXFONTUNDERLINE");
tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ), tag = gtk_text_tag_table_lookup( gtk_text_buffer_get_tag_table( text_buffer ),
@@ -943,7 +945,7 @@ wxFontEncoding wxTextCtrl::GetTextEncoding() const
// first check the default text style (we intentionally don't check the // first check the default text style (we intentionally don't check the
// style for the current position as it doesn't make sense for SetValue()) // style for the current position as it doesn't make sense for SetValue())
const wxTextAttr& style = GetDefaultStyle(); const wxTextAttr& style = GetDefaultStyle();
wxFontEncoding enc = style.HasFont() ? style.GetFont().GetEncoding() wxFontEncoding enc = style.HasFontEncoding() ? style.GetFontEncoding()
: wxFONTENCODING_SYSTEM; : wxFONTENCODING_SYSTEM;
// fall back to the controls font if no style // fall back to the controls font if no style
@@ -1028,9 +1030,9 @@ void wxTextCtrl::WriteText( const wxString &text )
// check if we have a specific style for the current position // check if we have a specific style for the current position
wxFontEncoding enc = wxFONTENCODING_SYSTEM; wxFontEncoding enc = wxFONTENCODING_SYSTEM;
wxTextAttr style; wxTextAttr style;
if ( GetStyle(GetInsertionPoint(), style) && style.HasFont() ) if ( GetStyle(GetInsertionPoint(), style) && style.HasFontEncoding() )
{ {
enc = style.GetFont().GetEncoding(); enc = style.GetFontEncoding();
} }
if ( enc == wxFONTENCODING_SYSTEM ) if ( enc == wxFONTENCODING_SYSTEM )

View File

@@ -55,8 +55,21 @@ static void wxGtkTextInsert(GtkWidget *text,
const char *txt, const char *txt,
size_t len) size_t len)
{ {
GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont() wxFont tmpFont;
: NULL; GdkFont *font;
if (attr.HasFont())
{
tmpFont = attr.GetFont();
// FIXME: if this crashes because tmpFont goes out of scope and the GdkFont is
// deleted, then we need to call gdk_font_ref on font.
// This is because attr.GetFont() now returns a temporary font since wxTextAttr
// no longer stores a wxFont object, for efficiency.
font = tmpFont.GetInternalFont();
}
else
font = NULL;
GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor() GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
: NULL; : NULL;

View File

@@ -1829,7 +1829,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
if ( style.HasFont() ) if ( style.HasFont() )
{ {
const wxFont &font = style.GetFont() ; wxFont font(style.GetFont()) ;
#if 0 // old version #if 0 // old version
Str255 fontName = "\pMonaco" ; Str255 fontName = "\pMonaco" ;

View File

@@ -2410,9 +2410,12 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
// the real height in twips and not the negative number which // the real height in twips and not the negative number which
// wxFillLogFont() returns (this is correct in general and works with // wxFillLogFont() returns (this is correct in general and works with
// the Windows font mapper, but not here) // the Windows font mapper, but not here)
wxFont font(style.GetFont());
LOGFONT lf; LOGFONT lf;
wxFillLogFont(&lf, &style.GetFont()); wxFillLogFont(&lf, &font);
cf.yHeight = 20*style.GetFont().GetPointSize(); // 1 pt = 20 twips cf.yHeight = 20*font.GetPointSize(); // 1 pt = 20 twips
cf.bCharSet = lf.lfCharSet; cf.bCharSet = lf.lfCharSet;
cf.bPitchAndFamily = lf.lfPitchAndFamily; cf.bPitchAndFamily = lf.lfPitchAndFamily;
wxStrncpy( cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName) ); wxStrncpy( cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName) );

File diff suppressed because it is too large Load Diff

View File

@@ -311,7 +311,7 @@ bool wxRichTextBulletsPage::TransferDataFromWindow()
{ {
wxPanel::TransferDataFromWindow(); wxPanel::TransferDataFromWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (m_hasBulletStyle) if (m_hasBulletStyle)
{ {
@@ -384,7 +384,7 @@ bool wxRichTextBulletsPage::TransferDataToWindow()
wxPanel::TransferDataToWindow(); wxPanel::TransferDataToWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (attr->HasBulletStyle()) if (attr->HasBulletStyle())
{ {
@@ -487,7 +487,7 @@ et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id m
iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
TransferDataFromWindow(); TransferDataFromWindow();
wxTextAttrEx attr(*GetAttributes()); wxTextAttr attr(*GetAttributes());
attr.SetFlags(attr.GetFlags() & attr.SetFlags(attr.GetFlags() &
(wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME| (wxTEXT_ATTR_BULLET_STYLE|wxTEXT_ATTR_BULLET_NUMBER|wxTEXT_ATTR_BULLET_TEXT|wxTEXT_ATTR_BULLET_NAME|
wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER| wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
@@ -497,7 +497,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
font.SetPointSize(9); font.SetPointSize(9);
m_previewCtrl->SetFont(font); m_previewCtrl->SetFont(font);
wxTextAttrEx normalParaAttr; wxTextAttr normalParaAttr;
normalParaAttr.SetFont(font); normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
@@ -521,7 +521,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
m_previewCtrl->Thaw(); m_previewCtrl->Thaw();
} }
wxTextAttrEx* wxRichTextBulletsPage::GetAttributes() wxTextAttr* wxRichTextBulletsPage::GetAttributes()
{ {
return wxRichTextFormattingDialog::GetDialogAttributes(this); return wxRichTextFormattingDialog::GetDialogAttributes(this);
} }

View File

@@ -149,7 +149,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
SetEditable(false); SetEditable(false);
// The base attributes must all have default values // The base attributes must all have default values
wxTextAttrEx attributes; wxTextAttr attributes;
attributes.SetFont(GetFont()); attributes.SetFont(GetFont());
attributes.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); attributes.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
attributes.SetAlignment(wxTEXT_ALIGNMENT_LEFT); attributes.SetAlignment(wxTEXT_ALIGNMENT_LEFT);
@@ -163,7 +163,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
// The default attributes will be merged with base attributes, so // The default attributes will be merged with base attributes, so
// can be empty to begin with // can be empty to begin with
wxTextAttrEx defaultAttributes; wxTextAttr defaultAttributes;
SetDefaultStyle(defaultAttributes); SetDefaultStyle(defaultAttributes);
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
@@ -402,7 +402,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
if (!GetEventHandler()->ProcessEvent(cmdEvent)) if (!GetEventHandler()->ProcessEvent(cmdEvent))
{ {
wxTextAttrEx attr; wxTextAttr attr;
if (GetStyle(position, attr)) if (GetStyle(position, attr))
{ {
if (attr.HasFlag(wxTEXT_ATTR_URL)) if (attr.HasFlag(wxTEXT_ATTR_URL))
@@ -450,7 +450,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
{ {
if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE)) if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
{ {
wxTextAttrEx attr; wxTextAttr attr;
if (GetStyle(position, attr)) if (GetStyle(position, attr))
{ {
if (attr.HasFlag(wxTEXT_ATTR_URL)) if (attr.HasFlag(wxTEXT_ATTR_URL))
@@ -2554,17 +2554,12 @@ void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
return; return;
} }
bool wxRichTextCtrl::SetStyle(long start, long end, const wxTextAttrEx& style)
{
return GetBuffer().SetStyle(wxRichTextRange(start, end-1), style);
}
bool wxRichTextCtrl::SetStyle(long start, long end, const wxTextAttr& style) bool wxRichTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
{ {
return GetBuffer().SetStyle(wxRichTextRange(start, end-1), wxTextAttrEx(style)); return GetBuffer().SetStyle(wxRichTextRange(start, end-1), wxTextAttr(style));
} }
bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxRichTextAttr& style) bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxTextAttr& style)
{ {
return GetBuffer().SetStyle(range.ToInternal(), style); return GetBuffer().SetStyle(range.ToInternal(), style);
} }
@@ -2572,34 +2567,15 @@ bool wxRichTextCtrl::SetStyle(const wxRichTextRange& range, const wxRichTextAttr
// extended style setting operation with flags including: // extended style setting operation with flags including:
// wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY. // wxRICHTEXT_SETSTYLE_WITH_UNDO, wxRICHTEXT_SETSTYLE_OPTIMIZE, wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY.
// see richtextbuffer.h for more details. // see richtextbuffer.h for more details.
bool wxRichTextCtrl::SetStyleEx(long start, long end, const wxTextAttrEx& style, int flags)
{
return GetBuffer().SetStyle(wxRichTextRange(start, end-1), style, flags);
}
bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxTextAttrEx& style, int flags) bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxTextAttr& style, int flags)
{ {
return GetBuffer().SetStyle(range.ToInternal(), style, flags); return GetBuffer().SetStyle(range.ToInternal(), style, flags);
} }
bool wxRichTextCtrl::SetStyleEx(const wxRichTextRange& range, const wxRichTextAttr& style, int flags)
{
return GetBuffer().SetStyle(range.ToInternal(), style, flags);
}
bool wxRichTextCtrl::SetDefaultStyle(const wxTextAttrEx& style)
{
return GetBuffer().SetDefaultStyle(style);
}
bool wxRichTextCtrl::SetDefaultStyle(const wxTextAttr& style) bool wxRichTextCtrl::SetDefaultStyle(const wxTextAttr& style)
{ {
return GetBuffer().SetDefaultStyle(wxTextAttrEx(style)); return GetBuffer().SetDefaultStyle(wxTextAttr(style));
}
const wxTextAttrEx& wxRichTextCtrl::GetDefaultStyleEx() const
{
return GetBuffer().GetDefaultStyle();
} }
const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const
@@ -2608,65 +2584,18 @@ const wxTextAttr& wxRichTextCtrl::GetDefaultStyle() const
} }
bool wxRichTextCtrl::GetStyle(long position, wxTextAttr& style) bool wxRichTextCtrl::GetStyle(long position, wxTextAttr& style)
{
wxTextAttrEx attr(style);
if (GetBuffer().GetStyle(position, attr))
{
style = attr;
return true;
}
else
return false;
}
bool wxRichTextCtrl::GetStyle(long position, wxTextAttrEx& style)
{
return GetBuffer().GetStyle(position, style);
}
bool wxRichTextCtrl::GetStyle(long position, wxRichTextAttr& style)
{ {
return GetBuffer().GetStyle(position, style); return GetBuffer().GetStyle(position, style);
} }
// get the common set of styles for the range // get the common set of styles for the range
bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxRichTextAttr& style) bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxTextAttr& style)
{
wxTextAttrEx styleEx;
if (GetBuffer().GetStyleForRange(range.ToInternal(), styleEx))
{
style = styleEx;
return true;
}
else
return false;
}
bool wxRichTextCtrl::GetStyleForRange(const wxRichTextRange& range, wxTextAttrEx& style)
{ {
return GetBuffer().GetStyleForRange(range.ToInternal(), style); return GetBuffer().GetStyleForRange(range.ToInternal(), style);
} }
/// Get the content (uncombined) attributes for this position. /// Get the content (uncombined) attributes for this position.
bool wxRichTextCtrl::GetUncombinedStyle(long position, wxTextAttr& style) bool wxRichTextCtrl::GetUncombinedStyle(long position, wxTextAttr& style)
{
wxTextAttrEx attr(style);
if (GetBuffer().GetUncombinedStyle(position, attr))
{
style = attr;
return true;
}
else
return false;
}
bool wxRichTextCtrl::GetUncombinedStyle(long position, wxTextAttrEx& style)
{
return GetBuffer().GetUncombinedStyle(position, style);
}
bool wxRichTextCtrl::GetUncombinedStyle(long position, wxRichTextAttr& style)
{ {
return GetBuffer().GetUncombinedStyle(position, style); return GetBuffer().GetUncombinedStyle(position, style);
} }
@@ -2676,7 +2605,7 @@ bool wxRichTextCtrl::SetFont(const wxFont& font)
{ {
wxControl::SetFont(font); wxControl::SetFont(font);
wxTextAttrEx attr = GetBuffer().GetAttributes(); wxTextAttr attr = GetBuffer().GetAttributes();
attr.SetFont(font); attr.SetFont(font);
GetBuffer().SetBasicStyle(attr); GetBuffer().SetBasicStyle(attr);
@@ -2831,7 +2760,7 @@ bool wxRichTextCtrl::IsSelectionBold()
{ {
if (HasSelection()) if (HasSelection())
{ {
wxRichTextAttr attr; wxTextAttr attr;
wxRichTextRange range = GetSelectionRange(); wxRichTextRange range = GetSelectionRange();
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(wxBOLD); attr.SetFontWeight(wxBOLD);
@@ -2842,7 +2771,7 @@ bool wxRichTextCtrl::IsSelectionBold()
{ {
// If no selection, then we need to combine current style with default style // If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing. // to see what the effect would be if we started typing.
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
long pos = GetAdjustedCaretPosition(GetCaretPosition()); long pos = GetAdjustedCaretPosition(GetCaretPosition());
@@ -2862,7 +2791,7 @@ bool wxRichTextCtrl::IsSelectionItalics()
if (HasSelection()) if (HasSelection())
{ {
wxRichTextRange range = GetSelectionRange(); wxRichTextRange range = GetSelectionRange();
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(wxITALIC); attr.SetFontStyle(wxITALIC);
@@ -2872,7 +2801,7 @@ bool wxRichTextCtrl::IsSelectionItalics()
{ {
// If no selection, then we need to combine current style with default style // If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing. // to see what the effect would be if we started typing.
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
long pos = GetAdjustedCaretPosition(GetCaretPosition()); long pos = GetAdjustedCaretPosition(GetCaretPosition());
@@ -2892,7 +2821,7 @@ bool wxRichTextCtrl::IsSelectionUnderlined()
if (HasSelection()) if (HasSelection())
{ {
wxRichTextRange range = GetSelectionRange(); wxRichTextRange range = GetSelectionRange();
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE); attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
attr.SetFontUnderlined(true); attr.SetFontUnderlined(true);
@@ -2902,7 +2831,7 @@ bool wxRichTextCtrl::IsSelectionUnderlined()
{ {
// If no selection, then we need to combine current style with default style // If no selection, then we need to combine current style with default style
// to see what the effect would be if we started typing. // to see what the effect would be if we started typing.
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE); attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
long pos = GetAdjustedCaretPosition(GetCaretPosition()); long pos = GetAdjustedCaretPosition(GetCaretPosition());
@@ -2919,7 +2848,7 @@ bool wxRichTextCtrl::IsSelectionUnderlined()
/// Apply bold to the selection /// Apply bold to the selection
bool wxRichTextCtrl::ApplyBoldToSelection() bool wxRichTextCtrl::ApplyBoldToSelection()
{ {
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT);
attr.SetFontWeight(IsSelectionBold() ? wxNORMAL : wxBOLD); attr.SetFontWeight(IsSelectionBold() ? wxNORMAL : wxBOLD);
@@ -2933,7 +2862,7 @@ bool wxRichTextCtrl::ApplyBoldToSelection()
/// Apply italic to the selection /// Apply italic to the selection
bool wxRichTextCtrl::ApplyItalicToSelection() bool wxRichTextCtrl::ApplyItalicToSelection()
{ {
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC); attr.SetFlags(wxTEXT_ATTR_FONT_ITALIC);
attr.SetFontStyle(IsSelectionItalics() ? wxNORMAL : wxITALIC); attr.SetFontStyle(IsSelectionItalics() ? wxNORMAL : wxITALIC);
@@ -2947,7 +2876,7 @@ bool wxRichTextCtrl::ApplyItalicToSelection()
/// Apply underline to the selection /// Apply underline to the selection
bool wxRichTextCtrl::ApplyUnderlineToSelection() bool wxRichTextCtrl::ApplyUnderlineToSelection()
{ {
wxRichTextAttr attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE); attr.SetFlags(wxTEXT_ATTR_FONT_UNDERLINE);
attr.SetFontUnderlined(!IsSelectionUnderlined()); attr.SetFontUnderlined(!IsSelectionUnderlined());
@@ -2967,7 +2896,7 @@ bool wxRichTextCtrl::IsSelectionAligned(wxTextAttrAlignment alignment)
else else
range = wxRichTextRange(GetCaretPosition()+1, GetCaretPosition()+2); range = wxRichTextRange(GetCaretPosition()+1, GetCaretPosition()+2);
wxRichTextAttr attr; wxTextAttr attr;
attr.SetAlignment(alignment); attr.SetAlignment(alignment);
return HasParagraphAttributes(range, attr); return HasParagraphAttributes(range, attr);
@@ -2976,7 +2905,7 @@ bool wxRichTextCtrl::IsSelectionAligned(wxTextAttrAlignment alignment)
/// Apply alignment to the selection /// Apply alignment to the selection
bool wxRichTextCtrl::ApplyAlignmentToSelection(wxTextAttrAlignment alignment) bool wxRichTextCtrl::ApplyAlignmentToSelection(wxTextAttrAlignment alignment)
{ {
wxRichTextAttr attr; wxTextAttr attr;
attr.SetAlignment(alignment); attr.SetAlignment(alignment);
if (HasSelection()) if (HasSelection())
return SetStyle(GetSelectionRange(), attr); return SetStyle(GetSelectionRange(), attr);
@@ -2994,7 +2923,7 @@ bool wxRichTextCtrl::ApplyStyle(wxRichTextStyleDefinition* def)
{ {
// Flags are defined within each definition, so only certain // Flags are defined within each definition, so only certain
// attributes are applied. // attributes are applied.
wxRichTextAttr attr(GetStyleSheet() ? def->GetStyleMergedWithBase(GetStyleSheet()) : def->GetStyle()); wxTextAttr attr(GetStyleSheet() ? def->GetStyleMergedWithBase(GetStyleSheet()) : def->GetStyle());
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE; int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE;
@@ -3058,7 +2987,7 @@ bool wxRichTextCtrl::ApplyStyleSheet(wxRichTextStyleSheet* styleSheet)
/// Sets the default style to the style under the cursor /// Sets the default style to the style under the cursor
bool wxRichTextCtrl::SetDefaultStyleToCursorStyle() bool wxRichTextCtrl::SetDefaultStyleToCursorStyle()
{ {
wxTextAttrEx attr; wxTextAttr attr;
attr.SetFlags(wxTEXT_ATTR_CHARACTER); attr.SetFlags(wxTEXT_ATTR_CHARACTER);
// If at the start of a paragraph, use the next position. // If at the start of a paragraph, use the next position.

View File

@@ -267,17 +267,14 @@ bool wxRichTextFontPage::TransferDataFromWindow()
{ {
wxPanel::TransferDataFromWindow(); wxPanel::TransferDataFromWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (m_faceListBox->GetSelection() != wxNOT_FOUND) if (m_faceListBox->GetSelection() != wxNOT_FOUND)
{ {
wxString faceName = m_faceListBox->GetFaceName(m_faceListBox->GetSelection()); wxString faceName = m_faceListBox->GetFaceName(m_faceListBox->GetSelection());
if (!faceName.IsEmpty()) if (!faceName.IsEmpty())
{ {
wxFont font(attr->GetFont().Ok() ? attr->GetFont() : *wxNORMAL_FONT); attr->SetFontFaceName(faceName);
font.SetFaceName(faceName);
wxSetFontPreservingStyles(*attr, font);
attr->SetFlags(attr->GetFlags() | wxTEXT_ATTR_FONT_FACE);
} }
} }
else else
@@ -289,10 +286,7 @@ bool wxRichTextFontPage::TransferDataFromWindow()
int sz = wxAtoi(strSize); int sz = wxAtoi(strSize);
if (sz > 0) if (sz > 0)
{ {
wxFont font(attr->GetFont().Ok() ? attr->GetFont() : *wxNORMAL_FONT); attr->SetFontSize(sz);
font.SetPointSize(sz);
wxSetFontPreservingStyles(*attr, font);
attr->SetFlags(attr->GetFlags() | wxTEXT_ATTR_FONT_SIZE);
} }
} }
else else
@@ -306,10 +300,7 @@ bool wxRichTextFontPage::TransferDataFromWindow()
else else
style = wxNORMAL; style = wxNORMAL;
wxFont font(attr->GetFont().Ok() ? attr->GetFont() : *wxNORMAL_FONT); attr->SetFontStyle(style);
font.SetStyle(style);
wxSetFontPreservingStyles(*attr, font);
attr->SetFlags(attr->GetFlags() | wxTEXT_ATTR_FONT_ITALIC);
} }
else else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_ITALIC)); attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_ITALIC));
@@ -322,10 +313,7 @@ bool wxRichTextFontPage::TransferDataFromWindow()
else else
weight = wxNORMAL; weight = wxNORMAL;
wxFont font(attr->GetFont().Ok() ? attr->GetFont() : *wxNORMAL_FONT); attr->SetFontWeight(weight);
font.SetWeight(weight);
wxSetFontPreservingStyles(*attr, font);
attr->SetFlags(attr->GetFlags() | wxTEXT_ATTR_FONT_WEIGHT);
} }
else else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_WEIGHT)); attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_WEIGHT));
@@ -338,10 +326,7 @@ bool wxRichTextFontPage::TransferDataFromWindow()
else else
underlined = false; underlined = false;
wxFont font(attr->GetFont().Ok() ? attr->GetFont() : *wxNORMAL_FONT); attr->SetFontUnderlined(underlined);
font.SetUnderlined(underlined);
wxSetFontPreservingStyles(*attr, font);
attr->SetFlags(attr->GetFlags() | wxTEXT_ATTR_FONT_UNDERLINE);
} }
else else
attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_UNDERLINE)); attr->SetFlags(attr->GetFlags() & (~ wxTEXT_ATTR_FONT_UNDERLINE));
@@ -381,11 +366,11 @@ bool wxRichTextFontPage::TransferDataToWindow()
wxPanel::TransferDataToWindow(); wxPanel::TransferDataToWindow();
m_dontUpdate = true; m_dontUpdate = true;
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (attr->HasFont() && attr->HasFontFaceName()) if (attr->HasFontFaceName())
{ {
m_faceTextCtrl->SetValue(attr->GetFont().GetFaceName()); m_faceTextCtrl->SetValue(attr->GetFontFaceName());
m_faceListBox->SetFaceNameSelection(attr->GetFont().GetFaceName()); m_faceListBox->SetFaceNameSelection(attr->GetFont().GetFaceName());
} }
else else
@@ -394,9 +379,9 @@ bool wxRichTextFontPage::TransferDataToWindow()
m_faceListBox->SetFaceNameSelection(wxEmptyString); m_faceListBox->SetFaceNameSelection(wxEmptyString);
} }
if (attr->HasFont() && attr->HasFontSize()) if (attr->HasFontSize())
{ {
wxString strSize = wxString::Format(wxT("%d"), attr->GetFont().GetPointSize()); wxString strSize = wxString::Format(wxT("%d"), attr->GetFontSize());
m_sizeTextCtrl->SetValue(strSize); m_sizeTextCtrl->SetValue(strSize);
if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND) if (m_sizeListBox->FindString(strSize) != wxNOT_FOUND)
m_sizeListBox->SetStringSelection(strSize); m_sizeListBox->SetStringSelection(strSize);
@@ -407,9 +392,9 @@ bool wxRichTextFontPage::TransferDataToWindow()
m_sizeListBox->SetSelection(wxNOT_FOUND); m_sizeListBox->SetSelection(wxNOT_FOUND);
} }
if (attr->HasFont() && attr->HasFontWeight()) if (attr->HasFontWeight())
{ {
if (attr->GetFont().GetWeight() == wxBOLD) if (attr->GetFontWeight() == wxBOLD)
m_weightCtrl->SetSelection(1); m_weightCtrl->SetSelection(1);
else else
m_weightCtrl->SetSelection(0); m_weightCtrl->SetSelection(0);
@@ -419,9 +404,9 @@ bool wxRichTextFontPage::TransferDataToWindow()
m_weightCtrl->SetSelection(wxNOT_FOUND); m_weightCtrl->SetSelection(wxNOT_FOUND);
} }
if (attr->HasFont() && attr->HasFontItalic()) if (attr->HasFontItalic())
{ {
if (attr->GetFont().GetStyle() == wxITALIC) if (attr->GetFontStyle() == wxITALIC)
m_styleCtrl->SetSelection(1); m_styleCtrl->SetSelection(1);
else else
m_styleCtrl->SetSelection(0); m_styleCtrl->SetSelection(0);
@@ -431,9 +416,9 @@ bool wxRichTextFontPage::TransferDataToWindow()
m_styleCtrl->SetSelection(wxNOT_FOUND); m_styleCtrl->SetSelection(wxNOT_FOUND);
} }
if (attr->HasFont() && attr->HasFontUnderlined()) if (attr->HasFontUnderlined())
{ {
if (attr->GetFont().GetUnderlined()) if (attr->GetFontUnderlined())
m_underliningCtrl->SetSelection(1); m_underliningCtrl->SetSelection(1);
else else
m_underliningCtrl->SetSelection(0); m_underliningCtrl->SetSelection(0);
@@ -484,7 +469,7 @@ bool wxRichTextFontPage::TransferDataToWindow()
return true; return true;
} }
wxTextAttrEx* wxRichTextFontPage::GetAttributes() wxTextAttr* wxRichTextFontPage::GetAttributes()
{ {
return wxRichTextFormattingDialog::GetDialogAttributes(this); return wxRichTextFormattingDialog::GetDialogAttributes(this);
} }

View File

@@ -130,7 +130,7 @@ bool wxRichTextFormattingDialog::ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTe
} }
/// Set the attributes and optionally update the display /// Set the attributes and optionally update the display
bool wxRichTextFormattingDialog::SetStyle(const wxTextAttrEx& style, bool update) bool wxRichTextFormattingDialog::SetStyle(const wxTextAttr& style, bool update)
{ {
m_attributes = style; m_attributes = style;
if (update) if (update)
@@ -440,7 +440,7 @@ wxRichTextFormattingDialog* wxRichTextFormattingDialog::GetDialog(wxWindow* win)
// Helper for pages to get the attributes // Helper for pages to get the attributes
wxTextAttrEx* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win) wxTextAttr* wxRichTextFormattingDialog::GetDialogAttributes(wxWindow* win)
{ {
wxRichTextFormattingDialog* dialog = GetDialog(win); wxRichTextFormattingDialog* dialog = GetDialog(win);
if (dialog) if (dialog)

View File

@@ -79,8 +79,8 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
wxTextOutputStream str(stream); wxTextOutputStream str(stream);
wxTextAttrEx currentParaStyle = buffer->GetAttributes(); wxTextAttr currentParaStyle = buffer->GetAttributes();
wxTextAttrEx currentCharStyle = buffer->GetAttributes(); wxTextAttr currentCharStyle = buffer->GetAttributes();
if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0) if ((GetFlags() & wxRICHTEXT_HANDLER_NO_HEADER_FOOTER) == 0)
str << wxT("<html><head></head><body>\n"); str << wxT("<html><head></head><body>\n");
@@ -103,7 +103,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
if (para) if (para)
{ {
wxTextAttrEx paraStyle(para->GetCombinedAttributes()); wxTextAttr paraStyle(para->GetCombinedAttributes());
BeginParagraphFormatting(currentParaStyle, paraStyle, str); BeginParagraphFormatting(currentParaStyle, paraStyle, str);
@@ -114,7 +114,7 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText); wxRichTextPlainText* textObj = wxDynamicCast(obj, wxRichTextPlainText);
if (textObj && !textObj->IsEmpty()) if (textObj && !textObj->IsEmpty())
{ {
wxTextAttrEx charStyle(para->GetCombinedAttributes(obj->GetAttributes())); wxTextAttr charStyle(para->GetCombinedAttributes(obj->GetAttributes()));
BeginCharacterFormatting(currentCharStyle, charStyle, paraStyle, str); BeginCharacterFormatting(currentCharStyle, charStyle, paraStyle, str);
wxString text = textObj->GetText(); wxString text = textObj->GetText();
@@ -160,18 +160,18 @@ bool wxRichTextHTMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
return true; return true;
} }
void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttrEx& currentStyle, const wxTextAttrEx& thisStyle, const wxTextAttrEx& WXUNUSED(paraStyle), wxTextOutputStream& str) void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttr& currentStyle, const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& str)
{ {
wxString style; wxString style;
// Is there any change in the font properties of the item? // Is there any change in the font properties of the item?
if (thisStyle.GetFont().GetFaceName() != currentStyle.GetFont().GetFaceName()) if (thisStyle.GetFontFaceName() != currentStyle.GetFontFaceName())
{ {
wxString faceName(thisStyle.GetFont().GetFaceName()); wxString faceName(thisStyle.GetFontFaceName());
style += wxString::Format(wxT(" face=\"%s\""), faceName.c_str()); style += wxString::Format(wxT(" face=\"%s\""), faceName.c_str());
} }
if (thisStyle.GetFont().GetPointSize() != currentStyle.GetFont().GetPointSize()) if (thisStyle.GetFontSize() != currentStyle.GetFontSize())
style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFont().GetPointSize())); style += wxString::Format(wxT(" size=\"%ld\""), PtToSize(thisStyle.GetFontSize()));
if (thisStyle.GetTextColour() != currentStyle.GetTextColour() ) if (thisStyle.GetTextColour() != currentStyle.GetTextColour() )
{ {
wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX)); wxString color(thisStyle.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX));
@@ -184,27 +184,27 @@ void wxRichTextHTMLHandler::BeginCharacterFormatting(const wxTextAttrEx& current
m_font = true; m_font = true;
} }
if (thisStyle.GetFont().GetWeight() == wxBOLD) if (thisStyle.GetFontWeight() == wxBOLD)
str << wxT("<b>"); str << wxT("<b>");
if (thisStyle.GetFont().GetStyle() == wxITALIC) if (thisStyle.GetFontStyle() == wxITALIC)
str << wxT("<i>"); str << wxT("<i>");
if (thisStyle.GetFont().GetUnderlined()) if (thisStyle.GetFontUnderlined())
str << wxT("<u>"); str << wxT("<u>");
if (thisStyle.HasURL()) if (thisStyle.HasURL())
str << wxT("<a href=\"") << thisStyle.GetURL() << wxT("\">"); str << wxT("<a href=\"") << thisStyle.GetURL() << wxT("\">");
} }
void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, const wxTextAttrEx& WXUNUSED(paraStyle), wxTextOutputStream& stream) void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, const wxTextAttr& WXUNUSED(paraStyle), wxTextOutputStream& stream)
{ {
if (thisStyle.HasURL()) if (thisStyle.HasURL())
stream << wxT("</a>"); stream << wxT("</a>");
if (thisStyle.GetFont().GetUnderlined()) if (thisStyle.GetFontUnderlined())
stream << wxT("</u>"); stream << wxT("</u>");
if (thisStyle.GetFont().GetStyle() == wxITALIC) if (thisStyle.GetFontStyle() == wxITALIC)
stream << wxT("</i>"); stream << wxT("</i>");
if (thisStyle.GetFont().GetWeight() == wxBOLD) if (thisStyle.GetFontWeight() == wxBOLD)
stream << wxT("</b>"); stream << wxT("</b>");
if (m_font) if (m_font)
@@ -215,7 +215,7 @@ void wxRichTextHTMLHandler::EndCharacterFormatting(const wxTextAttrEx& WXUNUSED(
} }
/// Begin paragraph formatting /// Begin paragraph formatting
void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxTextOutputStream& str) void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& str)
{ {
if (thisStyle.HasPageBreak()) if (thisStyle.HasPageBreak())
{ {
@@ -286,7 +286,7 @@ void wxRichTextHTMLHandler::BeginParagraphFormatting(const wxTextAttrEx& WXUNUSE
} }
/// End paragraph formatting /// End paragraph formatting
void wxRichTextHTMLHandler::EndParagraphFormatting(const wxTextAttrEx& WXUNUSED(currentStyle), const wxTextAttrEx& thisStyle, wxTextOutputStream& stream) void wxRichTextHTMLHandler::EndParagraphFormatting(const wxTextAttr& WXUNUSED(currentStyle), const wxTextAttr& thisStyle, wxTextOutputStream& stream)
{ {
if (m_inTable) if (m_inTable)
{ {
@@ -322,18 +322,18 @@ void wxRichTextHTMLHandler::CloseLists(int level, wxTextOutputStream& str)
} }
/// Output font tag /// Output font tag
void wxRichTextHTMLHandler::OutputFont(const wxTextAttrEx& style, wxTextOutputStream& stream) void wxRichTextHTMLHandler::OutputFont(const wxTextAttr& style, wxTextOutputStream& stream)
{ {
if (style.HasFont()) if (style.HasFont())
{ {
stream << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\""), style.GetFont().GetFaceName().c_str(), PtToSize(style.GetFont().GetPointSize())); stream << wxString::Format(wxT("<font face=\"%s\" size=\"%ld\""), style.GetFontFaceName().c_str(), PtToSize(style.GetFontSize()));
if (style.HasTextColour()) if (style.HasTextColour())
stream << wxString::Format(wxT(" color=\"%s\""), style.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX).c_str()); stream << wxString::Format(wxT(" color=\"%s\""), style.GetTextColour().GetAsString(wxC2S_HTML_SYNTAX).c_str());
stream << wxT(" >"); stream << wxT(" >");
} }
} }
int wxRichTextHTMLHandler::TypeOfList( const wxTextAttrEx& thisStyle, wxString& tag ) int wxRichTextHTMLHandler::TypeOfList( const wxTextAttr& thisStyle, wxString& tag )
{ {
// We can use number attribute of li tag but not all the browsers support it. // We can use number attribute of li tag but not all the browsers support it.
// also wxHtmlWindow doesn't support type attribute. // also wxHtmlWindow doesn't support type attribute.
@@ -361,7 +361,7 @@ int wxRichTextHTMLHandler::TypeOfList( const wxTextAttrEx& thisStyle, wxString&
return 0; return 0;
} }
wxString wxRichTextHTMLHandler::GetAlignment( const wxTextAttrEx& thisStyle ) wxString wxRichTextHTMLHandler::GetAlignment( const wxTextAttr& thisStyle )
{ {
switch( thisStyle.GetAlignment() ) switch( thisStyle.GetAlignment() )
{ {

View File

@@ -334,7 +334,7 @@ void wxRichTextIndentsSpacingPage::CreateControls()
////@end wxRichTextIndentsSpacingPage content construction ////@end wxRichTextIndentsSpacingPage content construction
} }
wxTextAttrEx* wxRichTextIndentsSpacingPage::GetAttributes() wxTextAttr* wxRichTextIndentsSpacingPage::GetAttributes()
{ {
return wxRichTextFormattingDialog::GetDialogAttributes(this); return wxRichTextFormattingDialog::GetDialogAttributes(this);
} }
@@ -352,7 +352,7 @@ et magnis dis parturient montes, nascetur ridiculus mus. Nullam vitae justo id m
iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n"); iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
TransferDataFromWindow(); TransferDataFromWindow();
wxTextAttrEx attr(*GetAttributes()); wxTextAttr attr(*GetAttributes());
attr.SetFlags(attr.GetFlags() & attr.SetFlags(attr.GetFlags() &
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER| (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
wxTEXT_ATTR_LINE_SPACING| wxTEXT_ATTR_LINE_SPACING|
@@ -362,7 +362,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
font.SetPointSize(9); font.SetPointSize(9);
m_previewCtrl->SetFont(font); m_previewCtrl->SetFont(font);
wxTextAttrEx normalParaAttr; wxTextAttr normalParaAttr;
normalParaAttr.SetFont(font); normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
@@ -389,7 +389,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataFromWindow()
{ {
wxPanel::TransferDataFromWindow(); wxPanel::TransferDataFromWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (m_alignmentLeft->GetValue()) if (m_alignmentLeft->GetValue())
attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT); attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
@@ -464,7 +464,7 @@ bool wxRichTextIndentsSpacingPage::TransferDataToWindow()
wxPanel::TransferDataToWindow(); wxPanel::TransferDataToWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (attr->HasAlignment()) if (attr->HasAlignment())
{ {

View File

@@ -530,7 +530,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
wxRichTextStyleSheet* styleSheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet(); wxRichTextStyleSheet* styleSheet = wxRichTextFormattingDialog::GetDialog(this)->GetStyleSheet();
wxTextAttrEx attr(styleSheet ? def->GetStyle() : def->GetStyleMergedWithBase(styleSheet)); wxTextAttr attr(styleSheet ? def->GetStyle() : def->GetStyleMergedWithBase(styleSheet));
attr.SetFlags(attr.GetFlags() & attr.SetFlags(attr.GetFlags() &
(wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER| (wxTEXT_ATTR_ALIGNMENT|wxTEXT_ATTR_LEFT_INDENT|wxTEXT_ATTR_RIGHT_INDENT|wxTEXT_ATTR_PARA_SPACING_BEFORE|wxTEXT_ATTR_PARA_SPACING_AFTER|
@@ -541,7 +541,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
font.SetPointSize(9); font.SetPointSize(9);
m_previewCtrl->SetFont(font); m_previewCtrl->SetFont(font);
wxTextAttrEx normalParaAttr; wxTextAttr normalParaAttr;
normalParaAttr.SetFont(font); normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
@@ -558,7 +558,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
int i; int i;
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
wxTextAttrEx levelAttr = * def->GetLevelAttributes(i); wxTextAttr levelAttr = * def->GetLevelAttributes(i);
levelAttr.SetBulletNumber(1); levelAttr.SetBulletNumber(1);
m_previewCtrl->BeginStyle(levelAttr); m_previewCtrl->BeginStyle(levelAttr);
m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2); m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2);
@@ -583,7 +583,7 @@ bool wxRichTextListStylePage::TransferDataFromWindow()
m_currentLevel = m_levelCtrl->GetValue(); m_currentLevel = m_levelCtrl->GetValue();
wxRichTextAttr* attr = GetAttributesForSelection(); wxTextAttr* attr = GetAttributesForSelection();
if (m_alignmentLeft->GetValue()) if (m_alignmentLeft->GetValue())
attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT); attr->SetAlignment(wxTEXT_ALIGNMENT_LEFT);
@@ -721,7 +721,7 @@ void wxRichTextListStylePage::DoTransferDataToWindow()
wxPanel::TransferDataToWindow(); wxPanel::TransferDataToWindow();
wxRichTextAttr* attr = GetAttributesForSelection(); wxTextAttr* attr = GetAttributesForSelection();
if (attr->HasAlignment()) if (attr->HasAlignment())
{ {
@@ -877,7 +877,7 @@ void wxRichTextListStylePage::DoTransferDataToWindow()
} }
/// Get attributes for selected level /// Get attributes for selected level
wxRichTextAttr* wxRichTextListStylePage::GetAttributesForSelection() wxTextAttr* wxRichTextListStylePage::GetAttributesForSelection()
{ {
wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this), wxRichTextListStyleDefinition* def = wxDynamicCast(wxRichTextFormattingDialog::GetDialogStyleDefinition(this),
wxRichTextListStyleDefinition); wxRichTextListStyleDefinition);
@@ -1282,7 +1282,7 @@ void wxRichTextListStylePage::OnStandardBulletUpdate( wxUpdateUIEvent& event )
void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) ) void wxRichTextListStylePage::OnChooseFontClick( wxCommandEvent& WXUNUSED(event) )
{ {
wxRichTextAttr* attr = GetAttributesForSelection(); wxTextAttr* attr = GetAttributesForSelection();
int pages = wxRICHTEXT_FORMAT_FONT; int pages = wxRICHTEXT_FORMAT_FONT;
wxRichTextFormattingDialog formatDlg; wxRichTextFormattingDialog formatDlg;

View File

@@ -426,13 +426,13 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition); wxRichTextListStyleDefinition* listDef = wxDynamicCast(def, wxRichTextListStyleDefinition);
wxTextAttrEx attr(def->GetStyleMergedWithBase(GetStyleSheet())); wxTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet()));
wxFont font(m_previewCtrl->GetFont()); wxFont font(m_previewCtrl->GetFont());
font.SetPointSize(9); font.SetPointSize(9);
m_previewCtrl->SetFont(font); m_previewCtrl->SetFont(font);
wxTextAttrEx normalParaAttr; wxTextAttr normalParaAttr;
normalParaAttr.SetFont(font); normalParaAttr.SetFont(font);
normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY"))); normalParaAttr.SetTextColour(wxColour(wxT("LIGHT GREY")));
@@ -451,7 +451,7 @@ iaculis malesuada. Donec bibendum ipsum ut ante porta fringilla.\n");
int i; int i;
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
{ {
wxTextAttrEx levelAttr = * listDef->GetLevelAttributes(i); wxTextAttr levelAttr = * listDef->GetLevelAttributes(i);
levelAttr.SetBulletNumber(1); levelAttr.SetBulletNumber(1);
m_previewCtrl->BeginStyle(levelAttr); m_previewCtrl->BeginStyle(levelAttr);
m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2List); m_previewCtrl->WriteText(wxString::Format(wxT("\nList level %d. "), i+1) + s_para2List);

View File

@@ -245,7 +245,7 @@ bool wxRichTextStylePage::TransferDataToWindow()
return true; return true;
} }
wxTextAttrEx* wxRichTextStylePage::GetAttributes() wxTextAttr* wxRichTextStylePage::GetAttributes()
{ {
return wxRichTextFormattingDialog::GetDialogAttributes(this); return wxRichTextFormattingDialog::GetDialogAttributes(this);
} }

View File

@@ -54,14 +54,14 @@ bool wxRichTextStyleDefinition::Eq(const wxRichTextStyleDefinition& def) const
} }
/// Gets the style combined with the base style /// Gets the style combined with the base style
wxRichTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const wxTextAttr wxRichTextStyleDefinition::GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const
{ {
if (!m_baseStyle.IsEmpty()) if (!m_baseStyle.IsEmpty())
{ {
wxRichTextStyleDefinition* baseStyle = sheet->FindStyle(m_baseStyle); wxRichTextStyleDefinition* baseStyle = sheet->FindStyle(m_baseStyle);
if (baseStyle) if (baseStyle)
{ {
wxRichTextAttr baseAttr = baseStyle->GetStyleMergedWithBase(sheet); wxTextAttr baseAttr = baseStyle->GetStyleMergedWithBase(sheet);
baseAttr.Apply(m_style, NULL); baseAttr.Apply(m_style, NULL);
return baseAttr; return baseAttr;
} }
@@ -111,14 +111,14 @@ bool wxRichTextListStyleDefinition::operator ==(const wxRichTextListStyleDefinit
} }
/// Sets/gets the attributes for the given level /// Sets/gets the attributes for the given level
void wxRichTextListStyleDefinition::SetLevelAttributes(int i, const wxRichTextAttr& attr) void wxRichTextListStyleDefinition::SetLevelAttributes(int i, const wxTextAttr& attr)
{ {
wxASSERT( (i >= 0 && i < 10) ); wxASSERT( (i >= 0 && i < 10) );
if (i >= 0 && i < 10) if (i >= 0 && i < 10)
m_levelStyles[i] = attr; m_levelStyles[i] = attr;
} }
const wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) const const wxTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) const
{ {
wxASSERT( (i >= 0 && i < 10) ); wxASSERT( (i >= 0 && i < 10) );
if (i >= 0 && i < 10) if (i >= 0 && i < 10)
@@ -127,7 +127,7 @@ const wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) c
return NULL; return NULL;
} }
wxRichTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i) wxTextAttr* wxRichTextListStyleDefinition::GetLevelAttributes(int i)
{ {
wxASSERT( (i >= 0 && i < 10) ); wxASSERT( (i >= 0 && i < 10) );
if (i >= 0 && i < 10) if (i >= 0 && i < 10)
@@ -142,7 +142,7 @@ void wxRichTextListStyleDefinition::SetAttributes(int i, int leftIndent, int lef
wxASSERT( (i >= 0 && i < 10) ); wxASSERT( (i >= 0 && i < 10) );
if (i >= 0 && i < 10) if (i >= 0 && i < 10)
{ {
wxRichTextAttr attr; wxTextAttr attr;
attr.SetBulletStyle(bulletStyle); attr.SetBulletStyle(bulletStyle);
attr.SetLeftIndent(leftIndent, leftSubIndent); attr.SetLeftIndent(leftIndent, leftSubIndent);
@@ -178,11 +178,11 @@ int wxRichTextListStyleDefinition::FindLevelForIndent(int indent) const
/// Combine the list style with a paragraph style, using the given indent (from which /// Combine the list style with a paragraph style, using the given indent (from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr wxRichTextListStyleDefinition::CombineWithParagraphStyle(int indent, const wxRichTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet) wxTextAttr wxRichTextListStyleDefinition::CombineWithParagraphStyle(int indent, const wxTextAttr& paraStyle, wxRichTextStyleSheet* styleSheet)
{ {
int listLevel = FindLevelForIndent(indent); int listLevel = FindLevelForIndent(indent);
wxRichTextAttr attr(*GetLevelAttributes(listLevel)); wxTextAttr attr(*GetLevelAttributes(listLevel));
int oldLeftIndent = attr.GetLeftIndent(); int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent(); int oldLeftSubIndent = attr.GetLeftSubIndent();
@@ -203,7 +203,7 @@ wxRichTextAttr wxRichTextListStyleDefinition::CombineWithParagraphStyle(int inde
/// Combine the base and list style, using the given indent (from which /// Combine the base and list style, using the given indent (from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr wxRichTextListStyleDefinition::GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet) wxTextAttr wxRichTextListStyleDefinition::GetCombinedStyle(int indent, wxRichTextStyleSheet* styleSheet)
{ {
int listLevel = FindLevelForIndent(indent); int listLevel = FindLevelForIndent(indent);
return GetCombinedStyleForLevel(listLevel, styleSheet); return GetCombinedStyleForLevel(listLevel, styleSheet);
@@ -211,9 +211,9 @@ wxRichTextAttr wxRichTextListStyleDefinition::GetCombinedStyle(int indent, wxRic
/// Combine the base and list style, using the given indent (from which /// Combine the base and list style, using the given indent (from which
/// an appropriate level is found) /// an appropriate level is found)
wxRichTextAttr wxRichTextListStyleDefinition::GetCombinedStyleForLevel(int listLevel, wxRichTextStyleSheet* styleSheet) wxTextAttr wxRichTextListStyleDefinition::GetCombinedStyleForLevel(int listLevel, wxRichTextStyleSheet* styleSheet)
{ {
wxRichTextAttr attr(*GetLevelAttributes(listLevel)); wxTextAttr attr(*GetLevelAttributes(listLevel));
int oldLeftIndent = attr.GetLeftIndent(); int oldLeftIndent = attr.GetLeftIndent();
int oldLeftSubIndent = attr.GetLeftSubIndent(); int oldLeftSubIndent = attr.GetLeftSubIndent();
@@ -590,7 +590,7 @@ wxString wxRichTextStyleListBox::CreateHTML(wxRichTextStyleDefinition* def) cons
bool isCentred = false; bool isCentred = false;
wxRichTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet())); wxTextAttr attr(def->GetStyleMergedWithBase(GetStyleSheet()));
if (attr.HasAlignment() && attr.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE) if (attr.HasAlignment() && attr.GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
isCentred = true; isCentred = true;
@@ -722,7 +722,7 @@ wxString wxRichTextStyleListBox::GetStyleToShowInIdleTime(wxRichTextCtrl* ctrl,
// Take into account current default style just chosen by user // Take into account current default style just chosen by user
if (ctrl->IsDefaultStyleShowing()) if (ctrl->IsDefaultStyleShowing())
{ {
wxTextAttrEx attr; wxTextAttr attr;
ctrl->GetStyle(adjustedCaretPos, attr); ctrl->GetStyle(adjustedCaretPos, attr);
wxRichTextApplyStyle(attr, ctrl->GetDefaultStyleEx()); wxRichTextApplyStyle(attr, ctrl->GetDefaultStyleEx());

View File

@@ -159,7 +159,7 @@ bool wxRichTextTabsPage::TransferDataFromWindow()
{ {
wxPanel::TransferDataFromWindow(); wxPanel::TransferDataFromWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
if (m_tabsPresent) if (m_tabsPresent)
{ {
@@ -178,7 +178,7 @@ bool wxRichTextTabsPage::TransferDataToWindow()
{ {
wxPanel::TransferDataToWindow(); wxPanel::TransferDataToWindow();
wxTextAttrEx* attr = GetAttributes(); wxTextAttr* attr = GetAttributes();
m_tabListCtrl->Clear(); m_tabListCtrl->Clear();
m_tabEditCtrl->SetValue(wxEmptyString); m_tabEditCtrl->SetValue(wxEmptyString);
@@ -226,7 +226,7 @@ void wxRichTextTabsPage::SortTabs()
} }
} }
wxTextAttrEx* wxRichTextTabsPage::GetAttributes() wxTextAttr* wxRichTextTabsPage::GetAttributes()
{ {
return wxRichTextFormattingDialog::GetDialogAttributes(this); return wxRichTextFormattingDialog::GetDialogAttributes(this);
} }

View File

@@ -270,7 +270,7 @@ bool wxRichTextXMLHandler::ImportStyleDefinition(wxRichTextStyleSheet* sheet, wx
{ {
if (child->GetName() == wxT("style")) if (child->GetName() == wxT("style"))
{ {
wxTextAttrEx attr; wxTextAttr attr;
GetStyle(attr, child, false); GetStyle(attr, child, false);
def->SetStyle(attr); def->SetStyle(attr);
} }
@@ -292,7 +292,7 @@ bool wxRichTextXMLHandler::ImportStyleDefinition(wxRichTextStyleSheet* sheet, wx
{ {
if (child->GetName() == wxT("style")) if (child->GetName() == wxT("style"))
{ {
wxTextAttrEx attr; wxTextAttr attr;
GetStyle(attr, child, false); GetStyle(attr, child, false);
def->SetStyle(attr); def->SetStyle(attr);
} }
@@ -314,7 +314,7 @@ bool wxRichTextXMLHandler::ImportStyleDefinition(wxRichTextStyleSheet* sheet, wx
{ {
if (child->GetName() == wxT("style")) if (child->GetName() == wxT("style"))
{ {
wxTextAttrEx attr; wxTextAttr attr;
GetStyle(attr, child, false); GetStyle(attr, child, false);
wxString styleLevel = child->GetAttribute(wxT("level"), wxEmptyString); wxString styleLevel = child->GetAttribute(wxT("level"), wxEmptyString);
@@ -834,7 +834,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxMBCon
int i; int i;
for (i = 0; i < 10; i ++) for (i = 0; i < 10; i ++)
{ {
wxRichTextAttr* levelAttr = listDef->GetLevelAttributes(i); wxTextAttr* levelAttr = listDef->GetLevelAttributes(i);
if (levelAttr) if (levelAttr)
{ {
wxString style = CreateStyle(def->GetStyle(), false); wxString style = CreateStyle(def->GetStyle(), false);
@@ -882,7 +882,7 @@ bool wxRichTextXMLHandler::ExportStyleDefinition(wxOutputStream& stream, wxMBCon
} }
/// Create style parameters /// Create style parameters
wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttrEx& attr, bool isPara) wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttr& attr, bool isPara)
{ {
wxString str; wxString str;
if (attr.HasTextColour() && attr.GetTextColour().Ok()) if (attr.HasTextColour() && attr.GetTextColour().Ok())
@@ -894,26 +894,23 @@ wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttrEx& attr, bool isPara
str << wxT(" bgcolor=\"#") << ColourToHexString(attr.GetBackgroundColour()) << wxT("\""); str << wxT(" bgcolor=\"#") << ColourToHexString(attr.GetBackgroundColour()) << wxT("\"");
} }
if (attr.GetFont().Ok())
{
if (attr.HasFontSize()) if (attr.HasFontSize())
str << wxT(" fontsize=\"") << attr.GetFont().GetPointSize() << wxT("\""); str << wxT(" fontsize=\"") << attr.GetFontSize() << wxT("\"");
//if (attr.HasFontFamily()) //if (attr.HasFontFamily())
// str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\""); // str << wxT(" fontfamily=\"") << attr.GetFont().GetFamily() << wxT("\"");
if (attr.HasFontItalic()) if (attr.HasFontItalic())
str << wxT(" fontstyle=\"") << attr.GetFont().GetStyle() << wxT("\""); str << wxT(" fontstyle=\"") << attr.GetFontStyle() << wxT("\"");
if (attr.HasFontWeight()) if (attr.HasFontWeight())
str << wxT(" fontweight=\"") << attr.GetFont().GetWeight() << wxT("\""); str << wxT(" fontweight=\"") << attr.GetFontWeight() << wxT("\"");
if (attr.HasFontUnderlined()) if (attr.HasFontUnderlined())
str << wxT(" fontunderlined=\"") << (int) attr.GetFont().GetUnderlined() << wxT("\""); str << wxT(" fontunderlined=\"") << (int) attr.GetFontUnderlined() << wxT("\"");
if (attr.HasFontFaceName()) if (attr.HasFontFaceName())
str << wxT(" fontface=\"") << attr.GetFont().GetFaceName() << wxT("\""); str << wxT(" fontface=\"") << attr.GetFontFaceName() << wxT("\"");
}
if (attr.HasTextEffects()) if (attr.HasTextEffects())
{ {
@@ -1009,20 +1006,20 @@ wxString wxRichTextXMLHandler::CreateStyle(const wxTextAttrEx& attr, bool isPara
} }
/// Get style parameters /// Get style parameters
bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool isPara) bool wxRichTextXMLHandler::GetStyle(wxTextAttr& attr, wxXmlNode* node, bool isPara)
{ {
wxString fontFacename; wxString fontFacename;
int fontSize = 12; int fontSize = 12;
int fontFamily = wxDEFAULT; // int fontFamily = wxDEFAULT;
int fontWeight = wxNORMAL; int fontWeight = wxNORMAL;
int fontStyle = wxNORMAL; int fontStyle = wxNORMAL;
bool fontUnderlined = false; bool fontUnderlined = false;
int fontFlags = 0; // int fontFlags = 0;
fontFacename = node->GetAttribute(wxT("fontface"), wxEmptyString); fontFacename = node->GetAttribute(wxT("fontface"), wxEmptyString);
if (!fontFacename.IsEmpty()) if (!fontFacename.IsEmpty())
fontFlags |= wxTEXT_ATTR_FONT_FACE; attr.SetFontFaceName(fontFacename);
wxString value; wxString value;
//value = node->GetAttribute(wxT("fontfamily"), wxEmptyString); //value = node->GetAttribute(wxT("fontfamily"), wxEmptyString);
@@ -1033,38 +1030,30 @@ bool wxRichTextXMLHandler::GetStyle(wxTextAttrEx& attr, wxXmlNode* node, bool is
if (!value.empty()) if (!value.empty())
{ {
fontStyle = wxAtoi(value); fontStyle = wxAtoi(value);
fontFlags |= wxTEXT_ATTR_FONT_ITALIC; attr.SetFontStyle(fontStyle);
} }
value = node->GetAttribute(wxT("fontsize"), wxEmptyString); value = node->GetAttribute(wxT("fontsize"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontSize = wxAtoi(value); fontSize = wxAtoi(value);
fontFlags |= wxTEXT_ATTR_FONT_SIZE; attr.SetFontSize(fontSize);
} }
value = node->GetAttribute(wxT("fontweight"), wxEmptyString); value = node->GetAttribute(wxT("fontweight"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontWeight = wxAtoi(value); fontWeight = wxAtoi(value);
fontFlags |= wxTEXT_ATTR_FONT_WEIGHT; attr.SetFontWeight(fontWeight);
} }
value = node->GetAttribute(wxT("fontunderlined"), wxEmptyString); value = node->GetAttribute(wxT("fontunderlined"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {
fontUnderlined = wxAtoi(value) != 0; fontUnderlined = wxAtoi(value) != 0;
fontFlags |= wxTEXT_ATTR_FONT_UNDERLINE; attr.SetFontUnderlined(fontUnderlined);
} }
attr.SetFlags(fontFlags);
if (attr.HasFlag(wxTEXT_ATTR_FONT))
attr.SetFont(* wxTheFontList->FindOrCreateFont(fontSize, fontFamily, fontStyle, fontWeight, fontUnderlined, fontFacename));
// Restore correct font flags
attr.SetFlags(fontFlags);
value = node->GetAttribute(wxT("textcolor"), wxEmptyString); value = node->GetAttribute(wxT("textcolor"), wxEmptyString);
if (!value.empty()) if (!value.empty())
{ {