]>
git.saurik.com Git - wxWidgets.git/blob - src/cocoa/font.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/font.cpp
3 // Purpose: wxFont class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
17 #include "wx/string.h"
18 #include "wx/gdicmn.h"
21 #include "wx/encinfo.h"
23 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
25 void wxFontRefData::Init(int size
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
30 m_underlined
= underlined
;
31 m_faceName
= faceName
;
32 m_encoding
= encoding
;
35 wxFontRefData::~wxFontRefData()
37 // TODO: delete font data
40 #define M_FONTDATA ((wxFontRefData*)m_refData)
42 bool wxFont::Create(const wxNativeFontInfo
&)
47 void wxFont::SetEncoding(wxFontEncoding
)
51 wxFontEncoding
wxFont::GetEncoding() const
53 return wxFontEncoding();
56 int wxFont::GetPointSize() const
61 bool wxFont::GetUnderlined() const
64 return M_FONTDATA
->m_underlined
;
69 int wxFont::GetStyle() const
74 int wxFont::GetFamily() const
79 int wxFont::GetWeight() const
84 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
89 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
91 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
94 m_refData
= new wxFontRefData
;
96 M_FONTDATA
->m_family
= family
;
97 M_FONTDATA
->m_style
= style
;
98 M_FONTDATA
->m_weight
= weight
;
99 M_FONTDATA
->m_pointSize
= pointSize
;
100 M_FONTDATA
->m_underlined
= underlined
;
101 M_FONTDATA
->m_faceName
= faceName
;
112 bool wxFont::RealizeResource()
114 // TODO: create the font (if there is a native font object)
118 void wxFont::Unshare()
120 // Don't change shared data
123 m_refData
= new wxFontRefData();
127 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
133 void wxFont::SetPointSize(int pointSize
)
137 M_FONTDATA
->m_pointSize
= pointSize
;
142 void wxFont::SetFamily(int family
)
146 M_FONTDATA
->m_family
= family
;
151 void wxFont::SetStyle(int style
)
155 M_FONTDATA
->m_style
= style
;
160 void wxFont::SetWeight(int weight
)
164 M_FONTDATA
->m_weight
= weight
;
169 bool wxFont::SetFaceName(const wxString
& faceName
)
173 M_FONTDATA
->m_faceName
= faceName
;
177 return wxFontBase::SetFaceName(faceName
);
180 void wxFont::SetUnderlined(bool underlined
)
184 M_FONTDATA
->m_underlined
= underlined
;
189 /* New font system */
190 wxString
wxFont::GetFaceName() const
194 str
= M_FONTDATA
->m_faceName
;