Just deprecate but don't schedule for removal wxNORMAL and friends.
Deprecate the use of the old untyped constants but don't schedule them from removal in a future wx version by removing "#if WXWIN_COMPATIBILITY_3_0" tests around their definition and use. Provoking deprecation warnings in the code using these constants is worth it as they are unclear and it's easy to make mistakes when using them, but breaking this code compilation outright can't be justified -- even in the future. Also use more informational wxDEPRECATED_MSG() instead of a simple wxDEPRECATED() as it might not be obvious at all how should the code be updated exactly. Finally, avoid the use of deprecated constants inside the library itself. As a side effect, this closes #15814. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -285,32 +285,6 @@ public:
|
||||
virtual ~wxFontBase();
|
||||
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
// from the font components
|
||||
static wxFont *New(
|
||||
int pointSize, // size of the font in points
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = false, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
|
||||
{ return New(pointSize, (wxFontFamily)family, (wxFontStyle)style,
|
||||
(wxFontWeight)weight, underlined, face, encoding); }
|
||||
|
||||
// from the font components
|
||||
static wxFont *New(
|
||||
const wxSize& pixelSize, // size of the font in pixels
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = false, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
|
||||
{ return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style,
|
||||
(wxFontWeight)weight, underlined, face, encoding); }
|
||||
#endif
|
||||
|
||||
// from the font components
|
||||
static wxFont *New(
|
||||
int pointSize, // size of the font in points
|
||||
@@ -423,6 +397,33 @@ public:
|
||||
wxDEPRECATED_INLINE(bool GetNoAntiAliasing() const, return false;)
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
// from the font components
|
||||
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants")
|
||||
static wxFont *New(
|
||||
int pointSize, // size of the font in points
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = false, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
|
||||
{ return New(pointSize, (wxFontFamily)family, (wxFontStyle)style,
|
||||
(wxFontWeight)weight, underlined, face, encoding); }
|
||||
|
||||
// from the font components
|
||||
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants")
|
||||
static wxFont *New(
|
||||
const wxSize& pixelSize, // size of the font in pixels
|
||||
int family, // see wxFontFamily enum
|
||||
int style, // see wxFontStyle enum
|
||||
int weight, // see wxFontWeight enum
|
||||
bool underlined = false, // not underlined by default
|
||||
const wxString& face = wxEmptyString, // facename
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
|
||||
{ return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style,
|
||||
(wxFontWeight)weight, underlined, face, encoding); }
|
||||
|
||||
|
||||
protected:
|
||||
// the function called by both overloads of SetNativeFontInfo()
|
||||
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info);
|
||||
@@ -475,27 +476,26 @@ WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font);
|
||||
WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font);
|
||||
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
#define wxDECLARE_FONT_COMPAT_SETTER \
|
||||
wxDEPRECATED( void SetFamily(int family) ) \
|
||||
{ SetFamily((wxFontFamily)family); } \
|
||||
wxDEPRECATED( void SetStyle(int style) ) \
|
||||
{ SetStyle((wxFontStyle)style); } \
|
||||
wxDEPRECATED( void SetWeight(int weight) ) \
|
||||
{ SetWeight((wxFontWeight)weight); } \
|
||||
wxDEPRECATED( void SetFamily(wxDeprecatedGUIConstants family) ) \
|
||||
{ SetFamily((wxFontFamily)family); } \
|
||||
wxDEPRECATED( void SetStyle(wxDeprecatedGUIConstants style) ) \
|
||||
{ SetStyle((wxFontStyle)style); } \
|
||||
wxDEPRECATED( void SetWeight(wxDeprecatedGUIConstants weight) ) \
|
||||
{ SetWeight((wxFontWeight)weight); }
|
||||
#else
|
||||
#define wxDECLARE_FONT_COMPAT_SETTER /*empty*/
|
||||
#endif
|
||||
|
||||
// this macro must be used in all derived wxFont classes declarations
|
||||
#define wxDECLARE_COMMON_FONT_METHODS() \
|
||||
wxDECLARE_FONT_COMPAT_SETTER \
|
||||
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
|
||||
void SetFamily(int family) \
|
||||
{ SetFamily((wxFontFamily)family); } \
|
||||
wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \
|
||||
void SetStyle(int style) \
|
||||
{ SetStyle((wxFontStyle)style); } \
|
||||
wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
|
||||
void SetWeight(int weight) \
|
||||
{ SetWeight((wxFontWeight)weight); } \
|
||||
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
|
||||
void SetFamily(wxDeprecatedGUIConstants family) \
|
||||
{ SetFamily((wxFontFamily)family); } \
|
||||
wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \
|
||||
void SetStyle(wxDeprecatedGUIConstants style) \
|
||||
{ SetStyle((wxFontStyle)style); } \
|
||||
wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
|
||||
void SetWeight(wxDeprecatedGUIConstants weight) \
|
||||
{ SetWeight((wxFontWeight)weight); } \
|
||||
\
|
||||
/* functions for modifying font in place */ \
|
||||
wxFont& MakeBold(); \
|
||||
@@ -546,14 +546,13 @@ public:
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants")
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
bool underline = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{ return FindOrCreateFont(pointSize, (wxFontFamily)family, (wxFontStyle)style,
|
||||
(wxFontWeight)weight, underline, face, encoding); }
|
||||
#endif
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
|
||||
@@ -565,29 +564,31 @@ extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
|
||||
//
|
||||
// to compile without warnings which it would otherwise provoke from some
|
||||
// compilers as it compares elements of different enums
|
||||
#if WXWIN_COMPATIBILITY_3_0
|
||||
|
||||
// Unfortunately some compilers have ambiguity issues when enum comparisons are
|
||||
// overloaded so we have to disable the overloads in this case, see
|
||||
// wxCOMPILER_NO_OVERLOAD_ON_ENUM definition in wx/platform.h for more details.
|
||||
#ifndef wxCOMPILER_NO_OVERLOAD_ON_ENUM
|
||||
|
||||
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
|
||||
inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t)
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
wxDEPRECATED_MSG("use wxFONTFAMILY_XXX constants") \
|
||||
inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t)
|
||||
{ return !(s == t); }
|
||||
{ return static_cast<int>(s) != static_cast<int>(t); }
|
||||
wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \
|
||||
inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t)
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
wxDEPRECATED_MSG("use wxFONTSTYLE_XXX constants") \
|
||||
inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t)
|
||||
{ return !(s == t); }
|
||||
{ return static_cast<int>(s) != static_cast<int>(t); }
|
||||
wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
|
||||
inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t)
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
{ return static_cast<int>(s) == static_cast<int>(t); }
|
||||
wxDEPRECATED_MSG("use wxFONTWEIGHT_XXX constants") \
|
||||
inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t)
|
||||
{ return !(s == t); }
|
||||
{ return static_cast<int>(s) != static_cast<int>(t); }
|
||||
|
||||
#endif // // wxCOMPILER_NO_OVERLOAD_ON_ENUM
|
||||
|
||||
#endif // WXWIN_COMPATIBILITY_3_0
|
||||
|
||||
#endif
|
||||
// _WX_FONT_H_BASE_
|
||||
#endif // _WX_FONT_H_BASE_
|
||||
|
Reference in New Issue
Block a user