]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/font.h
Fixed typo in my last commit (it did break socket detection code :-( ).
[wxWidgets.git] / include / wx / mac / font.h
CommitLineData
0dbd6262
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: font.h
3// Purpose: wxFont class
519cb848 4// Author: Julian Smart
0dbd6262 5// Modified by:
519cb848 6// Created: 01/02/97
0dbd6262 7// RCS-ID: $Id$
519cb848
SC
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
0dbd6262
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_FONT_H_
13#define _WX_FONT_H_
14
15#ifdef __GNUG__
519cb848 16 #pragma interface "font.h"
0dbd6262
SC
17#endif
18
e7549107
SC
19class WXDLLEXPORT wxFontRefData: public wxGDIRefData
20{
21 friend class WXDLLEXPORT wxFont;
22public:
23 wxFontRefData()
24 {
7c74e7fe
SC
25 Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
26 "Geneva", wxFONTENCODING_DEFAULT);
e7549107 27 }
0dbd6262 28
e7549107
SC
29 wxFontRefData(const wxFontRefData& data)
30 {
31 Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
32 data.m_underlined, data.m_faceName, data.m_encoding);
0dbd6262 33
e7549107
SC
34 m_macFontNum = data.m_macFontNum ;
35 m_macFontSize = data.m_macFontSize;
36 m_macFontStyle = data.m_macFontStyle;
37 m_fontId = data.m_fontId;
38 }
39
40 wxFontRefData(int size,
41 int family,
42 int style,
43 int weight,
44 bool underlined,
45 const wxString& faceName,
46 wxFontEncoding encoding)
47 {
48 Init(size, family, style, weight, underlined, faceName, encoding);
49 }
50
51 virtual ~wxFontRefData();
52protected:
53 // common part of all ctors
54 void Init(int size,
55 int family,
56 int style,
57 int weight,
58 bool underlined,
59 const wxString& faceName,
60 wxFontEncoding encoding);
61
62 // font characterstics
63 int m_fontId;
64 int m_pointSize;
65 int m_family;
66 int m_style;
67 int m_weight;
68 bool m_underlined;
69 wxString m_faceName;
70 wxFontEncoding m_encoding;
477594f7 71
e7549107
SC
72public :
73 short m_macFontNum ;
74 short m_macFontSize ;
5273bf2f 75 unsigned char m_macFontStyle ;
477594f7 76 wxUint32 m_macATSUFontID ;
e7549107
SC
77public :
78 void MacFindFont() ;
79};
519cb848
SC
80// ----------------------------------------------------------------------------
81// wxFont
82// ----------------------------------------------------------------------------
83
84class WXDLLEXPORT wxFont : public wxFontBase
0dbd6262 85{
0dbd6262 86public:
519cb848
SC
87 // ctors and such
88 wxFont() { Init(); }
89 wxFont(const wxFont& font) { Init(); Ref(font); }
90
91 wxFont(int size,
92 int family,
93 int style,
94 int weight,
95 bool underlined = FALSE,
96 const wxString& face = wxEmptyString,
97 wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
98 {
99 Init();
100
101 (void)Create(size, family, style, weight, underlined, face, encoding);
102 }
103
3b7e6277
GD
104 wxFont(const wxNativeFontInfo& info)
105 {
106 Init();
107
108 (void)Create(info);
109 }
110
111 wxFont(const wxString& fontDesc);
112
519cb848
SC
113 bool Create(int size,
114 int family,
115 int style,
116 int weight,
117 bool underlined = FALSE,
118 const wxString& face = wxEmptyString,
119 wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
120
3b7e6277
GD
121 bool Create(const wxNativeFontInfo& info);
122
519cb848
SC
123 virtual ~wxFont();
124
125 // assignment
126 wxFont& operator=(const wxFont& font);
127
128 // implement base class pure virtuals
129 virtual int GetPointSize() const;
130 virtual int GetFamily() const;
131 virtual int GetStyle() const;
132 virtual int GetWeight() const;
133 virtual bool GetUnderlined() const;
134 virtual wxString GetFaceName() const;
135 virtual wxFontEncoding GetEncoding() const;
136
137 virtual void SetPointSize(int pointSize);
138 virtual void SetFamily(int family);
139 virtual void SetStyle(int style);
140 virtual void SetWeight(int weight);
141 virtual void SetFaceName(const wxString& faceName);
142 virtual void SetUnderlined(bool underlined);
143 virtual void SetEncoding(wxFontEncoding encoding);
144
145 // implementation only from now on
146 // -------------------------------
147
519cb848 148 virtual bool RealizeResource();
0dbd6262 149
519cb848
SC
150protected:
151 // common part of all ctors
152 void Init();
0dbd6262 153
519cb848 154 void Unshare();
0dbd6262 155
519cb848
SC
156private:
157 DECLARE_DYNAMIC_CLASS(wxFont)
0dbd6262
SC
158};
159
160#endif
161 // _WX_FONT_H_