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