]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/private/fontmgr.h
added wxWeakRef<T> (slightly modified patch 1860953)
[wxWidgets.git] / include / wx / dfb / private / fontmgr.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/private/fontmgr.h
3 // Purpose: font management for wxDFB
4 // Author: Vaclav Slavik
5 // Created: 2006-11-18
6 // RCS-ID: $Id$
7 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
8 // (c) 2006 REA Elektronik GmbH
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DFB_PRIVATE_FONTMGR_H_
13 #define _WX_DFB_PRIVATE_FONTMGR_H_
14
15 #include "wx/dfb/wrapdfb.h"
16
17 class wxFileConfig;
18
19 class wxFontInstance : public wxFontInstanceBase
20 {
21 public:
22 wxFontInstance(float ptSize, bool aa, const wxString& filename);
23
24 wxIDirectFBFontPtr GetDirectFBFont() const { return m_font; }
25
26 private:
27 wxIDirectFBFontPtr m_font;
28 };
29
30 class wxFontFace : public wxFontFaceBase
31 {
32 public:
33 wxFontFace(const wxString& filename) : m_fileName(filename) {}
34
35 protected:
36 wxFontInstance *CreateFontInstance(float ptSize, bool aa);
37
38 private:
39 wxString m_fileName;
40 };
41
42 class wxFontBundle : public wxFontBundleBase
43 {
44 public:
45 wxFontBundle(const wxString& name,
46 const wxString& fileRegular,
47 const wxString& fileBold,
48 const wxString& fileItalic,
49 const wxString& fileBoldItalic,
50 bool isFixed);
51
52 /// Returns name of the family
53 virtual wxString GetName() const { return m_name; }
54
55 virtual bool IsFixed() const { return m_isFixed; }
56
57 private:
58 wxString m_name;
59 bool m_isFixed;
60 };
61
62 class wxFontsManager : public wxFontsManagerBase
63 {
64 public:
65 wxFontsManager() { AddAllFonts(); }
66
67 virtual wxString GetDefaultFacename(wxFontFamily family) const
68 {
69 return m_defaultFacenames[family];
70 }
71
72 private:
73 // adds all fonts using AddBundle()
74 void AddAllFonts();
75 void AddFontsFromDir(const wxString& indexFile);
76 void AddFont(const wxString& dir, const wxString& name, wxFileConfig& cfg);
77 void SetDefaultFonts(wxFileConfig& cfg);
78
79 private:
80 // default facenames
81 wxString m_defaultFacenames[wxFONTFAMILY_MAX];
82 };
83
84 #endif // _WX_DFB_PRIVATE_FONTMGR_H_