Add wxFontPickerCtrl::SetMinPointSize()
Allow setting the minimal, as well as maximal, point size. Closes #17126.
This commit is contained in:
committed by
Vadim Zeitlin
parent
60c93971b3
commit
accf7ab117
@@ -157,6 +157,7 @@ All (GUI):
|
|||||||
- Fix escaping/unescaping characters in wxLongStringProperty in wxPG (mikek).
|
- Fix escaping/unescaping characters in wxLongStringProperty in wxPG (mikek).
|
||||||
- Ensure that navigation order reflects layout of wxStdDialogButtonSizer.
|
- Ensure that navigation order reflects layout of wxStdDialogButtonSizer.
|
||||||
- Add Scintilla FineTicker methods to wxSTC (NewPagodi).
|
- Add Scintilla FineTicker methods to wxSTC (NewPagodi).
|
||||||
|
- Add wxFontPickerCtrl::SetMinPointSize() (Andreas Falkenhahn).
|
||||||
|
|
||||||
wxGTK:
|
wxGTK:
|
||||||
|
|
||||||
|
@@ -88,7 +88,8 @@ protected:
|
|||||||
#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
|
#define wxFNTP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
|
||||||
#define wxFNTP_DEFAULT_STYLE (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)
|
#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
|
#define wxFNTP_MAXPOINT_SIZE 100
|
||||||
|
|
||||||
|
|
||||||
@@ -101,8 +102,8 @@ protected:
|
|||||||
class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase
|
class WXDLLIMPEXP_CORE wxFontPickerCtrl : public wxPickerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontPickerCtrl()
|
wxFontPickerCtrl()
|
||||||
: m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
|
: m_nMinPointSize(wxFNTP_MINPOINT_SIZE), m_nMaxPointSize(wxFNTP_MAXPOINT_SIZE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@ public:
|
|||||||
long style = wxFNTP_DEFAULT_STYLE,
|
long style = wxFNTP_DEFAULT_STYLE,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxFontPickerCtrlNameStr)
|
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);
|
Create(parent, id, initial, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
@@ -149,9 +150,13 @@ public: // public API
|
|||||||
void SetSelectedColour(const wxColour& colour)
|
void SetSelectedColour(const wxColour& colour)
|
||||||
{ GetPickerWidget()->SetSelectedColour(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
|
// set/get the max point size
|
||||||
void SetMaxPointSize(unsigned int max)
|
void SetMaxPointSize(unsigned int max);
|
||||||
{ m_nMaxPointSize=max; }
|
|
||||||
unsigned int GetMaxPointSize() const
|
unsigned int GetMaxPointSize() const
|
||||||
{ return m_nMaxPointSize; }
|
{ return m_nMaxPointSize; }
|
||||||
|
|
||||||
@@ -173,6 +178,9 @@ protected:
|
|||||||
long GetPickerStyle(long style) const wxOVERRIDE
|
long GetPickerStyle(long style) const wxOVERRIDE
|
||||||
{ return (style & (wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL)); }
|
{ 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
|
// the maximum pointsize allowed to the user
|
||||||
unsigned int m_nMaxPointSize;
|
unsigned int m_nMaxPointSize;
|
||||||
|
|
||||||
|
@@ -109,6 +109,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
unsigned int GetMaxPointSize() const;
|
unsigned int GetMaxPointSize() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns the minimum point size value allowed for the user-chosen font.
|
||||||
|
|
||||||
|
@since 3.1.1
|
||||||
|
*/
|
||||||
|
unsigned int GetMinPointSize() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the currently selected colour.
|
Returns the currently selected colour.
|
||||||
|
|
||||||
@@ -137,6 +144,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetMaxPointSize(unsigned int max);
|
void SetMaxPointSize(unsigned int max);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets the minimum point size value allowed for the user-chosen font.
|
||||||
|
|
||||||
|
The default value is 0.
|
||||||
|
|
||||||
|
@since 3.1.1
|
||||||
|
*/
|
||||||
|
void SetMinPointSize(unsigned int min);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the font colour.
|
Sets the font colour.
|
||||||
|
|
||||||
|
@@ -38,6 +38,12 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
||||||
|
#define SetMinMaxPointSize(min, max)
|
||||||
|
#else
|
||||||
|
#define SetMinMaxPointSize(min, max) GetPickerWidget()->GetFontData()->SetRange((min), (max))
|
||||||
|
#endif
|
||||||
|
|
||||||
const char wxFontPickerCtrlNameStr[] = "fontpicker";
|
const char wxFontPickerCtrlNameStr[] = "fontpicker";
|
||||||
const char wxFontPickerWidgetNameStr[] = "fontpickerwidget";
|
const char wxFontPickerWidgetNameStr[] = "fontpickerwidget";
|
||||||
|
|
||||||
@@ -150,7 +156,17 @@ void wxFontPickerCtrl::UpdateTextCtrlFromPicker()
|
|||||||
m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont()));
|
m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFontPickerCtrl::SetMinPointSize(unsigned int min)
|
||||||
|
{
|
||||||
|
m_nMinPointSize = min;
|
||||||
|
SetMinMaxPointSize(m_nMinPointSize, m_nMaxPointSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxFontPickerCtrl::SetMaxPointSize(unsigned int max)
|
||||||
|
{
|
||||||
|
m_nMaxPointSize = max;
|
||||||
|
SetMinMaxPointSize(m_nMinPointSize, m_nMaxPointSize);
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFontPickerCtrl - event handlers
|
// wxFontPickerCtrl - event handlers
|
||||||
|
Reference in New Issue
Block a user