]> git.saurik.com Git - wxWidgets.git/blob - include/wx/fmappriv.h
Partial fix for #15196: wxRichTextCell caret issues (dghart)
[wxWidgets.git] / include / wx / fmappriv.h
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 // Copyright: (c) 1999-2003 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
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
27 #define FONTMAPPER_ROOT_PATH wxT("/wxWindows/FontMapper")
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
37 #if wxUSE_CONFIG && wxUSE_FILECONFIG
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
67 wxDECLARE_NO_COPY_CLASS(wxFontMapperPathChanger);
68 };
69
70 #endif // wxUSE_CONFIG
71
72 #endif // _WX_FMAPPRIV_H_
73