]>
git.saurik.com Git - wxWidgets.git/blob - src/cocoa/font.cpp
c8aa187d02a88996eb5cdb92c69984a81e4cf29f
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"
15 #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
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
;
106 bool wxFont::RealizeResource()
108 // TODO: create the font (if there is a native font object)
112 void wxFont::Unshare()
114 // Don't change shared data
117 m_refData
= new wxFontRefData();
121 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
127 void wxFont::SetPointSize(int pointSize
)
131 M_FONTDATA
->m_pointSize
= pointSize
;
136 void wxFont::SetFamily(int family
)
140 M_FONTDATA
->m_family
= family
;
145 void wxFont::SetStyle(int style
)
149 M_FONTDATA
->m_style
= style
;
154 void wxFont::SetWeight(int weight
)
158 M_FONTDATA
->m_weight
= weight
;
163 void wxFont::SetFaceName(const wxString
& faceName
)
167 M_FONTDATA
->m_faceName
= faceName
;
172 void wxFont::SetUnderlined(bool underlined
)
176 M_FONTDATA
->m_underlined
= underlined
;
181 /* New font system */
182 wxString
wxFont::GetFaceName() const
186 str
= M_FONTDATA
->m_faceName
;