Add wxFontPickerCtrl::SetMinPointSize()

Allow setting the minimal, as well as maximal, point size.

Closes #17126.
This commit is contained in:
Andreas Falkenhahn
2016-11-22 02:31:11 +01:00
committed by Vadim Zeitlin
parent 60c93971b3
commit accf7ab117
4 changed files with 47 additions and 6 deletions

View File

@@ -88,7 +88,8 @@ protected:
#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)
// not a style but rather the default value of the maximum pointsize allowed
// not a style but rather the default value of the minimum/maximum pointsize allowed
#define wxFNTP_MINPOINT_SIZE 0
#define wxFNTP_MAXPOINT_SIZE 100
@@ -101,8 +102,8 @@ protected:
class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase
{
public:
wxFontPickerCtrl()
: m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
wxFontPickerCtrl()
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
}
@@ -117,7 +118,7 @@ public:
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerCtrlNameStr)
: m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
{
Create(parent, id, initial, pos, size, style, validator, name);
}
@@ -149,9 +150,13 @@ public: // public API
void SetSelectedColour(const wxColour& colour)
{ GetPickerWidget()->SetSelectedColour(colour); }
// set/get the min point size
void SetMinPointSize(unsigned int min);
unsigned int GetMinPointSize() const
{ return m_nMinPointSize; }
// set/get the max point size
void SetMaxPointSize(unsigned int max)
{ m_nMaxPointSize=max; }
void SetMaxPointSize(unsigned int max);
unsigned int GetMaxPointSize() const
{ return m_nMaxPointSize; }
@@ -173,6 +178,9 @@ protected:
long GetPickerStyle(long style) const wxOVERRIDE
{ return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); }
// the minimum pointsize allowed to the user
unsigned int m_nMinPointSize;
// the maximum pointsize allowed to the user
unsigned int m_nMaxPointSize;