]>
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"
20 #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 bool wxFont::Create(const wxNativeFontInfo
&)
45 void wxFont::SetEncoding(wxFontEncoding
)
49 wxFontEncoding
wxFont::GetEncoding() const
51 return wxFontEncoding();
54 int wxFont::GetPointSize() const
59 bool wxFont::GetUnderlined() const
64 int wxFont::GetStyle() const
69 int wxFont::GetFamily() const
74 int wxFont::GetWeight() const
79 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
84 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
86 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
89 m_refData
= new wxFontRefData
;
91 M_FONTDATA
->m_family
= family
;
92 M_FONTDATA
->m_style
= style
;
93 M_FONTDATA
->m_weight
= weight
;
94 M_FONTDATA
->m_pointSize
= pointSize
;
95 M_FONTDATA
->m_underlined
= underlined
;
96 M_FONTDATA
->m_faceName
= faceName
;
107 bool wxFont::RealizeResource()
109 // TODO: create the font (if there is a native font object)
113 void wxFont::Unshare()
115 // Don't change shared data
118 m_refData
= new wxFontRefData();
122 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
128 void wxFont::SetPointSize(int pointSize
)
132 M_FONTDATA
->m_pointSize
= pointSize
;
137 void wxFont::SetFamily(int family
)
141 M_FONTDATA
->m_family
= family
;
146 void wxFont::SetStyle(int style
)
150 M_FONTDATA
->m_style
= style
;
155 void wxFont::SetWeight(int weight
)
159 M_FONTDATA
->m_weight
= weight
;
164 bool wxFont::SetFaceName(const wxString
& faceName
)
168 M_FONTDATA
->m_faceName
= faceName
;
172 return wxFontBase::SetFaceName(faceName
);
175 void wxFont::SetUnderlined(bool underlined
)
179 M_FONTDATA
->m_underlined
= underlined
;
184 /* New font system */
185 wxString
wxFont::GetFaceName() const
189 str
= M_FONTDATA
->m_faceName
;