]>
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
66 int wxFont::GetStyle() const
71 int wxFont::GetFamily() const
76 int wxFont::GetWeight() const
81 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
86 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
88 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
91 m_refData
= new wxFontRefData
;
93 M_FONTDATA
->m_family
= family
;
94 M_FONTDATA
->m_style
= style
;
95 M_FONTDATA
->m_weight
= weight
;
96 M_FONTDATA
->m_pointSize
= pointSize
;
97 M_FONTDATA
->m_underlined
= underlined
;
98 M_FONTDATA
->m_faceName
= faceName
;
109 bool wxFont::RealizeResource()
111 // TODO: create the font (if there is a native font object)
115 void wxFont::Unshare()
117 // Don't change shared data
120 m_refData
= new wxFontRefData();
124 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
130 void wxFont::SetPointSize(int pointSize
)
134 M_FONTDATA
->m_pointSize
= pointSize
;
139 void wxFont::SetFamily(int family
)
143 M_FONTDATA
->m_family
= family
;
148 void wxFont::SetStyle(int style
)
152 M_FONTDATA
->m_style
= style
;
157 void wxFont::SetWeight(int weight
)
161 M_FONTDATA
->m_weight
= weight
;
166 bool wxFont::SetFaceName(const wxString
& faceName
)
170 M_FONTDATA
->m_faceName
= faceName
;
174 return wxFontBase::SetFaceName(faceName
);
177 void wxFont::SetUnderlined(bool underlined
)
181 M_FONTDATA
->m_underlined
= underlined
;
186 /* New font system */
187 wxString
wxFont::GetFaceName() const
191 str
= M_FONTDATA
->m_faceName
;