fix the incoherence pointed out by ifacecheck between wx docs, that documents usage of the wxFontFamily, wxFontStyle and wxFontWeight enums in wxFont setters and getters, and the actual sources, which use 'int' instead; provided the same backward-compatibility pattern already used for wxBrush,wxPen both against 'int' overloads and against the wxDeprecatedGUIConstants enum values

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-11-03 17:02:25 +00:00
parent e2ca659906
commit 0c14b6c324
26 changed files with 736 additions and 493 deletions

View File

@@ -40,6 +40,7 @@ public:
/*! @abstract Platform-independent construction with individual properties /*! @abstract Platform-independent construction with individual properties
*/ */
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -47,6 +48,17 @@ public:
bool underlined = FALSE, bool underlined = FALSE,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, family, style, weight, underlined, face, encoding);
} }
@@ -66,9 +78,9 @@ public:
// NOTE: Copy c-tor and assignment from wxObject is fine // NOTE: Copy c-tor and assignment from wxObject is fine
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = FALSE, bool underlined = FALSE,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -79,22 +91,24 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
// implementation only from now on // implementation only from now on
// ------------------------------- // -------------------------------

View File

@@ -2087,6 +2087,14 @@ enum wxHitTest
/* GDI descriptions */ /* GDI descriptions */
/* ---------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------- */
/*
WARNING: the following styles are deprecated; use the
wxFontFamily, wxFontStyle, wxFontWeight, wxBrushStyle,
wxPenStyle, wxPenCap, wxPenJoin enum values instead!
*/
#if FUTURE_WXWIN_COMPATIBILITY_3_0
/* don't use any elements of this enum in the new code */ /* don't use any elements of this enum in the new code */
enum wxDeprecatedGUIConstants enum wxDeprecatedGUIConstants
{ {
@@ -2110,13 +2118,6 @@ enum wxDeprecatedGUIConstants
wxITALIC, wxITALIC,
wxSLANT, wxSLANT,
#if FUTURE_WXWIN_COMPATIBILITY_3_0
/*
WARNING: the following styles are deprecated; use the wxBrushStyle,
wxPenStyle, wxPenCap, wxPenJoin enum values instead!
*/
/* Pen styles */ /* Pen styles */
wxSOLID = 100, wxSOLID = 100,
wxDOT, wxDOT,
@@ -2142,8 +2143,8 @@ enum wxDeprecatedGUIConstants
wxVERTICAL_HATCH, wxVERTICAL_HATCH,
wxFIRST_HATCH = wxBDIAGONAL_HATCH, wxFIRST_HATCH = wxBDIAGONAL_HATCH,
wxLAST_HATCH = wxVERTICAL_HATCH wxLAST_HATCH = wxVERTICAL_HATCH
#endif
}; };
#endif
/* Logical ops */ /* Logical ops */
typedef enum typedef enum

View File

@@ -24,6 +24,7 @@ class WXDLLIMPEXP_CORE wxFont : public wxFontBase
public: public:
wxFont() {} wxFont() {}
wxFont(const wxNativeFontInfo& info) { Create(info); } wxFont(const wxNativeFontInfo& info) { Create(info); }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -31,14 +32,26 @@ public:
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
Create(size, family, style, weight, underlined, face, encoding); Create(size, family, style, weight, underlined, face, encoding);
} }
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -46,9 +59,9 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -56,13 +69,15 @@ public:
virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
// Unofficial API, don't use // Unofficial API, don't use
virtual void SetNoAntiAliasing(bool no = true); virtual void SetNoAntiAliasing(bool no = true);
virtual bool GetNoAntiAliasing() const; virtual bool GetNoAntiAliasing() const;

View File

@@ -114,6 +114,8 @@ public:
// creator function // creator function
virtual ~wxFontBase(); virtual ~wxFontBase();
#if FUTURE_WXWIN_COMPATIBILITY_3_0
// from the font components // from the font components
static wxFont *New( static wxFont *New(
int pointSize, // size of the font in points int pointSize, // size of the font in points
@@ -122,6 +124,41 @@ public:
int weight, // see wxFontWeight enum int weight, // see wxFontWeight enum
bool underlined = false, // not underlined by default bool underlined = false, // not underlined by default
const wxString& face = wxEmptyString, // facename 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
wxFontFamily family, // see wxFontFamily enum
wxFontStyle style, // see wxFontStyle enum
wxFontWeight weight, // see wxFontWeight enum
bool underlined = false, // not underlined by default
const wxString& face = wxEmptyString, // facename
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
// from the font components
static wxFont *New(
const wxSize& pixelSize, // size of the font in pixels
wxFontFamily family, // see wxFontFamily enum
wxFontStyle style, // see wxFontStyle enum
wxFontWeight weight, // see wxFontWeight enum
bool underlined = false, // not underlined by default
const wxString& face = wxEmptyString, // facename
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ... wxFontEncoding encoding = wxFONTENCODING_DEFAULT); // ISO8859-X, ...
// from the font components but using the font flags instead of separate // from the font components but using the font flags instead of separate
@@ -132,15 +169,6 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
// 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, ...
// from the font components but using the font flags instead of separate // from the font components but using the font flags instead of separate
// parameters for each flag // parameters for each flag
@@ -164,9 +192,9 @@ public:
virtual int GetPointSize() const = 0; virtual int GetPointSize() const = 0;
virtual wxSize GetPixelSize() const; virtual wxSize GetPixelSize() const;
virtual bool IsUsingSizeInPixels() const; virtual bool IsUsingSizeInPixels() const;
virtual int GetFamily() const = 0; virtual wxFontFamily GetFamily() const = 0;
virtual int GetStyle() const = 0; virtual wxFontStyle GetStyle() const = 0;
virtual int GetWeight() const = 0; virtual wxFontWeight GetWeight() const = 0;
virtual bool GetUnderlined() const = 0; virtual bool GetUnderlined() const = 0;
virtual wxString GetFaceName() const = 0; virtual wxString GetFaceName() const = 0;
virtual wxFontEncoding GetEncoding() const = 0; virtual wxFontEncoding GetEncoding() const = 0;
@@ -180,9 +208,10 @@ public:
// change the font characteristics // change the font characteristics
virtual void SetPointSize( int pointSize ) = 0; virtual void SetPointSize( int pointSize ) = 0;
virtual void SetPixelSize( const wxSize& pixelSize ); virtual void SetPixelSize( const wxSize& pixelSize );
virtual void SetFamily( int family ) = 0; virtual void SetFamily( wxFontFamily family ) = 0;
virtual void SetStyle( int style ) = 0; virtual void SetStyle( wxFontStyle style ) = 0;
virtual void SetWeight( int weight ) = 0; virtual void SetWeight( wxFontWeight weight ) = 0;
virtual void SetUnderlined( bool underlined ) = 0; virtual void SetUnderlined( bool underlined ) = 0;
virtual void SetEncoding(wxFontEncoding encoding) = 0; virtual void SetEncoding(wxFontEncoding encoding) = 0;
virtual bool SetFaceName( const wxString& faceName ); virtual bool SetFaceName( const wxString& faceName );
@@ -224,6 +253,23 @@ WXDLLIMPEXP_CORE wxString wxToString(const wxFontBase& font);
WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font); WXDLLIMPEXP_CORE bool wxFromString(const wxString& str, wxFontBase* font);
#if FUTURE_WXWIN_COMPATIBILITY_3_0
#define WXDECLARE_COMPAT_SETTERS \
wxDEPRECATED_FUTURE( void SetFamily(int family) ) \
{ SetFamily((wxFontFamily)family); } \
wxDEPRECATED_FUTURE( void SetStyle(int style) ) \
{ SetStyle((wxFontStyle)style); } \
wxDEPRECATED_FUTURE( void SetWeight(int weight) ) \
{ SetWeight((wxFontWeight)weight); } \
wxDEPRECATED_FUTURE( void SetFamily(wxDeprecatedGUIConstants family) ) \
{ SetFamily((wxFontFamily)family); } \
wxDEPRECATED_FUTURE( void SetStyle(wxDeprecatedGUIConstants style) ) \
{ SetStyle((wxFontStyle)style); } \
wxDEPRECATED_FUTURE( void SetWeight(wxDeprecatedGUIConstants weight) ) \
{ SetWeight((wxFontWeight)weight); }
#else
#define WXDECLARE_COMPAT_SETTERS /*empty*/
#endif
// include the real class declaration // include the real class declaration
#if defined(__WXPALMOS__) #if defined(__WXPALMOS__)
@@ -278,5 +324,29 @@ public:
extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList; extern WXDLLIMPEXP_DATA_CORE(wxFontList*) wxTheFontList;
// provide comparison operators to allow code such as
//
// if ( font.GetStyle() == wxFONTSTYLE_SLANT )
//
// to compile without warnings which it would otherwise provoke from some
// compilers as it compares elements of different enums
#if FUTURE_WXWIN_COMPATIBILITY_3_0
inline bool operator==(wxFontFamily s, wxDeprecatedGUIConstants t)
{ return static_cast<int>(s) == static_cast<int>(t); }
inline bool operator!=(wxFontFamily s, wxDeprecatedGUIConstants t)
{ return !(s == t); }
inline bool operator==(wxFontStyle s, wxDeprecatedGUIConstants t)
{ return static_cast<int>(s) == static_cast<int>(t); }
inline bool operator!=(wxFontStyle s, wxDeprecatedGUIConstants t)
{ return !(s == t); }
inline bool operator==(wxFontWeight s, wxDeprecatedGUIConstants t)
{ return static_cast<int>(s) == static_cast<int>(t); }
inline bool operator!=(wxFontWeight s, wxDeprecatedGUIConstants t)
{ return !(s == t); }
#endif // FUTURE_WXWIN_COMPATIBILITY_3_0
#endif #endif
// _WX_FONT_H_BASE_ // _WX_FONT_H_BASE_

View File

@@ -27,6 +27,7 @@ public:
wxFont(const wxNativeFontInfo& info); wxFont(const wxNativeFontInfo& info);
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -35,13 +36,25 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -53,9 +66,9 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -63,13 +76,15 @@ public:
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
virtual void SetPointSize( int pointSize ); virtual void SetPointSize( int pointSize );
virtual void SetFamily( int family ); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle( int style ); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight( int weight ); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName( const wxString& faceName ); virtual bool SetFaceName( const wxString& faceName );
virtual void SetUnderlined( bool underlined ); virtual void SetUnderlined( bool underlined );
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
virtual void SetNoAntiAliasing( bool no = true ); virtual void SetNoAntiAliasing( bool no = true );
virtual bool GetNoAntiAliasing() const ; virtual bool GetNoAntiAliasing() const ;

View File

@@ -40,6 +40,7 @@ public:
wxFont(const wxNativeFontInfo& info); wxFont(const wxNativeFontInfo& info);
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -48,17 +49,30 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
// wxGTK-specific // wxGTK-specific
bool Create(const wxString& fontname); bool Create(const wxString& fontname);
@@ -66,9 +80,9 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -76,13 +90,15 @@ public:
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
virtual void SetPointSize( int pointSize ); virtual void SetPointSize( int pointSize );
virtual void SetFamily( int family ); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle( int style ); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight( int weight ); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName( const wxString& faceName ); virtual bool SetFaceName( const wxString& faceName );
virtual void SetUnderlined( bool underlined ); virtual void SetUnderlined( bool underlined );
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
virtual void SetNoAntiAliasing( bool no = true ); virtual void SetNoAntiAliasing( bool no = true );
virtual bool GetNoAntiAliasing() const ; virtual bool GetNoAntiAliasing() const ;

View File

@@ -37,22 +37,35 @@ public:
(void)Create(info); (void)Create(info);
} }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
int weight, int weight,
bool underlined = FALSE, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = FALSE, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -62,9 +75,9 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -72,13 +85,15 @@ public:
virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
// Unofficial API, don't use // Unofficial API, don't use
virtual void SetNoAntiAliasing(bool no = true); virtual void SetNoAntiAliasing(bool no = true);
virtual bool GetNoAntiAliasing() const; virtual bool GetNoAntiAliasing() const;

View File

@@ -28,6 +28,9 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
wxFont(const wxNativeFontInfo& info);
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -36,15 +39,25 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
wxFont(const wxNativeFontInfo& info);
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -58,22 +71,24 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
// Implementation // Implementation
// Find an existing, or create a new, XFontStruct // Find an existing, or create a new, XFontStruct

View File

@@ -24,6 +24,7 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -32,9 +33,34 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
return DoCreate(size, wxDefaultSize, false, family, style,
weight, underlined, face, encoding);
}
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(const wxSize& pixelSize, wxFont(const wxSize& pixelSize,
int family, int family,
int style, int style,
@@ -42,6 +68,19 @@ public:
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(pixelSize, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight,
underlined, face, encoding);
}
#endif
wxFont(const wxSize& pixelSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(pixelSize, family, style, weight, (void)Create(pixelSize, family, style, weight,
underlined, face, encoding); underlined, face, encoding);
@@ -54,22 +93,11 @@ public:
wxFont(const wxString& fontDesc); wxFont(const wxString& fontDesc);
bool Create(int size,
int family,
int style,
int weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
return DoCreate(size, wxDefaultSize, false, family, style,
weight, underlined, face, encoding);
}
bool Create(const wxSize& pixelSize, bool Create(const wxSize& pixelSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = false, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
@@ -90,9 +118,9 @@ public:
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual wxSize GetPixelSize() const; virtual wxSize GetPixelSize() const;
virtual bool IsUsingSizeInPixels() const; virtual bool IsUsingSizeInPixels() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -100,13 +128,15 @@ public:
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetPixelSize(const wxSize& pixelSize); virtual void SetPixelSize(const wxSize& pixelSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
// implementation only from now on // implementation only from now on

View File

@@ -27,24 +27,37 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
wxFont( int nSize #if FUTURE_WXWIN_COMPATIBILITY_3_0
,int nFamily wxFont(int size,
,int nStyle int family,
,int nWeight int style,
,bool bUnderlined = false int weight,
,const wxString& rsFace = wxEmptyString bool underlined = false,
,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT const wxString& face = wxEmptyString,
) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create( nSize (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
,nFamily
,nStyle
,nWeight
,bUnderlined
,rsFace
,vEncoding
);
} }
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont( const wxNativeFontInfo& rInfo wxFont( const wxNativeFontInfo& rInfo
,WXHFONT hFont = 0 ,WXHFONT hFont = 0
@@ -58,14 +71,6 @@ public:
wxFont(const wxString& rsFontDesc); wxFont(const wxString& rsFontDesc);
bool Create( int nSize
,int nFamily
,int nStyle
,int nWeight
,bool bUnderlined = false
,const wxString& rsFace = wxEmptyString
,wxFontEncoding vEncoding = wxFONTENCODING_DEFAULT
);
bool Create( const wxNativeFontInfo& rInfo bool Create( const wxNativeFontInfo& rInfo
,WXHFONT hFont = 0 ,WXHFONT hFont = 0
); );
@@ -76,22 +81,24 @@ public:
// Implement base class pure virtuals // Implement base class pure virtuals
// //
virtual int GetPointSize(void) const; virtual int GetPointSize(void) const;
virtual int GetFamily(void) const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle(void) const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight(void) const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined(void) const; virtual bool GetUnderlined(void) const;
virtual wxString GetFaceName(void) const; virtual wxString GetFaceName(void) const;
virtual wxFontEncoding GetEncoding(void) const; virtual wxFontEncoding GetEncoding(void) const;
virtual const wxNativeFontInfo* GetNativeFontInfo() const; virtual const wxNativeFontInfo* GetNativeFontInfo() const;
virtual void SetPointSize(int nPointSize); virtual void SetPointSize(int nPointSize);
virtual void SetFamily(int nFamily); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int nStyle); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int nWeight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& rsFaceName); virtual bool SetFaceName(const wxString& rsFaceName);
virtual void SetUnderlined(bool bUnderlined); virtual void SetUnderlined(bool bUnderlined);
virtual void SetEncoding(wxFontEncoding vEncoding); virtual void SetEncoding(wxFontEncoding vEncoding);
WXDECLARE_COMPAT_SETTERS
// //
// For internal use only! // For internal use only!
// //

View File

@@ -22,16 +22,37 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
int weight, int weight,
bool underlined = FALSE, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
} }
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont(const wxNativeFontInfo& info) wxFont(const wxNativeFontInfo& info)
{ {
@@ -40,14 +61,6 @@ public:
wxFont(const wxString& fontDesc); wxFont(const wxString& fontDesc);
bool Create(int size,
int family,
int style,
int weight,
bool underlined = FALSE,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
bool Create(const wxNativeFontInfo& info); bool Create(const wxNativeFontInfo& info);
#if wxOSX_USE_CARBON #if wxOSX_USE_CARBON
@@ -64,22 +77,24 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual wxSize GetPixelSize() const; virtual wxSize GetPixelSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const; virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
// implementation only from now on // implementation only from now on
// ------------------------------- // -------------------------------

View File

@@ -24,6 +24,7 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
@@ -32,8 +33,28 @@ public:
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
} }
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
}
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont(const wxSize& pixelSize, wxFont(const wxSize& pixelSize,
int family, int family,
@@ -54,18 +75,6 @@ public:
wxFont(const wxString& fontDesc); wxFont(const wxString& fontDesc);
bool Create(int size,
int family,
int style,
int weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
return DoCreate(size, wxDefaultSize, false, family, style,
weight, underlined, face, encoding);
}
bool Create(const wxSize& pixelSize, bool Create(const wxSize& pixelSize,
int family, int family,
int style, int style,
@@ -90,9 +99,9 @@ public:
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual wxSize GetPixelSize() const; virtual wxSize GetPixelSize() const;
virtual bool IsUsingSizeInPixels() const; virtual bool IsUsingSizeInPixels() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -100,13 +109,15 @@ public:
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetPixelSize(const wxSize& pixelSize); virtual void SetPixelSize(const wxSize& pixelSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
// implementation only from now on // implementation only from now on

View File

@@ -21,27 +21,40 @@ public:
// ctors and such // ctors and such
wxFont() { } wxFont() { }
#if FUTURE_WXWIN_COMPATIBILITY_3_0
wxFont(int size, wxFont(int size,
int family, int family,
int style, int style,
int weight, int weight,
bool underlined = FALSE, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{ {
(void)Create(size, family, style, weight, underlined, face, encoding); (void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
#endif
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
} }
wxFont(const wxNativeFontInfo& info);
bool Create(int size, bool Create(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined = FALSE, bool underlined = false,
const wxString& face = wxEmptyString, const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont(const wxNativeFontInfo& info);
// FIXME: I added the ! to make it compile; // FIXME: I added the ! to make it compile;
// is this right? - JACS // is this right? - JACS
#if !wxUSE_UNICODE #if !wxUSE_UNICODE
@@ -55,9 +68,9 @@ public:
// implement base class pure virtuals // implement base class pure virtuals
virtual int GetPointSize() const; virtual int GetPointSize() const;
virtual int GetFamily() const; virtual wxFontFamily GetFamily() const;
virtual int GetStyle() const; virtual wxFontStyle GetStyle() const;
virtual int GetWeight() const; virtual wxFontWeight GetWeight() const;
virtual bool GetUnderlined() const; virtual bool GetUnderlined() const;
virtual wxString GetFaceName() const; virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const; virtual wxFontEncoding GetEncoding() const;
@@ -66,13 +79,15 @@ public:
virtual bool IsFixedWidth() const; virtual bool IsFixedWidth() const;
virtual void SetPointSize(int pointSize); virtual void SetPointSize(int pointSize);
virtual void SetFamily(int family); virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(int style); virtual void SetStyle(wxFontStyle style);
virtual void SetWeight(int weight); virtual void SetWeight(wxFontWeight weight);
virtual bool SetFaceName(const wxString& faceName); virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined); virtual void SetUnderlined(bool underlined);
virtual void SetEncoding(wxFontEncoding encoding); virtual void SetEncoding(wxFontEncoding encoding);
WXDECLARE_COMPAT_SETTERS
virtual void SetNoAntiAliasing( bool no = TRUE ); virtual void SetNoAntiAliasing( bool no = TRUE );
virtual bool GetNoAntiAliasing() const ; virtual bool GetNoAntiAliasing() const ;

View File

@@ -94,7 +94,7 @@
static NSFont* GetNSFontForNativeFontInfo(const wxNativeFontInfo &info); static NSFont* GetNSFontForNativeFontInfo(const wxNativeFontInfo &info);
static void UpdateNativeFontInfoWithNSFont(wxNativeFontInfo &info, NSFont *cocoaNSFont); static void UpdateNativeFontInfoWithNSFont(wxNativeFontInfo &info, NSFont *cocoaNSFont);
static wxNativeFontInfo MakeNativeFontInfoForNSFont(NSFont *cocoaNSFont, bool underlined = false); static wxNativeFontInfo MakeNativeFontInfoForNSFont(NSFont *cocoaNSFont, bool underlined = false);
static wxNativeFontInfo MakeNativeFontInfo(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding); static wxNativeFontInfo MakeNativeFontInfo(int size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underlined, const wxString& faceName, wxFontEncoding encoding);
/*! @discussion /*! @discussion
Due to 2.8 ABI compatibility concerns we probably don't want to change wxNativeFontInfo Due to 2.8 ABI compatibility concerns we probably don't want to change wxNativeFontInfo
@@ -146,9 +146,9 @@ public:
} }
wxFontRefData(int size, wxFontRefData(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -166,9 +166,9 @@ protected:
FIXME: Remove from trunk FIXME: Remove from trunk
*/ */
void Init(int size, void Init(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -283,7 +283,7 @@ static wxNativeFontInfo MakeNativeFontInfoForNSFont(NSFont *cocoaNSFont, bool un
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
static wxNativeFontInfo MakeNativeFontInfo(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding) static wxNativeFontInfo MakeNativeFontInfo(int size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
{ {
wxNativeFontInfo m_info; // NOTE: not an i-var despite name wxNativeFontInfo m_info; // NOTE: not an i-var despite name
m_info.pointSize = size; m_info.pointSize = size;
@@ -296,7 +296,7 @@ static wxNativeFontInfo MakeNativeFontInfo(int size, int family, int style, int
return m_info; return m_info;
} }
void wxFontRefData::Init(int size, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding) void wxFontRefData::Init(int size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
{ {
m_info = MakeNativeFontInfo(size, family, style, weight, underlined, faceName, encoding); m_info = MakeNativeFontInfo(size, family, style, weight, underlined, faceName, encoding);
} }
@@ -364,19 +364,19 @@ bool wxFont::GetUnderlined() const
return false; return false;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.style; return M_FONTDATA->m_info.style;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.family; return M_FONTDATA->m_info.family;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), 0, wxT("invalid font") );
return M_FONTDATA->m_info.weight; return M_FONTDATA->m_info.weight;
@@ -388,7 +388,7 @@ const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
return &M_FONTDATA->m_info; return &M_FONTDATA->m_info;
} }
bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName, wxFontEncoding encoding) bool wxFont::Create(int pointSize, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underlined, const wxString& faceName, wxFontEncoding encoding)
{ {
UnRef(); UnRef();
m_refData = new wxFontRefData(pointSize, family, style, weight, underlined, faceName, encoding); m_refData = new wxFontRefData(pointSize, family, style, weight, underlined, faceName, encoding);
@@ -417,7 +417,7 @@ void wxFont::SetPointSize(int pointSize)
RealizeResource(); RealizeResource();
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
AllocExclusive(); AllocExclusive();
@@ -426,7 +426,7 @@ void wxFont::SetFamily(int family)
RealizeResource(); RealizeResource();
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
AllocExclusive(); AllocExclusive();
@@ -435,7 +435,7 @@ void wxFont::SetStyle(int style)
RealizeResource(); RealizeResource();
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
AllocExclusive(); AllocExclusive();

View File

@@ -130,9 +130,9 @@ wxFontBase::~wxFontBase()
/* static */ /* static */
wxFont *wxFontBase::New(int size, wxFont *wxFontBase::New(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -176,9 +176,9 @@ wxFont *wxFontBase::New(int pointSize,
/* static */ /* static */
wxFont *wxFontBase::New(const wxSize& pixelSize, wxFont *wxFontBase::New(const wxSize& pixelSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)

View File

@@ -48,9 +48,9 @@ bool wxFont::Create(const wxNativeFontInfo& info)
} }
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -98,23 +98,23 @@ wxString wxFont::GetFaceName() const
return M_FONTDATA->GetFaceName(); return M_FONTDATA->GetFaceName();
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily(); return M_FONTDATA->GetFamily();
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle(); return M_FONTDATA->GetStyle();
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight(); return M_FONTDATA->GetWeight();
} }
@@ -165,19 +165,19 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetPointSize(pointSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetWeight(weight); M_FONTDATA->SetWeight(weight);

View File

@@ -49,9 +49,9 @@ class wxFontRefData : public wxGDIRefData
public: public:
// from broken down font parameters, also default ctor // from broken down font parameters, also default ctor
wxFontRefData(int size = -1, wxFontRefData(int size = -1,
int family = wxFONTFAMILY_DEFAULT, wxFontFamily family = wxFONTFAMILY_DEFAULT,
int style = wxFONTSTYLE_NORMAL, wxFontStyle style = wxFONTSTYLE_NORMAL,
int weight = wxFONTWEIGHT_NORMAL, wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false, bool underlined = false,
const wxString& faceName = wxEmptyString, const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -74,9 +74,9 @@ public:
// setters: all of them also take care to modify m_nativeFontInfo if we // setters: all of them also take care to modify m_nativeFontInfo if we
// have it so as to not lose the information not carried by our fields // have it so as to not lose the information not carried by our fields
void SetPointSize(int pointSize); void SetPointSize(int pointSize);
void SetFamily(int family); void SetFamily(wxFontFamily family);
void SetStyle(int style); void SetStyle(wxFontStyle style);
void SetWeight(int weight); void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined); void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename); bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding); void SetEncoding(wxFontEncoding encoding);
@@ -90,9 +90,9 @@ public:
protected: protected:
// common part of all ctors // common part of all ctors
void Init(int pointSize, void Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -105,9 +105,9 @@ private:
void ClearGdkFonts(); void ClearGdkFonts();
int m_pointSize; int m_pointSize;
int m_family, wxFontFamily m_family;
m_style, wxFontStyle m_style;
m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; wxFontEncoding m_encoding;
@@ -127,9 +127,9 @@ private:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -252,8 +252,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString()); m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString());
} }
wxFontRefData::wxFontRefData(int size, int family, int style, wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
int weight, bool underlined, wxFontWeight weight, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
@@ -287,21 +287,21 @@ void wxFontRefData::SetPointSize(int pointSize)
m_nativeFontInfo.SetPointSize(pointSize); m_nativeFontInfo.SetPointSize(pointSize);
} }
void wxFontRefData::SetFamily(int family) void wxFontRefData::SetFamily(wxFontFamily family)
{ {
m_family = family; m_family = family;
// TODO: what are we supposed to do with m_nativeFontInfo here? // TODO: what are we supposed to do with m_nativeFontInfo here?
} }
void wxFontRefData::SetStyle(int style) void wxFontRefData::SetStyle(wxFontStyle style)
{ {
m_style = style; m_style = style;
m_nativeFontInfo.SetStyle((wxFontStyle)style); m_nativeFontInfo.SetStyle((wxFontStyle)style);
} }
void wxFontRefData::SetWeight(int weight) void wxFontRefData::SetWeight(wxFontWeight weight)
{ {
m_weight = weight; m_weight = weight;
@@ -356,9 +356,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
} }
bool wxFont::Create( int pointSize, bool wxFont::Create( int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -410,11 +410,11 @@ wxString wxFont::GetFaceName() const
: M_FONTDATA->m_faceName; : M_FONTDATA->m_faceName;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
int ret = M_FONTDATA->m_family; wxFontFamily ret = M_FONTDATA->m_family;
if (M_FONTDATA->HasNativeFont()) if (M_FONTDATA->HasNativeFont())
// wxNativeFontInfo::GetFamily is expensive, must not call more than once // wxNativeFontInfo::GetFamily is expensive, must not call more than once
ret = M_FONTDATA->m_nativeFontInfo.GetFamily(); ret = M_FONTDATA->m_nativeFontInfo.GetFamily();
@@ -425,17 +425,17 @@ int wxFont::GetFamily() const
return ret; return ret;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetStyle() return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetStyle()
: M_FONTDATA->m_style; : M_FONTDATA->m_style;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetWeight() return M_FONTDATA->HasNativeFont() ? M_FONTDATA->m_nativeFontInfo.GetWeight()
: M_FONTDATA->m_weight; : M_FONTDATA->m_weight;
@@ -487,21 +487,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetPointSize(pointSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
AllocExclusive(); AllocExclusive();

View File

@@ -59,9 +59,9 @@ class wxFontRefData : public wxGDIRefData
public: public:
// from broken down font parameters, also default ctor // from broken down font parameters, also default ctor
wxFontRefData(int size = -1, wxFontRefData(int size = -1,
int family = wxFONTFAMILY_DEFAULT, wxFontFamily family = wxFONTFAMILY_DEFAULT,
int style = wxFONTSTYLE_NORMAL, wxFontStyle style = wxFONTSTYLE_NORMAL,
int weight = wxFONTWEIGHT_NORMAL, wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false, bool underlined = false,
const wxString& faceName = wxEmptyString, const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -84,9 +84,9 @@ public:
// setters: all of them also take care to modify m_nativeFontInfo if we // setters: all of them also take care to modify m_nativeFontInfo if we
// have it so as to not lose the information not carried by our fields // have it so as to not lose the information not carried by our fields
void SetPointSize(int pointSize); void SetPointSize(int pointSize);
void SetFamily(int family); void SetFamily(wxFontFamily family);
void SetStyle(int style); void SetStyle(wxFontStyle style);
void SetWeight(int weight); void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined); void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename); bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding); void SetEncoding(wxFontEncoding encoding);
@@ -120,9 +120,9 @@ public:
protected: protected:
// common part of all ctors // common part of all ctors
void Init(int pointSize, void Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -138,9 +138,9 @@ private:
wxScaledFontList m_scaled_xfonts; wxScaledFontList m_scaled_xfonts;
int m_pointSize; int m_pointSize;
int m_family, wxFontFamily m_family;
m_style, wxFontStyle m_style;
m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; // Unused under GTK 2.0 wxFontEncoding m_encoding; // Unused under GTK 2.0
@@ -160,9 +160,9 @@ private:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -311,8 +311,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString()); m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString());
} }
wxFontRefData::wxFontRefData(int size, int family, int style, wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
int weight, bool underlined, wxFontWeight weight, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
@@ -365,14 +365,14 @@ void wxFontRefData::SetPointSize(int pointSize)
} }
} }
void wxFontRefData::SetFamily(int family) void wxFontRefData::SetFamily(wxFontFamily family)
{ {
m_family = family; m_family = family;
// TODO: what are we supposed to do with m_nativeFontInfo here? // TODO: what are we supposed to do with m_nativeFontInfo here?
} }
void wxFontRefData::SetStyle(int style) void wxFontRefData::SetStyle(wxFontStyle style)
{ {
m_style = style; m_style = style;
@@ -401,7 +401,7 @@ void wxFontRefData::SetStyle(int style)
} }
} }
void wxFontRefData::SetWeight(int weight) void wxFontRefData::SetWeight(wxFontWeight weight)
{ {
m_weight = weight; m_weight = weight;
@@ -488,9 +488,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
} }
bool wxFont::Create( int pointSize, bool wxFont::Create( int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -564,23 +564,23 @@ wxString wxFont::GetFaceName() const
return M_FONTDATA->m_faceName; return M_FONTDATA->m_faceName;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
@@ -649,21 +649,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetPointSize(pointSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
Unshare(); Unshare();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
Unshare(); Unshare();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
Unshare(); Unshare();

View File

@@ -45,9 +45,9 @@ bool wxFont::Create(const wxNativeFontInfo& info)
} }
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& face, const wxString& face,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -95,23 +95,23 @@ wxString wxFont::GetFaceName() const
return M_FONTDATA->GetFaceName(); return M_FONTDATA->GetFaceName();
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily(); return M_FONTDATA->GetFamily();
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle(); return M_FONTDATA->GetStyle();
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight(); return M_FONTDATA->GetWeight();
} }
@@ -162,19 +162,19 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetPointSize(pointSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetWeight(weight); M_FONTDATA->SetWeight(weight);

View File

@@ -1736,7 +1736,9 @@ void wxWindowDCImpl::SetPen( const wxPen &pen )
pixel = m_backgroundPixel; pixel = m_backgroundPixel;
else else
{ {
pixel = CalculatePixel( (wxColour&) m_pen.GetColour(), m_currentColour, false); wxColour penClr = m_pen.GetColour();
pixel = CalculatePixel( penClr, m_currentColour, false);
m_pen.SetColour(penClr);
} }
// Finally, set the GC to the required colour // Finally, set the GC to the required colour
@@ -1898,7 +1900,9 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush )
// must test m_logicalFunction, because it involves background! // must test m_logicalFunction, because it involves background!
if (!sameColour || !GET_OPTIMIZATION || m_logicalFunction == wxXOR) if (!sameColour || !GET_OPTIMIZATION || m_logicalFunction == wxXOR)
{ {
WXPixel pixel = CalculatePixel( (wxColour&) m_brush.GetColour(), m_currentColour, true); wxColour brushClr = m_brush.GetColour();
WXPixel pixel = CalculatePixel( brushClr, m_currentColour, true);
m_brush.SetColour(brushClr);
if (pixel > -1) if (pixel > -1)
SetForegroundPixelWithLogicalFunction(pixel); SetForegroundPixelWithLogicalFunction(pixel);

View File

@@ -75,9 +75,9 @@ class wxFontRefData: public wxGDIRefData
public: public:
wxFontRefData(int size = wxDEFAULT, wxFontRefData(int size = wxDEFAULT,
int family = wxDEFAULT, wxFontFamily family = wxFONTFAMILY_DEFAULT,
int style = wxDEFAULT, wxFontStyle style = wxFONTSTYLE_NORMAL,
int weight = wxDEFAULT, wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false, bool underlined = false,
const wxString& faceName = wxEmptyString, const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
@@ -96,18 +96,18 @@ public:
protected: protected:
// common part of all ctors // common part of all ctors
void Init(int size, void Init(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
// font attributes // font attributes
int m_pointSize; int m_pointSize;
int m_family; wxFontFamily m_family;
int m_style; wxFontStyle m_style;
int m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; wxFontEncoding m_encoding;
@@ -166,27 +166,27 @@ wxXFont::~wxXFont()
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
if (family == wxDEFAULT) if (family == wxDEFAULT)
m_family = wxSWISS; m_family = wxFONTFAMILY_SWISS;
else else
m_family = family; m_family = family;
m_faceName = faceName; m_faceName = faceName;
if (style == wxDEFAULT) if (style == wxDEFAULT)
m_style = wxNORMAL; m_style = wxFONTSTYLE_NORMAL;
else else
m_style = style; m_style = style;
if (weight == wxDEFAULT) if (weight == wxDEFAULT)
m_weight = wxNORMAL; m_weight = wxFONTWEIGHT_NORMAL;
else else
m_weight = weight; m_weight = weight;
@@ -223,9 +223,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
} }
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -260,18 +260,18 @@ bool wxFont::Create(const wxString& fontname, wxFontEncoding enc)
M_FONTDATA->m_faceName = tn.GetNextToken(); // family M_FONTDATA->m_faceName = tn.GetNextToken(); // family
tmp = tn.GetNextToken().MakeUpper(); // weight tmp = tn.GetNextToken().MakeUpper(); // weight
if (tmp == wxT("BOLD")) M_FONTDATA->m_weight = wxBOLD; if (tmp == wxT("BOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD;
if (tmp == wxT("BLACK")) M_FONTDATA->m_weight = wxBOLD; if (tmp == wxT("BLACK")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD;
if (tmp == wxT("EXTRABOLD")) M_FONTDATA->m_weight = wxBOLD; if (tmp == wxT("EXTRABOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD;
if (tmp == wxT("DEMIBOLD")) M_FONTDATA->m_weight = wxBOLD; if (tmp == wxT("DEMIBOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD;
if (tmp == wxT("ULTRABOLD")) M_FONTDATA->m_weight = wxBOLD; if (tmp == wxT("ULTRABOLD")) M_FONTDATA->m_weight = wxFONTWEIGHT_BOLD;
if (tmp == wxT("LIGHT")) M_FONTDATA->m_weight = wxLIGHT; if (tmp == wxT("LIGHT")) M_FONTDATA->m_weight = wxFONTWEIGHT_LIGHT;
if (tmp == wxT("THIN")) M_FONTDATA->m_weight = wxLIGHT; if (tmp == wxT("THIN")) M_FONTDATA->m_weight = wxFONTWEIGHT_LIGHT;
tmp = tn.GetNextToken().MakeUpper(); // slant tmp = tn.GetNextToken().MakeUpper(); // slant
if (tmp == wxT("I")) M_FONTDATA->m_style = wxITALIC; if (tmp == wxT("I")) M_FONTDATA->m_style = wxFONTSTYLE_ITALIC;
if (tmp == wxT("O")) M_FONTDATA->m_style = wxITALIC; if (tmp == wxT("O")) M_FONTDATA->m_style = wxFONTSTYLE_ITALIC;
tn.GetNextToken(); // set width tn.GetNextToken(); // set width
tn.GetNextToken(); // add. style tn.GetNextToken(); // add. style
@@ -290,17 +290,17 @@ bool wxFont::Create(const wxString& fontname, wxFontEncoding enc)
tmp = tn.GetNextToken().MakeUpper(); // spacing tmp = tn.GetNextToken().MakeUpper(); // spacing
if (tmp == wxT("M")) if (tmp == wxT("M"))
M_FONTDATA->m_family = wxMODERN; M_FONTDATA->m_family = wxFONTFAMILY_MODERN;
else if (M_FONTDATA->m_faceName == wxT("TIMES")) else if (M_FONTDATA->m_faceName == wxT("TIMES"))
M_FONTDATA->m_family = wxROMAN; M_FONTDATA->m_family = wxFONTFAMILY_ROMAN;
else if (M_FONTDATA->m_faceName == wxT("HELVETICA")) else if (M_FONTDATA->m_faceName == wxT("HELVETICA"))
M_FONTDATA->m_family = wxSWISS; M_FONTDATA->m_family = wxFONTFAMILY_SWISS;
else if (M_FONTDATA->m_faceName == wxT("LUCIDATYPEWRITER")) else if (M_FONTDATA->m_faceName == wxT("LUCIDATYPEWRITER"))
M_FONTDATA->m_family = wxTELETYPE; M_FONTDATA->m_family = wxFONTFAMILY_TELETYPE;
else if (M_FONTDATA->m_faceName == wxT("LUCIDA")) else if (M_FONTDATA->m_faceName == wxT("LUCIDA"))
M_FONTDATA->m_family = wxDECORATIVE; M_FONTDATA->m_family = wxFONTFAMILY_DECORATIVE;
else if (M_FONTDATA->m_faceName == wxT("UTOPIA")) else if (M_FONTDATA->m_faceName == wxT("UTOPIA"))
M_FONTDATA->m_family = wxSCRIPT; M_FONTDATA->m_family = wxFONTFAMILY_SCRIPT;
tn.GetNextToken(); // avg width tn.GetNextToken(); // avg width
@@ -381,7 +381,7 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
Unshare(); Unshare();
@@ -389,7 +389,7 @@ void wxFont::SetFamily(int family)
M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
Unshare(); Unshare();
@@ -397,7 +397,7 @@ void wxFont::SetStyle(int style)
M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now M_FONTDATA->m_nativeFontInfo.GetXFontName().Clear(); // invalid now
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
Unshare(); Unshare();
@@ -455,23 +455,23 @@ wxString wxFont::GetFaceName() const
return M_FONTDATA->m_faceName ; return M_FONTDATA->m_faceName ;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }

View File

@@ -116,9 +116,9 @@ public:
wxFontRefData(int size, wxFontRefData(int size,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -257,14 +257,14 @@ public:
} }
} }
void SetFamily(int family) void SetFamily(wxFontFamily family)
{ {
Free(); Free();
m_family = family; m_family = family;
} }
void SetStyle(int style) void SetStyle(wxFontStyle style)
{ {
Free(); Free();
@@ -274,7 +274,7 @@ public:
m_style = style; m_style = style;
} }
void SetWeight(int weight) void SetWeight(wxFontWeight weight)
{ {
Free(); Free();
@@ -334,9 +334,9 @@ protected:
void Init(int size, void Init(int size,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -347,9 +347,9 @@ protected:
int m_pointSize; int m_pointSize;
wxSize m_pixelSize; wxSize m_pixelSize;
bool m_sizeUsingPixels; bool m_sizeUsingPixels;
int m_family; wxFontFamily m_family;
int m_style; wxFontStyle m_style;
int m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; wxFontEncoding m_encoding;
@@ -375,9 +375,9 @@ protected:
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -864,9 +864,9 @@ wxFont::wxFont(const wxString& fontdesc)
bool wxFont::DoCreate(int pointSize, bool wxFont::DoCreate(int pointSize,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -958,21 +958,21 @@ void wxFont::SetPixelSize(const wxSize& pixelSize)
M_FONTDATA->SetPixelSize(pixelSize); M_FONTDATA->SetPixelSize(pixelSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
AllocExclusive(); AllocExclusive();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
AllocExclusive(); AllocExclusive();
@@ -1042,23 +1042,23 @@ bool wxFont::IsUsingSizeInPixels() const
return M_FONTDATA->IsUsingSizeInPixels(); return M_FONTDATA->IsUsingSizeInPixels();
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily(); return M_FONTDATA->GetFamily();
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle(); return M_FONTDATA->GetStyle();
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight(); return M_FONTDATA->GetWeight();
} }

View File

@@ -272,9 +272,9 @@ protected:
// Font characterstics // Font characterstics
// //
int m_nPointSize; int m_nPointSize;
int m_nFamily; wxFontFamily m_family;
int m_nStyle; wxFontStyle m_style;
int m_nWeight; wxFontWeight m_weight;
bool m_bUnderlined; bool m_bUnderlined;
wxString m_sFaceName; wxString m_sFaceName;
wxFontEncoding m_vEncoding; wxFontEncoding m_vEncoding;
@@ -891,9 +891,9 @@ wxFont::wxFont(
// in wxDC::SetFont, when information is available about scaling etc. // in wxDC::SetFont, when information is available about scaling etc.
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool wxFont::Create( int nPointSize, bool wxFont::Create( int nPointSize,
int nFamily, wxFontFamily nFamily,
int nStyle, wxFontStyle nStyle,
int nWeight, wxFontWeight nWeight,
bool bUnderlined, bool bUnderlined,
const wxString& rsFaceName, const wxString& rsFaceName,
wxFontEncoding vEncoding ) wxFontEncoding vEncoding )
@@ -1082,23 +1082,23 @@ int wxFont::GetPointSize() const
return M_FONTDATA->GetPointSize(); return M_FONTDATA->GetPointSize();
} // end of wxFont::GetPointSize } // end of wxFont::GetPointSize
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily(); return M_FONTDATA->GetFamily();
} // end of wxFont::GetFamily } // end of wxFont::GetFamily
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle(); return M_FONTDATA->GetStyle();
} // end of wxFont::GetStyle } // end of wxFont::GetStyle
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight(); return M_FONTDATA->GetWeight();
} }

View File

@@ -54,9 +54,9 @@ public:
} }
wxFontRefData(int size, wxFontRefData(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -84,7 +84,7 @@ public:
int GetPointSize() const { return m_pointSize; } int GetPointSize() const { return m_pointSize; }
void SetFamily( int family ) void SetFamily( wxFontFamily family )
{ {
m_family = family; m_family = family;
MacInvalidateNativeFont(); MacInvalidateNativeFont();
@@ -93,7 +93,7 @@ public:
int GetFamily() const { return m_family; } int GetFamily() const { return m_family; }
void SetStyle( int style ) void SetStyle( wxFontStyle style )
{ {
m_style = style; m_style = style;
MacInvalidateNativeFont(); MacInvalidateNativeFont();
@@ -102,7 +102,7 @@ public:
int GetStyle() const { return m_style; } int GetStyle() const { return m_style; }
void SetWeight( int weight ) void SetWeight( wxFontWeight weight )
{ {
m_weight = weight; m_weight = weight;
MacInvalidateNativeFont(); MacInvalidateNativeFont();
@@ -142,9 +142,9 @@ public:
protected: protected:
// common part of all ctors // common part of all ctors
void Init(int size, void Init(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -154,9 +154,9 @@ protected:
#endif #endif
// font characterstics // font characterstics
int m_pointSize; int m_pointSize;
int m_family; wxFontFamily m_family;
int m_style; wxFontStyle m_style;
int m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; wxFontEncoding m_encoding;
@@ -202,9 +202,9 @@ public:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -711,9 +711,9 @@ wxFont::wxFont(const wxString& fontdesc)
} }
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -837,7 +837,7 @@ void wxFont::SetPointSize(int pointSize)
RealizeResource(); RealizeResource();
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
Unshare(); Unshare();
@@ -846,7 +846,7 @@ void wxFont::SetFamily(int family)
RealizeResource(); RealizeResource();
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
Unshare(); Unshare();
@@ -855,7 +855,7 @@ void wxFont::SetStyle(int style)
RealizeResource(); RealizeResource();
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
Unshare(); Unshare();
@@ -921,23 +921,23 @@ wxSize wxFont::GetPixelSize() const
#endif #endif
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); wxCHECK_MSG( M_FONTDATA != NULL , wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->GetFamily(); return M_FONTDATA->GetFamily();
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); wxCHECK_MSG( M_FONTDATA != NULL , wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->GetStyle() ; return M_FONTDATA->GetStyle() ;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( M_FONTDATA != NULL , 0, wxT("invalid font") ); wxCHECK_MSG( M_FONTDATA != NULL , wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->GetWeight(); return M_FONTDATA->GetWeight();
} }

View File

@@ -107,9 +107,9 @@ public:
wxFontRefData(int size, wxFontRefData(int size,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -231,12 +231,12 @@ public:
} }
} }
void SetFamily(int family) void SetFamily(wxFontFamily family)
{ {
m_family = family; m_family = family;
} }
void SetStyle(int style) void SetStyle(wxFontStyle style)
{ {
if ( m_nativeFontInfoOk ) if ( m_nativeFontInfoOk )
m_nativeFontInfo.SetStyle((wxFontStyle)style); m_nativeFontInfo.SetStyle((wxFontStyle)style);
@@ -244,7 +244,7 @@ public:
m_style = style; m_style = style;
} }
void SetWeight(int weight) void SetWeight(wxFontWeight weight)
{ {
if ( m_nativeFontInfoOk ) if ( m_nativeFontInfoOk )
m_nativeFontInfo.SetWeight((wxFontWeight)weight); m_nativeFontInfo.SetWeight((wxFontWeight)weight);
@@ -287,9 +287,9 @@ protected:
void Init(int size, void Init(int size,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -300,9 +300,9 @@ protected:
int m_pointSize; int m_pointSize;
wxSize m_pixelSize; wxSize m_pixelSize;
bool m_sizeUsingPixels; bool m_sizeUsingPixels;
int m_family; wxFontFamily m_family;
int m_style; wxFontStyle m_style;
int m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; wxFontEncoding m_encoding;
@@ -328,9 +328,9 @@ protected:
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -381,9 +381,9 @@ wxFont::wxFont(const wxString& fontdesc)
bool wxFont::DoCreate(int pointSize, bool wxFont::DoCreate(int pointSize,
const wxSize& pixelSize, const wxSize& pixelSize,
bool sizeUsingPixels, bool sizeUsingPixels,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -440,15 +440,15 @@ void wxFont::SetPixelSize(const wxSize& pixelSize)
{ {
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
} }
@@ -488,17 +488,17 @@ bool wxFont::IsUsingSizeInPixels() const
return false; return false;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
return wxFONTFAMILY_ROMAN; return wxFONTFAMILY_ROMAN;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
return wxFONTSTYLE_NORMAL; return wxFONTSTYLE_NORMAL;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
return wxFONTWEIGHT_NORMAL; return wxFONTWEIGHT_NORMAL;
} }

View File

@@ -99,9 +99,9 @@ friend class wxFont;
public: public:
wxFontRefData(int size = wxDEFAULT, wxFontRefData(int size = wxDEFAULT,
int family = wxDEFAULT, wxFontFamily family = wxFONTFAMILY_DEFAULT,
int style = wxDEFAULT, wxFontStyle style = wxFONTSTYLE_NORMAL,
int weight = wxDEFAULT, wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false, bool underlined = false,
const wxString& faceName = wxEmptyString, const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT); wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@@ -118,9 +118,9 @@ public:
// setters: all of them also take care to modify m_nativeFontInfo if we // setters: all of them also take care to modify m_nativeFontInfo if we
// have it so as to not lose the information not carried by our fields // have it so as to not lose the information not carried by our fields
void SetPointSize(int pointSize); void SetPointSize(int pointSize);
void SetFamily(int family); void SetFamily(wxFontFamily family);
void SetStyle(int style); void SetStyle(wxFontStyle style);
void SetWeight(int weight); void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined); void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename); bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding); void SetEncoding(wxFontEncoding encoding);
@@ -134,9 +134,9 @@ public:
protected: protected:
// common part of all ctors // common part of all ctors
void Init(int size, void Init(int size,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding); wxFontEncoding encoding);
@@ -146,9 +146,9 @@ protected:
// font attributes // font attributes
int m_pointSize; int m_pointSize;
int m_family; wxFontFamily m_family;
int m_style; wxFontStyle m_style;
int m_weight; wxFontWeight m_weight;
bool m_underlined; bool m_underlined;
wxString m_faceName; wxString m_faceName;
wxFontEncoding m_encoding; // Unused in Unicode mode wxFontEncoding m_encoding; // Unused in Unicode mode
@@ -172,9 +172,9 @@ protected:
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize, void wxFontRefData::Init(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -419,8 +419,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo = data.m_nativeFontInfo; m_nativeFontInfo = data.m_nativeFontInfo;
} }
wxFontRefData::wxFontRefData(int size, int family, int style, wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
int weight, bool underlined, wxFontWeight weight, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
{ {
@@ -474,14 +474,14 @@ void wxFontRefData::SetPointSize(int pointSize)
#endif #endif
} }
void wxFontRefData::SetFamily(int family) void wxFontRefData::SetFamily(wxFontFamily family)
{ {
m_family = family; m_family = family;
// TODO: what are we supposed to do with m_nativeFontInfo here? // TODO: what are we supposed to do with m_nativeFontInfo here?
} }
void wxFontRefData::SetStyle(int style) void wxFontRefData::SetStyle(wxFontStyle style)
{ {
m_style = style; m_style = style;
@@ -507,7 +507,7 @@ void wxFontRefData::SetStyle(int style)
#endif #endif
} }
void wxFontRefData::SetWeight(int weight) void wxFontRefData::SetWeight(wxFontWeight weight)
{ {
m_weight = weight; m_weight = weight;
} }
@@ -561,9 +561,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
} }
bool wxFont::Create(int pointSize, bool wxFont::Create(int pointSize,
int family, wxFontFamily family,
int style, wxFontStyle style,
int weight, wxFontWeight weight,
bool underlined, bool underlined,
const wxString& faceName, const wxString& faceName,
wxFontEncoding encoding) wxFontEncoding encoding)
@@ -733,23 +733,23 @@ wxString wxFont::GetFaceName() const
return M_FONTDATA->m_faceName; return M_FONTDATA->m_faceName;
} }
int wxFont::GetFamily() const wxFontFamily wxFont::GetFamily() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTFAMILY_MAX, wxT("invalid font") );
return M_FONTDATA->m_family; return M_FONTDATA->m_family;
} }
int wxFont::GetStyle() const wxFontStyle wxFont::GetStyle() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTSTYLE_MAX, wxT("invalid font") );
return M_FONTDATA->m_style; return M_FONTDATA->m_style;
} }
int wxFont::GetWeight() const wxFontWeight wxFont::GetWeight() const
{ {
wxCHECK_MSG( Ok(), 0, wxT("invalid font") ); wxCHECK_MSG( Ok(), wxFONTWEIGHT_MAX, wxT("invalid font") );
return M_FONTDATA->m_weight; return M_FONTDATA->m_weight;
} }
@@ -822,21 +822,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize); M_FONTDATA->SetPointSize(pointSize);
} }
void wxFont::SetFamily(int family) void wxFont::SetFamily(wxFontFamily family)
{ {
Unshare(); Unshare();
M_FONTDATA->SetFamily(family); M_FONTDATA->SetFamily(family);
} }
void wxFont::SetStyle(int style) void wxFont::SetStyle(wxFontStyle style)
{ {
Unshare(); Unshare();
M_FONTDATA->SetStyle(style); M_FONTDATA->SetStyle(style);
} }
void wxFont::SetWeight(int weight) void wxFont::SetWeight(wxFontWeight weight)
{ {
Unshare(); Unshare();