wxBrushBase between wxBrush and wxGDIObject (class follows wxFontBase model).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-12-03 15:31:31 +00:00
parent 7a4d2469f9
commit cb9d5bd07e
13 changed files with 44 additions and 60 deletions

View File

@@ -1,6 +1,18 @@
#ifndef _WX_BRUSH_H_BASE_
#define _WX_BRUSH_H_BASE_
// wxBrushBase
class WXDLLEXPORT wxBrushBase: public wxGDIObject
{
public:
virtual ~wxBrushBase() { }
virtual int GetStyle() const = 0;
virtual bool IsHatch() const
{ return (GetStyle()>=wxFIRST_HATCH) && (GetStyle()<=wxLAST_HATCH); }
};
#if defined(__PALMOS__)
#include "wx/palmos/brush.h"
#elif defined(__WXMSW__)

View File

@@ -21,7 +21,7 @@ class WXDLLEXPORT wxBrush;
// ========================================================================
// wxBrush
// ========================================================================
class WXDLLEXPORT wxBrush: public wxGDIObject
class WXDLLEXPORT wxBrush: public wxBrushBase
{
DECLARE_DYNAMIC_CLASS(wxBrush)
// ------------------------------------------------------------------------
@@ -32,7 +32,7 @@ public:
wxBrush(const wxColour& col, int style = wxSOLID);
wxBrush(const wxBitmap& stipple);
wxBrush(const wxBrush& brush)
: wxGDIObject()
: wxBrushBase()
{ Ref(brush); }
~wxBrush();
@@ -56,12 +56,9 @@ public:
// accessors
wxColour GetColour() const;
int GetStyle() const;
virtual int GetStyle() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const
{ return (m_refData != NULL); }

View File

@@ -1813,8 +1813,10 @@ enum
wxCROSSDIAG_HATCH, /* to verify these wx*_HATCH are in style */
wxFDIAGONAL_HATCH, /* of wxBrush. In wxWidgets >= 2.6 use */
wxCROSS_HATCH, /* wxBrush::IsHatch() instead. */
wxHORIZONTAL_HATCH, /* Adding new hatch styles remember to */
wxVERTICAL_HATCH, /* adjust style check accordingly. */
wxHORIZONTAL_HATCH,
wxVERTICAL_HATCH,
wxFIRST_HATCH = wxBDIAGONAL_HATCH,
wxLAST_HATCH = wxVERTICAL_HATCH,
wxJOIN_BEVEL = 120,
wxJOIN_MITER,
@@ -1826,7 +1828,7 @@ enum
};
#if WXWIN_COMPATIBILITY_2_4
#define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
#else
/* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */
#endif

View File

@@ -31,7 +31,7 @@ class wxBrush;
// wxBrush
//-----------------------------------------------------------------------------
class wxBrush: public wxGDIObject
class wxBrush: public wxBrushBase
{
public:
wxBrush() { }
@@ -41,7 +41,7 @@ public:
~wxBrush();
wxBrush( const wxBrush &brush )
: wxGDIObject()
: wxBrushBase()
{ Ref(brush); }
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
@@ -50,13 +50,10 @@ public:
bool operator == ( const wxBrush& brush ) const;
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
int GetStyle() const;
virtual int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style );

View File

@@ -31,7 +31,7 @@ class wxBrush;
// wxBrush
//-----------------------------------------------------------------------------
class wxBrush: public wxGDIObject
class wxBrush: public wxBrushBase
{
public:
wxBrush() { }
@@ -41,7 +41,7 @@ public:
~wxBrush();
wxBrush( const wxBrush &brush )
: wxGDIObject()
: wxBrushBase()
{ Ref(brush); }
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
@@ -50,13 +50,10 @@ public:
bool operator == ( const wxBrush& brush ) const;
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
int GetStyle() const;
virtual int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style );

View File

@@ -30,7 +30,7 @@ typedef enum
} wxMacBrushKind ;
// Brush
class WXDLLEXPORT wxBrush: public wxGDIObject
class WXDLLEXPORT wxBrush: public wxBrushBase
{
DECLARE_DYNAMIC_CLASS(wxBrush)
@@ -40,7 +40,7 @@ public:
wxBrush(const wxColour& col, int style = wxSOLID);
wxBrush(const wxBitmap& stipple);
wxBrush(const wxBrush& brush)
: wxGDIObject()
: wxBrushBase()
{ Ref(brush); }
~wxBrush();
@@ -63,12 +63,9 @@ public:
unsigned long MacGetThemeBackground(WXRECTPTR extent) const ;
short MacGetTheme() const ;
wxColour& GetColour() const ;
int GetStyle() const ;
virtual int GetStyle() const ;
wxBitmap *GetStipple() const ;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const { return (m_refData != NULL) ; }
// Implementation

View File

@@ -30,7 +30,7 @@ typedef enum
} wxMacBrushKind ;
// Brush
class WXDLLEXPORT wxBrush: public wxGDIObject
class WXDLLEXPORT wxBrush: public wxBrushBase
{
DECLARE_DYNAMIC_CLASS(wxBrush)
@@ -40,7 +40,7 @@ public:
wxBrush(const wxColour& col, int style = wxSOLID);
wxBrush(const wxBitmap& stipple);
wxBrush(const wxBrush& brush)
: wxGDIObject()
: wxBrushBase()
{ Ref(brush); }
~wxBrush();
@@ -63,12 +63,9 @@ public:
unsigned long GetMacThemeBackground(WXRECTPTR extent) const ;
short GetMacTheme() const ;
wxColour& GetColour() const ;
int GetStyle() const ;
virtual int GetStyle() const ;
wxBitmap *GetStipple() const ;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const { return (m_refData != NULL) ; }
// Implementation

View File

@@ -32,7 +32,7 @@ class WXDLLEXPORT wxBrush;
// wxBrush
//-----------------------------------------------------------------------------
class WXDLLEXPORT wxBrush: public wxGDIObject
class WXDLLEXPORT wxBrush: public wxBrushBase
{
public:
wxBrush() {}
@@ -45,13 +45,10 @@ public:
bool operator != (const wxBrush& brush) const;
bool Ok() const;
int GetStyle() const;
virtual int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour(const wxColour& col);
void SetColour(unsigned char r, unsigned char g, unsigned char b);
void SetStyle(int style);

View File

@@ -26,13 +26,13 @@ class WXDLLEXPORT wxBrush;
// wxBrush
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBrush : public wxGDIObject
class WXDLLEXPORT wxBrush : public wxBrushBase
{
public:
wxBrush();
wxBrush(const wxColour& col, int style = wxSOLID);
wxBrush(const wxBitmap& stipple);
wxBrush(const wxBrush& brush) : wxGDIObject(brush) { Ref(brush); }
wxBrush(const wxBrush& brush) : wxBrushBase(brush) { Ref(brush); }
virtual ~wxBrush();
virtual void SetColour(const wxColour& col);
@@ -45,12 +45,9 @@ public:
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
wxColour GetColour() const;
int GetStyle() const;
virtual int GetStyle() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
bool Ok() const { return m_refData != NULL; }
// return the HBRUSH for this brush

View File

@@ -37,7 +37,7 @@ protected:
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
// Brush
class WXDLLEXPORT wxBrush: public wxGDIObject
class WXDLLEXPORT wxBrush: public wxBrushBase
{
DECLARE_DYNAMIC_CLASS(wxBrush)
@@ -64,13 +64,10 @@ public:
virtual void SetStipple(const wxBitmap& rStipple);
inline wxColour& GetColour(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_vColour : wxNullColour); };
inline int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); };
virtual int GetStyle(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_nStyle : 0); };
inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); };
inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
inline virtual bool Ok(void) const { return (m_refData != NULL) ; }
//

View File

@@ -26,7 +26,7 @@ class WXDLLEXPORT wxBrush;
// wxBrush
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBrush : public wxGDIObject
class WXDLLEXPORT wxBrush : public wxBrushBase
{
public:
wxBrush();
@@ -45,12 +45,9 @@ public:
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
wxColour GetColour() const;
int GetStyle() const;
virtual int GetStyle() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
bool Ok() const { return m_refData != NULL; }
// return the HBRUSH for this brush

View File

@@ -30,7 +30,7 @@ class wxBitmap;
// wxBrush
//-----------------------------------------------------------------------------
class wxBrush: public wxGDIObject
class wxBrush: public wxBrushBase
{
public:
wxBrush() { }
@@ -47,13 +47,10 @@ public:
bool operator == ( const wxBrush& brush ) const;
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
int GetStyle() const;
virtual int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style );

View File

@@ -93,7 +93,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
#ifndef IS_HATCH
// IS_HATCH exists for WXWIN_COMPATIBILITY_2_4 only
// but wxMotif needs it for its internals here
#define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
#endif
// ----------------------------------------------------------------------------