X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/142b3bc26a6e93f5857bc053c7748b2c845c4a8e..a0c6a355b7b53866286ec6263b99f787cfdbe731:/src/msw/font.cpp diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 25ff0295e3..02cd9c93da 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "font.h" #endif @@ -44,7 +44,51 @@ #include "wx/tokenzr.h" -IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) +#if wxUSE_EXTENDED_RTTI + +WX_BEGIN_ENUM( wxFontFamily ) + WX_ENUM_MEMBER( wxDEFAULT ) + WX_ENUM_MEMBER( wxDECORATIVE ) + WX_ENUM_MEMBER( wxROMAN ) + WX_ENUM_MEMBER( wxSCRIPT ) + WX_ENUM_MEMBER( wxSWISS ) + WX_ENUM_MEMBER( wxMODERN ) + WX_ENUM_MEMBER( wxTELETYPE ) +WX_END_ENUM( wxFontFamily ) + +WX_BEGIN_ENUM( wxFontStyle ) + WX_ENUM_MEMBER( wxNORMAL ) + WX_ENUM_MEMBER( wxITALIC ) + WX_ENUM_MEMBER( wxSLANT ) +WX_END_ENUM( wxFontStyle ) + +WX_BEGIN_ENUM( wxFontWeight ) + WX_ENUM_MEMBER( wxNORMAL ) + WX_ENUM_MEMBER( wxLIGHT ) + WX_ENUM_MEMBER( wxBOLD ) +WX_END_ENUM( wxFontWeight ) + +IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject,"wx/font.h") + +WX_BEGIN_PROPERTIES_TABLE(wxFont) + WX_PROPERTY( Size,int, SetPointSize, GetPointSize, 12 ) + WX_PROPERTY( Family, int , SetFamily, GetFamily, (int)wxDEFAULT ) // wxFontFamily + WX_PROPERTY( Style, int , SetStyle, GetStyle, (int)wxNORMAL ) // wxFontStyle + WX_PROPERTY( Weight, int , SetWeight, GetWeight, (int)wxNORMAL ) // wxFontWeight + WX_PROPERTY( Underlined, bool , SetUnderlined, GetUnderlined, false ) + WX_PROPERTY( Face, wxString , SetFaceName, GetFaceName, ) + WX_PROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT ) +WX_END_PROPERTIES_TABLE() + +WX_CONSTRUCTOR_6( wxFont , int , Size , int , Family , int , Style , int , Weight , bool , Underlined , wxString , Face ) + +WX_BEGIN_HANDLERS_TABLE(wxFont) +WX_END_HANDLERS_TABLE() + +#else + IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) +#endif + // ---------------------------------------------------------------------------- // constants @@ -64,7 +108,7 @@ public: wxFontRefData() { Init(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, - FALSE, _T(""), wxFONTENCODING_DEFAULT); + FALSE, wxEmptyString, wxFONTENCODING_DEFAULT); } wxFontRefData(int size, @@ -281,6 +325,9 @@ void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont) m_nativeFontInfoOk = TRUE; m_nativeFontInfo = info; + // This is the best we can do since we don't have the + // correct information at this point. + m_family = wxSWISS; } wxFontRefData::~wxFontRefData() @@ -429,6 +476,7 @@ void wxNativeFontInfo::SetStyle(wxFontStyle style) // fall through case wxFONTSTYLE_NORMAL: + lf.lfItalic = FALSE; break; case wxFONTSTYLE_ITALIC: @@ -632,7 +680,7 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(_T("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%s"), + s.Printf(_T("%d;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"), 0, // version, in case we want to change the format later lf.lfHeight, lf.lfWidth, @@ -738,9 +786,9 @@ bool wxFont::FreeResource(bool WXUNUSED(force)) return FALSE; } -WXHANDLE wxFont::GetResourceHandle() +WXHANDLE wxFont::GetResourceHandle() const { - return GetHFONT(); + return (WXHANDLE)GetHFONT(); } WXHFONT wxFont::GetHFONT() const @@ -835,7 +883,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) RealizeResource(); } -void wxFont::SetNativeFontInfo(const wxNativeFontInfo& info) +void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo& info) { Unshare(); @@ -887,7 +935,7 @@ bool wxFont::GetUnderlined() const wxString wxFont::GetFaceName() const { - wxCHECK_MSG( Ok(), wxT(""), wxT("invalid font") ); + wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") ); return M_FONTDATA->GetFaceName(); }