]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e1d63b79 | 2 | // Name: wx/palmos/font.h |
ffecfa5a | 3 | // Purpose: wxFont class |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
6afc1b46 | 5 | // Modified by: Yunhui Fu |
ffecfa5a | 6 | // Created: 10/14/04 |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FONT_H_ | |
13 | #define _WX_FONT_H_ | |
14 | ||
c0089c96 | 15 | #include "wx/gdicmn.h" |
ffecfa5a JS |
16 | |
17 | // ---------------------------------------------------------------------------- | |
18 | // wxFont | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxFont : public wxFontBase |
ffecfa5a JS |
22 | { |
23 | public: | |
24 | // ctors and such | |
f8855e47 | 25 | wxFont() { } |
ffecfa5a JS |
26 | |
27 | wxFont(int size, | |
28 | int family, | |
29 | int style, | |
30 | int weight, | |
31 | bool underlined = false, | |
32 | const wxString& face = wxEmptyString, | |
33 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
34 | { | |
ffecfa5a JS |
35 | (void)Create(size, family, style, weight, underlined, face, encoding); |
36 | } | |
37 | ||
38 | wxFont(const wxSize& pixelSize, | |
39 | int family, | |
40 | int style, | |
41 | int weight, | |
42 | bool underlined = false, | |
43 | const wxString& face = wxEmptyString, | |
44 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
45 | { | |
ffecfa5a JS |
46 | (void)Create(pixelSize, family, style, weight, |
47 | underlined, face, encoding); | |
48 | } | |
49 | ||
50 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) | |
51 | { | |
ffecfa5a JS |
52 | Create(info, hFont); |
53 | } | |
54 | ||
55 | wxFont(const wxString& fontDesc); | |
56 | ||
57 | bool Create(int size, | |
58 | int family, | |
59 | int style, | |
60 | int weight, | |
61 | bool underlined = false, | |
62 | const wxString& face = wxEmptyString, | |
63 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
64 | { | |
65 | return DoCreate(size, wxDefaultSize, false, family, style, | |
66 | weight, underlined, face, encoding); | |
67 | } | |
68 | ||
69 | bool Create(const wxSize& pixelSize, | |
70 | int family, | |
71 | int style, | |
72 | int weight, | |
73 | bool underlined = false, | |
74 | const wxString& face = wxEmptyString, | |
75 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
76 | { | |
77 | return DoCreate(-1, pixelSize, true, family, style, | |
78 | weight, underlined, face, encoding); | |
79 | } | |
80 | ||
81 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); | |
82 | ||
83 | virtual ~wxFont(); | |
84 | ||
6afc1b46 VZ |
85 | // wxFontBase overridden functions |
86 | virtual wxString GetNativeFontInfoDesc() const; | |
87 | virtual wxString GetNativeFontInfoUserDesc() const; | |
88 | ||
ffecfa5a JS |
89 | // implement base class pure virtuals |
90 | virtual int GetPointSize() const; | |
91 | virtual wxSize GetPixelSize() const; | |
92 | virtual bool IsUsingSizeInPixels() const; | |
93 | virtual int GetFamily() const; | |
94 | virtual int GetStyle() const; | |
95 | virtual int GetWeight() const; | |
96 | virtual bool GetUnderlined() const; | |
97 | virtual wxString GetFaceName() const; | |
98 | virtual wxFontEncoding GetEncoding() const; | |
99 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
100 | ||
101 | virtual void SetPointSize(int pointSize); | |
102 | virtual void SetPixelSize(const wxSize& pixelSize); | |
103 | virtual void SetFamily(int family); | |
104 | virtual void SetStyle(int style); | |
105 | virtual void SetWeight(int weight); | |
85ab460e | 106 | virtual bool SetFaceName(const wxString& faceName); |
ffecfa5a JS |
107 | virtual void SetUnderlined(bool underlined); |
108 | virtual void SetEncoding(wxFontEncoding encoding); | |
109 | ||
110 | virtual bool IsFixedWidth() const; | |
111 | ||
112 | // implementation only from now on | |
113 | // ------------------------------- | |
114 | ||
115 | virtual bool IsFree() const; | |
116 | virtual bool RealizeResource(); | |
117 | virtual WXHANDLE GetResourceHandle() const; | |
118 | virtual bool FreeResource(bool force = false); | |
119 | ||
ffecfa5a JS |
120 | protected: |
121 | // real font creation function, used in all cases | |
122 | bool DoCreate(int size, | |
123 | const wxSize& pixelSize, | |
124 | bool sizeUsingPixels, | |
125 | int family, | |
126 | int style, | |
127 | int weight, | |
128 | bool underlined = false, | |
129 | const wxString& face = wxEmptyString, | |
130 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
131 | ||
132 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); | |
133 | ||
6afc1b46 VZ |
134 | // implement wxObject virtuals which are used by AllocExclusive() |
135 | virtual wxGDIRefData *CreateGDIRefData() const; | |
136 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
ffecfa5a JS |
137 | |
138 | private: | |
139 | DECLARE_DYNAMIC_CLASS(wxFont) | |
140 | }; | |
141 | ||
c0089c96 | 142 | #endif // _WX_FONT_H_ |