]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/font.h
add the wxFont(const wxSize& pixelSize, ...) ctor to all ports; add some wxCHECK_MSGs...
[wxWidgets.git] / include / wx / palmos / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/font.h
3 // Purpose: wxFont class
4 // Author: William Osborne - minimal working wxPalmOS port
5 // Modified by: Yunhui Fu
6 // Created: 10/14/04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONT_H_
13 #define _WX_FONT_H_
14
15 #include "wx/gdicmn.h"
16
17 // ----------------------------------------------------------------------------
18 // wxFont
19 // ----------------------------------------------------------------------------
20
21 class WXDLLIMPEXP_CORE wxFont : public wxFontBase
22 {
23 public:
24 // ctors and such
25 wxFont() { }
26
27 #if FUTURE_WXWIN_COMPATIBILITY_3_0
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 {
36 (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
37 }
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 }
50
51 wxFont(const wxSize& pixelSize,
52 wxFontFamily family,
53 wxFontStyle style,
54 wxFontWeight weight,
55 bool underlined = false,
56 const wxString& face = wxEmptyString,
57 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
58 {
59 Create(10, family, style, weight, underlined, face, encoding);
60 SetPixelSize(pixelSize);
61 }
62
63 bool Create(int size,
64 wxFontFamily family,
65 wxFontStyle style,
66 wxFontWeight weight,
67 bool underlined = false,
68 const wxString& face = wxEmptyString,
69 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
70
71 wxFont(const wxSize& pixelSize,
72 int family,
73 int style,
74 int weight,
75 bool underlined = false,
76 const wxString& face = wxEmptyString,
77 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
78 {
79 (void)Create(pixelSize, family, style, weight,
80 underlined, face, encoding);
81 }
82
83 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
84 {
85 Create(info, hFont);
86 }
87
88 wxFont(const wxString& fontDesc);
89
90 bool Create(const wxSize& pixelSize,
91 int family,
92 int style,
93 int weight,
94 bool underlined = false,
95 const wxString& face = wxEmptyString,
96 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
97 {
98 return DoCreate(-1, pixelSize, true, family, style,
99 weight, underlined, face, encoding);
100 }
101
102 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
103
104 virtual ~wxFont();
105
106 // wxFontBase overridden functions
107 virtual wxString GetNativeFontInfoDesc() const;
108 virtual wxString GetNativeFontInfoUserDesc() const;
109
110 // implement base class pure virtuals
111 virtual int GetPointSize() const;
112 virtual wxSize GetPixelSize() const;
113 virtual bool IsUsingSizeInPixels() const;
114 virtual wxFontFamily GetFamily() const;
115 virtual wxFontStyle GetStyle() const;
116 virtual wxFontWeight GetWeight() const;
117 virtual bool GetUnderlined() const;
118 virtual wxString GetFaceName() const;
119 virtual wxFontEncoding GetEncoding() const;
120 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
121
122 virtual void SetPointSize(int pointSize);
123 virtual void SetPixelSize(const wxSize& pixelSize);
124 virtual void SetFamily(wxFontFamily family);
125 virtual void SetStyle(wxFontStyle style);
126 virtual void SetWeight(wxFontWeight weight);
127 virtual bool SetFaceName(const wxString& faceName);
128 virtual void SetUnderlined(bool underlined);
129 virtual void SetEncoding(wxFontEncoding encoding);
130
131 WXDECLARE_COMPAT_SETTERS
132
133 virtual bool IsFixedWidth() const;
134
135 // implementation only from now on
136 // -------------------------------
137
138 virtual bool IsFree() const;
139 virtual bool RealizeResource();
140 virtual WXHANDLE GetResourceHandle() const;
141 virtual bool FreeResource(bool force = false);
142
143 protected:
144 // real font creation function, used in all cases
145 bool DoCreate(int size,
146 const wxSize& pixelSize,
147 bool sizeUsingPixels,
148 int family,
149 int style,
150 int weight,
151 bool underlined = false,
152 const wxString& face = wxEmptyString,
153 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
154
155 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
156
157 // implement wxObject virtuals which are used by AllocExclusive()
158 virtual wxGDIRefData *CreateGDIRefData() const;
159 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
160
161 private:
162 DECLARE_DYNAMIC_CLASS(wxFont)
163 };
164
165 #endif // _WX_FONT_H_