]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/symbolpickerdialog.tex
added the mention of library in which each class is defined to the documentation...
[wxWidgets.git] / docs / latex / wx / symbolpickerdialog.tex
1 \section{\class{wxSymbolPickerDialog}}\label{wxsymbolpickerdialog}
2
3 wxSymbolPickerDialog presents the user with a choice of fonts and a grid
4 of available characters. This modal dialog provides the application with
5 a selected symbol and optional font selection.
6
7 Although this dialog is contained in the rich text library, the dialog
8 is generic and can be used in other contexts.
9
10 To use the dialog, pass a default symbol specified as a string, an initial font name,
11 and a current font name. The difference between the initial font and
12 current font is that the initial font determines what the font control will be
13 set to when the dialog shows - an empty string will show the selection {\it normal text}.
14 The current font, on the other hand, is used by the dialog to determine what font
15 to display the characters in, even when no initial font is selected.
16 This allows the user (and application) to distinguish between inserting a
17 symbol in the current font, and inserting it with a specified font.
18
19 When the dialog is dismissed, the application can get the selected symbol
20 with GetSymbol and test whether a font was specified with UseNormalFont,
21 fetching the specified font with GetFontName.
22
23 Here's a realistic example, inserting the supplied symbol into a
24 rich 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
66 \wxheading{Include files}
67
68 <wx/richtext/richtextsymboldlg.h>
69
70 \wxheading{Library}
71
72 \helpref{wxRichtext}{librarieslist}
73
74 \wxheading{Data structures}
75
76 \latexignore{\rtfignore{\wxheading{Members}}}
77
78
79 \membersection{wxSymbolPickerDialog::wxSymbolPickerDialog}\label{wxsymbolpickerdialogwxsymbolpickerdialog}
80
81 \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}}
82
83 \func{}{wxSymbolPickerDialog}{\void}
84
85 Constructors.
86
87 \wxheading{Parameters}
88
89 \docparam{symbol}{The initial symbol to show. Specify a single character in a string, or an empty string.}
90
91 \docparam{initialFont}{The initial font to be displayed in the font list. If empty, the item {\it normal text} will be selected.}
92
93 \docparam{normalTextFont}{The font the dialog will use to display the symbols if the initial font is empty.}
94
95 \docparam{parent}{The dialog's parent.}
96
97 \docparam{id}{The dialog's identifier.}
98
99 \docparam{title}{The dialog's caption.}
100
101 \docparam{pos}{The dialog's position.}
102
103 \docparam{size}{The dialog's size.}
104
105 \docparam{style}{The dialog's window style.}
106
107 \membersection{wxSymbolPickerDialog::Create}\label{wxsymbolpickerdialogcreate}
108
109 \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}}
110
111 Creation: see \helpref{the constructor}{wxsymbolpickerdialogwxsymbolpickerdialog} for details about the parameters.
112
113 \membersection{wxSymbolPickerDialog::GetFontName}\label{wxsymbolpickerdialoggetfontname}
114
115 \constfunc{wxString}{GetFontName}{\void}
116
117 Returns the font name (the font reflected in the font list).
118
119 \membersection{wxSymbolPickerDialog::GetFromUnicode}\label{wxsymbolpickerdialoggetfromunicode}
120
121 \constfunc{bool}{GetFromUnicode}{\void}
122
123 Returns \true if the dialog is showing the full range of Unicode characters.
124
125 \membersection{wxSymbolPickerDialog::GetNormalTextFontName}\label{wxsymbolpickerdialoggetnormaltextfontname}
126
127 \constfunc{wxString}{GetNormalTextFontName}{\void}
128
129 Gets the font name used for displaying symbols in the absence of a selected font.
130
131 \membersection{wxSymbolPickerDialog::GetSymbol}\label{wxsymbolpickerdialoggetsymbol}
132
133 \constfunc{wxString}{GetSymbol}{\void}
134
135 Gets the current or initial symbol as a string.
136
137 \membersection{wxSymbolPickerDialog::GetSymbolChar}\label{wxsymbolpickerdialoggetsymbolchar}
138
139 \constfunc{int}{GetSymbolChar}{\void}
140
141 Gets the selected symbol character as an integer.
142
143 \membersection{wxSymbolPickerDialog::HasSelection}\label{wxsymbolpickerdialoghasselection}
144
145 \constfunc{bool}{HasSelection}{\void}
146
147 Returns \true if a symbol is selected.
148
149 \membersection{wxSymbolPickerDialog::SetFontName}\label{wxsymbolpickerdialogsetfontname}
150
151 \func{void}{SetFontName}{\param{const wxString\& }{value}}
152
153 Sets the initial/selected font name.
154
155 \membersection{wxSymbolPickerDialog::SetFromUnicode}\label{wxsymbolpickerdialogsetfromunicode}
156
157 \func{void}{SetFromUnicode}{\param{bool }{value}}
158
159 Sets the internal flag indicating that the full Unicode range should be displayed.
160
161 \membersection{wxSymbolPickerDialog::SetNormalTextFontName}\label{wxsymbolpickerdialogsetnormaltextfontname}
162
163 \func{void}{SetNormalTextFontName}{\param{const wxString\& }{value}}
164
165 Sets the name of the font to be used in the absence of a selected font.
166
167 \membersection{wxSymbolPickerDialog::SetSymbol}\label{wxsymbolpickerdialogsetsymbol}
168
169 \func{void}{SetSymbol}{\param{const wxString\& }{value}}
170
171 Sets the symbol as a one or zero character string.
172
173 \membersection{wxSymbolPickerDialog::SetUnicodeMode}\label{wxsymbolpickerdialogsetunicodemode}
174
175 \func{void}{SetUnicodeMode}{\param{bool }{unicodeMode}}
176
177 Sets Unicode display mode.
178
179 \membersection{wxSymbolPickerDialog::UseNormalFont}\label{wxsymbolpickerdialogusenormalfont}
180
181 \constfunc{bool}{UseNormalFont}{\void}
182
183 Returns true if the has specified normal text - that is, there is no selected font.
184