]>
Commit | Line | Data |
---|---|---|
e2478fde VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/fmappriv.h | |
3 | // Purpose: private wxFontMapper stuff, not to be used by the library users | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 21.06.2003 (extracted from common/fontmap.cpp) | |
77ffb593 | 7 | // Copyright: (c) 1999-2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 8 | // Licence: wxWindows licence |
e2478fde VZ |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_FMAPPRIV_H_ | |
12 | #define _WX_FMAPPRIV_H_ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // constants | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | // a special pseudo encoding which means "don't ask me about this charset | |
19 | // any more" -- we need it to avoid driving the user crazy with asking him | |
20 | // time after time about the same charset which he [presumably] doesn't | |
21 | // have the fonts for | |
22 | enum { wxFONTENCODING_UNKNOWN = -2 }; | |
23 | ||
24 | // the config paths we use | |
25 | #if wxUSE_CONFIG | |
26 | ||
e7d9c398 | 27 | #define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper") |
e2478fde VZ |
28 | #define FONTMAPPER_CHARSET_PATH wxT("Charsets") |
29 | #define FONTMAPPER_CHARSET_ALIAS_PATH wxT("Aliases") | |
30 | ||
31 | #endif // wxUSE_CONFIG | |
32 | ||
33 | // ---------------------------------------------------------------------------- | |
34 | // wxFontMapperPathChanger: change the config path during our lifetime | |
35 | // ---------------------------------------------------------------------------- | |
36 | ||
f1c75e0f | 37 | #if wxUSE_CONFIG && wxUSE_FILECONFIG |
e2478fde VZ |
38 | |
39 | class wxFontMapperPathChanger | |
40 | { | |
41 | public: | |
42 | wxFontMapperPathChanger(wxFontMapperBase *fontMapper, const wxString& path) | |
43 | { | |
44 | m_fontMapper = fontMapper; | |
45 | m_ok = m_fontMapper->ChangePath(path, &m_pathOld); | |
46 | } | |
47 | ||
48 | bool IsOk() const { return m_ok; } | |
49 | ||
50 | ~wxFontMapperPathChanger() | |
51 | { | |
52 | if ( IsOk() ) | |
53 | m_fontMapper->RestorePath(m_pathOld); | |
54 | } | |
55 | ||
56 | private: | |
57 | // the fontmapper object we're working with | |
58 | wxFontMapperBase *m_fontMapper; | |
59 | ||
60 | // the old path to be restored if m_ok | |
61 | wxString m_pathOld; | |
62 | ||
63 | // have we changed the path successfully? | |
64 | bool m_ok; | |
65 | ||
66 | ||
c0c133e1 | 67 | wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger); |
e2478fde VZ |
68 | }; |
69 | ||
70 | #endif // wxUSE_CONFIG | |
71 | ||
72 | #endif // _WX_FMAPPRIV_H_ | |
73 |