]>
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 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
;
105 wxTheFontList
->DeleteObject(this);
108 bool wxFont::RealizeResource()
110 // TODO: create the font (if there is a native font object)
114 void wxFont::Unshare()
116 // Don't change shared data
119 m_refData
= new wxFontRefData();
123 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
129 void wxFont::SetPointSize(int pointSize
)
133 M_FONTDATA
->m_pointSize
= pointSize
;
138 void wxFont::SetFamily(int family
)
142 M_FONTDATA
->m_family
= family
;
147 void wxFont::SetStyle(int style
)
151 M_FONTDATA
->m_style
= style
;
156 void wxFont::SetWeight(int weight
)
160 M_FONTDATA
->m_weight
= weight
;
165 void wxFont::SetFaceName(const wxString
& faceName
)
169 M_FONTDATA
->m_faceName
= faceName
;
174 void wxFont::SetUnderlined(bool underlined
)
178 M_FONTDATA
->m_underlined
= underlined
;
183 /* New font system */
184 wxString
wxFont::GetFaceName() const
188 str
= M_FONTDATA
->m_faceName
;