]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: font.h | |
3 | // Author: Vaclav Slavik | |
4 | // Id: $Id$ | |
5 | // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com) | |
6 | // Licence: wxWindows licence | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | #ifndef __WX_FONT_H__ | |
10 | #define __WX_FONT_H__ | |
11 | ||
12 | #include "wx/hash.h" | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // classes | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
18 | class WXDLLIMPEXP_FWD_CORE wxDC; | |
19 | class WXDLLIMPEXP_FWD_CORE wxPaintDC; | |
20 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
21 | class WXDLLIMPEXP_FWD_CORE wxFont; | |
22 | ||
23 | struct font_t; | |
24 | ||
25 | // ---------------------------------------------------------------------------- | |
26 | // wxFont | |
27 | // ---------------------------------------------------------------------------- | |
28 | ||
29 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase | |
30 | { | |
31 | public: | |
32 | // ctors and such | |
33 | wxFont() { } | |
34 | ||
35 | wxFont(const wxNativeFontInfo& info) | |
36 | { | |
37 | (void)Create(info); | |
38 | } | |
39 | ||
40 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
41 | wxFont(int size, | |
42 | int family, | |
43 | int style, | |
44 | int weight, | |
45 | bool underlined = false, | |
46 | const wxString& face = wxEmptyString, | |
47 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
48 | { | |
49 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); | |
50 | } | |
51 | #endif | |
52 | ||
53 | wxFont(int size, | |
54 | wxFontFamily family, | |
55 | wxFontStyle style, | |
56 | wxFontWeight weight, | |
57 | bool underlined = false, | |
58 | const wxString& face = wxEmptyString, | |
59 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
60 | { | |
61 | Create(size, family, style, weight, underlined, face, encoding); | |
62 | } | |
63 | ||
64 | wxFont(const wxSize& pixelSize, | |
65 | wxFontFamily family, | |
66 | wxFontStyle style, | |
67 | wxFontWeight weight, | |
68 | bool underlined = false, | |
69 | const wxString& face = wxEmptyString, | |
70 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
71 | { | |
72 | Create(10, family, style, weight, underlined, face, encoding); | |
73 | SetPixelSize(pixelSize); | |
74 | } | |
75 | ||
76 | bool Create(int size, | |
77 | wxFontFamily family, | |
78 | wxFontStyle style, | |
79 | wxFontWeight weight, | |
80 | bool underlined = false, | |
81 | const wxString& face = wxEmptyString, | |
82 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
83 | ||
84 | bool Create(const wxNativeFontInfo& fontinfo); | |
85 | ||
86 | virtual ~wxFont() {} | |
87 | ||
88 | // implement base class pure virtuals | |
89 | virtual int GetPointSize() const; | |
90 | virtual wxFontStyle GetStyle() const; | |
91 | virtual wxFontWeight GetWeight() const; | |
92 | virtual wxString GetFaceName() const; | |
93 | virtual bool GetUnderlined() const; | |
94 | virtual wxFontEncoding GetEncoding() const; | |
95 | virtual bool IsFixedWidth() const; | |
96 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
97 | ||
98 | virtual void SetPointSize(int pointSize); | |
99 | virtual void SetFamily(wxFontFamily family); | |
100 | virtual void SetStyle(wxFontStyle style); | |
101 | virtual void SetWeight(wxFontWeight weight); | |
102 | virtual bool SetFaceName(const wxString& faceName); | |
103 | virtual void SetUnderlined(bool underlined); | |
104 | virtual void SetEncoding(wxFontEncoding encoding); | |
105 | ||
106 | wxDECLARE_COMMON_FONT_METHODS(); | |
107 | ||
108 | struct font_t *GetMGLfont_t(float scale, bool antialiased); | |
109 | ||
110 | protected: | |
111 | // ref counting code | |
112 | virtual wxGDIRefData *CreateGDIRefData() const; | |
113 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
114 | ||
115 | virtual wxFontFamily DoGetFamily() const; | |
116 | ||
117 | private: | |
118 | DECLARE_DYNAMIC_CLASS(wxFont) | |
119 | }; | |
120 | ||
121 | #endif // __WX_FONT_H__ |