]>
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 | ||
88899f6b RL |
19 | #include <wx/gdicmn.h> |
20 | ||
0c5d3e1c VZ |
21 | // ---------------------------------------------------------------------------- |
22 | // wxFont | |
23 | // ---------------------------------------------------------------------------- | |
24 | ||
25 | class WXDLLEXPORT wxFont : public wxFontBase | |
2bda0e17 | 26 | { |
2bda0e17 | 27 | public: |
0c5d3e1c VZ |
28 | // ctors and such |
29 | wxFont() { Init(); } | |
4dddb8a2 | 30 | wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); } |
0c5d3e1c VZ |
31 | |
32 | wxFont(int size, | |
33 | int family, | |
34 | int style, | |
35 | int weight, | |
dabbc6a5 | 36 | bool underlined = false, |
0c5d3e1c VZ |
37 | const wxString& face = wxEmptyString, |
38 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
39 | { | |
40 | Init(); | |
41 | ||
544229d1 VZ |
42 | (void)Create(size, wxSize(0, 0), FALSE, family, style, weight, |
43 | underlined, face, encoding); | |
44 | } | |
45 | ||
46 | wxFont(const wxSize& pixelSize, | |
47 | int family, | |
48 | int style, | |
49 | int weight, | |
50 | bool underlined = false, | |
51 | const wxString& face = wxEmptyString, | |
52 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
53 | { | |
54 | Init(); | |
55 | ||
56 | (void)Create(0, pixelSize, TRUE, family, style, weight, underlined, | |
57 | face, encoding); | |
0c5d3e1c VZ |
58 | } |
59 | ||
04ef50df | 60 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) |
30764ab5 VZ |
61 | { |
62 | Init(); | |
63 | ||
04ef50df | 64 | Create(info, hFont); |
30764ab5 VZ |
65 | } |
66 | ||
76e23cdb VZ |
67 | wxFont(const wxString& fontDesc); |
68 | ||
0c5d3e1c | 69 | bool Create(int size, |
544229d1 VZ |
70 | const wxSize& pixelSize, |
71 | bool sizeUsingPixels, | |
0c5d3e1c VZ |
72 | int family, |
73 | int style, | |
74 | int weight, | |
dabbc6a5 | 75 | bool underlined = false, |
0c5d3e1c VZ |
76 | const wxString& face = wxEmptyString, |
77 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
78 | ||
04ef50df | 79 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); |
76e23cdb | 80 | |
0c5d3e1c VZ |
81 | virtual ~wxFont(); |
82 | ||
74b31181 VZ |
83 | // assignment |
84 | wxFont& operator=(const wxFont& font); | |
85 | ||
0c5d3e1c VZ |
86 | // implement base class pure virtuals |
87 | virtual int GetPointSize() const; | |
544229d1 VZ |
88 | virtual wxSize GetPixelSize() const; |
89 | virtual bool IsUsingSizeInPixels() const; | |
0c5d3e1c VZ |
90 | virtual int GetFamily() const; |
91 | virtual int GetStyle() const; | |
92 | virtual int GetWeight() const; | |
93 | virtual bool GetUnderlined() const; | |
94 | virtual wxString GetFaceName() const; | |
95 | virtual wxFontEncoding GetEncoding() const; | |
3bf5a59b | 96 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; |
0c5d3e1c VZ |
97 | |
98 | virtual void SetPointSize(int pointSize); | |
544229d1 | 99 | virtual void SetPixelSize(const wxSize& pixelSize); |
0c5d3e1c VZ |
100 | virtual void SetFamily(int family); |
101 | virtual void SetStyle(int style); | |
102 | virtual void SetWeight(int weight); | |
103 | virtual void SetFaceName(const wxString& faceName); | |
104 | virtual void SetUnderlined(bool underlined); | |
105 | virtual void SetEncoding(wxFontEncoding encoding); | |
106 | ||
9cf8de4c VZ |
107 | virtual bool IsFixedWidth() const; |
108 | ||
0c5d3e1c VZ |
109 | // implementation only from now on |
110 | // ------------------------------- | |
111 | ||
0c5d3e1c VZ |
112 | virtual bool IsFree() const; |
113 | virtual bool RealizeResource(); | |
2b5f62a0 | 114 | virtual WXHANDLE GetResourceHandle() const; |
dabbc6a5 | 115 | virtual bool FreeResource(bool force = false); |
f6bcfd97 | 116 | |
2b5f62a0 | 117 | // for consistency with other wxMSW classes |
f6bcfd97 BP |
118 | WXHFONT GetHFONT() const; |
119 | ||
0c5d3e1c VZ |
120 | /* |
121 | virtual bool UseResource(); | |
122 | virtual bool ReleaseResource(); | |
123 | */ | |
b823f5a1 JS |
124 | |
125 | protected: | |
9045ad9d VZ |
126 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); |
127 | ||
0c5d3e1c VZ |
128 | // common part of all ctors |
129 | void Init(); | |
130 | ||
131 | void Unshare(); | |
132 | ||
133 | private: | |
134 | DECLARE_DYNAMIC_CLASS(wxFont) | |
2bda0e17 KB |
135 | }; |
136 | ||
137 | #endif | |
bbcdf8bc | 138 | // _WX_FONT_H_ |