Add wxFontDialog::RestrictSelection() to disallow raster fonts

Under MSW it is possible to restrict the native font dialog to showing
only scalable fonts only, disallowing the raster fonts, so add a method
to wxFontDialog exposing this functionality in wxWidgets API.

Closes https://github.com/wxWidgets/wxWidgets/pull/1926

Closes #16988.
This commit is contained in:
Gilbert Pelletier
2020-07-03 23:28:10 +02:00
committed by Vadim Zeitlin
parent b35ef94a72
commit 76c7f723fc
4 changed files with 65 additions and 11 deletions

View File

@@ -12,6 +12,14 @@
#include "wx/colour.h"
#include "wx/encinfo.h"
// Possible values for RestrictSelection() flags.
enum
{
wxFONTRESTRICT_NONE = 0,
wxFONTRESTRICT_SCALABLE = 1 << 0,
wxFONTRESTRICT_FIXEDPITCH = 1 << 1
};
class WXDLLIMPEXP_CORE wxFontData : public wxObject
{
public:
@@ -33,6 +41,9 @@ public:
void EnableEffects(bool flag) { m_enableEffects = flag; }
bool GetEnableEffects() const { return m_enableEffects; }
void RestrictSelection(int flags) { m_restrictSelection = flags; }
int GetRestrictSelection() const { return m_restrictSelection; }
void SetInitialFont(const wxFont& font) { m_initialFont = font; }
wxFont GetInitialFont() const { return m_initialFont; }
@@ -63,6 +74,7 @@ public:
private:
wxFontEncoding m_encoding;
wxNativeEncodingInfo m_encodingInfo;
int m_restrictSelection;
wxDECLARE_DYNAMIC_CLASS(wxFontData);
};