From 62a268cc71a93c9fd2d696bc85b323e232f44a20 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 10 Oct 2006 16:48:47 +0000 Subject: [PATCH] Added some missing newlines to ends of files (necessary for linear RTF) Added rich text control formatting and symbol dialogs API changes for wxRichTextCtrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/category.tex | 4 +- docs/latex/wx/classes.tex | 2 + docs/latex/wx/notebook.tex | 2 +- docs/latex/wx/richtextattr.tex | 15 + docs/latex/wx/richtextbuffer.tex | 121 ++++++++ .../wx/richtextcharacterstyledefinition.tex | 1 + docs/latex/wx/richtextctrl.tex | 155 +++++++++- docs/latex/wx/richtextevent.tex | 4 +- docs/latex/wx/richtextfilehandler.tex | 1 + docs/latex/wx/richtextformattingdialog.tex | 272 ++++++++++++++++++ docs/latex/wx/richtexthtmlhandler.tex | 1 + docs/latex/wx/richtextoverview.tex | 14 +- .../wx/richtextparagraphstyledefinition.tex | 1 + docs/latex/wx/richtextrange.tex | 19 +- docs/latex/wx/richtextstylelistbox.tex | 89 +++++- docs/latex/wx/richtextstylesheet.tex | 1 + docs/latex/wx/symbolpickerdialog.tex | 180 ++++++++++++ docs/latex/wx/textattrex.tex | 15 + docs/latex/wx/tsamples.tex | 1 + docs/latex/wx/window.tex | 1 + 20 files changed, 883 insertions(+), 16 deletions(-) create mode 100644 docs/latex/wx/richtextformattingdialog.tex create mode 100644 docs/latex/wx/symbolpickerdialog.tex diff --git a/docs/latex/wx/category.tex b/docs/latex/wx/category.tex index 750d1456b7..91cbd1ac13 100644 --- a/docs/latex/wx/category.tex +++ b/docs/latex/wx/category.tex @@ -18,8 +18,8 @@ Frames and dialogs are similar in wxWidgets, but only dialogs may be modal. \twocolitem{\helpref{wxMDIChildFrame}{wxmdichildframe}}{MDI child frame} \twocolitem{\helpref{wxMDIParentFrame}{wxmdiparentframe}}{MDI parent frame} \twocolitem{\helpref{wxMiniFrame}{wxminiframe}}{A frame with a small title bar} -\twocolitem{\helpref{wxSplashScreen}{wxsplashscreen}}{Splash screen class} \twocolitem{\helpref{wxPropertySheetDialog}{wxpropertysheetdialog}}{Property sheet dialog} +\twocolitem{\helpref{wxSplashScreen}{wxsplashscreen}}{Splash screen class} %\twocolitem{\helpref{wxTabbedDialog}{wxtabbeddialog}}{Tabbed dialog %(deprecated, use wxNotebook instead)} \twocolitem{\helpref{wxTipWindow}{wxtipwindow}}{Shows text in a small window} @@ -75,6 +75,8 @@ in an application. \twocolitem{\helpref{wxPrintDialog}{wxprintdialog}}{Standard print dialog} \twocolitem{\helpref{wxProgressDialog}{wxprogressdialog}}{Progress indication dialog} \twocolitem{\helpref{wxMessageDialog}{wxmessagedialog}}{Simple message box dialog} +\twocolitem{\helpref{wxSymbolPickerDialog}{wxsymbolpickerdialog}}{Symbol selector dialog} +\twocolitem{\helpref{wxRichTextFormattingDialog}{wxrichtextformattingdialog}}{A dialog for formatting the content of a wxRichTextCtrl} \twocolitem{\helpref{wxWizard}{wxwizard}}{A wizard dialog.} \end{twocollist} diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index 08aa6d1a82..ac166e930b 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -307,6 +307,7 @@ \input richtextctrl.tex \input richtextevent.tex \input richtextfilehandler.tex +\input richtextformattingdialog.tex \input richtexthtmlhandler.tex \input richtextparagraphstyledefinition.tex \input richtextrange.tex @@ -367,6 +368,7 @@ \input sistream.tex \input sostream.tex \input tokenizr.tex +\input symbolpickerdialog.tex \input sysclevt.tex \input sysopt.tex \input settings.tex diff --git a/docs/latex/wx/notebook.tex b/docs/latex/wx/notebook.tex index 038be5568b..3a714b6f18 100644 --- a/docs/latex/wx/notebook.tex +++ b/docs/latex/wx/notebook.tex @@ -412,7 +412,6 @@ This function is deprecated and should not be used in new code. Please use the \helpref{wxNotebook::GetSelection}{wxnotebookgetselection} - \membersection{wxNotebook::ChangeSelection}\label{wxnotebookchangeselection} \func{int}{ChangeSelection}{\param{size\_t}{ page}} @@ -422,3 +421,4 @@ Changes the selection for the given page, returning the previous selection. The call to this function \emph{does not} generate the page changing events. This is the only difference with \helpref{SetSelection}{wxnotebooksetselection}. See \helpref{this topic}{progevent} for more info. + diff --git a/docs/latex/wx/richtextattr.tex b/docs/latex/wx/richtextattr.tex index dad254d20c..375451cf14 100644 --- a/docs/latex/wx/richtextattr.tex +++ b/docs/latex/wx/richtextattr.tex @@ -143,6 +143,13 @@ See \helpref{wxRichTextAttr::SetAlignment}{wxrichtextattrsetalignment} for a lis 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::GetBulletNumber}\label{wxrichtextattrgetbulletnumber} \constfunc{int}{GetBulletNumber}{\void} @@ -446,6 +453,13 @@ enum wxTextAttrAlignment 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::SetBulletNumber}\label{wxrichtextattrsetbulletnumber} \func{void}{SetBulletNumber}{\param{int }{n}} @@ -638,3 +652,4 @@ Assignment from a \helpref{wxRichTextAttr}{wxrichtextattr} object. \constfunc{operator}{wxTextAttrEx}{\void} Makes a \helpref{wxTextAttrEx}{wxtextattrex} object from this object. + diff --git a/docs/latex/wx/richtextbuffer.tex b/docs/latex/wx/richtextbuffer.tex index bcefb8c2f7..c177b3f5e5 100644 --- a/docs/latex/wx/richtextbuffer.tex +++ b/docs/latex/wx/richtextbuffer.tex @@ -403,6 +403,15 @@ Finds a handler by name. Finds a handler by filename or, if supplied, type. +\membersection{wxRichTextBuffer::GetBasicStyle}\label{wxrichtextbuffergetbasicstyle} + +\constfunc{const wxTextAttrEx\&}{GetBasicStyle}{\void} + +Gets the basic (overall) style. This is the style of the whole +buffer before further styles are applied, unlike the default style, which +only affects the style currently being applied (for example, setting the default +style to bold will cause subsequently inserted text to be bold). + \membersection{wxRichTextBuffer::GetBatchedCommand}\label{wxrichtextbuffergetbatchedcommand} \constfunc{wxRichTextCommand*}{GetBatchedCommand}{\void} @@ -416,6 +425,13 @@ Gets the collapsed command. Gets the command processor. A text buffer always creates its own command processor when it is initialized. +\membersection{wxRichTextBuffer::GetDefaultStyle}\label{wxrichtextbuffergetdefaultstyle} + +\constfunc{const wxTextAttrEx\&}{GetDefaultStyle}{\void} + +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). + \membersection{wxRichTextBuffer::GetExtWildcard}\label{wxrichtextbuffergetextwildcard} \func{wxString}{GetExtWildcard}{\param{bool }{combine = false}, \param{bool }{save = false}, \param{wxArrayInt* }{types = NULL}} @@ -430,6 +446,41 @@ used to determine the type to pass to \helpref{LoadFile}{wxrichtextbuffergetextw Returns the list of file handlers. +\membersection{wxRichTextBuffer::GetStyle}\label{wxrichtextbuffergetstyle} + +\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} + +\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} + +Gets the attributes at the given position. + +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 +or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextbuffergetuncombinedstyle}. + +\membersection{wxRichTextBuffer::GetStyleForRange}\label{wxrichtextbuffergetstyleforrange} + +\func{bool}{GetStyleForRange}{\param{const wxRichTextRange\&}{ range}, \param{wxTextAttrEx\& }{style}} + +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 +flags. + +The function is used to get the attributes to display in the formatting dialog: the user +can edit the attributes common to the selection, and optionally specify the values of further +attributes to be applied uniformly. + +To apply the edited attributes, you can use \helpref{SetStyle}{wxrichtextbuffersetstyle} specifying +the wxRICHTEXT\_SETSTYLE\_OPTIMIZE flag, which will only apply attributes that are different +from the {\it combined} attributes within the range. So, the user edits the effective, displayed attributes +for the range, but his choice won't be applied unnecessarily to content. As an example, +say the style for a paragraph specifies bold, but the paragraph text doesn't specify a weight. The +combined style is bold, and this is what the user will see on-screen and in the formatting +dialog. The user now specifies red text, in addition to bold. When applying with +SetStyle, the content font weight attributes won't be changed to bold because this is already specified +by the paragraph. However the text colour attributes {\it will} be changed to +show red. + \membersection{wxRichTextBuffer::GetStyleSheet}\label{wxrichtextbuffergetstylesheet} \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} @@ -442,6 +493,21 @@ Returns the current style sheet associated with the buffer, if any. Get the size of the style stack, for example to check correct nesting. +\membersection{wxRichTextBuffer::GetUncombinedStyle}\label{wxrichtextbuffergetuncombinedstyle} + +\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} + +\func{bool}{GetUncombinedStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} + +Gets the attributes at the given position. + +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 +screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextbuffergetstyle}. + +If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch +the paragraph attributes. Otherwise, it will return the character attributes. + \membersection{wxRichTextBuffer::HitTest}\label{wxrichtextbufferhittest} \func{int}{HitTest}{\param{wxDC\& }{dc}, \param{const wxPoint\& }{pt}, \param{long\& }{textPosition}} @@ -552,6 +618,61 @@ Saves content to a stream. Saves content to a file. +\membersection{wxRichTextBuffer::SetBasicStyle}\label{wxrichtextbuffersetbasicstyle} + +\func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} + +\func{void}{SetBasicStyle}{\param{const wxTextAttrEx\& }{style}} + +Sets the basic (overall) style. This is the style of the whole +buffer before further styles are applied, unlike the default style, which +only affects the style currently being applied (for example, setting the default +style to bold will cause subsequently inserted text to be bold). + +\membersection{wxRichTextBuffer::SetDefaultStyle}\label{wxrichtextbuffersetdefaultstyle} + +\func{void}{SetDefaultStyle}{\param{const wxTextAttrEx\& }{style}} + +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). + +This is not cumulative - setting the default style will replace the previous default style. + +\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 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. + +The end point of range is specified as the last character position of the span of text. +So, for example, to set the style for a character at position 5, use the range (5,5). +This differs from the wxRichTextCtrl API, where you would specify (5,6). + +{\it flags} may contain a bit list of the following values: + +\begin{verbatim} +#define wxRICHTEXT_SETSTYLE_NONE 0x00 + +// Specifies that this operation should be undoable +#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 + +// Specifies that the style should not be applied if the +// combined style at this point is already the style in question. +#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 + +// Specifies that the style should only be applied to paragraphs, +// and not the content. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 + +// Specifies that the style should only be applied to characters, +// and not the paragraph. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 +\end{verbatim} + \membersection{wxRichTextBuffer::SetStyleSheet}\label{wxrichtextbuffersetstylesheet} \func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}} diff --git a/docs/latex/wx/richtextcharacterstyledefinition.tex b/docs/latex/wx/richtextcharacterstyledefinition.tex index 04995f286a..ca231698b9 100644 --- a/docs/latex/wx/richtextcharacterstyledefinition.tex +++ b/docs/latex/wx/richtextcharacterstyledefinition.tex @@ -25,3 +25,4 @@ Constructor. \func{}{\destruct{wxRichTextCharacterStyleDefinition}}{\void} Destructor. + diff --git a/docs/latex/wx/richtextctrl.tex b/docs/latex/wx/richtextctrl.tex index 89a2d73ed2..62d1834713 100644 --- a/docs/latex/wx/richtextctrl.tex +++ b/docs/latex/wx/richtextctrl.tex @@ -67,6 +67,22 @@ Apples bold to the selection (undoable). Applies italic to the selection (undoable). +\membersection{wxRichTextCtrl::ApplyStyle}\label{wxrichtextctrlapplystyle} + +\func{bool}{ApplyStyle}{\param{wxRichTextStyleDefinition*}{ def}} + +Applies the given style to the selection. + +\membersection{wxRichTextCtrl::ApplyStyleSheet}\label{wxrichtextctrlapplystylesheet} + +\func{bool}{ApplyStyleSheet}{\param{wxRichTextStyleSheet*}{ sheet $=$ NULL}} + +Applies the style sheet to the buffer, matching paragraph styles in the sheet against named styles +in the buffer. This might be useful if the styles have changed. If {\it sheet} is NULL, the +sheet set with SetStyleSheet is used. + +Currently this applies paragraph styles only. + \membersection{wxRichTextCtrl::ApplyUnderlineToSelection}\label{wxrichtextctrlapplyunderlinetoselection} \func{bool}{ApplyUnderlineToSelection}{\void} @@ -147,7 +163,6 @@ Begins appling line spacing. {\it spacing} is a multiple, where 10 means single- 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 @@ -577,11 +592,17 @@ Transforms logical (unscrolled) position to physical window position. Gets the text for the given range. +The end point of range is specified as the last character position of the span of text, plus one. + \membersection{wxRichTextCtrl::GetSelection}\label{wxrichtextctrlgetselection} \constfunc{void}{GetSelection}{\param{long* }{from}, \param{long* }{to}} -Returns the range of the current selection. If the return values {\it from} and {\it to} are the same, there is no selection. +Returns the range of the current selection. + +The end point of range is specified as the last character position of the span of text, plus one. + +If the return values {\it from} and {\it to} are the same, there is no selection. \membersection{wxRichTextCtrl::GetSelectionRange}\label{wxrichtextctrlgetselectionrange} @@ -597,13 +618,19 @@ Returns the text within the current selection range, if any. \membersection{wxRichTextCtrl::GetStyle}\label{wxrichtextctrlgetstyle} -\constfunc{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} +\func{bool}{GetStyle}{\param{long }{position}, \param{wxRichTextAttr\& }{style}} -\constfunc{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} +\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttrEx\& }{style}} + +\func{bool}{GetStyle}{\param{long }{position}, \param{wxTextAttr\& }{style}} Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient 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 +of combining base style, paragraph style and character style attributes. To get the character +or paragraph style alone, use \helpref{GetUncombinedStyle}{wxrichtextctrlgetuncombinedstyle}. + \membersection{wxRichTextCtrl::GetStyleSheet}\label{wxrichtextctrlgetstylesheet} \constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} @@ -611,6 +638,24 @@ because it does not use wxFont objects. Returns the style sheet associated with the control, if any. A style sheet allows named character and paragraph styles to be applied. +\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}} + +Gets the attributes at the given position. The wxRichTextAttr version is generally more efficient +because it does not use wxFont objects. + +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 +screen. To get the combined attributes, use \helpref{GetStyle}{wxrichtextctrlgetstyle}. + +If you specify (any) paragraph attribute in {\it style}'s flags, this function will fetch +the paragraph attributes. Otherwise, it will return the character attributes. + \membersection{wxRichTextCtrl::GetValue}\label{wxrichtextctrlgetvalue} \constfunc{wxString}{GetValue}{\void} @@ -676,6 +721,50 @@ Initialises the members of the control. Initialises the command event. +\membersection{wxRichTextCtrl::IsDefaultStyleShowing}\label{wxrichtextctrlisdefaultstyleshowing} + +\constfunc{bool}{IsDefaultStyleShowing}{\void} + +Returns \true if the user has recently set the default style without moving the caret, +and therefore the UI needs to reflect the default style and not the style at the caret. + +Below is an example of code that uses this function to determine whether the UI +should show that the current style is bold. + +\begin{verbatim} +/// Is all of the selection bold? +bool wxRichTextCtrl::IsSelectionBold() +{ + if (HasSelection()) + { + wxRichTextAttr attr; + wxRichTextRange range = GetInternalSelectionRange(); + attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); + attr.SetFontWeight(wxBOLD); + + return HasCharacterAttributes(range, attr); + } + else + { + // If no selection, then we need to combine current style with default style + // to see what the effect would be if we started typing. + wxRichTextAttr attr; + attr.SetFlags(wxTEXT_ATTR_FONT_WEIGHT); + + long pos = GetAdjustedCaretPosition(GetCaretPosition()); + if (GetStyle(pos, attr)) + { + if (IsDefaultStyleShowing()) + wxRichTextApplyStyle(attr, GetDefaultStyleEx()); + return attr.GetFontWeight() == wxBOLD; + } + } + return false; +} +\end{verbatim} + +See also \helpref{SetAndShowDefaultStyle}{wxrichtextctrlsetandshowdefaultstyle}. + \membersection{wxRichTextCtrl::IsEditable}\label{wxrichtextctrliseditable} \constfunc{bool}{IsEditable}{\void} @@ -1031,6 +1120,15 @@ Selects all the text in the buffer. Cancels any selection. +\membersection{wxRichTextCtrl::SetAndShowDefaultStyle}\label{wxrichtextctrlsetandshowdefaultstyle} + +\func{void}{SetAndShowDefaultStyle}{\param{const wxRichTextAttr\& }{attr}} + +Sets {\it attr} as the default style and tells the control that the UI should reflect +this attribute until the user moves the caret. + +See also \helpref{IsDefaultStyleShowing}{wxrichtextctrlisdefaultstyleshowing}. + \membersection{wxRichTextCtrl::SetBasicStyle}\label{wxrichtextctrlsetbasicstyle} \func{void}{SetBasicStyle}{\param{const wxRichTextAttr\& }{style}} @@ -1105,21 +1203,69 @@ Sets the insertion point to the end of the text control. Sets the selection to the given range. +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). + \membersection{wxRichTextCtrl::SetSelectionRange}\label{wxrichtextctrlsetselectionrange} \func{void}{SetSelectionRange}{\param{const wxRichTextRange\& }{range}} Sets the selection to the given range. +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). + \membersection{wxRichTextCtrl::SetStyle}\label{wxrichtextctrlsetstyle} \func{bool}{SetStyle}{\param{const wxRichTextRange\& }{range}, \param{const wxRichTextAttr\& }{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}} + Sets the attributes for the given range. 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. +So, for example, to set the style for a character at position 5, use the range (5,6). + +\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 wxTextAttrEx\& }{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. 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. +So, for example, to set the style for a character at position 5, use the range (5,6). + +{\it flags} may contain a bit list of the following values: + +\begin{verbatim} +#define wxRICHTEXT_SETSTYLE_NONE 0x00 + +// Specifies that this operation should be undoable +#define wxRICHTEXT_SETSTYLE_WITH_UNDO 0x01 + +// Specifies that the style should not be applied if the +// combined style at this point is already the style in question. +#define wxRICHTEXT_SETSTYLE_OPTIMIZE 0x02 + +// Specifies that the style should only be applied to paragraphs, +// and not the content. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY 0x04 + +// Specifies that the style should only be applied to characters, +// and not the paragraph. This allows content styling to be +// preserved independently from that of e.g. a named paragraph style. +#define wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY 0x08 +\end{verbatim} + \membersection{wxRichTextCtrl::SetStyleSheet}\label{wxrichtextctrlsetstylesheet} \func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}} @@ -1203,3 +1349,4 @@ Writes text at the current position. \constfunc{long}{XYToPosition}{\param{long }{x}, \param{long }{y}} Translates from column and line number to position. + diff --git a/docs/latex/wx/richtextevent.tex b/docs/latex/wx/richtextevent.tex index 6214a6dea7..49c371709f 100644 --- a/docs/latex/wx/richtextevent.tex +++ b/docs/latex/wx/richtextevent.tex @@ -1,8 +1,7 @@ \section{\class{wxRichTextEvent}}\label{wxrichtextevent} This is the event class for wxRichTextCtrl notifications. Note that event generation -is very incomplete; we need to implement events such as selection of text, deletion, -insertion, and so on. +is incomplete; events to be implemented include selection of text, deletion, insertion, and so on. \wxheading{Event table macros} @@ -68,3 +67,4 @@ wxRICHTEXT\_SHIFT\_DOWN, andwxRICHTEXT\_ALT\_DOWN. \func{void}{SetIndex}{\param{int }{n}} Not currently used. + diff --git a/docs/latex/wx/richtextfilehandler.tex b/docs/latex/wx/richtextfilehandler.tex index 0e6c27c1b9..d97d817329 100644 --- a/docs/latex/wx/richtextfilehandler.tex +++ b/docs/latex/wx/richtextfilehandler.tex @@ -128,3 +128,4 @@ Sets the handler type. Sets whether the handler should be visible to the user (via the application's load and save dialogs). + diff --git a/docs/latex/wx/richtextformattingdialog.tex b/docs/latex/wx/richtextformattingdialog.tex new file mode 100644 index 0000000000..509a11751b --- /dev/null +++ b/docs/latex/wx/richtextformattingdialog.tex @@ -0,0 +1,272 @@ +\section{\class{wxRichTextFormattingDialog}}\label{wxrichtextformattingdialog} + +This dialog allows the user to edit a character and/or paragraph style. + +In the constructor, specify the pages that will be created. Use GetStyle +to retrieve the common style for a given range, and then use ApplyStyle +to apply the user-selected formatting to a control. For example: + +\begin{verbatim} + wxRichTextRange range; + if (m_richTextCtrl->HasSelection()) + range = m_richTextCtrl->GetSelectionRange(); + else + range = wxRichTextRange(0, m_richTextCtrl->GetLastPosition()+1); + + int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING|wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS; + + wxRichTextFormattingDialog formatDlg(pages, this); + formatDlg.GetStyle(m_richTextCtrl, range); + + if (formatDlg.ShowModal() == wxID_OK) + { + formatDlg.ApplyStyle(m_richTextCtrl, range); + } +\end{verbatim} + +\wxheading{Derived from} + +\helpref{wxPropertySheetDialog}{wxpropertysheetdialog} + +\wxheading{Include files} + + + +\wxheading{Data structures} + +The following flags passed to the dialog constructor indicate the pages to +be created: + +\begin{verbatim} +#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001 +#define wxRICHTEXT_FORMAT_FONT 0x0002 +#define wxRICHTEXT_FORMAT_TABS 0x0004 +#define wxRICHTEXT_FORMAT_BULLETS 0x0008 +#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010 +\end{verbatim} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxRichTextFormattingDialog::wxRichTextFormattingDialog}\label{wxrichtextformattingdialogwxrichtextformattingdialog} + +\func{}{wxRichTextFormattingDialog}{\param{long }{flags}, \param{wxWindow* }{parent}, \param{const wxString\& }{title = \_("Formatting")}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{sz = wxDefaultSize}, \param{long }{style = wxDEFAULT\_DIALOG\_STYLE}} + +\func{}{wxRichTextFormattingDialog}{\void} + +Constructors. + +\wxheading{Parameters} + +\docparam{flags}{The pages to show.} + +\docparam{parent}{The dialog's parent.} + +\docparam{id}{The dialog's identifier.} + +\docparam{title}{The dialog's caption.} + +\docparam{pos}{The dialog's position.} + +\docparam{size}{The dialog's size.} + +\docparam{style}{The dialog's window style.} + + +\membersection{wxRichTextFormattingDialog::\destruct{wxRichTextFormattingDialog}}\label{wxrichtextformattingdialogdtor} + +\func{}{\destruct{wxRichTextFormattingDialog}}{\void} + +Destructor. + +\membersection{wxRichTextFormattingDialog::ApplyStyle}\label{wxrichtextformattingdialogapplystyle} + +\func{bool}{ApplyStyle}{\param{wxRichTextCtrl* }{ctrl}, \param{const wxRichTextRange\& }{range}, \param{int }{flags = wxRICHTEXT\_SETSTYLE\_WITH\_UNDO|wxRICHTEXT\_SETSTYLE\_OPTIMIZE}} + +Apply attributes to the given range, only changing attributes that need to be changed. + +\membersection{wxRichTextFormattingDialog::Create}\label{wxrichtextformattingdialogcreate} + +\func{bool}{Create}{\param{long }{flags}, \param{wxWindow* }{parent}, \param{const wxString\& }{title}, \param{wxWindowID }{id}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{sz = wxDefaultSize}, \param{long }{style = wxDEFAULT\_DIALOG\_STYLE}} + +Creation: see \helpref{the constructor}{wxrichtextformattingdialog} for details about the parameters. + +\membersection{wxRichTextFormattingDialog::GetAttributes}\label{wxrichtextformattingdialoggetattributes} + +\constfunc{const wxTextAttrEx\&}{GetAttributes}{\void} + +\func{wxTextAttrEx\&}{GetAttributes}{\void} + +Gets the attributes being edited. + +\membersection{wxRichTextFormattingDialog::GetDialog}\label{wxrichtextformattingdialoggetdialog} + +\func{wxRichTextFormattingDialog*}{GetDialog}{\param{wxWindow* }{win}} + +Helper for pages to get the top-level dialog. + +\membersection{wxRichTextFormattingDialog::GetDialogAttributes}\label{wxrichtextformattingdialoggetdialogattributes} + +\func{wxTextAttrEx*}{GetDialogAttributes}{\param{wxWindow* }{win}} + +Helper for pages to get the attributes. + +\membersection{wxRichTextFormattingDialog::GetDialogStyleDefinition}\label{wxrichtextformattingdialoggetdialogstyledefinition} + +\func{wxRichTextStyleDefinition*}{GetDialogStyleDefinition}{\param{wxWindow* }{win}} + +Helper for pages to get the style. + +\membersection{wxRichTextFormattingDialog::GetFormattingDialogFactory}\label{wxrichtextformattingdialoggetformattingdialogfactory} + +\func{wxRichTextFormattingDialogFactory*}{GetFormattingDialogFactory}{\void} + +Returns the object to be used to customize the dialog and provide pages. + +\membersection{wxRichTextFormattingDialog::GetImageList}\label{wxrichtextformattingdialoggetimagelist} + +\constfunc{wxImageList*}{GetImageList}{\void} + +Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook. + +\membersection{wxRichTextFormattingDialog::GetStyle}\label{wxrichtextformattingdialoggetstyle} + +\func{bool}{GetStyle}{\param{wxRichTextCtrl* }{ctrl}, \param{const wxRichTextRange\& }{range}} + +Gets common attributes from the given range and calls SetAttributes. Attributes that do not have common values in the given range +will be omitted from the style's flags. + +\membersection{wxRichTextFormattingDialog::GetStyleDefinition}\label{wxrichtextformattingdialoggetstyledefinition} + +\constfunc{wxRichTextStyleDefinition*}{GetStyleDefinition}{\void} + +Gets the associated style definition, if any. + +\membersection{wxRichTextFormattingDialog::GetStyleSheet}\label{wxrichtextformattingdialoggetstylesheet} + +\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} + +Gets the associated style sheet, if any. + +\membersection{wxRichTextFormattingDialog::SetAttributes}\label{wxrichtextformattingdialogsetattributes} + +\func{void}{SetAttributes}{\param{const wxTextAttrEx\& }{attr}} + +Sets the attributes to be edited. + +\membersection{wxRichTextFormattingDialog::SetFormattingDialogFactory}\label{wxrichtextformattingdialogsetformattingdialogfactory} + +\func{void}{SetFormattingDialogFactory}{\param{wxRichTextFormattingDialogFactory* }{factory}} + +Sets the formatting factory object to be used for customization and page creation. +It deletes the existing factory object. + +\membersection{wxRichTextFormattingDialog::SetImageList}\label{wxrichtextformattingdialogsetimagelist} + +\func{void}{SetImageList}{\param{wxImageList* }{imageList}} + +Sets the image list associated with the dialog's property sheet. + +\membersection{wxRichTextFormattingDialog::SetStyle}\label{wxrichtextformattingdialogsetstyle} + +\func{bool}{SetStyle}{\param{const wxTextAttrEx\& }{style}, \param{bool }{update = true}} + +Sets the attributes and optionally updates the display, if {\it update} is \true. + +\membersection{wxRichTextFormattingDialog::SetStyleDefinition}\label{wxrichtextformattingdialogsetstyledefinition} + +\func{bool}{SetStyleDefinition}{\param{const wxRichTextStyleDefinition\& }{styleDef}, \param{wxRichTextStyleSheet* }{sheet}, \param{bool }{update = true}} + +Sets the style definition and optionally update the display, if {\it update} is \true. + +\membersection{wxRichTextFormattingDialog::UpdateDisplay}\label{wxrichtextformattingdialogupdatedisplay} + +\func{bool}{UpdateDisplay}{\void} + +Updates the display. + + +% +% automatically generated by HelpGen $Revision$ from +% richtextformatdlg.h at 10/Oct/06 15:42:06 +% + + +\section{\class{wxRichTextFormattingDialogFactory}}\label{wxrichtextformattingdialogfactory} + +This class provides pages for wxRichTextFormattingDialog, and allows other customization of the dialog. +A default instance of this class is provided automatically. If you wish to change the behaviour of the +formatting dialog (for example add or replace a page), you may derive from this class, +override one or more functions, and call the static function wxRichTextFormattingDialog::SetFormattingDialogFactory. + +\wxheading{Derived from} + +\helpref{wxObject}{wxobject} + +\wxheading{Include files} + + + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxRichTextFormattingDialogFactory::wxRichTextFormattingDialogFactory}\label{wxrichtextformattingdialogfactorywxrichtextformattingdialogfactory} + +\func{}{wxRichTextFormattingDialogFactory}{\void} + +Constructor. + +\membersection{wxRichTextFormattingDialogFactory::\destruct{wxRichTextFormattingDialogFactory}}\label{wxrichtextformattingdialogfactorydtor} + +\func{}{\destruct{wxRichTextFormattingDialogFactory}}{\void} + +Destructor. + +\membersection{wxRichTextFormattingDialogFactory::CreateButtons}\label{wxrichtextformattingdialogfactorycreatebuttons} + +\func{virtual bool}{CreateButtons}{\param{wxRichTextFormattingDialog* }{dialog}} + +Creates the main dialog buttons. + +\membersection{wxRichTextFormattingDialogFactory::CreatePage}\label{wxrichtextformattingdialogfactorycreatepage} + +\func{virtual wxPanel*}{CreatePage}{\param{int }{page}, \param{wxString\& }{title}, \param{wxRichTextFormattingDialog* }{dialog}} + +Creates a page, given a page identifier. + +\membersection{wxRichTextFormattingDialogFactory::CreatePages}\label{wxrichtextformattingdialogfactorycreatepages} + +\func{virtual bool}{CreatePages}{\param{long }{pages}, \param{wxRichTextFormattingDialog* }{dialog}} + +Creates all pages under the dialog's book control, also calling AddPage. + +\membersection{wxRichTextFormattingDialogFactory::GetPageId}\label{wxrichtextformattingdialogfactorygetpageid} + +\constfunc{virtual int}{GetPageId}{\param{int }{i}} + +Enumerate all available page identifiers. + +\membersection{wxRichTextFormattingDialogFactory::GetPageIdCount}\label{wxrichtextformattingdialogfactorygetpageidcount} + +\constfunc{virtual int}{GetPageIdCount}{\void} + +Gets the number of available page identifiers. + +\membersection{wxRichTextFormattingDialogFactory::GetPageImage}\label{wxrichtextformattingdialogfactorygetpageimage} + +\constfunc{virtual int}{GetPageImage}{\param{int }{id}} + +Gets the image index for the given page identifier. + +\membersection{wxRichTextFormattingDialogFactory::SetSheetStyle}\label{wxrichtextformattingdialogfactorysetsheetstyle} + +\func{virtual bool}{SetSheetStyle}{\param{wxRichTextFormattingDialog* }{dialog}} + +Set the property sheet style, called at the start of wxRichTextFormattingDialog::Create. + +\membersection{wxRichTextFormattingDialogFactory::ShowHelp}\label{wxrichtextformattingdialogfactoryshowhelp} + +\func{virtual bool}{ShowHelp}{\param{int }{page}, \param{wxRichTextFormattingDialog* }{dialog}} + +Invokes help for the dialog. + diff --git a/docs/latex/wx/richtexthtmlhandler.tex b/docs/latex/wx/richtexthtmlhandler.tex index 17a90e9137..02cea9151b 100644 --- a/docs/latex/wx/richtexthtmlhandler.tex +++ b/docs/latex/wx/richtexthtmlhandler.tex @@ -25,3 +25,4 @@ Constructor. \func{bool}{DoSaveFile}{\param{wxRichTextBuffer* }{buffer}, \param{wxOutputStream\& }{stream}} Saves the buffer content to the HTML stream. + diff --git a/docs/latex/wx/richtextoverview.tex b/docs/latex/wx/richtextoverview.tex index 0242b4ff5e..498f115cd7 100644 --- a/docs/latex/wx/richtextoverview.tex +++ b/docs/latex/wx/richtextoverview.tex @@ -5,10 +5,13 @@ Classes: \helpref{wxRichTextCtrl}{wxrichtextctrl}, \helpref{wxRichTextBuffer}{wx \helpref{wxRichTextCharacterStyleDefinition}{wxrichtextcharacterstyledefinition}, \helpref{wxRichTextParagraphStyleDefinition}{wxrichtextparagraphstyledefinition}, \helpref{wxRichTextStyleSheet}{wxrichtextstylesheet}, +\helpref{wxRichTextStyleComboCtrl}{wxrichtextstylecomboctrl}, \helpref{wxRichTextStyleListBox}{wxrichtextstylelistbox}, \helpref{wxRichTextEvent}{wxrichtextevent}, \helpref{wxRichTextRange}{wxrichtextrange}, \helpref{wxRichTextFileHandler}{wxrichtextfilehandler}, \helpref{wxRichTextHTMLHandler}{wxrichtexthtmlhandler}, -\helpref{wxRichTextXMLHandler}{wxrichtextxmlhandler} +\helpref{wxRichTextXMLHandler}{wxrichtextxmlhandler}, +\helpref{wxRichTextFormattingDialog}{wxrichtextformattingdialog}, +\helpref{wxSymbolPickerDialog}{wxsymbolpickerdialog} wxRichTextCtrl provides a generic implementation of a rich text editor that can handle different character styles, paragraph formatting, and images. It's aimed at editing 'natural' language text - if you need an editor that supports code editing, @@ -230,7 +233,7 @@ from the start of the main parent box. When Layout is called on an object, it is given a size which the object must limit itself to, or one or more flexible directions (vertical -or horizontal). So, for example, a centered paragraph is given the page +or horizontal). So, for example, a centred paragraph is given the page width to play with (minus any margins), but can extend indefinitely in the vertical direction. The implementation of Layout caches the calculated size and position. @@ -272,15 +275,14 @@ This is a list of some of the features that have yet to be implemented. Help wit \item A ruler control \item Standard editing toolbars \item Automatic list numbering -\item Standard dialogs for paragraph/character formatting \item Tables \item Text frames -\item Add ability to show images in wxHTML output (currently uses +\item Add ability to show images in wxHTML output (currently uses embedded data suitable only for real browsers) \item More complete stylesheet viewer, plus style sheet editing dialogs -\item Ability to store style sheets with documents -embedded images suitable only for browsers). +\item Ability to read and write style sheets \end{itemize} There are also things that could be done to take advantage of the underlying text capabilities of the platform; higher-level text formatting APIs are available on some platforms, such as Mac OS X, and some of translation from high level to low level wxDC API is unnecessary. However this would require additions to the wxWidgets API. + diff --git a/docs/latex/wx/richtextparagraphstyledefinition.tex b/docs/latex/wx/richtextparagraphstyledefinition.tex index c6491d0409..377af87a52 100644 --- a/docs/latex/wx/richtextparagraphstyledefinition.tex +++ b/docs/latex/wx/richtextparagraphstyledefinition.tex @@ -37,3 +37,4 @@ Returns the style that should normally follow this style. \func{void}{SetNextStyle}{\param{const wxString\& }{name}} Sets the style that should normally follow this style. + diff --git a/docs/latex/wx/richtextrange.tex b/docs/latex/wx/richtextrange.tex index fd3d0fa622..c594ef6158 100644 --- a/docs/latex/wx/richtextrange.tex +++ b/docs/latex/wx/richtextrange.tex @@ -55,6 +55,14 @@ Returns the length of the range. Returns the start of the range. +\membersection{wxRichTextRange::FromInternal}\label{wxrichtextrangefrominternal} + +\constfunc{wxRichTextRange}{FromInternal}{\void} + +Converts the internal range, which uses the first and last character positions of the range, +to the API-standard range, whose end is one past the last character in the range. +In other words, one is added to the end position. + \membersection{wxRichTextRange::IsOutside}\label{wxrichtextrangeisoutside} \constfunc{bool}{IsOutside}{\param{const wxRichTextRange\& }{range}} @@ -97,6 +105,14 @@ Sets the start of the range. Swaps the start and end. +\membersection{wxRichTextRange::ToInternal}\label{wxrichtextrangetointernal} + +\constfunc{wxRichTextRange}{ToInternal}{\void} + +Converts the API-standard range, whose end is one past the last character in the range, +to the internal form, which uses the first and last character positions of the range. +In other words, one is subtracted from the end position. + \membersection{wxRichTextRange::operator+}\label{wxrichtextrangeoperatorplus} \constfunc{wxRichTextRange}{operator+}{\param{const wxRichTextRange\& }{range}} @@ -107,7 +123,7 @@ Adds {\it range} to this range. \constfunc{wxRichTextRange}{operator-}{\param{const wxRichTextRange\& }{range}} -Subtracs {\it range} from this range. +Subtracts {\it range} from this range. \membersection{wxRichTextRange::operator=}\label{wxrichtextrangeoperatorassign} @@ -120,3 +136,4 @@ Assigns {\it range} to this range. \constfunc{bool}{operator==}{\param{const wxRichTextRange\& }{range}} Returns \true if {\it range} is the same as this range. + diff --git a/docs/latex/wx/richtextstylelistbox.tex b/docs/latex/wx/richtextstylelistbox.tex index c546751105..92081ea2fd 100644 --- a/docs/latex/wx/richtextstylelistbox.tex +++ b/docs/latex/wx/richtextstylelistbox.tex @@ -1,3 +1,67 @@ +\section{\class{wxRichTextStyleComboCtrl}}\label{wxrichtextstylecomboctrl} + +This is a combo control that can display the styles in a \helpref{wxRichTextStyleSheet}{wxrichtextstylesheet}, +and apply the selection to an associated \helpref{wxRichTextCtrl}{wxrichtextctrl}. + +See {\tt samples/richtext} for an example of how to use it. + +\wxheading{Derived from} + +\helpref{wxComboCtrl}{wxcomboctrl} + +\wxheading{Include files} + + + +\wxheading{See also} + +\helpref{wxRichTextStyleListBox}{wxrichtextstylelistbox}, \helpref{wxRichTextCtrl overview}{wxrichtextctrloverview} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxRichTextStyleComboCtrl::wxRichTextStyleComboCtrl}\label{wxrichtextstylecomboctrlwxrichtextstylecomboctrl} + +\func{}{wxRichTextStyleComboCtrl}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = 0}} + +Constructor. + +\membersection{wxRichTextStyleComboCtrl::\destruct{wxRichTextStyleComboCtrl}}\label{wxrichtextstylecomboctrldtor} + +\func{}{\destruct{wxRichTextStyleComboCtrl}}{\void} + +Destructor. + +\membersection{wxRichTextStyleComboCtrl::GetRichTextCtrl}\label{wxrichtextstylecomboctrlgetrichtextctrl} + +\constfunc{wxRichTextCtrl*}{GetRichTextCtrl}{\void} + +Returns the \helpref{wxRichTextCtrl}{wxrichtextctrl} associated with this control. + +\membersection{wxRichTextStyleComboCtrl::GetStyleSheet}\label{wxrichtextstylecomboctrlgetstylesheet} + +\constfunc{wxRichTextStyleSheet*}{GetStyleSheet}{\void} + +Returns the style sheet associated with this control. + +\membersection{wxRichTextStyleComboCtrl::SetRichTextCtrl}\label{wxrichtextstylecomboctrlsetrichtextctrl} + +\func{void}{SetRichTextCtrl}{\param{wxRichTextCtrl* }{ctrl}} + +Associates the control with a \helpref{wxRichTextCtrl}{wxrichtextctrl}. + +\membersection{wxRichTextStyleComboCtrl::SetStyleSheet}\label{wxrichtextstylecomboctrlsetstylesheet} + +\func{void}{SetStyleSheet}{\param{wxRichTextStyleSheet* }{styleSheet}} + +Associates the control with a style sheet. + +\membersection{wxRichTextStyleComboCtrl::UpdateStyles}\label{wxrichtextstylecomboctrlupdatestyles} + +\func{void}{UpdateStyles}{\void} + +Updates the combo control from the associated style sheet. + + \section{\class{wxRichTextStyleListBox}}\label{wxrichtextstylelistbox} This is a listbox that can display the styles in a \helpref{wxRichTextStyleSheet}{wxrichtextstylesheet}, @@ -13,7 +77,9 @@ See {\tt samples/richtext} for an example of how to use it. -\wxheading{Data structures} +\wxheading{See also} + +\helpref{wxRichTextStyleComboCtrl}{wxrichtextstylecomboctrl}, \helpref{wxRichTextCtrl overview}{wxrichtextctrloverview} \latexignore{\rtfignore{\wxheading{Members}}} @@ -29,6 +95,12 @@ Constructor. Destructor. +\membersection{wxRichTextStyleListBox::ApplyStyle}\label{wxrichtextstylelistboxapplystyle} + +\func{void}{ApplyStyle}{\param{int }{i}} + +Applies the {\it i}th style to the associated rich text control. + \membersection{wxRichTextStyleListBox::ConvertTenthsMMToPixels}\label{wxrichtextstylelistboxconverttenthsmmtopixels} \constfunc{int}{ConvertTenthsMMToPixels}{\param{wxDC\& }{dc}, \param{int }{units}} @@ -41,6 +113,13 @@ Converts units in tenths of a millimetre to device units. Creates a suitable HTML fragment for a definition. +\membersection{wxRichTextStyleListBox::GetApplyOnSelection}\label{wxrichtextstylelistboxgetapplyonselection} + +\constfunc{bool}{GetApplyOnSelection}{\void} + +If the return value is \true, clicking on a style name in the list will immediately +apply the style to the associated rich text control. + \membersection{wxRichTextStyleListBox::GetRichTextCtrl}\label{wxrichtextstylelistboxgetrichtextctrl} \constfunc{wxRichTextCtrl*}{GetRichTextCtrl}{\void} @@ -77,6 +156,13 @@ Implements left click behaviour, applying the clicked style to the wxRichTextCtr Reacts to selection. +\membersection{wxRichTextStyleListBox::SetApplyOnSelection}\label{wxrichtextstylelistboxsetapplyonselection} + +\func{void}{SetApplyOnSelection}{\param{bool }{applyOnSelection}} + +If {\it applyOnSelection} is \true, clicking on a style name in the list will immediately +apply the style to the associated rich text control. + \membersection{wxRichTextStyleListBox::SetRichTextCtrl}\label{wxrichtextstylelistboxsetrichtextctrl} \func{void}{SetRichTextCtrl}{\param{wxRichTextCtrl* }{ctrl}} @@ -94,3 +180,4 @@ Associates the control with a style sheet. \func{void}{UpdateStyles}{\void} Updates the list from the associated style sheet. + diff --git a/docs/latex/wx/richtextstylesheet.tex b/docs/latex/wx/richtextstylesheet.tex index 04fbf34231..dc62390022 100644 --- a/docs/latex/wx/richtextstylesheet.tex +++ b/docs/latex/wx/richtextstylesheet.tex @@ -102,3 +102,4 @@ Removes a character style. \func{bool}{RemoveParagraphStyle}{\param{wxRichTextStyleDefinition* }{def}, \param{bool }{deleteStyle = false}} Removes a paragraph style. + diff --git a/docs/latex/wx/symbolpickerdialog.tex b/docs/latex/wx/symbolpickerdialog.tex new file mode 100644 index 0000000000..7030e7f6f5 --- /dev/null +++ b/docs/latex/wx/symbolpickerdialog.tex @@ -0,0 +1,180 @@ +\section{\class{wxSymbolPickerDialog}}\label{wxsymbolpickerdialog} + +wxSymbolPickerDialog presents the user with a choice of fonts and a grid +of available characters. This modal dialog provides the application with +a selected symbol and optional font selection. + +Although this dialog is contained in the rich text library, the dialog +is generic and can be used in other contexts. + +To use the dialog, pass a default symbol specified as a string, an initial font name, +and a current font name. The difference between the initial font and +current font is that the initial font determines what the font control will be +set to when the dialog shows - an empty string will show the selection {\it normal text}. +The current font, on the other hand, is used by the dialog to determine what font +to display the characters in, even when no initial font is selected. +This allows the user (and application) to distinguish between inserting a +symbol in the current font, and inserting it with a specified font. + +When the dialog is dismissed, the application can get the selected symbol +with GetSymbol and test whether a font was specified with UseNormalFont, +fetching the specified font with GetFontName. + +Here's a realistic example, inserting the supplied symbol into a +rich text control in either the current font or specified font. + +\begin{verbatim} + wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL); + + wxTextAttrEx attr; + attr.SetFlags(wxTEXT_ATTR_FONT); + ctrl->GetStyle(ctrl->GetInsertionPoint(), attr); + + wxString currentFontName; + if (attr.HasFont() && attr.GetFont().Ok()) + currentFontName = attr.GetFont().GetFaceName(); + + // Don't set the initial font in the dialog (so the user is choosing + // 'normal text', i.e. the current font) but do tell the dialog + // what 'normal text' is. + + wxSymbolPickerDialog dlg(wxT("*"), wxEmptyString, currentFontName, this); + + if (dlg.ShowModal() == wxID_OK) + { + if (dlg.HasSelection()) + { + long insertionPoint = ctrl->GetInsertionPoint(); + + ctrl->WriteText(dlg.GetSymbol()); + + if (!dlg.UseNormalFont()) + { + wxFont font(attr.GetFont()); + font.SetFaceName(dlg.GetFontName()); + attr.SetFont(font); + ctrl->SetStyle(insertionPoint, insertionPoint+1, attr); + } + } + } +\end{verbatim} + +\wxheading{Derived from} + +\helpref{wxDialog}{wxdialog} + +\wxheading{Include files} + + + +\wxheading{Data structures} + +\latexignore{\rtfignore{\wxheading{Members}}} + + +\membersection{wxSymbolPickerDialog::wxSymbolPickerDialog}\label{wxsymbolpickerdialogwxsymbolpickerdialog} + +\func{}{wxSymbolPickerDialog}{\param{const wxString\& }{symbol}, \param{const wxString\& }{initialFont}, \param{const wxString\& }{normalTextFont}, \param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{title = \_("Symbols")}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX}} + +\func{}{wxSymbolPickerDialog}{\void} + +Constructors. + +\wxheading{Parameters} + +\docparam{symbol}{The initial symbol to show. Specify a single character in a string, or an empty string.} + +\docparam{initialFont}{The initial font to be displayed in the font list. If empty, the item {\it normal text} will be selected.} + +\docparam{normalTextFont}{The font the dialog will use to display the symbols if the initial font is empty.} + +\docparam{parent}{The dialog's parent.} + +\docparam{id}{The dialog's identifier.} + +\docparam{title}{The dialog's caption.} + +\docparam{pos}{The dialog's position.} + +\docparam{size}{The dialog's size.} + +\docparam{style}{The dialog's window style.} + +\membersection{wxSymbolPickerDialog::Create}\label{wxsymbolpickerdialogcreate} + +\func{bool}{Create}{\param{const wxString\& }{symbol}, \param{const wxString\& }{initialFont}, \param{const wxString\& }{normalTextFont}, \param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY}, \param{const wxString\& }{title = \_("Symbols")}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize}, \param{long }{style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX}} + +Creation: see \helpref{the constructor}{wxsymbolpickerdialogwxsymbolpickerdialog} for details about the parameters. + +\membersection{wxSymbolPickerDialog::GetFontName}\label{wxsymbolpickerdialoggetfontname} + +\constfunc{wxString}{GetFontName}{\void} + +Returns the font name (the font reflected in the font list). + +\membersection{wxSymbolPickerDialog::GetFromUnicode}\label{wxsymbolpickerdialoggetfromunicode} + +\constfunc{bool}{GetFromUnicode}{\void} + +Returns \true if the dialog is showing the full range of Unicode characters. + +\membersection{wxSymbolPickerDialog::GetNormalTextFontName}\label{wxsymbolpickerdialoggetnormaltextfontname} + +\constfunc{wxString}{GetNormalTextFontName}{\void} + +Gets the font name used for displaying symbols in the absence of a selected font. + +\membersection{wxSymbolPickerDialog::GetSymbol}\label{wxsymbolpickerdialoggetsymbol} + +\constfunc{wxString}{GetSymbol}{\void} + +Gets the current or initial symbol as a string. + +\membersection{wxSymbolPickerDialog::GetSymbolChar}\label{wxsymbolpickerdialoggetsymbolchar} + +\constfunc{int}{GetSymbolChar}{\void} + +Gets the selected symbol character as an integer. + +\membersection{wxSymbolPickerDialog::HasSelection}\label{wxsymbolpickerdialoghasselection} + +\constfunc{bool}{HasSelection}{\void} + +Returns \true if a symbol is selected. + +\membersection{wxSymbolPickerDialog::SetFontName}\label{wxsymbolpickerdialogsetfontname} + +\func{void}{SetFontName}{\param{const wxString\& }{value}} + +Sets the initial/selected font name. + +\membersection{wxSymbolPickerDialog::SetFromUnicode}\label{wxsymbolpickerdialogsetfromunicode} + +\func{void}{SetFromUnicode}{\param{bool }{value}} + +Sets the internal flag indicating that the full Unicode range should be displayed. + +\membersection{wxSymbolPickerDialog::SetNormalTextFontName}\label{wxsymbolpickerdialogsetnormaltextfontname} + +\func{void}{SetNormalTextFontName}{\param{const wxString\& }{value}} + +Sets the name of the font to be used in the absence of a selected font. + +\membersection{wxSymbolPickerDialog::SetSymbol}\label{wxsymbolpickerdialogsetsymbol} + +\func{void}{SetSymbol}{\param{const wxString\& }{value}} + +Sets the symbol as a one or zero character string. + +\membersection{wxSymbolPickerDialog::SetUnicodeMode}\label{wxsymbolpickerdialogsetunicodemode} + +\func{void}{SetUnicodeMode}{\param{bool }{unicodeMode}} + +Sets Unicode display mode. + +\membersection{wxSymbolPickerDialog::UseNormalFont}\label{wxsymbolpickerdialogusenormalfont} + +\constfunc{bool}{UseNormalFont}{\void} + +Returns true if the has specified normal text - that is, there is no selected font. + diff --git a/docs/latex/wx/textattrex.tex b/docs/latex/wx/textattrex.tex index 80c8275045..5eea7fe272 100644 --- a/docs/latex/wx/textattrex.tex +++ b/docs/latex/wx/textattrex.tex @@ -124,6 +124,13 @@ The following constants can be passed to wxRichTextAttr::SetLineSpacing: 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::GetBulletNumber}\label{wxtextattrexgetbulletnumber} \constfunc{int}{GetBulletNumber}{\void} @@ -249,6 +256,13 @@ 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}} @@ -331,3 +345,4 @@ Assignment from a wxTextAttr object. \func{void operator}{operator=}{\param{const wxTextAttrEx\& }{attr}} Assignment from a wxTextAttrEx object. + diff --git a/docs/latex/wx/tsamples.tex b/docs/latex/wx/tsamples.tex index dd201e9b3c..46c7967120 100644 --- a/docs/latex/wx/tsamples.tex +++ b/docs/latex/wx/tsamples.tex @@ -598,3 +598,4 @@ but sometimes it depends on the user choices: wxCheckboxPage shows how to dynamically decide which page to display next (see also \helpref{wxWizardPage}{wxwizardpage}) \end{itemize} + diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index 0d199dedd7..65ecd4b2a5 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -3692,3 +3692,4 @@ Interface Guidelines forbid moving the mouse cursor programmatically. \docparam{x}{The new x position for the cursor.} \docparam{y}{The new y position for the cursor.} + -- 2.45.2