]>
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
;
102 bool wxFont::RealizeResource()
104 // TODO: create the font (if there is a native font object)
108 void wxFont::Unshare()
110 // Don't change shared data
113 m_refData
= new wxFontRefData();
117 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
123 void wxFont::SetPointSize(int pointSize
)
127 M_FONTDATA
->m_pointSize
= pointSize
;
132 void wxFont::SetFamily(int family
)
136 M_FONTDATA
->m_family
= family
;
141 void wxFont::SetStyle(int style
)
145 M_FONTDATA
->m_style
= style
;
150 void wxFont::SetWeight(int weight
)
154 M_FONTDATA
->m_weight
= weight
;
159 void wxFont::SetFaceName(const wxString
& faceName
)
163 M_FONTDATA
->m_faceName
= faceName
;
168 void wxFont::SetUnderlined(bool underlined
)
172 M_FONTDATA
->m_underlined
= underlined
;
177 /* New font system */
178 wxString
wxFont::GetFaceName() const
182 str
= M_FONTDATA
->m_faceName
;