]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/palmos/font.h
wxHelpController now wxCHMHelpController on Windows
[wxWidgets.git] / include / wx / palmos / font.h
... / ...
CommitLineData
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#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "font.h"
17#endif
18
19#include <wx/gdicmn.h>
20
21// ----------------------------------------------------------------------------
22// wxFont
23// ----------------------------------------------------------------------------
24
25class WXDLLEXPORT wxFont : public wxFontBase
26{
27public:
28 // ctors and such
29 wxFont() { Init(); }
30 wxFont(const wxFont& font) : wxFontBase(font) { Init(); Ref(font); }
31
32 wxFont(int size,
33 int family,
34 int style,
35 int weight,
36 bool underlined = false,
37 const wxString& face = wxEmptyString,
38 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
39 {
40 Init();
41
42 (void)Create(size, family, style, weight, underlined, face, encoding);
43 }
44
45 wxFont(const wxSize& pixelSize,
46 int family,
47 int style,
48 int weight,
49 bool underlined = false,
50 const wxString& face = wxEmptyString,
51 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
52 {
53 Init();
54
55 (void)Create(pixelSize, family, style, weight,
56 underlined, face, encoding);
57 }
58
59 wxFont(const wxNativeFontInfo& info, WXHFONT hFont = 0)
60 {
61 Init();
62
63 Create(info, hFont);
64 }
65
66 wxFont(const wxString& fontDesc);
67
68 bool Create(int size,
69 int family,
70 int style,
71 int weight,
72 bool underlined = false,
73 const wxString& face = wxEmptyString,
74 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
75 {
76 return DoCreate(size, wxDefaultSize, false, family, style,
77 weight, underlined, face, encoding);
78 }
79
80 bool Create(const wxSize& pixelSize,
81 int family,
82 int style,
83 int weight,
84 bool underlined = false,
85 const wxString& face = wxEmptyString,
86 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
87 {
88 return DoCreate(-1, pixelSize, true, family, style,
89 weight, underlined, face, encoding);
90 }
91
92 bool Create(const wxNativeFontInfo& info, WXHFONT hFont = 0);
93
94 virtual ~wxFont();
95
96 // assignment
97 wxFont& operator=(const wxFont& font);
98
99 // implement base class pure virtuals
100 virtual int GetPointSize() const;
101 virtual wxSize GetPixelSize() const;
102 virtual bool IsUsingSizeInPixels() const;
103 virtual int GetFamily() const;
104 virtual int GetStyle() const;
105 virtual int GetWeight() const;
106 virtual bool GetUnderlined() const;
107 virtual wxString GetFaceName() const;
108 virtual wxFontEncoding GetEncoding() const;
109 virtual const wxNativeFontInfo *GetNativeFontInfo() const;
110
111 virtual void SetPointSize(int pointSize);
112 virtual void SetPixelSize(const wxSize& pixelSize);
113 virtual void SetFamily(int family);
114 virtual void SetStyle(int style);
115 virtual void SetWeight(int weight);
116 virtual void SetFaceName(const wxString& faceName);
117 virtual void SetUnderlined(bool underlined);
118 virtual void SetEncoding(wxFontEncoding encoding);
119
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
130protected:
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);
143
144 // common part of all ctors
145 void Init();
146
147 void Unshare();
148
149private:
150 DECLARE_DYNAMIC_CLASS(wxFont)
151};
152
153#endif
154 // _WX_FONT_H_