]> git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/font.h
Minor cleanings.
[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() { Init(); }
26 wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); }
27
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 Init();
37
38 (void)Create(size, family, style, weight, underlined, face, encoding);
39 }
40
41 wxFont(const wxSize& pixelSize,
42 int family,
43 int style,
44 int weight,
45 bool underlined = false,
46 const wxString& face = wxEmptyString,
47 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
48 {
49 Init();
50
51 (void)Create(pixelSize, family, style, weight,
52 underlined, face, encoding);
53 }
54
55 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
56 {
57 Init();
58
59 Create(info, hFont);
60 }
61
62 wxFont(const wxString& fontDesc);
63
64 bool Create(int size,
65 int family,
66 int style,
67 int weight,
68 bool underlined = false,
69 const wxString& face = wxEmptyString,
70 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
71 {
72 return DoCreate(size, wxDefaultSize, false, family, style,
73 weight, underlined, face, encoding);
74 }
75
76 bool Create(const wxSize& pixelSize,
77 int family,
78 int style,
79 int weight,
80 bool underlined = false,
81 const wxString& face = wxEmptyString,
82 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
83 {
84 return DoCreate(-1, pixelSize, true, family, style,
85 weight, underlined, face, encoding);
86 }
87
88 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
89
90 virtual ~wxFont();
91
92 // assignment
93 wxFont& operator=(const wxFont& font);
94
95 // implement base class pure virtuals
96 virtual int GetPointSize() const;
97 virtual wxSize GetPixelSize() const;
98 virtual bool IsUsingSizeInPixels() const;
99 virtual int GetFamily() const;
100 virtual int GetStyle() const;
101 virtual int GetWeight() const;
102 virtual bool GetUnderlined() const;
103 virtual wxString GetFaceName() const;
104 virtual wxFontEncoding GetEncoding() const;
105 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
106
107 virtual void SetPointSize(int pointSize);
108 virtual void SetPixelSize(const wxSize& pixelSize);
109 virtual void SetFamily(int family);
110 virtual void SetStyle(int style);
111 virtual void SetWeight(int weight);
112 virtual void SetFaceName(const wxString& faceName);
113 virtual void SetUnderlined(bool underlined);
114 virtual void SetEncoding(wxFontEncoding encoding);
115
116 virtual bool IsFixedWidth() const;
117
118 // implementation only from now on
119 // -------------------------------
120
121 virtual bool IsFree() const;
122 virtual bool RealizeResource();
123 virtual WXHANDLE GetResourceHandle() const;
124 virtual bool FreeResource(bool force = false);
125
126 protected:
127 // real font creation function, used in all cases
128 bool DoCreate(int size,
129 const wxSize& pixelSize,
130 bool sizeUsingPixels,
131 int family,
132 int style,
133 int weight,
134 bool underlined = false,
135 const wxString& face = wxEmptyString,
136 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
137
138 virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
139
140 // common part of all ctors
141 void Init();
142
143 void Unshare();
144
145 private:
146 DECLARE_DYNAMIC_CLASS(wxFont)
147 };
148
149 #endif // _WX_FONT_H_