2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: fontenum.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxFontEnumerator
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFontEnumerator
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
wxFontEnumerator enumerates either all available fonts on the system or only
|
|
|
|
the ones with given attributes - either only fixed-width (suited for use in
|
|
|
|
programs such as terminal emulators and the like) or the fonts available in
|
2008-09-25 19:15:28 +00:00
|
|
|
the given encoding).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
|
|
To do this, you just have to call one of EnumerateXXX() functions - either
|
2008-09-25 19:15:28 +00:00
|
|
|
wxFontEnumerator::EnumerateFacenames() or wxFontEnumerator::EnumerateEncodings()
|
|
|
|
and the corresponding callback (wxFontEnumerator::OnFacename() or
|
|
|
|
wxFontEnumerator::OnFontEncoding()) will be called repeatedly until either
|
|
|
|
all fonts satisfying the specified criteria are exhausted or the callback
|
|
|
|
returns @false.
|
|
|
|
|
|
|
|
@section fontenum_virtual Virtual functions to override
|
|
|
|
|
|
|
|
Either OnFacename or OnFontEncoding should be overridden depending on
|
|
|
|
whether you plan to call EnumerateFacenames or EnumerateEncodings.
|
|
|
|
Of course, if you call both of them, you should override both functions.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
2008-09-25 19:15:28 +00:00
|
|
|
@category{gdi}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-09-25 20:00:31 +00:00
|
|
|
@see @ref overview_fontencoding, @ref page_samples_font, wxFont, wxFontMapper
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxFontEnumerator
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-09-25 19:15:28 +00:00
|
|
|
Call OnFontEncoding() for each encoding supported by the given font -
|
|
|
|
or for each encoding supported by at least some font if @a font is not specified.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-10-28 15:36:26 +00:00
|
|
|
virtual bool EnumerateEncodings(const wxString& font = wxEmptyString);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-09-25 19:15:28 +00:00
|
|
|
Call OnFacename() for each font which supports given encoding (only if
|
|
|
|
it is not @c wxFONTENCODING_SYSTEM) and is of fixed width
|
|
|
|
(if @a fixedWidthOnly is @true).
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Calling this function with default arguments will result in enumerating all
|
|
|
|
fonts available on the system.
|
|
|
|
*/
|
|
|
|
virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
|
2008-03-09 12:33:59 +00:00
|
|
|
bool fixedWidthOnly = false);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Return array of strings containing all encodings found by
|
2008-03-08 13:52:38 +00:00
|
|
|
EnumerateEncodings().
|
|
|
|
*/
|
2009-01-10 18:31:45 +00:00
|
|
|
static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Return array of strings containing all facenames found by
|
2008-03-08 13:52:38 +00:00
|
|
|
EnumerateFacenames().
|
|
|
|
*/
|
|
|
|
static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
|
2008-03-09 12:33:59 +00:00
|
|
|
bool fixedWidthOnly = false);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the given string is valid face name, i.e. it's the face name
|
2008-09-25 19:15:28 +00:00
|
|
|
of an installed font and it can safely be used with wxFont::SetFaceName.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
static bool IsValidFacename(const wxString& facename);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-09-25 19:15:28 +00:00
|
|
|
Called by EnumerateFacenames() for each match.
|
|
|
|
|
|
|
|
Return @true to continue enumeration or @false to stop it.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
virtual bool OnFacename(const wxString& font);
|
|
|
|
|
|
|
|
/**
|
2008-09-25 19:15:28 +00:00
|
|
|
Called by EnumerateEncodings() for each match.
|
|
|
|
|
|
|
|
Return @true to continue enumeration or @false to stop it.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
virtual bool OnFontEncoding(const wxString& font,
|
|
|
|
const wxString& encoding);
|
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|