2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: fontpicker.h
|
|
|
|
// Purpose: documentation for wxFontPickerCtrl class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFontPickerCtrl
|
|
|
|
@wxheader{fontpicker.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This control allows the user to select a font. The generic implementation is
|
|
|
|
a button which brings up a wxFontDialog when clicked. Native implementation
|
|
|
|
may differ but this is usually a (small) widget which give access to the
|
|
|
|
font-chooser
|
|
|
|
dialog.
|
|
|
|
It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxFNTP_DEFAULT_STYLE}:
|
|
|
|
The default style: wxFNTP_FONTDESC_AS_LABEL |
|
|
|
|
wxFNTP_USEFONT_FOR_LABEL.
|
|
|
|
@style{wxFNTP_USE_TEXTCTRL}:
|
|
|
|
Creates a text control to the left of the picker button which is
|
|
|
|
completely managed by the wxFontPickerCtrl and which can be used by
|
|
|
|
the user to specify a font (see SetSelectedFont). The text control
|
|
|
|
is automatically synchronized with button's value. Use functions
|
|
|
|
defined in wxPickerBase to modify the text control.
|
|
|
|
@style{wxFNTP_FONTDESC_AS_LABEL}:
|
|
|
|
Keeps the label of the button updated with the fontface name and
|
|
|
|
the font size. E.g. choosing "Times New Roman bold, italic with
|
|
|
|
size 10" from the fontdialog, will update the label (overwriting
|
|
|
|
any previous label) with the "Times New Roman, 10" text.
|
|
|
|
@style{wxFNTP_USEFONT_FOR_LABEL}:
|
|
|
|
Uses the currently selected font to draw the label of the button.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{miscpickers}
|
|
|
|
@appearance{fontpickerctrl.png}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@seealso
|
|
|
|
wxFontDialog, wxFontPickerEvent
|
|
|
|
*/
|
|
|
|
class wxFontPickerCtrl : public wxPickerBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Initializes the object and calls Create() with
|
|
|
|
all the parameters.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxFontPickerCtrl(wxWindow* parent, wxWindowID id,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxFont& font = wxNullFont,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxFNTP_DEFAULT_STYLE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "fontpickerctrl");
|
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window, must not be non-@NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
The identifier for the control.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param font
|
2008-03-09 12:33:59 +00:00
|
|
|
The initial font shown in the control. If wxNullFont
|
|
|
|
is given, the default font is used.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial size.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
The window style, see wxFNTP_* flags.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Validator which can be used for additional date checks.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Control name.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@returns @true if the control was successfully created or @false if
|
2008-03-09 12:33:59 +00:00
|
|
|
creation failed.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxFont& font = wxNullFont,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxFNTP_DEFAULT_STYLE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "fontpickerctrl");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the maximum point size value allowed for the user-chosen font.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
unsigned int GetMaxPointSize() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently selected font.
|
|
|
|
Note that this function is completely different from wxWindow::GetFont.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont GetSelectedFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the maximum point size value allowed for the user-chosen font.
|
|
|
|
The default value is 100. Note that big fonts can require a lot of memory and
|
|
|
|
CPU time
|
|
|
|
both for creation and for rendering; thus, specially because the user has the
|
|
|
|
option to specify
|
|
|
|
the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea
|
|
|
|
to put a limit
|
|
|
|
to the maximum font size when huge fonts do not make much sense.
|
|
|
|
*/
|
|
|
|
void GetMaxPointSize(unsigned int max);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the currently selected font.
|
|
|
|
Note that this function is completely different from wxWindow::SetFont.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void SetSelectedFont(const wxFont& font);
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFontPickerEvent
|
|
|
|
@wxheader{fontpicker.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This event class is used for the events generated by
|
|
|
|
wxFontPickerCtrl.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{FIXME}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@seealso
|
|
|
|
wxFontPickerCtrl
|
|
|
|
*/
|
|
|
|
class wxFontPickerEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxFontPickerEvent(wxObject* generator, int id,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxFont& font);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieve the font the user has just selected.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxFont GetFont() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the font associated with the event.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void SetFont(const wxFont& f);
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|