+ wxConfigBase *m_configDummy;
+
+ wxString m_configRootPath;
+#endif // wxUSE_CONFIG
+
+ // the real implementation of the base class version of CharsetToEncoding()
+ //
+ // returns wxFONTENCODING_UNKNOWN if encoding is unknown and we shouldn't
+ // ask the user about it, wxFONTENCODING_SYSTEM if it is unknown but we
+ // should/could ask the user
+ int NonInteractiveCharsetToEncoding(const wxString& charset);
+
+private:
+ // the global fontmapper object or NULL
+ static wxFontMapper *sm_instance;
+
+ friend class wxFontMapperPathChanger;
+
+ DECLARE_NO_COPY_CLASS(wxFontMapperBase)
+};
+
+// ----------------------------------------------------------------------------
+// wxFontMapper: interactive extension of wxFontMapperBase
+//
+// The default implementations of all functions will ask the user if they are
+// not capable of finding the answer themselves and store the answer in a
+// config file (configurable via SetConfigXXX functions). This behaviour may
+// be disabled by giving the value of false to "interactive" parameter.
+// However, the functions will always consult the config file to allow the
+// user-defined values override the default logic and there is no way to
+// disable this -- which shouldn't be ever needed because if "interactive" was
+// never true, the config file is never created anyhow.
+// ----------------------------------------------------------------------------
+
+#if wxUSE_GUI
+
+class WXDLLIMPEXP_CORE wxFontMapper : public wxFontMapperBase
+{
+public:
+ // default ctor
+ wxFontMapper();
+
+ // virtual dtor for a base class
+ virtual ~wxFontMapper();
+
+ // working with the encodings
+ // --------------------------
+
+ // returns the encoding for the given charset (in the form of RFC 2046) or
+ // wxFONTENCODING_SYSTEM if couldn't decode it
+ virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
+ bool interactive = true);
+
+ // find an alternative for the given encoding (which is supposed to not be
+ // available on this system). If successful, return true and fill info
+ // structure with the parameters required to create the font, otherwise
+ // return false
+ virtual bool GetAltForEncoding(wxFontEncoding encoding,
+ wxNativeEncodingInfo *info,
+ const wxString& facename = wxEmptyString,
+ bool interactive = true);
+
+ // version better suitable for 'public' use. Returns wxFontEcoding
+ // that can be used it wxFont ctor
+ bool GetAltForEncoding(wxFontEncoding encoding,
+ wxFontEncoding *alt_encoding,
+ const wxString& facename = wxEmptyString,
+ bool interactive = true);
+
+ // checks whether given encoding is available in given face or not.
+ //
+ // if no facename is given (default), return true if it's available in any
+ // facename at alll.
+ virtual bool IsEncodingAvailable(wxFontEncoding encoding,
+ const wxString& facename = wxEmptyString);
+
+
+ // configure the appearance of the dialogs we may popup
+ // ----------------------------------------------------
+
+ // the parent window for modal dialogs
+ void SetDialogParent(wxWindow *parent) { m_windowParent = parent; }
+
+ // the title for the dialogs (note that default is quite reasonable)
+ void SetDialogTitle(const wxString& title) { m_titleDialog = title; }
+
+ // GUI code needs to know it's a wxFontMapper because there
+ // are additional methods in the subclass.
+ static wxFontMapper *Get();
+
+ // pseudo-RTTI since we aren't a wxObject.
+ virtual bool IsDummy() { return false; }
+
+protected:
+ // GetAltForEncoding() helper: tests for the existence of the given
+ // encoding and saves the result in config if ok - this results in the
+ // following (desired) behaviour: when an unknown/unavailable encoding is
+ // requested for the first time, the user is asked about a replacement,
+ // but if he doesn't choose any and the default logic finds one, it will
+ // be saved in the config so that the user won't be asked about it any
+ // more
+ bool TestAltEncoding(const wxString& configEntry,
+ wxFontEncoding encReplacement,
+ wxNativeEncodingInfo *info);