]>
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"
21 #if !USE_SHARED_LIBRARIES
22 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
44 bool wxFont::Create(const wxNativeFontInfo
&)
49 void wxFont::SetEncoding(wxFontEncoding
)
53 wxFontEncoding
wxFont::GetEncoding() const
55 return wxFontEncoding();
58 int wxFont::GetPointSize() const
63 bool wxFont::GetUnderlined() const
68 int wxFont::GetStyle() const
73 int wxFont::GetFamily() const
78 int wxFont::GetWeight() const
83 const wxNativeFontInfo
*wxFont::GetNativeFontInfo() const
88 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*);
90 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
)
93 m_refData
= new wxFontRefData
;
95 M_FONTDATA
->m_family
= family
;
96 M_FONTDATA
->m_style
= style
;
97 M_FONTDATA
->m_weight
= weight
;
98 M_FONTDATA
->m_pointSize
= pointSize
;
99 M_FONTDATA
->m_underlined
= underlined
;
100 M_FONTDATA
->m_faceName
= faceName
;
110 wxTheFontList
->DeleteObject(this);
113 bool wxFont::RealizeResource()
115 // TODO: create the font (if there is a native font object)
119 void wxFont::Unshare()
121 // Don't change shared data
124 m_refData
= new wxFontRefData();
128 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
134 void wxFont::SetPointSize(int pointSize
)
138 M_FONTDATA
->m_pointSize
= pointSize
;
143 void wxFont::SetFamily(int family
)
147 M_FONTDATA
->m_family
= family
;
152 void wxFont::SetStyle(int style
)
156 M_FONTDATA
->m_style
= style
;
161 void wxFont::SetWeight(int weight
)
165 M_FONTDATA
->m_weight
= weight
;
170 void wxFont::SetFaceName(const wxString
& faceName
)
174 M_FONTDATA
->m_faceName
= faceName
;
179 void wxFont::SetUnderlined(bool underlined
)
183 M_FONTDATA
->m_underlined
= underlined
;
188 /* New font system */
189 wxString
wxFont::GetFaceName() const
193 str
= M_FONTDATA
->m_faceName
;