X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1de8d512b7c844d67b2dab36addc89868e68c9b6..25c702609db6a749ffd5f3e659ec348e4aa3a3c8:/src/cocoa/font.cpp diff --git a/src/cocoa/font.cpp b/src/cocoa/font.cpp index af1f3b552b..bfbed70f38 100644 --- a/src/cocoa/font.cpp +++ b/src/cocoa/font.cpp @@ -1,30 +1,35 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: font.cpp +// Name: src/cocoa/font.cpp // Purpose: wxFont class // Author: AUTHOR // Modified by: // Created: ??/??/98 // RCS-ID: $Id$ // Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#include "wx/defs.h" -#include "wx/string.h" +#include "wx/wxprec.h" + #include "wx/font.h" -#include "wx/gdicmn.h" + +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/gdicmn.h" +#endif + #include "wx/encinfo.h" IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) void wxFontRefData::Init(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding) { - m_family = family; - m_style = style; - m_weight = weight; - m_underlined = underlined; - m_faceName = faceName; - m_encoding = encoding; + m_family = family; + m_style = style; + m_weight = weight; + m_underlined = underlined; + m_faceName = faceName; + m_encoding = encoding; } wxFontRefData::~wxFontRefData() @@ -32,9 +37,11 @@ wxFontRefData::~wxFontRefData() // TODO: delete font data } +#define M_FONTDATA ((wxFontRefData*)m_refData) + bool wxFont::Create(const wxNativeFontInfo&) { - return FALSE; + return false; } void wxFont::SetEncoding(wxFontEncoding) @@ -53,7 +60,10 @@ int wxFont::GetPointSize() const bool wxFont::GetUnderlined() const { - return FALSE; + if(M_FONTDATA) + return M_FONTDATA->m_underlined; + else + return false; } int wxFont::GetStyle() const @@ -92,7 +102,7 @@ bool wxFont::Create(int pointSize, int family, int style, int weight, bool under RealizeResource(); - return TRUE; + return true; } wxFont::~wxFont() @@ -102,22 +112,22 @@ wxFont::~wxFont() bool wxFont::RealizeResource() { // TODO: create the font (if there is a native font object) - return FALSE; + return false; } void wxFont::Unshare() { - // Don't change shared data - if (!m_refData) + // Don't change shared data + if (!m_refData) { - m_refData = new wxFontRefData(); - } + m_refData = new wxFontRefData(); + } else { - wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData); - UnRef(); - m_refData = ref; - } + wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData); + UnRef(); + m_refData = ref; + } } void wxFont::SetPointSize(int pointSize) @@ -156,13 +166,15 @@ void wxFont::SetWeight(int weight) RealizeResource(); } -void wxFont::SetFaceName(const wxString& faceName) +bool wxFont::SetFaceName(const wxString& faceName) { Unshare(); M_FONTDATA->m_faceName = faceName; RealizeResource(); + + return wxFontBase::SetFaceName(faceName); } void wxFont::SetUnderlined(bool underlined) @@ -179,7 +191,7 @@ wxString wxFont::GetFaceName() const { wxString str; if (M_FONTDATA) - str = M_FONTDATA->m_faceName ; + str = M_FONTDATA->m_faceName ; return str; }