/**
@class wxSymbolPickerDialog
@headerfile richtextsymboldlg.h wx/richtext/richtextsymboldlg.h
-
+
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
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.
-
+
@code
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
-
+
wxTextAttr 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());
}
}
@endcode
-
+
@library{wxrichtext}
@category{cmndlg}
*/
/**
Constructors.
- @param symbol
+ @param symbol
The initial symbol to show. Specify a single character in a string, or an empty
string.
- @param initialFont
+ @param initialFont
The initial font to be displayed in the font list. If empty, the item normal
text will be selected.
- @param normalTextFont
+ @param normalTextFont
The font the dialog will use to display the symbols if the initial font is
empty.
- @param parent
+ @param parent
The dialog's parent.
- @param id
+ @param id
The dialog's identifier.
- @param title
+ @param title
The dialog's caption.
- @param pos
+ @param pos
The dialog's position.
- @param size
+ @param size
The dialog's size.
- @param style
+ @param style
The dialog's window style.
*/
wxSymbolPickerDialog(const wxString& symbol,
const wxString& normalTextFont,
wxWindow* parent,
wxWindowID id = wxID_ANY);
- const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
- wxSymbolPickerDialog();
+ const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
+ wxSymbolPickerDialog();
//@}
/**