]>
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 | |
b960795e VZ |
27 | wxFont(const wxFontInfo& info); |
28 | ||
0c14b6c3 | 29 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
0c5d3e1c VZ |
30 | wxFont(int size, |
31 | int family, | |
32 | int style, | |
33 | int weight, | |
dabbc6a5 | 34 | bool underlined = false, |
0c5d3e1c VZ |
35 | const wxString& face = wxEmptyString, |
36 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
37 | { | |
0c14b6c3 | 38 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
544229d1 | 39 | } |
0c14b6c3 | 40 | #endif |
544229d1 | 41 | |
0c14b6c3 FM |
42 | wxFont(int size, |
43 | wxFontFamily family, | |
44 | wxFontStyle style, | |
45 | wxFontWeight weight, | |
46 | bool underlined = false, | |
47 | const wxString& face = wxEmptyString, | |
48 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
49 | { | |
50 | Create(size, family, style, weight, underlined, face, encoding); | |
51 | } | |
03647350 | 52 | |
0c14b6c3 FM |
53 | bool Create(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 | return DoCreate(size, wxDefaultSize, false, family, style, | |
62 | weight, underlined, face, encoding); | |
63 | } | |
64 | ||
65 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 | |
544229d1 VZ |
66 | wxFont(const wxSize& pixelSize, |
67 | int family, | |
68 | int style, | |
69 | int weight, | |
70 | bool underlined = false, | |
71 | const wxString& face = wxEmptyString, | |
72 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
0c14b6c3 FM |
73 | { |
74 | (void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, | |
75 | underlined, face, encoding); | |
76 | } | |
77 | #endif | |
78 | ||
79 | wxFont(const wxSize& pixelSize, | |
80 | wxFontFamily family, | |
81 | wxFontStyle style, | |
82 | wxFontWeight weight, | |
83 | bool underlined = false, | |
84 | const wxString& face = wxEmptyString, | |
85 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
544229d1 | 86 | { |
df455719 VZ |
87 | (void)Create(pixelSize, family, style, weight, |
88 | underlined, face, encoding); | |
0c5d3e1c VZ |
89 | } |
90 | ||
04ef50df | 91 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) |
30764ab5 | 92 | { |
04ef50df | 93 | Create(info, hFont); |
30764ab5 VZ |
94 | } |
95 | ||
76e23cdb VZ |
96 | wxFont(const wxString& fontDesc); |
97 | ||
df455719 VZ |
98 | |
99 | bool Create(const wxSize& pixelSize, | |
0c14b6c3 FM |
100 | wxFontFamily family, |
101 | wxFontStyle style, | |
102 | wxFontWeight weight, | |
df455719 VZ |
103 | bool underlined = false, |
104 | const wxString& face = wxEmptyString, | |
105 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
106 | { | |
107 | return DoCreate(-1, pixelSize, true, family, style, | |
108 | weight, underlined, face, encoding); | |
109 | } | |
0c5d3e1c | 110 | |
04ef50df | 111 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); |
76e23cdb | 112 | |
0c5d3e1c VZ |
113 | virtual ~wxFont(); |
114 | ||
115 | // implement base class pure virtuals | |
116 | virtual int GetPointSize() const; | |
544229d1 VZ |
117 | virtual wxSize GetPixelSize() const; |
118 | virtual bool IsUsingSizeInPixels() const; | |
0c14b6c3 FM |
119 | virtual wxFontStyle GetStyle() const; |
120 | virtual wxFontWeight GetWeight() const; | |
0c5d3e1c | 121 | virtual bool GetUnderlined() const; |
c7a49742 | 122 | virtual bool GetStrikethrough() const; |
0c5d3e1c VZ |
123 | virtual wxString GetFaceName() const; |
124 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 125 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
0c5d3e1c VZ |
126 | |
127 | virtual void SetPointSize(int pointSize); | |
544229d1 | 128 | virtual void SetPixelSize(const wxSize& pixelSize); |
0c14b6c3 FM |
129 | virtual void SetFamily(wxFontFamily family); |
130 | virtual void SetStyle(wxFontStyle style); | |
131 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 132 | virtual bool SetFaceName(const wxString& faceName); |
0c5d3e1c | 133 | virtual void SetUnderlined(bool underlined); |
c7a49742 | 134 | virtual void SetStrikethrough(bool strikethrough); |
0c5d3e1c VZ |
135 | virtual void SetEncoding(wxFontEncoding encoding); |
136 | ||
f76c0758 | 137 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 138 | |
9cf8de4c VZ |
139 | virtual bool IsFixedWidth() const; |
140 | ||
0c5d3e1c VZ |
141 | // implementation only from now on |
142 | // ------------------------------- | |
143 | ||
0c5d3e1c VZ |
144 | virtual bool IsFree() const; |
145 | virtual bool RealizeResource(); | |
2b5f62a0 | 146 | virtual WXHANDLE GetResourceHandle() const; |
dabbc6a5 | 147 | virtual bool FreeResource(bool force = false); |
f6bcfd97 | 148 | |
2b5f62a0 | 149 | // for consistency with other wxMSW classes |
f6bcfd97 BP |
150 | WXHFONT GetHFONT() const; |
151 | ||
b823f5a1 | 152 | protected: |
df455719 VZ |
153 | // real font creation function, used in all cases |
154 | bool DoCreate(int size, | |
155 | const wxSize& pixelSize, | |
156 | bool sizeUsingPixels, | |
9817be8a FM |
157 | wxFontFamily family, |
158 | wxFontStyle style, | |
159 | wxFontWeight weight, | |
df455719 VZ |
160 | bool underlined = false, |
161 | const wxString& face = wxEmptyString, | |
162 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
163 | ||
9045ad9d | 164 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); |
59b7da02 | 165 | virtual wxFontFamily DoGetFamily() const; |
9045ad9d | 166 | |
f030b28c | 167 | // implement wxObject virtuals which are used by AllocExclusive() |
8f884a0d VZ |
168 | virtual wxGDIRefData *CreateGDIRefData() const; |
169 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
0c5d3e1c VZ |
170 | |
171 | private: | |
172 | DECLARE_DYNAMIC_CLASS(wxFont) | |
2bda0e17 KB |
173 | }; |
174 | ||
c0089c96 | 175 | #endif // _WX_FONT_H_ |