]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/font.cpp
TransferFrom/ToWindow() were reverted, fixed
[wxWidgets.git] / src / msw / font.cpp
index 918e7c06d28ffad9b7a3e5bf675200792be5d736..296142c5852e951b1f84cda50a426865d3515e8e 100644 (file)
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "font.h"
 #endif
 
@@ -35,6 +35,7 @@
     #include "wx/app.h"
     #include "wx/font.h"
     #include "wx/log.h"
+    #include "wx/encinfo.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
 
 #include "wx/tokenzr.h"
 
-IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
+#if wxUSE_EXTENDED_RTTI
+
+wxBEGIN_ENUM( wxFontFamily )
+       wxENUM_MEMBER( wxDEFAULT )
+       wxENUM_MEMBER( wxDECORATIVE )
+       wxENUM_MEMBER( wxROMAN )
+       wxENUM_MEMBER( wxSCRIPT )
+       wxENUM_MEMBER( wxSWISS )
+       wxENUM_MEMBER( wxMODERN )
+       wxENUM_MEMBER( wxTELETYPE )
+wxEND_ENUM( wxFontFamily )
+
+wxBEGIN_ENUM( wxFontStyle )
+       wxENUM_MEMBER( wxNORMAL )
+       wxENUM_MEMBER( wxITALIC )
+       wxENUM_MEMBER( wxSLANT )
+wxEND_ENUM( wxFontStyle )
+
+wxBEGIN_ENUM( wxFontWeight )
+       wxENUM_MEMBER( wxNORMAL )
+       wxENUM_MEMBER( wxLIGHT )
+       wxENUM_MEMBER( wxBOLD )
+wxEND_ENUM( wxFontWeight )
+
+IMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI(wxFont, wxGDIObject,"wx/font.h")
+
+wxBEGIN_PROPERTIES_TABLE(wxFont)
+       wxPROPERTY( Size,int, SetPointSize, GetPointSize, 12 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Family, int  , SetFamily, GetFamily, (int)wxDEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontFamily
+       wxPROPERTY( Style, int , SetStyle, GetStyle, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontStyle
+       wxPROPERTY( Weight, int , SetWeight, GetWeight, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontWeight
+       wxPROPERTY( Underlined, bool , SetUnderlined, GetUnderlined, false , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Face, wxString , SetFaceName, GetFaceName, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+wxEND_PROPERTIES_TABLE()
+
+wxCONSTRUCTOR_6( wxFont , int , Size , int , Family , int , Style , int , Weight , bool , Underlined , wxString , Face )  
+
+wxBEGIN_HANDLERS_TABLE(wxFont)
+wxEND_HANDLERS_TABLE()
+
+#else
+       IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
+#endif
+
 
 // ----------------------------------------------------------------------------
 // constants
@@ -64,7 +109,7 @@ public:
     wxFontRefData()
     {
         Init(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
-             FALSE, _T(""), wxFONTENCODING_DEFAULT);
+             FALSE, wxEmptyString, wxFONTENCODING_DEFAULT);
     }
 
     wxFontRefData(int size,
@@ -432,6 +477,7 @@ void wxNativeFontInfo::SetStyle(wxFontStyle style)
             // fall through
 
         case wxFONTSTYLE_NORMAL:
+            lf.lfItalic = FALSE;
             break;
 
         case wxFONTSTYLE_ITALIC:
@@ -635,7 +681,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,
@@ -741,9 +787,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
@@ -838,7 +884,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
     RealizeResource();
 }
 
-void wxFont::SetNativeFontInfo(const wxNativeFontInfo& info)
+void wxFont::DoSetNativeFontInfo(const wxNativeFontInfo& info)
 {
     Unshare();
 
@@ -890,7 +936,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();
 }