]>
git.saurik.com Git - wxWidgets.git/blob - src/cocoa/font.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "font.h"
17 #include "wx/string.h"
19 #include "wx/gdicmn.h"
20 #include "wx/encinfo.h"
22 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
24 void wxFontRefData::Init(int size
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
29 m_underlined
= underlined
;
30 m_faceName
= faceName
;
31 m_encoding
= encoding
;
34 wxFontRefData::~wxFontRefData()
36 // TODO: delete font data
43 bool wxFont::Create(const wxNativeFontInfo
&)
48 void wxFont::SetEncoding(wxFontEncoding
)
52 wxFontEncoding
wxFont::GetEncoding() const
54 return wxFontEncoding();
57 int wxFont::GetPointSize() const
62 bool wxFont::GetUnderlined() const
67 int wxFont::GetStyle() const
72 int wxFont::GetFamily() const
77 int wxFont::GetWeight() const
82 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
87 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
89 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
92 m_refData
= new wxFontRefData
;
94 M_FONTDATA
->m_family
= family
;
95 M_FONTDATA
->m_style
= style
;
96 M_FONTDATA
->m_weight
= weight
;
97 M_FONTDATA
->m_pointSize
= pointSize
;
98 M_FONTDATA
->m_underlined
= underlined
;
99 M_FONTDATA
->m_faceName
= faceName
;
109 wxTheFontList
->DeleteObject(this);
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 void wxFont::SetFaceName(const wxString
& faceName
)
173 M_FONTDATA
->m_faceName
= faceName
;
178 void wxFont::SetUnderlined(bool underlined
)
182 M_FONTDATA
->m_underlined
= underlined
;
187 /* New font system */
188 wxString
wxFont::GetFaceName() const
192 str
= M_FONTDATA
->m_faceName
;