1999-10-01 18:01:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-05-29 21:12:51 +00:00
|
|
|
// Name: wx/fontenum.h
|
1999-10-01 18:01:54 +00:00
|
|
|
// Purpose: wxFontEnumerator class for getting available fonts
|
|
|
|
// Author: Julian Smart, Vadim Zeitlin
|
1999-11-04 20:40:41 +00:00
|
|
|
// Modified by: extended to enumerate more than just font facenames and works
|
|
|
|
// not only on Windows now (VZ)
|
1999-10-01 18:01:54 +00:00
|
|
|
// Created: 04/01/98
|
|
|
|
// Copyright: (c) Julian Smart, Vadim Zeitlin
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-10-01 18:01:54 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_FONTENUM_H_
|
|
|
|
#define _WX_FONTENUM_H_
|
|
|
|
|
2007-07-21 02:20:00 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_FONTENUM
|
|
|
|
|
2003-02-12 20:35:27 +00:00
|
|
|
#include "wx/fontenc.h"
|
2003-07-08 20:41:48 +00:00
|
|
|
#include "wx/arrstr.h"
|
2003-02-12 20:35:27 +00:00
|
|
|
|
1999-10-01 18:01:54 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxFontEnumerator enumerates all available fonts on the system or only the
|
|
|
|
// fonts with given attributes
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 15:06:00 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxFontEnumerator
|
1999-10-01 18:01:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2006-05-28 13:51:34 +00:00
|
|
|
wxFontEnumerator() {}
|
|
|
|
|
|
|
|
// virtual dtor for the base class
|
|
|
|
virtual ~wxFontEnumerator() {}
|
1999-11-06 15:38:23 +00:00
|
|
|
|
1999-11-04 20:40:41 +00:00
|
|
|
// start enumerating font facenames (either all of them or those which
|
|
|
|
// support the given encoding) - will result in OnFacename() being
|
|
|
|
// called for each available facename (until they are exhausted or
|
2004-06-12 23:44:08 +00:00
|
|
|
// OnFacename returns false)
|
1999-11-04 20:40:41 +00:00
|
|
|
virtual bool EnumerateFacenames
|
1999-10-29 17:54:13 +00:00
|
|
|
(
|
|
|
|
wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
|
2004-06-12 23:44:08 +00:00
|
|
|
bool fixedWidthOnly = false
|
1999-10-29 17:54:13 +00:00
|
|
|
);
|
1999-10-01 18:01:54 +00:00
|
|
|
|
1999-11-04 20:40:41 +00:00
|
|
|
// enumerate the different encodings either for given font facename or for
|
|
|
|
// all facenames - will result in OnFontEncoding() being called for each
|
|
|
|
// available (facename, encoding) couple
|
2003-07-10 08:36:14 +00:00
|
|
|
virtual bool EnumerateEncodings(const wxString& facename = wxEmptyString);
|
1999-10-01 18:01:54 +00:00
|
|
|
|
|
|
|
// callbacks which are called after one of EnumerateXXX() functions from
|
2004-06-12 23:44:08 +00:00
|
|
|
// above is invoked - all of them may return false to stop enumeration or
|
|
|
|
// true to continue with it
|
1999-10-01 18:01:54 +00:00
|
|
|
|
1999-11-04 20:40:41 +00:00
|
|
|
// called by EnumerateFacenames
|
2006-05-28 13:51:34 +00:00
|
|
|
virtual bool OnFacename(const wxString& WXUNUSED(facename))
|
|
|
|
{ return true; }
|
1999-10-01 18:01:54 +00:00
|
|
|
|
|
|
|
// called by EnumerateEncodings
|
1999-11-04 20:40:41 +00:00
|
|
|
virtual bool OnFontEncoding(const wxString& WXUNUSED(facename),
|
2006-05-28 13:51:34 +00:00
|
|
|
const wxString& WXUNUSED(encoding))
|
|
|
|
{ return true; }
|
2004-06-12 23:44:08 +00:00
|
|
|
|
|
|
|
|
2003-01-02 23:38:11 +00:00
|
|
|
|
2006-05-28 13:51:34 +00:00
|
|
|
// convenience function that returns array of facenames.
|
|
|
|
static wxArrayString
|
|
|
|
GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
|
|
|
|
bool fixedWidthOnly = false);
|
|
|
|
|
|
|
|
// convenience function that returns array of all available encodings.
|
|
|
|
static wxArrayString GetEncodings(const wxString& facename = wxEmptyString);
|
|
|
|
|
2006-05-29 00:03:36 +00:00
|
|
|
// convenience function that returns true if the given face name exist
|
|
|
|
// in the user's system
|
|
|
|
static bool IsValidFacename(const wxString &str);
|
|
|
|
|
2006-05-28 13:51:34 +00:00
|
|
|
private:
|
2006-12-01 10:14:28 +00:00
|
|
|
#ifdef wxHAS_UTF8_FONTS
|
|
|
|
// helper for ports that only use UTF-8 encoding natively
|
|
|
|
bool EnumerateEncodingsUTF8(const wxString& facename);
|
|
|
|
#endif
|
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxFontEnumerator);
|
1999-10-01 18:01:54 +00:00
|
|
|
};
|
|
|
|
|
2007-07-21 02:20:00 +00:00
|
|
|
#endif // wxUSE_FONTENUM
|
|
|
|
|
1999-10-01 18:01:54 +00:00
|
|
|
#endif // _WX_FONTENUM_H_
|