]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fontmap.h
Incremented the version number used in the DLL filename to match version.h
[wxWidgets.git] / include / wx / fontmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/fontmap.h
3 // Purpose: wxFontMapper class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 04.11.99
7 // RCS-ID: $Id$
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONTMAPPER_H_
13 #define _WX_FONTMAPPER_H_
14
15 #ifdef __GNUG__
16 #pragma interface "fontmap.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers
21 // ----------------------------------------------------------------------------
22
23 #include "wx/defs.h" // for wxDEFAULT &c
24
25 #include "wx/font.h" // for wxFontEncoding
26
27 class WXDLLEXPORT wxConfigBase;
28
29 // ----------------------------------------------------------------------------
30 // wxFontMapper manages user-definable correspondence between logical font
31 // names and the fonts present on the machine.
32 //
33 // The default implementations of all functions will ask the user if they are
34 // not capable of finding the answer themselves and store the answer in a
35 // config file (configurable via SetConfigXXX functions). This behaviour may
36 // be disabled by giving the value of FALSE to "interactive" parameter.
37 // However, the functions will always consult the config file to allow the
38 // user-defined values override the default logic and there is no way to
39 // disable this - which shouldn't be ever needed because if "interactive" was
40 // never TRUE, the config file is never created anyhow.
41 // ----------------------------------------------------------------------------
42
43 class WXDLLEXPORT wxFontMapper
44 {
45 public:
46 // default ctor
47 wxFontMapper();
48
49 // virtual dtor for a base class
50 virtual ~wxFontMapper();
51
52 // returns the encoding for the given charset (in the form of RFC 2046) or
53 // wxFONTENCODING_SYSTEM if couldn't decode it
54 virtual wxFontEncoding CharsetToEncoding(const wxString& charset,
55 bool interactive = TRUE);
56
57 // configure the appearance of the dialogs we may popup
58 // ----------------------------------------------------
59
60 void SetDialogTitle(const wxString& title) { m_titleDialog = title; }
61
62 // functions which allow to configure the config object used: by default,
63 // the global one (from wxConfigBase::Get() will be used) and the default
64 // root path for the config settings is the string returned by
65 // GetDefaultConfigPath()
66 // ----------------------------------------------------------------------
67
68 // set the config object to use (may be NULL to use default)
69 void SetConfig(wxConfigBase *config) { m_config = config; }
70
71 // set the root config path to use (should be an absolute path)
72 void SetConfigPath(const wxString& prefix);
73
74 // return default config path
75 static const wxChar *GetDefaultConfigPath();
76
77 protected:
78 // get the config object we're using - if it wasn't set explicitly, this
79 // function will use wxConfig::Get() to get the global one
80 wxConfigBase *GetConfig();
81
82 // gets the root path for our settings - if itwasn't set explicitly, use
83 // GetDefaultConfigPath()
84 const wxString& GetConfigPath();
85
86 // change to the given (relative) path in the config, return TRUE if ok
87 // (then GetConfig() will return something !NULL), FALSE if no config
88 // object
89 //
90 // caller should provide a pointer to the string variable which should be
91 // later passed to RestorePath()
92 bool ChangePath(const wxString& pathNew, wxString *pathOld);
93
94 // restore the config path after use
95 void RestorePath(const wxString& pathOld);
96
97 // config object and path (in it) to use
98 wxConfigBase *m_config;
99 wxString m_configRootPath;
100
101 // the title for our dialogs
102 wxString m_titleDialog;
103
104 // the parent window for our dialogs
105 wxWindow *m_windowParent;
106 };
107
108 #endif // _WX_FONTMAPPER_H_