]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/font.cpp
removed asserts to suppress gcc 3.4 warnings about condition being always true
[wxWidgets.git] / src / msw / font.cpp
index 24ef9f2d33260e415e43ee742938b48fa1954a0a..14b78ac9e62db33884e92a282bcaf107aa8c3ed2 100644 (file)
@@ -5,7 +5,7 @@
 // Modified by:
 // Created:     01/02/97
 // RCS-ID:      $Id$
-// Copyright:   (c) wxWindows team
+// Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -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"
 
 #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 )
+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")
 
-WX_BEGIN_PROPERTIES_TABLE(wxFont)
-       WX_PROPERTY( Size,int, SetPointSize, GetPointSize, 12 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-       WX_PROPERTY( Family, int  , SetFamily, GetFamily, (int)wxDEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontFamily
-       WX_PROPERTY( Style, int , SetStyle, GetStyle, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontStyle
-       WX_PROPERTY( Weight, int , SetWeight, GetWeight, (int)wxNORMAL , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // wxFontWeight
-       WX_PROPERTY( Underlined, bool , SetUnderlined, GetUnderlined, false , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-       WX_PROPERTY( Face, wxString , SetFaceName, GetFaceName, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-       WX_PROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
-WX_END_PROPERTIES_TABLE()
+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, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+       wxPROPERTY( Encoding, wxFontEncoding , SetEncoding, GetEncoding, wxFONTENCODING_DEFAULT , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+wxEND_PROPERTIES_TABLE()
 
-WX_CONSTRUCTOR_6( wxFont , int , Size , int , Family , int , Style , int , Weight , bool , Underlined , wxString , Face )  
+wxCONSTRUCTOR_6( wxFont , int , Size , int , Family , int , Style , int , Weight , bool , Underlined , wxString , Face )  
 
-WX_BEGIN_HANDLERS_TABLE(wxFont)
-WX_END_HANDLERS_TABLE()
+wxBEGIN_HANDLERS_TABLE(wxFont)
+wxEND_HANDLERS_TABLE()
 
 #else
        IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
@@ -456,7 +457,7 @@ wxFontEncoding wxNativeFontInfo::GetEncoding() const
 void wxNativeFontInfo::SetPointSize(int pointsize)
 {
 #if wxFONT_SIZE_COMPATIBILITY
-    // Incorrect, but compatible with old wxWindows behaviour
+    // Incorrect, but compatible with old wxWidgets behaviour
     lf.lfHeight = (pointSize*ppInch)/72;
 #else // wxFONT_SIZE_COMPATIBILITY
     // FIXME: using the screen here results in incorrect font size calculation
@@ -947,12 +948,10 @@ wxFontEncoding wxFont::GetEncoding() const
     return M_FONTDATA->GetEncoding();
 }
 
-wxNativeFontInfo *wxFont::GetNativeFontInfo() const
+const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
 {
-    if ( M_FONTDATA->HasNativeFontInfo() )
-        return new wxNativeFontInfo(M_FONTDATA->GetNativeFontInfo());
-
-    return 0;
+    return M_FONTDATA->HasNativeFontInfo() ? &(M_FONTDATA->GetNativeFontInfo())
+                                           : NULL;
 }
 
 bool wxFont::IsFixedWidth() const