]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/font.h
wxCalendarCtrl workaround for occasional wrong combobox height reporting on wxMSW
[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:
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 WXDLLEXPORT wxFont : public wxFontBase
22 {
23 public:
24 // ctors and such
25 wxFont() { }
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 {
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 {
46 (void)Create(pixelSize, family, style, weight,
47 underlined, face, encoding);
48 }
49
50 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
51 {
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
85 // implement base class pure virtuals
86 virtual int GetPointSize() const;
87 virtual wxSize GetPixelSize() const;
88 virtual bool IsUsingSizeInPixels() const;
89 virtual int GetFamily() const;
90 virtual int GetStyle() const;
91 virtual int GetWeight() const;
92 virtual bool GetUnderlined() const;
93 virtual wxString GetFaceName() const;
94 virtual wxFontEncoding GetEncoding() const;
95 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
96
97 virtual void SetPointSize(int pointSize);
98 virtual void SetPixelSize(const wxSize& pixelSize);
99 virtual void SetFamily(int family);
100 virtual void SetStyle(int style);
101 virtual void SetWeight(int weight);
102 virtual bool SetFaceName(const wxString& faceName);
103 virtual void SetUnderlined(bool underlined);
104 virtual void SetEncoding(wxFontEncoding encoding);
105
106 virtual bool IsFixedWidth() const;
107
108 // implementation only from now on
109 // -------------------------------
110
111 virtual bool IsFree() const;
112 virtual bool RealizeResource();
113 virtual WXHANDLE GetResourceHandle() const;
114 virtual bool FreeResource(bool force = false);
115
116 protected:
117 // real font creation function, used in all cases
118 bool DoCreate(int size,
119 const wxSize& pixelSize,
120 bool sizeUsingPixels,
121 int family,
122 int style,
123 int weight,
124 bool underlined = false,
125 const wxString& face = wxEmptyString,
126 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
127
128 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
129
130 void Unshare();
131
132 private:
133 DECLARE_DYNAMIC_CLASS(wxFont)
134 };
135
136 #endif // _WX_FONT_H_