]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
c0089c96 | 2 | // Name: wx/msw/font.h |
2bda0e17 KB |
3 | // Purpose: wxFont class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FONT_H_ |
13 | #define _WX_FONT_H_ | |
2bda0e17 | 14 | |
c0089c96 | 15 | #include "wx/gdicmn.h" |
88899f6b | 16 | |
0c5d3e1c VZ |
17 | // ---------------------------------------------------------------------------- |
18 | // wxFont | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
2bda0e17 | 22 | { |
2bda0e17 | 23 | public: |
0c5d3e1c | 24 | // ctors and such |
f8855e47 | 25 | wxFont() { } |
0c5d3e1c | 26 | |
0c14b6c3 | 27 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
0c5d3e1c VZ |
28 | wxFont(int size, |
29 | int family, | |
30 | int style, | |
31 | int weight, | |
dabbc6a5 | 32 | bool underlined = false, |
0c5d3e1c VZ |
33 | const wxString& face = wxEmptyString, |
34 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
35 | { | |
0c14b6c3 | 36 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
544229d1 | 37 | } |
0c14b6c3 | 38 | #endif |
544229d1 | 39 | |
0c14b6c3 FM |
40 | wxFont(int size, |
41 | wxFontFamily family, | |
42 | wxFontStyle style, | |
43 | wxFontWeight weight, | |
44 | bool underlined = false, | |
45 | const wxString& face = wxEmptyString, | |
46 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
47 | { | |
48 | Create(size, family, style, weight, underlined, face, encoding); | |
49 | } | |
03647350 | 50 | |
0c14b6c3 FM |
51 | bool Create(int size, |
52 | wxFontFamily family, | |
53 | wxFontStyle style, | |
54 | wxFontWeight weight, | |
55 | bool underlined = false, | |
56 | const wxString& face = wxEmptyString, | |
57 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
58 | { | |
59 | return DoCreate(size, wxDefaultSize, false, family, style, | |
60 | weight, underlined, face, encoding); | |
61 | } | |
62 | ||
63 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
544229d1 VZ |
64 | wxFont(const wxSize& pixelSize, |
65 | int family, | |
66 | int style, | |
67 | int weight, | |
68 | bool underlined = false, | |
69 | const wxString& face = wxEmptyString, | |
70 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
0c14b6c3 FM |
71 | { |
72 | (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, | |
73 | underlined, face, encoding); | |
74 | } | |
75 | #endif | |
76 | ||
77 | wxFont(const wxSize& pixelSize, | |
78 | wxFontFamily family, | |
79 | wxFontStyle style, | |
80 | wxFontWeight weight, | |
81 | bool underlined = false, | |
82 | const wxString& face = wxEmptyString, | |
83 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
544229d1 | 84 | { |
df455719 VZ |
85 | (void)Create(pixelSize, family, style, weight, |
86 | underlined, face, encoding); | |
0c5d3e1c VZ |
87 | } |
88 | ||
04ef50df | 89 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) |
30764ab5 | 90 | { |
04ef50df | 91 | Create(info, hFont); |
30764ab5 VZ |
92 | } |
93 | ||
76e23cdb VZ |
94 | wxFont(const wxString& fontDesc); |
95 | ||
df455719 VZ |
96 | |
97 | bool Create(const wxSize& pixelSize, | |
0c14b6c3 FM |
98 | wxFontFamily family, |
99 | wxFontStyle style, | |
100 | wxFontWeight weight, | |
df455719 VZ |
101 | bool underlined = false, |
102 | const wxString& face = wxEmptyString, | |
103 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
104 | { | |
105 | return DoCreate(-1, pixelSize, true, family, style, | |
106 | weight, underlined, face, encoding); | |
107 | } | |
0c5d3e1c | 108 | |
04ef50df | 109 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); |
76e23cdb | 110 | |
0c5d3e1c VZ |
111 | virtual ~wxFont(); |
112 | ||
113 | // implement base class pure virtuals | |
114 | virtual int GetPointSize() const; | |
544229d1 VZ |
115 | virtual wxSize GetPixelSize() const; |
116 | virtual bool IsUsingSizeInPixels() const; | |
0c14b6c3 FM |
117 | virtual wxFontFamily GetFamily() const; |
118 | virtual wxFontStyle GetStyle() const; | |
119 | virtual wxFontWeight GetWeight() const; | |
0c5d3e1c VZ |
120 | virtual bool GetUnderlined() const; |
121 | virtual wxString GetFaceName() const; | |
122 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 123 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
0c5d3e1c VZ |
124 | |
125 | virtual void SetPointSize(int pointSize); | |
544229d1 | 126 | virtual void SetPixelSize(const wxSize& pixelSize); |
0c14b6c3 FM |
127 | virtual void SetFamily(wxFontFamily family); |
128 | virtual void SetStyle(wxFontStyle style); | |
129 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 130 | virtual bool SetFaceName(const wxString& faceName); |
0c5d3e1c VZ |
131 | virtual void SetUnderlined(bool underlined); |
132 | virtual void SetEncoding(wxFontEncoding encoding); | |
133 | ||
f76c0758 | 134 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 135 | |
9cf8de4c VZ |
136 | virtual bool IsFixedWidth() const; |
137 | ||
0c5d3e1c VZ |
138 | // implementation only from now on |
139 | // ------------------------------- | |
140 | ||
0c5d3e1c VZ |
141 | virtual bool IsFree() const; |
142 | virtual bool RealizeResource(); | |
2b5f62a0 | 143 | virtual WXHANDLE GetResourceHandle() const; |
dabbc6a5 | 144 | virtual bool FreeResource(bool force = false); |
f6bcfd97 | 145 | |
2b5f62a0 | 146 | // for consistency with other wxMSW classes |
f6bcfd97 BP |
147 | WXHFONT GetHFONT() const; |
148 | ||
b823f5a1 | 149 | protected: |
df455719 VZ |
150 | // real font creation function, used in all cases |
151 | bool DoCreate(int size, | |
152 | const wxSize& pixelSize, | |
153 | bool sizeUsingPixels, | |
9817be8a FM |
154 | wxFontFamily family, |
155 | wxFontStyle style, | |
156 | wxFontWeight weight, | |
df455719 VZ |
157 | bool underlined = false, |
158 | const wxString& face = wxEmptyString, | |
159 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
160 | ||
9045ad9d VZ |
161 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); |
162 | ||
f030b28c | 163 | // implement wxObject virtuals which are used by AllocExclusive() |
8f884a0d VZ |
164 | virtual wxGDIRefData *CreateGDIRefData() const; |
165 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
0c5d3e1c VZ |
166 | |
167 | private: | |
168 | DECLARE_DYNAMIC_CLASS(wxFont) | |
2bda0e17 KB |
169 | }; |
170 | ||
c0089c96 | 171 | #endif // _WX_FONT_H_ |