]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/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 wxFontRefData::wxFontRefData()
39 wxFontRefData::wxFontRefData(const wxFontRefData
& data
)
41 m_style
= data
.m_style
;
42 m_pointSize
= data
.m_pointSize
;
43 m_family
= data
.m_family
;
44 m_style
= data
.m_style
;
45 m_weight
= data
.m_weight
;
46 m_underlined
= data
.m_underlined
;
47 m_faceName
= data
.m_faceName
;
53 wxFontRefData::~wxFontRefData()
55 // TODO: delete font data
61 wxTheFontList
->Append(this);
64 wxFont::wxFont(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
)
66 Create(pointSize
, family
, style
, weight
, underlined
, faceName
);
69 wxTheFontList
->Append(this);
72 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
)
75 m_refData
= new wxFontRefData
;
77 M_FONTDATA
->m_family
= family
;
78 M_FONTDATA
->m_style
= style
;
79 M_FONTDATA
->m_weight
= weight
;
80 M_FONTDATA
->m_pointSize
= pointSize
;
81 M_FONTDATA
->m_underlined
= underlined
;
82 M_FONTDATA
->m_faceName
= faceName
;
92 wxTheFontList
->DeleteObject(this);
95 bool wxFont::RealizeResource()
97 // TODO: create the font (if there is a native font object)
101 void wxFont::Unshare()
103 // Don't change shared data
106 m_refData
= new wxFontRefData();
110 wxFontRefData
* ref
= new wxFontRefData(*(wxFontRefData
*)m_refData
);
116 void wxFont::SetPointSize(int pointSize
)
120 M_FONTDATA
->m_pointSize
= pointSize
;
125 void wxFont::SetFamily(int family
)
129 M_FONTDATA
->m_family
= family
;
134 void wxFont::SetStyle(int style
)
138 M_FONTDATA
->m_style
= style
;
143 void wxFont::SetWeight(int weight
)
147 M_FONTDATA
->m_weight
= weight
;
152 void wxFont::SetFaceName(const wxString
& faceName
)
156 M_FONTDATA
->m_faceName
= faceName
;
161 void wxFont::SetUnderlined(bool underlined
)
165 M_FONTDATA
->m_underlined
= underlined
;
170 wxString
wxFont::GetFamilyString() const
176 fam
= "wxDECORATIVE";
200 /* New font system */
201 wxString
wxFont::GetFaceName() const
205 str
= M_FONTDATA
->m_faceName
;
209 wxString
wxFont::GetStyleString() const
227 wxString
wxFont::GetWeightString() const