]> git.saurik.com Git - wxWidgets.git/commitdiff
wxBrushBase between wxBrush and wxGDIObject (class follows wxFontBase model).
authorWłodzimierz Skiba <abx@abx.art.pl>
Fri, 3 Dec 2004 15:31:31 +0000 (15:31 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Fri, 3 Dec 2004 15:31:31 +0000 (15:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
include/wx/brush.h
include/wx/cocoa/brush.h
include/wx/defs.h
include/wx/gtk/brush.h
include/wx/gtk1/brush.h
include/wx/mac/carbon/brush.h
include/wx/mac/classic/brush.h
include/wx/mgl/brush.h
include/wx/msw/brush.h
include/wx/os2/brush.h
include/wx/palmos/brush.h
include/wx/x11/brush.h
src/motif/dcclient.cpp

index 4d14799f1783d4f57b1cb271b2be88bebf90ee7a..ce4abb1a3b9138d856708f0f81c6cae2aa28bf99 100644 (file)
@@ -1,6 +1,18 @@
 #ifndef _WX_BRUSH_H_BASE_
 #define _WX_BRUSH_H_BASE_
 
 #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__)
 #if defined(__PALMOS__)
     #include "wx/palmos/brush.h"
 #elif defined(__WXMSW__)
index 050fad84541d3f1b686a3e281ddee430423f70c1..e3d793db541696443505f5924c3d038b0c878e61 100644 (file)
@@ -21,7 +21,7 @@ class WXDLLEXPORT wxBrush;
 // ========================================================================
 // wxBrush
 // ========================================================================
 // ========================================================================
 // wxBrush
 // ========================================================================
-class WXDLLEXPORT wxBrush: public wxGDIObject
+class WXDLLEXPORT wxBrush: public wxBrushBase
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 // ------------------------------------------------------------------------
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 // ------------------------------------------------------------------------
@@ -32,7 +32,7 @@ public:
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
-    :   wxGDIObject()
+    :   wxBrushBase()
     {   Ref(brush); }
     ~wxBrush();
 
     {   Ref(brush); }
     ~wxBrush();
 
@@ -56,12 +56,9 @@ public:
 
     // accessors
     wxColour GetColour() const;
 
     // accessors
     wxColour GetColour() const;
-    int GetStyle() const;
+    virtual int GetStyle() const;
     wxBitmap *GetStipple() const;
 
     wxBitmap *GetStipple() const;
 
-    bool IsHatch() const
-        { return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
-
     virtual bool Ok() const
     {   return (m_refData != NULL); }
 
     virtual bool Ok() const
     {   return (m_refData != NULL); }
 
index 97999c872201b5ec4294a58ebddc354ba2e8b1d5..6c9931e48296e9bbb7a6d006dc8c388e388b73e1 100644 (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.            */
     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,
 
     wxJOIN_BEVEL =     120,
     wxJOIN_MITER,
@@ -1826,7 +1828,7 @@ enum
 };
 
 #if WXWIN_COMPATIBILITY_2_4
 };
 
 #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
 #else
     /* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */
 #endif
index 52953d6a135465afecd9e264a4575fb1ed7d3433..144bb4a1cb47e61e3c133267316c87eee4d14146 100644 (file)
@@ -31,7 +31,7 @@ class wxBrush;
 // wxBrush
 //-----------------------------------------------------------------------------
 
 // wxBrush
 //-----------------------------------------------------------------------------
 
-class wxBrush: public wxGDIObject
+class wxBrush: public wxBrushBase
 {
 public:
     wxBrush() { }
 {
 public:
     wxBrush() { }
@@ -41,7 +41,7 @@ public:
     ~wxBrush();
 
     wxBrush( const wxBrush &brush )
     ~wxBrush();
 
     wxBrush( const wxBrush &brush )
-        : wxGDIObject()
+        : wxBrushBase()
         { Ref(brush); }
     wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
 
         { 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); }
 
     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;
 
     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 );
     void SetColour( const wxColour& col );
     void SetColour( unsigned char r, unsigned char g, unsigned char b );
     void SetStyle( int style );
index 52953d6a135465afecd9e264a4575fb1ed7d3433..144bb4a1cb47e61e3c133267316c87eee4d14146 100644 (file)
@@ -31,7 +31,7 @@ class wxBrush;
 // wxBrush
 //-----------------------------------------------------------------------------
 
 // wxBrush
 //-----------------------------------------------------------------------------
 
-class wxBrush: public wxGDIObject
+class wxBrush: public wxBrushBase
 {
 public:
     wxBrush() { }
 {
 public:
     wxBrush() { }
@@ -41,7 +41,7 @@ public:
     ~wxBrush();
 
     wxBrush( const wxBrush &brush )
     ~wxBrush();
 
     wxBrush( const wxBrush &brush )
-        : wxGDIObject()
+        : wxBrushBase()
         { Ref(brush); }
     wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
 
         { 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); }
 
     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;
 
     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 );
     void SetColour( const wxColour& col );
     void SetColour( unsigned char r, unsigned char g, unsigned char b );
     void SetStyle( int style );
index 6f915f9d8f29eb3cb5e2f283d600883fe5e5b8aa..d5c3e5be123db2b1867f72b04b09787b9e6629f4 100644 (file)
@@ -30,7 +30,7 @@ typedef enum
 } wxMacBrushKind ;
 
 // Brush
 } wxMacBrushKind ;
 
 // Brush
-class WXDLLEXPORT wxBrush: public wxGDIObject
+class WXDLLEXPORT wxBrush: public wxBrushBase
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 
@@ -40,7 +40,7 @@ public:
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
-        : wxGDIObject()
+        : wxBrushBase()
         { Ref(brush); }
     ~wxBrush();
 
         { Ref(brush); }
     ~wxBrush();
 
@@ -63,12 +63,9 @@ public:
     unsigned long MacGetThemeBackground(WXRECTPTR extent)  const ;
     short MacGetTheme()  const ;
     wxColour& GetColour() const ;
     unsigned long MacGetThemeBackground(WXRECTPTR extent)  const ;
     short MacGetTheme()  const ;
     wxColour& GetColour() const ;
-    int GetStyle() const ;
+    virtual int GetStyle() const ;
     wxBitmap *GetStipple() const ;
 
     wxBitmap *GetStipple() const ;
 
-    bool IsHatch() const
-        { return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
-
     virtual bool Ok() const { return (m_refData != NULL) ; }
 
 // Implementation
     virtual bool Ok() const { return (m_refData != NULL) ; }
 
 // Implementation
index c410e26d8bd02585155e90877254e1a6d34cc68a..9406bd4a72523cfade3c504d552e41bd94fa9fa4 100644 (file)
@@ -30,7 +30,7 @@ typedef enum
 } wxMacBrushKind ;
 
 // Brush
 } wxMacBrushKind ;
 
 // Brush
-class WXDLLEXPORT wxBrush: public wxGDIObject
+class WXDLLEXPORT wxBrush: public wxBrushBase
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 
@@ -40,7 +40,7 @@ public:
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
     wxBrush(const wxColour& col, int style = wxSOLID);
     wxBrush(const wxBitmap& stipple);
     wxBrush(const wxBrush& brush)
-        : wxGDIObject()
+        : wxBrushBase()
         { Ref(brush); }
     ~wxBrush();
 
         { Ref(brush); }
     ~wxBrush();
 
@@ -63,12 +63,9 @@ public:
     unsigned long GetMacThemeBackground(WXRECTPTR extent)  const ;
     short GetMacTheme()  const ;
     wxColour& GetColour() const ;
     unsigned long GetMacThemeBackground(WXRECTPTR extent)  const ;
     short GetMacTheme()  const ;
     wxColour& GetColour() const ;
-    int GetStyle() const ;
+    virtual int GetStyle() const ;
     wxBitmap *GetStipple() const ;
 
     wxBitmap *GetStipple() const ;
 
-    bool IsHatch() const
-        { return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
-
     virtual bool Ok() const { return (m_refData != NULL) ; }
 
 // Implementation
     virtual bool Ok() const { return (m_refData != NULL) ; }
 
 // Implementation
index fbfdd8df2a75648e304b0aea531756cda132e27c..7f7ab1a23979589820b4dea1dff264d7abc956a3 100644 (file)
@@ -32,7 +32,7 @@ class WXDLLEXPORT wxBrush;
 // wxBrush
 //-----------------------------------------------------------------------------
 
 // wxBrush
 //-----------------------------------------------------------------------------
 
-class WXDLLEXPORT wxBrush: public wxGDIObject
+class WXDLLEXPORT wxBrush: public wxBrushBase
 {
 public:
     wxBrush() {}
 {
 public:
     wxBrush() {}
@@ -45,13 +45,10 @@ public:
     bool operator != (const wxBrush& brush) const;
     bool Ok() const;
 
     bool operator != (const wxBrush& brush) const;
     bool Ok() const;
 
-    int GetStyle() const;
+    virtual int GetStyle() const;
     wxColour &GetColour() const;
     wxBitmap *GetStipple() 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);
     void SetColour(const wxColour& col);
     void SetColour(unsigned char r, unsigned char g, unsigned char b);
     void SetStyle(int style);
index d034e59cd4120a294704346414c260ea884c0385..782bc57f2d0ff6b205405df4813f447f6d088f18 100644 (file)
@@ -26,13 +26,13 @@ class WXDLLEXPORT wxBrush;
 // 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);
 {
 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);
     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;
     bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
 
     wxColour GetColour() const;
-    int GetStyle() const;
+    virtual int GetStyle() const;
     wxBitmap *GetStipple() 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
     bool Ok() const { return m_refData != NULL; }
 
     // return the HBRUSH for this brush
index 3655cfeaf40f55d42f070f8404f2b7eabb9a0439..365a4a0575b634ec0a78777f5482ac189156164f 100644 (file)
@@ -37,7 +37,7 @@ protected:
 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
 
 // Brush
 #define M_BRUSHDATA ((wxBrushRefData *)m_refData)
 
 // Brush
-class WXDLLEXPORT wxBrush: public wxGDIObject
+class WXDLLEXPORT wxBrush: public wxBrushBase
 {
     DECLARE_DYNAMIC_CLASS(wxBrush)
 
 {
     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); };
     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); };
 
     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) ; }
 
     //
     inline virtual bool Ok(void) const { return (m_refData != NULL) ; }
 
     //
index a5dc6d2c521598429a3357b18b1ac2c2b1f33dfc..bd7d5a50b80bbe81c90ab8315bb14dea9f50c14a 100644 (file)
@@ -26,7 +26,7 @@ class WXDLLEXPORT wxBrush;
 // wxBrush
 // ----------------------------------------------------------------------------
 
 // wxBrush
 // ----------------------------------------------------------------------------
 
-class WXDLLEXPORT wxBrush : public wxGDIObject
+class WXDLLEXPORT wxBrush : public wxBrushBase
 {
 public:
     wxBrush();
 {
 public:
     wxBrush();
@@ -45,12 +45,9 @@ public:
     bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
 
     wxColour GetColour() const;
     bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
 
     wxColour GetColour() const;
-    int GetStyle() const;
+    virtual int GetStyle() const;
     wxBitmap *GetStipple() 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
     bool Ok() const { return m_refData != NULL; }
 
     // return the HBRUSH for this brush
index 37f49da49717edaf685a69d187f0ef9b9bbd62aa..58160f1fc3cb37b69c8b152a18a4ccaa18b7bd76 100644 (file)
@@ -30,7 +30,7 @@ class wxBitmap;
 // wxBrush
 //-----------------------------------------------------------------------------
 
 // wxBrush
 //-----------------------------------------------------------------------------
 
-class wxBrush: public wxGDIObject
+class wxBrush: public wxBrushBase
 {
 public:
     wxBrush() { }
 {
 public:
     wxBrush() { }
@@ -47,13 +47,10 @@ public:
     bool operator == ( const wxBrush& brush ) const;
     bool operator != (const wxBrush& brush) const { return !(*this == brush); }
 
     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;
 
     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 );
     void SetColour( const wxColour& col );
     void SetColour( unsigned char r, unsigned char g, unsigned char b );
     void SetStyle( int style );
index 908526c8bc961e78ffd2a3682e81e742146a25f5..e082c7e640834e5ce4610a330ab403ff269fcafd 100644 (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
 #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
 
 // ----------------------------------------------------------------------------
 #endif
 
 // ----------------------------------------------------------------------------