]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/symbolpickerdialog.tex
Added AdvanceSelection, ShowWindowMenu and keyboard handling
[wxWidgets.git] / docs / latex / wx / symbolpickerdialog.tex
... / ...
CommitLineData
1\section{\class{wxSymbolPickerDialog}}\label{wxsymbolpickerdialog}
2
3wxSymbolPickerDialog presents the user with a choice of fonts and a grid
4of available characters. This modal dialog provides the application with
5a selected symbol and optional font selection.
6
7Although this dialog is contained in the rich text library, the dialog
8is generic and can be used in other contexts.
9
10To use the dialog, pass a default symbol specified as a string, an initial font name,
11and a current font name. The difference between the initial font and
12current font is that the initial font determines what the font control will be
13set to when the dialog shows - an empty string will show the selection {\it normal text}.
14The current font, on the other hand, is used by the dialog to determine what font
15to display the characters in, even when no initial font is selected.
16This allows the user (and application) to distinguish between inserting a
17symbol in the current font, and inserting it with a specified font.
18
19When the dialog is dismissed, the application can get the selected symbol
20with GetSymbol and test whether a font was specified with UseNormalFont,
21fetching the specified font with GetFontName.
22
23Here's a realistic example, inserting the supplied symbol into a
24rich text control in either the current font or specified font.
25
26\begin{verbatim}
27 wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
28
29 wxTextAttrEx attr;
30 attr.SetFlags(wxTEXT_ATTR_FONT);
31 ctrl->GetStyle(ctrl->GetInsertionPoint(), attr);
32
33 wxString currentFontName;
34 if (attr.HasFont() && attr.GetFont().Ok())
35 currentFontName = attr.GetFont().GetFaceName();
36
37 // Don't set the initial font in the dialog (so the user is choosing
38 // 'normal text', i.e. the current font) but do tell the dialog
39 // what 'normal text' is.
40
41 wxSymbolPickerDialog dlg(wxT("*"), wxEmptyString, currentFontName, this);
42
43 if (dlg.ShowModal() == wxID_OK)
44 {
45 if (dlg.HasSelection())
46 {
47 long insertionPoint = ctrl->GetInsertionPoint();
48
49 ctrl->WriteText(dlg.GetSymbol());
50
51 if (!dlg.UseNormalFont())
52 {
53 wxFont font(attr.GetFont());
54 font.SetFaceName(dlg.GetFontName());
55 attr.SetFont(font);
56 ctrl->SetStyle(insertionPoint, insertionPoint+1, attr);
57 }
58 }
59 }
60\end{verbatim}
61
62\wxheading{Derived from}
63
64\helpref{wxDialog}{wxdialog}\\
65\helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
66\helpref{wxWindow}{wxwindow}\\
67\helpref{wxEvtHandler}{wxevthandler}\\
68\helpref{wxObject}{wxobject}
69
70\wxheading{Include files}
71
72<wx/richtext/richtextsymboldlg.h>
73
74\wxheading{Library}
75
76\helpref{wxRichtext}{librarieslist}
77
78\wxheading{Data structures}
79
80\latexignore{\rtfignore{\wxheading{Members}}}
81
82
83\membersection{wxSymbolPickerDialog::wxSymbolPickerDialog}\label{wxsymbolpickerdialogwxsymbolpickerdialog}
84
85\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}}
86
87\func{}{wxSymbolPickerDialog}{\void}
88
89Constructors.
90
91\wxheading{Parameters}
92
93\docparam{symbol}{The initial symbol to show. Specify a single character in a string, or an empty string.}
94
95\docparam{initialFont}{The initial font to be displayed in the font list. If empty, the item {\it normal text} will be selected.}
96
97\docparam{normalTextFont}{The font the dialog will use to display the symbols if the initial font is empty.}
98
99\docparam{parent}{The dialog's parent.}
100
101\docparam{id}{The dialog's identifier.}
102
103\docparam{title}{The dialog's caption.}
104
105\docparam{pos}{The dialog's position.}
106
107\docparam{size}{The dialog's size.}
108
109\docparam{style}{The dialog's window style.}
110
111\membersection{wxSymbolPickerDialog::Create}\label{wxsymbolpickerdialogcreate}
112
113\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}}
114
115Creation: see \helpref{the constructor}{wxsymbolpickerdialogwxsymbolpickerdialog} for details about the parameters.
116
117\membersection{wxSymbolPickerDialog::GetFontName}\label{wxsymbolpickerdialoggetfontname}
118
119\constfunc{wxString}{GetFontName}{\void}
120
121Returns the font name (the font reflected in the font list).
122
123\membersection{wxSymbolPickerDialog::GetFromUnicode}\label{wxsymbolpickerdialoggetfromunicode}
124
125\constfunc{bool}{GetFromUnicode}{\void}
126
127Returns \true if the dialog is showing the full range of Unicode characters.
128
129\membersection{wxSymbolPickerDialog::GetNormalTextFontName}\label{wxsymbolpickerdialoggetnormaltextfontname}
130
131\constfunc{wxString}{GetNormalTextFontName}{\void}
132
133Gets the font name used for displaying symbols in the absence of a selected font.
134
135\membersection{wxSymbolPickerDialog::GetSymbol}\label{wxsymbolpickerdialoggetsymbol}
136
137\constfunc{wxString}{GetSymbol}{\void}
138
139Gets the current or initial symbol as a string.
140
141\membersection{wxSymbolPickerDialog::GetSymbolChar}\label{wxsymbolpickerdialoggetsymbolchar}
142
143\constfunc{int}{GetSymbolChar}{\void}
144
145Gets the selected symbol character as an integer.
146
147\membersection{wxSymbolPickerDialog::HasSelection}\label{wxsymbolpickerdialoghasselection}
148
149\constfunc{bool}{HasSelection}{\void}
150
151Returns \true if a symbol is selected.
152
153\membersection{wxSymbolPickerDialog::SetFontName}\label{wxsymbolpickerdialogsetfontname}
154
155\func{void}{SetFontName}{\param{const wxString\& }{value}}
156
157Sets the initial/selected font name.
158
159\membersection{wxSymbolPickerDialog::SetFromUnicode}\label{wxsymbolpickerdialogsetfromunicode}
160
161\func{void}{SetFromUnicode}{\param{bool }{value}}
162
163Sets the internal flag indicating that the full Unicode range should be displayed.
164
165\membersection{wxSymbolPickerDialog::SetNormalTextFontName}\label{wxsymbolpickerdialogsetnormaltextfontname}
166
167\func{void}{SetNormalTextFontName}{\param{const wxString\& }{value}}
168
169Sets the name of the font to be used in the absence of a selected font.
170
171\membersection{wxSymbolPickerDialog::SetSymbol}\label{wxsymbolpickerdialogsetsymbol}
172
173\func{void}{SetSymbol}{\param{const wxString\& }{value}}
174
175Sets the symbol as a one or zero character string.
176
177\membersection{wxSymbolPickerDialog::SetUnicodeMode}\label{wxsymbolpickerdialogsetunicodemode}
178
179\func{void}{SetUnicodeMode}{\param{bool }{unicodeMode}}
180
181Sets Unicode display mode.
182
183\membersection{wxSymbolPickerDialog::UseNormalFont}\label{wxsymbolpickerdialogusenormalfont}
184
185\constfunc{bool}{UseNormalFont}{\void}
186
187Returns true if the has specified normal text - that is, there is no selected font.
188