]>
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 |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_FONT_H_ |
13 | #define _WX_FONT_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
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, | |
dabbc6a5 | 34 | bool underlined = false, |
0c5d3e1c VZ |
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 | ||
04ef50df | 43 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) |
30764ab5 VZ |
44 | { |
45 | Init(); | |
46 | ||
04ef50df | 47 | Create(info, hFont); |
30764ab5 VZ |
48 | } |
49 | ||
76e23cdb VZ |
50 | wxFont(const wxString& fontDesc); |
51 | ||
0c5d3e1c VZ |
52 | bool Create(int size, |
53 | int family, | |
54 | int style, | |
55 | int weight, | |
dabbc6a5 | 56 | bool underlined = false, |
0c5d3e1c VZ |
57 | const wxString& face = wxEmptyString, |
58 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
59 | ||
04ef50df | 60 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); |
76e23cdb | 61 | |
0c5d3e1c VZ |
62 | virtual ~wxFont(); |
63 | ||
74b31181 VZ |
64 | // assignment |
65 | wxFont& operator=(const wxFont& font); | |
66 | ||
0c5d3e1c VZ |
67 | // implement base class pure virtuals |
68 | virtual int GetPointSize() const; | |
69 | virtual int GetFamily() const; | |
70 | virtual int GetStyle() const; | |
71 | virtual int GetWeight() const; | |
72 | virtual bool GetUnderlined() const; | |
73 | virtual wxString GetFaceName() const; | |
74 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 75 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
0c5d3e1c VZ |
76 | |
77 | virtual void SetPointSize(int pointSize); | |
78 | virtual void SetFamily(int family); | |
79 | virtual void SetStyle(int style); | |
80 | virtual void SetWeight(int weight); | |
81 | virtual void SetFaceName(const wxString& faceName); | |
82 | virtual void SetUnderlined(bool underlined); | |
83 | virtual void SetEncoding(wxFontEncoding encoding); | |
84 | ||
9cf8de4c VZ |
85 | virtual bool IsFixedWidth() const; |
86 | ||
0c5d3e1c VZ |
87 | // implementation only from now on |
88 | // ------------------------------- | |
89 | ||
0c5d3e1c VZ |
90 | virtual bool IsFree() const; |
91 | virtual bool RealizeResource(); | |
2b5f62a0 | 92 | virtual WXHANDLE GetResourceHandle() const; |
dabbc6a5 | 93 | virtual bool FreeResource(bool force = false); |
f6bcfd97 | 94 | |
2b5f62a0 | 95 | // for consistency with other wxMSW classes |
f6bcfd97 BP |
96 | WXHFONT GetHFONT() const; |
97 | ||
0c5d3e1c VZ |
98 | /* |
99 | virtual bool UseResource(); | |
100 | virtual bool ReleaseResource(); | |
101 | */ | |
b823f5a1 JS |
102 | |
103 | protected: | |
9045ad9d VZ |
104 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); |
105 | ||
0c5d3e1c VZ |
106 | // common part of all ctors |
107 | void Init(); | |
108 | ||
109 | void Unshare(); | |
110 | ||
111 | private: | |
112 | DECLARE_DYNAMIC_CLASS(wxFont) | |
2bda0e17 KB |
113 | }; |
114 | ||
115 | #endif | |
bbcdf8bc | 116 | // _WX_FONT_H_ |