]>
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" 
  20 #include "wx/encinfo.h" 
  22 #if !USE_SHARED_LIBRARIES 
  23 IMPLEMENT_DYNAMIC_CLASS(wxFont
, wxGDIObject
) 
  26 void wxFontRefData::Init(int size
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
) 
  31         m_underlined 
= underlined
; 
  32         m_faceName 
= faceName
; 
  33         m_encoding 
= encoding
; 
  36 wxFontRefData::~wxFontRefData() 
  38     // TODO: delete font data 
  45 bool wxFont::Create(const wxNativeFontInfo
&) 
  50 void wxFont::SetEncoding(wxFontEncoding
) 
  54 wxFontEncoding 
wxFont::GetEncoding() const 
  56     return wxFontEncoding(); 
  59 int wxFont::GetPointSize() const 
  64 bool wxFont::GetUnderlined() const 
  69 int wxFont::GetStyle() const 
  74 int wxFont::GetFamily() const 
  79 int wxFont::GetWeight() const 
  84 const wxNativeFontInfo 
*wxFont::GetNativeFontInfo() const 
  89 void wxGetNativeFontEncoding(wxFontEncoding
, wxNativeEncodingInfo
*); 
  91 bool wxFont::Create(int pointSize
, int family
, int style
, int weight
, bool underlined
, const wxString
& faceName
, wxFontEncoding encoding
) 
  94     m_refData 
= new wxFontRefData
; 
  96     M_FONTDATA
->m_family 
= family
; 
  97     M_FONTDATA
->m_style 
= style
; 
  98     M_FONTDATA
->m_weight 
= weight
; 
  99     M_FONTDATA
->m_pointSize 
= pointSize
; 
 100     M_FONTDATA
->m_underlined 
= underlined
; 
 101     M_FONTDATA
->m_faceName 
= faceName
; 
 111         wxTheFontList
->DeleteObject(this); 
 114 bool wxFont::RealizeResource() 
 116     // TODO: create the font (if there is a native font object) 
 120 void wxFont::Unshare() 
 122         // Don't change shared data 
 125                 m_refData 
= new wxFontRefData(); 
 129                 wxFontRefData
* ref 
= new wxFontRefData(*(wxFontRefData
*)m_refData
); 
 135 void wxFont::SetPointSize(int pointSize
) 
 139     M_FONTDATA
->m_pointSize 
= pointSize
; 
 144 void wxFont::SetFamily(int family
) 
 148     M_FONTDATA
->m_family 
= family
; 
 153 void wxFont::SetStyle(int style
) 
 157     M_FONTDATA
->m_style 
= style
; 
 162 void wxFont::SetWeight(int weight
) 
 166     M_FONTDATA
->m_weight 
= weight
; 
 171 void wxFont::SetFaceName(const wxString
& faceName
) 
 175     M_FONTDATA
->m_faceName 
= faceName
; 
 180 void wxFont::SetUnderlined(bool underlined
) 
 184     M_FONTDATA
->m_underlined 
= underlined
; 
 189 /* New font system */ 
 190 wxString 
wxFont::GetFaceName() const 
 194             str 
= M_FONTDATA
->m_faceName 
;