]>
git.saurik.com Git - wxWidgets.git/blob - src/cocoa/font.cpp
dd538c4d8ede6e3ba40674850d63cb0a05e563d1
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFont class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/string.h"
15 #include "wx/gdicmn.h"
16 #include "wx/encinfo.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
)
20 void wxFontRefData::Init(int size
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
25 m_underlined
= underlined
;
26 m_faceName
= faceName
;
27 m_encoding
= encoding
;
30 wxFontRefData::~wxFontRefData()
32 // TODO: delete font data
39 bool wxFont::Create(const wxNativeFontInfo
&)
44 void wxFont::SetEncoding(wxFontEncoding
)
48 wxFontEncoding
wxFont::GetEncoding() const
50 return wxFontEncoding();
53 int wxFont::GetPointSize() const
58 bool wxFont::GetUnderlined() const
63 int wxFont::GetStyle() const
68 int wxFont::GetFamily() const
73 int wxFont::GetWeight() const
78 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
83 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
85 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
88 m_refData
= new wxFontRefData
;
90 M_FONTDATA
->m_family
= family
;
91 M_FONTDATA
->m_style
= style
;
92 M_FONTDATA
->m_weight
= weight
;
93 M_FONTDATA
->m_pointSize
= pointSize
;
94 M_FONTDATA
->m_underlined
= underlined
;
95 M_FONTDATA
->m_faceName
= faceName
;
105 wxTheFontList
->DeleteObject(this);
108 bool wxFont::RealizeResource()
110 // TODO: create the font (if there is a native font object)
114 void wxFont::Unshare()
116 // Don't change shared data
119 m_refData
= new wxFontRefData();
123 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
129 void wxFont::SetPointSize(int pointSize
)
133 M_FONTDATA
->m_pointSize
= pointSize
;
138 void wxFont::SetFamily(int family
)
142 M_FONTDATA
->m_family
= family
;
147 void wxFont::SetStyle(int style
)
151 M_FONTDATA
->m_style
= style
;
156 void wxFont::SetWeight(int weight
)
160 M_FONTDATA
->m_weight
= weight
;
165 void wxFont::SetFaceName(const wxString
& faceName
)
169 M_FONTDATA
->m_faceName
= faceName
;
174 void wxFont::SetUnderlined(bool underlined
)
178 M_FONTDATA
->m_underlined
= underlined
;
183 /* New font system */
184 wxString
wxFont::GetFaceName() const
188 str
= M_FONTDATA
->m_faceName
;