]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: font.h | |
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 |
a1d58ddc | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FONT_H_ |
13 | #define _WX_FONT_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
0c5d3e1c | 16 | #pragma interface "font.h" |
2bda0e17 KB |
17 | #endif |
18 | ||
0c5d3e1c VZ |
19 | // ---------------------------------------------------------------------------- |
20 | // wxFont | |
21 | // ---------------------------------------------------------------------------- | |
22 | ||
23 | class WXDLLEXPORT wxFont : public wxFontBase | |
2bda0e17 | 24 | { |
2bda0e17 | 25 | public: |
0c5d3e1c VZ |
26 | // ctors and such |
27 | wxFont() { Init(); } | |
28 | wxFont(const wxFont& font) { Init(); Ref(font); } | |
29 | ||
30 | wxFont(int size, | |
31 | int family, | |
32 | int style, | |
33 | int weight, | |
34 | bool underlined = FALSE, | |
35 | const wxString& face = wxEmptyString, | |
36 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
37 | { | |
38 | Init(); | |
39 | ||
40 | (void)Create(size, family, style, weight, underlined, face, encoding); | |
41 | } | |
42 | ||
30764ab5 VZ |
43 | wxFont(const wxNativeFontInfo& info) |
44 | { | |
45 | Init(); | |
46 | ||
47 | (void)Create(info.pointSize, info.family, info.style, info.weight, | |
48 | info.underlined, info.faceName, info.encoding); | |
49 | } | |
50 | ||
0c5d3e1c VZ |
51 | bool Create(int size, |
52 | int family, | |
53 | int style, | |
54 | int weight, | |
55 | bool underlined = FALSE, | |
56 | const wxString& face = wxEmptyString, | |
57 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
58 | ||
59 | virtual ~wxFont(); | |
60 | ||
74b31181 VZ |
61 | // assignment |
62 | wxFont& operator=(const wxFont& font); | |
63 | ||
0c5d3e1c VZ |
64 | // implement base class pure virtuals |
65 | virtual int GetPointSize() const; | |
66 | virtual int GetFamily() const; | |
67 | virtual int GetStyle() const; | |
68 | virtual int GetWeight() const; | |
69 | virtual bool GetUnderlined() const; | |
70 | virtual wxString GetFaceName() const; | |
71 | virtual wxFontEncoding GetEncoding() const; | |
72 | ||
73 | virtual void SetPointSize(int pointSize); | |
74 | virtual void SetFamily(int family); | |
75 | virtual void SetStyle(int style); | |
76 | virtual void SetWeight(int weight); | |
77 | virtual void SetFaceName(const wxString& faceName); | |
78 | virtual void SetUnderlined(bool underlined); | |
79 | virtual void SetEncoding(wxFontEncoding encoding); | |
80 | ||
81 | // implementation only from now on | |
82 | // ------------------------------- | |
83 | ||
84 | int GetFontId() const; | |
85 | virtual bool IsFree() const; | |
86 | virtual bool RealizeResource(); | |
87 | virtual WXHANDLE GetResourceHandle(); | |
88 | virtual bool FreeResource(bool force = FALSE); | |
f6bcfd97 BP |
89 | |
90 | // for consistency with other wxMSW classes and to have a const | |
91 | // GetResourceHandle()-like function we have a synonym for it | |
92 | WXHFONT GetHFONT() const; | |
93 | ||
0c5d3e1c VZ |
94 | /* |
95 | virtual bool UseResource(); | |
96 | virtual bool ReleaseResource(); | |
97 | */ | |
b823f5a1 JS |
98 | |
99 | protected: | |
0c5d3e1c VZ |
100 | // common part of all ctors |
101 | void Init(); | |
102 | ||
103 | void Unshare(); | |
104 | ||
105 | private: | |
106 | DECLARE_DYNAMIC_CLASS(wxFont) | |
2bda0e17 KB |
107 | }; |
108 | ||
109 | #endif | |
bbcdf8bc | 110 | // _WX_FONT_H_ |