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

View File

@ -103,7 +103,7 @@
# endif
/*
VC6 insists on complaining about
VC6 insists on complaining about
return type for 'wxVector<T>::reverse_iterator::operator ->' is 'T **'
(ie; not a UDT or reference to a UDT. Will produce errors if applied
@ -506,7 +506,7 @@ typedef short int WXTYPE;
#else
#define wxDEPRECATED_CONSTRUCTOR(x) wxDEPRECATED( inline x)
#endif
/*
Macro which marks the function as being deprecated but also defines it
inline.
@ -1222,7 +1222,7 @@ typedef double wxDouble;
#if wxUSE_WCHAR_T && (!defined(SIZEOF_WCHAR_T) || (SIZEOF_WCHAR_T == 2))
#define wxWCHAR_T_IS_WXCHAR16
typedef wchar_t wxChar16;
typedef wchar_t wxChar16;
#else
typedef wxUint16 wxChar16;
#endif
@ -2087,6 +2087,14 @@ enum wxHitTest
/* 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 */
enum wxDeprecatedGUIConstants
{
@ -2110,13 +2118,6 @@ enum wxDeprecatedGUIConstants
wxITALIC,
wxSLANT,
#if FUTURE_WXWIN_COMPATIBILITY_3_0
/*
WARNING: the following styles are deprecated; use the wxBrushStyle,
wxPenStyle, wxPenCap, wxPenJoin enum values instead!
*/
/* Pen styles */
wxSOLID = 100,
wxDOT,
@ -2142,8 +2143,8 @@ enum wxDeprecatedGUIConstants
wxVERTICAL_HATCH,
wxFIRST_HATCH = wxBDIAGONAL_HATCH,
wxLAST_HATCH = wxVERTICAL_HATCH
#endif
};
#endif
/* Logical ops */
typedef enum

View File

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

View File

@ -114,6 +114,8 @@ public:
// creator function
virtual ~wxFontBase();
#if FUTURE_WXWIN_COMPATIBILITY_3_0
// from the font components
static wxFont *New(
int pointSize, // size of the font in points
@ -122,6 +124,41 @@ public:
int weight, // see wxFontWeight enum
bool underlined = false, // not underlined by default
const wxString& face = wxEmptyString, // facename
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
{ return New(pointSize, (wxFontFamily)family, (wxFontStyle)style,
(wxFontWeight)weight, underlined, face, encoding); }
// from the font components
static wxFont *New(
const wxSize& pixelSize, // size of the font in pixels
int family, // see wxFontFamily enum
int style, // see wxFontStyle enum
int weight, // see wxFontWeight enum
bool underlined = false, // not underlined by default
const wxString& face = wxEmptyString, // facename
wxFontEncoding encoding = wxFONTENCODING_DEFAULT) // ISO8859-X, ...
{ return New(pixelSize, (wxFontFamily)family, (wxFontStyle)style,
(wxFontWeight)weight, underlined, face, encoding); }
#endif
// from the font components
static wxFont *New(
int pointSize, // size of the font in points
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, ...
// from the font components but using the font flags instead of separate
@ -132,15 +169,6 @@ public:
const wxString& face = wxEmptyString,
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
// parameters for each flag
@ -164,9 +192,9 @@ public:
virtual int GetPointSize() const = 0;
virtual wxSize GetPixelSize() const;
virtual bool IsUsingSizeInPixels() const;
virtual int GetFamily() const = 0;
virtual int GetStyle() const = 0;
virtual int GetWeight() const = 0;
virtual wxFontFamily GetFamily() const = 0;
virtual wxFontStyle GetStyle() const = 0;
virtual wxFontWeight GetWeight() const = 0;
virtual bool GetUnderlined() const = 0;
virtual wxString GetFaceName() const = 0;
virtual wxFontEncoding GetEncoding() const = 0;
@ -180,9 +208,10 @@ public:
// change the font characteristics
virtual void SetPointSize( int pointSize ) = 0;
virtual void SetPixelSize( const wxSize& pixelSize );
virtual void SetFamily( int family ) = 0;
virtual void SetStyle( int style ) = 0;
virtual void SetWeight( int weight ) = 0;
virtual void SetFamily( wxFontFamily family ) = 0;
virtual void SetStyle( wxFontStyle style ) = 0;
virtual void SetWeight( wxFontWeight weight ) = 0;
virtual void SetUnderlined( bool underlined ) = 0;
virtual void SetEncoding(wxFontEncoding encoding) = 0;
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);
#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
#if defined(__WXPALMOS__)
@ -278,5 +324,29 @@ public:
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
// _WX_FONT_H_BASE_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,9 +48,9 @@ bool wxFont::Create(const wxNativeFontInfo& info)
}
bool wxFont::Create(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& face,
wxFontEncoding encoding)
@ -98,23 +98,23 @@ wxString wxFont::GetFaceName() const
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();
}
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();
}
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();
}
@ -165,19 +165,19 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
AllocExclusive();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
AllocExclusive();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();
M_FONTDATA->SetWeight(weight);

View File

@ -49,9 +49,9 @@ class wxFontRefData : public wxGDIRefData
public:
// from broken down font parameters, also default ctor
wxFontRefData(int size = -1,
int family = wxFONTFAMILY_DEFAULT,
int style = wxFONTSTYLE_NORMAL,
int weight = wxFONTWEIGHT_NORMAL,
wxFontFamily family = wxFONTFAMILY_DEFAULT,
wxFontStyle style = wxFONTSTYLE_NORMAL,
wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false,
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@ -74,9 +74,9 @@ public:
// 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
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFamily(wxFontFamily family);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding);
@ -90,9 +90,9 @@ public:
protected:
// common part of all ctors
void Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
@ -105,9 +105,9 @@ private:
void ClearGdkFonts();
int m_pointSize;
int m_family,
m_style,
m_weight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
@ -127,9 +127,9 @@ private:
// ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -252,8 +252,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString());
}
wxFontRefData::wxFontRefData(int size, int family, int style,
int weight, bool underlined,
wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
wxFontWeight weight, bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
{
@ -287,21 +287,21 @@ void wxFontRefData::SetPointSize(int pointSize)
m_nativeFontInfo.SetPointSize(pointSize);
}
void wxFontRefData::SetFamily(int family)
void wxFontRefData::SetFamily(wxFontFamily family)
{
m_family = family;
// 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_nativeFontInfo.SetStyle((wxFontStyle)style);
}
void wxFontRefData::SetWeight(int weight)
void wxFontRefData::SetWeight(wxFontWeight weight)
{
m_weight = weight;
@ -356,9 +356,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
}
bool wxFont::Create( int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& face,
wxFontEncoding encoding)
@ -410,11 +410,11 @@ wxString wxFont::GetFaceName() const
: 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())
// wxNativeFontInfo::GetFamily is expensive, must not call more than once
ret = M_FONTDATA->m_nativeFontInfo.GetFamily();
@ -425,17 +425,17 @@ int wxFont::GetFamily() const
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()
: 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()
: M_FONTDATA->m_weight;
@ -487,21 +487,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
AllocExclusive();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
AllocExclusive();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();

View File

@ -59,9 +59,9 @@ class wxFontRefData : public wxGDIRefData
public:
// from broken down font parameters, also default ctor
wxFontRefData(int size = -1,
int family = wxFONTFAMILY_DEFAULT,
int style = wxFONTSTYLE_NORMAL,
int weight = wxFONTWEIGHT_NORMAL,
wxFontFamily family = wxFONTFAMILY_DEFAULT,
wxFontStyle style = wxFONTSTYLE_NORMAL,
wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false,
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@ -84,9 +84,9 @@ public:
// 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
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFamily(wxFontFamily family);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding);
@ -120,9 +120,9 @@ public:
protected:
// common part of all ctors
void Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
@ -138,9 +138,9 @@ private:
wxScaledFontList m_scaled_xfonts;
int m_pointSize;
int m_family,
m_style,
m_weight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding; // Unused under GTK 2.0
@ -160,9 +160,9 @@ private:
// ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -311,8 +311,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo.FromString(data.m_nativeFontInfo.ToString());
}
wxFontRefData::wxFontRefData(int size, int family, int style,
int weight, bool underlined,
wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
wxFontWeight weight, bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
{
@ -365,14 +365,14 @@ void wxFontRefData::SetPointSize(int pointSize)
}
}
void wxFontRefData::SetFamily(int family)
void wxFontRefData::SetFamily(wxFontFamily family)
{
m_family = family;
// TODO: what are we supposed to do with m_nativeFontInfo here?
}
void wxFontRefData::SetStyle(int style)
void wxFontRefData::SetStyle(wxFontStyle 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;
@ -488,9 +488,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
}
bool wxFont::Create( int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& face,
wxFontEncoding encoding)
@ -564,23 +564,23 @@ wxString wxFont::GetFaceName() const
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;
}
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;
}
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;
}
@ -649,21 +649,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
Unshare();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
Unshare();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
Unshare();

View File

@ -45,9 +45,9 @@ bool wxFont::Create(const wxNativeFontInfo& info)
}
bool wxFont::Create(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& face,
wxFontEncoding encoding)
@ -95,23 +95,23 @@ wxString wxFont::GetFaceName() const
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();
}
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();
}
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();
}
@ -162,19 +162,19 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
AllocExclusive();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
AllocExclusive();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();
M_FONTDATA->SetWeight(weight);

View File

@ -1736,7 +1736,9 @@ void wxWindowDCImpl::SetPen( const wxPen &pen )
pixel = m_backgroundPixel;
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
@ -1898,7 +1900,9 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush )
// must test m_logicalFunction, because it involves background!
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)
SetForegroundPixelWithLogicalFunction(pixel);

View File

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

View File

@ -116,9 +116,9 @@ public:
wxFontRefData(int size,
const wxSize& pixelSize,
bool sizeUsingPixels,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -257,14 +257,14 @@ public:
}
}
void SetFamily(int family)
void SetFamily(wxFontFamily family)
{
Free();
m_family = family;
}
void SetStyle(int style)
void SetStyle(wxFontStyle style)
{
Free();
@ -274,7 +274,7 @@ public:
m_style = style;
}
void SetWeight(int weight)
void SetWeight(wxFontWeight weight)
{
Free();
@ -334,9 +334,9 @@ protected:
void Init(int size,
const wxSize& pixelSize,
bool sizeUsingPixels,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
@ -347,9 +347,9 @@ protected:
int m_pointSize;
wxSize m_pixelSize;
bool m_sizeUsingPixels;
int m_family;
int m_style;
int m_weight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
@ -375,9 +375,9 @@ protected:
void wxFontRefData::Init(int pointSize,
const wxSize& pixelSize,
bool sizeUsingPixels,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -864,9 +864,9 @@ wxFont::wxFont(const wxString& fontdesc)
bool wxFont::DoCreate(int pointSize,
const wxSize& pixelSize,
bool sizeUsingPixels,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -958,21 +958,21 @@ void wxFont::SetPixelSize(const wxSize& pixelSize)
M_FONTDATA->SetPixelSize(pixelSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
AllocExclusive();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
AllocExclusive();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
AllocExclusive();
@ -1042,23 +1042,23 @@ bool wxFont::IsUsingSizeInPixels() const
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();
}
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();
}
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();
}

View File

@ -272,9 +272,9 @@ protected:
// Font characterstics
//
int m_nPointSize;
int m_nFamily;
int m_nStyle;
int m_nWeight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_bUnderlined;
wxString m_sFaceName;
wxFontEncoding m_vEncoding;
@ -891,9 +891,9 @@ wxFont::wxFont(
// in wxDC::SetFont, when information is available about scaling etc.
// ----------------------------------------------------------------------------
bool wxFont::Create( int nPointSize,
int nFamily,
int nStyle,
int nWeight,
wxFontFamily nFamily,
wxFontStyle nStyle,
wxFontWeight nWeight,
bool bUnderlined,
const wxString& rsFaceName,
wxFontEncoding vEncoding )
@ -1082,23 +1082,23 @@ int wxFont::GetPointSize() const
return M_FONTDATA->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();
} // 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();
} // 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();
}

View File

@ -54,9 +54,9 @@ public:
}
wxFontRefData(int size,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -84,7 +84,7 @@ public:
int GetPointSize() const { return m_pointSize; }
void SetFamily( int family )
void SetFamily( wxFontFamily family )
{
m_family = family;
MacInvalidateNativeFont();
@ -93,7 +93,7 @@ public:
int GetFamily() const { return m_family; }
void SetStyle( int style )
void SetStyle( wxFontStyle style )
{
m_style = style;
MacInvalidateNativeFont();
@ -102,7 +102,7 @@ public:
int GetStyle() const { return m_style; }
void SetWeight( int weight )
void SetWeight( wxFontWeight weight )
{
m_weight = weight;
MacInvalidateNativeFont();
@ -142,9 +142,9 @@ public:
protected:
// common part of all ctors
void Init(int size,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
@ -154,9 +154,9 @@ protected:
#endif
// font characterstics
int m_pointSize;
int m_family;
int m_style;
int m_weight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding;
@ -202,9 +202,9 @@ public:
// ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -406,17 +406,17 @@ void wxFontRefData::MacFindFont()
}
}
CTFontSymbolicTraits traits = 0;
if (m_weight == wxBOLD)
traits |= kCTFontBoldTrait;
if (m_style == wxITALIC || m_style == wxSLANT)
traits |= kCTFontItalicTrait;
// use font caching
wxString lookupnameWithSize = wxString::Format( "%s_%ld_%ld", m_faceName.c_str(), traits, m_pointSize );
static std::map< std::wstring , wxCFRef< CTFontRef > > fontcache ;
m_ctFont = fontcache[ std::wstring(lookupnameWithSize.wc_str()) ];
if ( !m_ctFont )
@ -429,7 +429,7 @@ void wxFontRefData::MacFindFont()
qdstyle |= bold;
if (m_style == wxITALIC || m_style == wxSLANT)
qdstyle |= italic;
Str255 qdFontName ;
wxMacStringToPascal( m_faceName , qdFontName );
m_ctFont.reset( CTFontCreateWithQuickdrawInstance(qdFontName, 0 , qdstyle, m_pointSize) );
@ -454,7 +454,7 @@ void wxFontRefData::MacFindFont()
// TODO further fallbacks, synthesizing bold and italic, trying direct PostScript names etc
}
}
fontcache[ std::wstring(lookupnameWithSize.wc_str()) ] = m_ctFont;
#if 1 // debugging coretext font matching
CTFontSymbolicTraits received = CTFontGetSymbolicTraits( m_ctFont ) & 0x03;
@ -473,7 +473,7 @@ void wxFontRefData::MacFindFont()
CFShow( dict );
CFRelease( dict );
}
#endif
#endif
}
}
@ -711,12 +711,12 @@ wxFont::wxFont(const wxString& fontdesc)
}
bool wxFont::Create(int pointSize,
int family,
int style,
int weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
{
UnRef();
@ -837,7 +837,7 @@ void wxFont::SetPointSize(int pointSize)
RealizeResource();
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
Unshare();
@ -846,7 +846,7 @@ void wxFont::SetFamily(int family)
RealizeResource();
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
Unshare();
@ -855,7 +855,7 @@ void wxFont::SetStyle(int style)
RealizeResource();
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
Unshare();
@ -921,23 +921,23 @@ wxSize wxFont::GetPixelSize() const
#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();
}
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() ;
}
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();
}

View File

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

View File

@ -99,9 +99,9 @@ friend class wxFont;
public:
wxFontRefData(int size = wxDEFAULT,
int family = wxDEFAULT,
int style = wxDEFAULT,
int weight = wxDEFAULT,
wxFontFamily family = wxFONTFAMILY_DEFAULT,
wxFontStyle style = wxFONTSTYLE_NORMAL,
wxFontWeight weight = wxFONTWEIGHT_NORMAL,
bool underlined = false,
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
@ -118,9 +118,9 @@ public:
// 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
void SetPointSize(int pointSize);
void SetFamily(int family);
void SetStyle(int style);
void SetWeight(int weight);
void SetFamily(wxFontFamily family);
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
bool SetFaceName(const wxString& facename);
void SetEncoding(wxFontEncoding encoding);
@ -134,9 +134,9 @@ public:
protected:
// common part of all ctors
void Init(int size,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding);
@ -146,9 +146,9 @@ protected:
// font attributes
int m_pointSize;
int m_family;
int m_style;
int m_weight;
wxFontFamily m_family;
wxFontStyle m_style;
wxFontWeight m_weight;
bool m_underlined;
wxString m_faceName;
wxFontEncoding m_encoding; // Unused in Unicode mode
@ -172,9 +172,9 @@ protected:
// ----------------------------------------------------------------------------
void wxFontRefData::Init(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -419,8 +419,8 @@ wxFontRefData::wxFontRefData( const wxFontRefData& data )
m_nativeFontInfo = data.m_nativeFontInfo;
}
wxFontRefData::wxFontRefData(int size, int family, int style,
int weight, bool underlined,
wxFontRefData::wxFontRefData(int size, wxFontFamily family, wxFontStyle style,
wxFontWeight weight, bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
{
@ -474,14 +474,14 @@ void wxFontRefData::SetPointSize(int pointSize)
#endif
}
void wxFontRefData::SetFamily(int family)
void wxFontRefData::SetFamily(wxFontFamily family)
{
m_family = family;
// TODO: what are we supposed to do with m_nativeFontInfo here?
}
void wxFontRefData::SetStyle(int style)
void wxFontRefData::SetStyle(wxFontStyle style)
{
m_style = style;
@ -507,7 +507,7 @@ void wxFontRefData::SetStyle(int style)
#endif
}
void wxFontRefData::SetWeight(int weight)
void wxFontRefData::SetWeight(wxFontWeight weight)
{
m_weight = weight;
}
@ -561,9 +561,9 @@ wxFont::wxFont(const wxNativeFontInfo& info)
}
bool wxFont::Create(int pointSize,
int family,
int style,
int weight,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined,
const wxString& faceName,
wxFontEncoding encoding)
@ -733,23 +733,23 @@ wxString wxFont::GetFaceName() const
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;
}
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;
}
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;
}
@ -822,21 +822,21 @@ void wxFont::SetPointSize(int pointSize)
M_FONTDATA->SetPointSize(pointSize);
}
void wxFont::SetFamily(int family)
void wxFont::SetFamily(wxFontFamily family)
{
Unshare();
M_FONTDATA->SetFamily(family);
}
void wxFont::SetStyle(int style)
void wxFont::SetStyle(wxFontStyle style)
{
Unshare();
M_FONTDATA->SetStyle(style);
}
void wxFont::SetWeight(int weight)
void wxFont::SetWeight(wxFontWeight weight)
{
Unshare();