]>
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 #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
35 bool wxFont::Create(const wxNativeFontInfo
&)
40 void wxFont::SetEncoding(wxFontEncoding
)
44 wxFontEncoding
wxFont::GetEncoding() const
46 return wxFontEncoding();
49 int wxFont::GetPointSize() const
54 bool wxFont::GetUnderlined() const
59 int wxFont::GetStyle() const
64 int wxFont::GetFamily() const
69 int wxFont::GetWeight() const
74 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
79 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
81 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
84 m_refData
= new wxFontRefData
;
86 M_FONTDATA
->m_family
= family
;
87 M_FONTDATA
->m_style
= style
;
88 M_FONTDATA
->m_weight
= weight
;
89 M_FONTDATA
->m_pointSize
= pointSize
;
90 M_FONTDATA
->m_underlined
= underlined
;
91 M_FONTDATA
->m_faceName
= faceName
;
101 wxTheFontList
->DeleteObject(this);
104 bool wxFont::RealizeResource()
106 // TODO: create the font (if there is a native font object)
110 void wxFont::Unshare()
112 // Don't change shared data
115 m_refData
= new wxFontRefData();
119 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
125 void wxFont::SetPointSize(int pointSize
)
129 M_FONTDATA
->m_pointSize
= pointSize
;
134 void wxFont::SetFamily(int family
)
138 M_FONTDATA
->m_family
= family
;
143 void wxFont::SetStyle(int style
)
147 M_FONTDATA
->m_style
= style
;
152 void wxFont::SetWeight(int weight
)
156 M_FONTDATA
->m_weight
= weight
;
161 void wxFont::SetFaceName(const wxString
& faceName
)
165 M_FONTDATA
->m_faceName
= faceName
;
170 void wxFont::SetUnderlined(bool underlined
)
174 M_FONTDATA
->m_underlined
= underlined
;
179 /* New font system */
180 wxString
wxFont::GetFaceName() const
184 str
= M_FONTDATA
->m_faceName
;