]>
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 | 26 | |
0c14b6c3 | 27 | #if FUTURE_WXWIN_COMPATIBILITY_3_0 |
ffecfa5a JS |
28 | wxFont(int size, |
29 | int family, | |
30 | int style, | |
31 | int weight, | |
32 | bool underlined = false, | |
33 | const wxString& face = wxEmptyString, | |
34 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
35 | { | |
0c14b6c3 | 36 | (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding); |
ffecfa5a | 37 | } |
0c14b6c3 FM |
38 | #endif |
39 | ||
40 | wxFont(int size, | |
41 | wxFontFamily family, | |
42 | wxFontStyle style, | |
43 | wxFontWeight weight, | |
44 | bool underlined = false, | |
45 | const wxString& face = wxEmptyString, | |
46 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
47 | { | |
48 | Create(size, family, style, weight, underlined, face, encoding); | |
49 | } | |
03647350 | 50 | |
0c14b6c3 FM |
51 | bool Create(int size, |
52 | wxFontFamily family, | |
53 | wxFontStyle style, | |
54 | wxFontWeight weight, | |
55 | bool underlined = false, | |
56 | const wxString& face = wxEmptyString, | |
57 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
ffecfa5a JS |
58 | |
59 | wxFont(const wxSize& pixelSize, | |
60 | int family, | |
61 | int style, | |
62 | int weight, | |
63 | bool underlined = false, | |
64 | const wxString& face = wxEmptyString, | |
65 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
66 | { | |
ffecfa5a JS |
67 | (void)Create(pixelSize, family, style, weight, |
68 | underlined, face, encoding); | |
69 | } | |
70 | ||
71 | wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0) | |
72 | { | |
ffecfa5a JS |
73 | Create(info, hFont); |
74 | } | |
75 | ||
76 | wxFont(const wxString& fontDesc); | |
77 | ||
ffecfa5a JS |
78 | bool Create(const wxSize& pixelSize, |
79 | int family, | |
80 | int style, | |
81 | int weight, | |
82 | bool underlined = false, | |
83 | const wxString& face = wxEmptyString, | |
84 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT) | |
85 | { | |
86 | return DoCreate(-1, pixelSize, true, family, style, | |
87 | weight, underlined, face, encoding); | |
88 | } | |
89 | ||
90 | bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0); | |
91 | ||
92 | virtual ~wxFont(); | |
93 | ||
6afc1b46 VZ |
94 | // wxFontBase overridden functions |
95 | virtual wxString GetNativeFontInfoDesc() const; | |
96 | virtual wxString GetNativeFontInfoUserDesc() const; | |
97 | ||
ffecfa5a JS |
98 | // implement base class pure virtuals |
99 | virtual int GetPointSize() const; | |
100 | virtual wxSize GetPixelSize() const; | |
101 | virtual bool IsUsingSizeInPixels() const; | |
0c14b6c3 FM |
102 | virtual wxFontStyle GetStyle() const; |
103 | virtual wxFontWeight GetWeight() const; | |
ffecfa5a JS |
104 | virtual bool GetUnderlined() const; |
105 | virtual wxString GetFaceName() const; | |
106 | virtual wxFontEncoding GetEncoding() const; | |
107 | virtual const wxNativeFontInfo *GetNativeFontInfo() const; | |
108 | ||
109 | virtual void SetPointSize(int pointSize); | |
110 | virtual void SetPixelSize(const wxSize& pixelSize); | |
0c14b6c3 FM |
111 | virtual void SetFamily(wxFontFamily family); |
112 | virtual void SetStyle(wxFontStyle style); | |
113 | virtual void SetWeight(wxFontWeight weight); | |
85ab460e | 114 | virtual bool SetFaceName(const wxString& faceName); |
ffecfa5a JS |
115 | virtual void SetUnderlined(bool underlined); |
116 | virtual void SetEncoding(wxFontEncoding encoding); | |
117 | ||
f76c0758 | 118 | wxDECLARE_COMMON_FONT_METHODS(); |
0c14b6c3 | 119 | |
ffecfa5a JS |
120 | virtual bool IsFixedWidth() const; |
121 | ||
122 | // implementation only from now on | |
123 | // ------------------------------- | |
124 | ||
125 | virtual bool IsFree() const; | |
126 | virtual bool RealizeResource(); | |
127 | virtual WXHANDLE GetResourceHandle() const; | |
128 | virtual bool FreeResource(bool force = false); | |
129 | ||
ffecfa5a JS |
130 | protected: |
131 | // real font creation function, used in all cases | |
132 | bool DoCreate(int size, | |
133 | const wxSize& pixelSize, | |
134 | bool sizeUsingPixels, | |
135 | int family, | |
136 | int style, | |
137 | int weight, | |
138 | bool underlined = false, | |
139 | const wxString& face = wxEmptyString, | |
140 | wxFontEncoding encoding = wxFONTENCODING_DEFAULT); | |
141 | ||
142 | virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info); | |
59b7da02 | 143 | virtual wxFontFamily DoGetFamily() const; |
ffecfa5a | 144 | |
6afc1b46 VZ |
145 | // implement wxObject virtuals which are used by AllocExclusive() |
146 | virtual wxGDIRefData *CreateGDIRefData() const; | |
147 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
ffecfa5a JS |
148 | |
149 | private: | |
150 | DECLARE_DYNAMIC_CLASS(wxFont) | |
151 | }; | |
152 | ||
c0089c96 | 153 | #endif // _WX_FONT_H_ |