From cb9d5bd07e7aa0b190c3ee60f5778a974ac9f87b Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 3 Dec 2004 15:31:31 +0000 Subject: [PATCH] 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 --- include/wx/brush.h | 12 ++++++++++++ include/wx/cocoa/brush.h | 9 +++------ include/wx/defs.h | 8 +++++--- include/wx/gtk/brush.h | 9 +++------ include/wx/gtk1/brush.h | 9 +++------ include/wx/mac/carbon/brush.h | 9 +++------ include/wx/mac/classic/brush.h | 9 +++------ include/wx/mgl/brush.h | 7 ++----- include/wx/msw/brush.h | 9 +++------ include/wx/os2/brush.h | 7 ++----- include/wx/palmos/brush.h | 7 ++----- include/wx/x11/brush.h | 7 ++----- src/motif/dcclient.cpp | 2 +- 13 files changed, 44 insertions(+), 60 deletions(-) diff --git a/include/wx/brush.h b/include/wx/brush.h index 4d14799f17..ce4abb1a3b 100644 --- a/include/wx/brush.h +++ b/include/wx/brush.h @@ -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__) diff --git a/include/wx/cocoa/brush.h b/include/wx/cocoa/brush.h index 050fad8454..e3d793db54 100644 --- a/include/wx/cocoa/brush.h +++ b/include/wx/cocoa/brush.h @@ -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); } diff --git a/include/wx/defs.h b/include/wx/defs.h index 97999c8722..6c9931e482 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -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 diff --git a/include/wx/gtk/brush.h b/include/wx/gtk/brush.h index 52953d6a13..144bb4a1cb 100644 --- a/include/wx/gtk/brush.h +++ b/include/wx/gtk/brush.h @@ -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 ); diff --git a/include/wx/gtk1/brush.h b/include/wx/gtk1/brush.h index 52953d6a13..144bb4a1cb 100644 --- a/include/wx/gtk1/brush.h +++ b/include/wx/gtk1/brush.h @@ -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 ); diff --git a/include/wx/mac/carbon/brush.h b/include/wx/mac/carbon/brush.h index 6f915f9d8f..d5c3e5be12 100644 --- a/include/wx/mac/carbon/brush.h +++ b/include/wx/mac/carbon/brush.h @@ -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 diff --git a/include/wx/mac/classic/brush.h b/include/wx/mac/classic/brush.h index c410e26d8b..9406bd4a72 100644 --- a/include/wx/mac/classic/brush.h +++ b/include/wx/mac/classic/brush.h @@ -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 diff --git a/include/wx/mgl/brush.h b/include/wx/mgl/brush.h index fbfdd8df2a..7f7ab1a239 100644 --- a/include/wx/mgl/brush.h +++ b/include/wx/mgl/brush.h @@ -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); diff --git a/include/wx/msw/brush.h b/include/wx/msw/brush.h index d034e59cd4..782bc57f2d 100644 --- a/include/wx/msw/brush.h +++ b/include/wx/msw/brush.h @@ -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 diff --git a/include/wx/os2/brush.h b/include/wx/os2/brush.h index 3655cfeaf4..365a4a0575 100644 --- a/include/wx/os2/brush.h +++ b/include/wx/os2/brush.h @@ -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) ; } // diff --git a/include/wx/palmos/brush.h b/include/wx/palmos/brush.h index a5dc6d2c52..bd7d5a50b8 100644 --- a/include/wx/palmos/brush.h +++ b/include/wx/palmos/brush.h @@ -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 diff --git a/include/wx/x11/brush.h b/include/wx/x11/brush.h index 37f49da497..58160f1fc3 100644 --- a/include/wx/x11/brush.h +++ b/include/wx/x11/brush.h @@ -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 ); diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index 908526c8bc..e082c7e640 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -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 // ---------------------------------------------------------------------------- -- 2.45.2