]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/font.h
f7596f241b292a355094e08d4f1d23fa8e3a79dd
[wxWidgets.git] / include / wx / mac / font.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: font.h
3 // Purpose: wxFont class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FONT_H_
13 #define _WX_FONT_H_
14
15 #ifdef __GNUG__
16 #pragma interface "font.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // public functions
21 // ----------------------------------------------------------------------------
22
23 // convert wxFontEncoding into one of Windows XXX_CHARSET constants (fill exact
24 // parameter if it's not NULL with TRUE if encoding is realyl supported under
25 // Windows and FALSE if not and we just chose something close to it)
26 extern int wxCharsetFromEncoding(wxFontEncoding encoding, bool *exact = NULL);
27
28 // ----------------------------------------------------------------------------
29 // wxFont
30 // ----------------------------------------------------------------------------
31
32 class WXDLLEXPORT wxFont : public wxFontBase
33 {
34 public:
35 // ctors and such
36 wxFont() { Init(); }
37 wxFont(const wxFont& font) { Init(); Ref(font); }
38
39 wxFont(int size,
40 int family,
41 int style,
42 int weight,
43 bool underlined = FALSE,
44 const wxString& face = wxEmptyString,
45 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
46 {
47 Init();
48
49 (void)Create(size, family, style, weight, underlined, face, encoding);
50 }
51
52 bool Create(int size,
53 int family,
54 int style,
55 int weight,
56 bool underlined = FALSE,
57 const wxString& face = wxEmptyString,
58 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
59
60 virtual ~wxFont();
61
62 // assignment
63 wxFont& operator=(const wxFont& font);
64
65 // implement base class pure virtuals
66 virtual int GetPointSize() const;
67 virtual int GetFamily() const;
68 virtual int GetStyle() const;
69 virtual int GetWeight() const;
70 virtual bool GetUnderlined() const;
71 virtual wxString GetFaceName() const;
72 virtual wxFontEncoding GetEncoding() const;
73
74 virtual void SetPointSize(int pointSize);
75 virtual void SetFamily(int family);
76 virtual void SetStyle(int style);
77 virtual void SetWeight(int weight);
78 virtual void SetFaceName(const wxString& faceName);
79 virtual void SetUnderlined(bool underlined);
80 virtual void SetEncoding(wxFontEncoding encoding);
81
82 // implementation only from now on
83 // -------------------------------
84
85 int GetFontId() const;
86 virtual bool IsFree() const;
87 virtual bool RealizeResource();
88 virtual WXHANDLE GetResourceHandle();
89 virtual bool FreeResource(bool force = FALSE);
90 /*
91 virtual bool UseResource();
92 virtual bool ReleaseResource();
93 */
94
95 protected:
96 // common part of all ctors
97 void Init();
98
99 void Unshare();
100
101 private:
102 DECLARE_DYNAMIC_CLASS(wxFont)
103 };
104
105 #endif
106 // _WX_FONT_H_