]> git.saurik.com Git - wxWidgets.git/commitdiff
removed overloaded virtual InitWith() methods, keep just a single InitRGBA()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Sep 2006 02:00:24 +0000 (02:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Sep 2006 02:00:24 +0000 (02:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

19 files changed:
include/wx/cocoa/colour.h
include/wx/colour.h
include/wx/generic/colour.h
include/wx/gtk/colour.h
include/wx/gtk1/colour.h
include/wx/mac/carbon/colour.h
include/wx/motif/colour.h
include/wx/msw/colour.h
include/wx/os2/colour.h
include/wx/x11/colour.h
src/cocoa/colour.mm
src/generic/colour.cpp
src/gtk/colour.cpp
src/gtk1/colour.cpp
src/mac/carbon/colour.cpp
src/motif/colour.cpp
src/msw/colour.cpp
src/os2/colour.cpp
src/x11/colour.cpp

index f0088f694c6128760d37547ce3897249c3852cd5..cfdcd373f3d350f48eb82f53d4efd4adf75ed882 100644 (file)
@@ -83,10 +83,8 @@ protected:
     // puts the object in an invalid, uninitialized state
     void Init();
 
-    virtual void InitWith(unsigned char red,
-                          unsigned char green,
-                          unsigned char blue,
-                          unsigned char alpha);
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     WX_NSColor m_cocoaNSColor;
index 78204d1843c62c982d63fb3236f7e271ddceaabd..7bba397dc2abed2fd67be9c3f514a5a728ce91cd 100644 (file)
@@ -21,8 +21,8 @@
 // Set() is a virtual function and thus cannot be called by wxColourBase
 // constructors
 #define DEFINE_STD_WXCOLOUR_CONSTRUCTORS                                      \
-    wxColour( unsigned char red, unsigned char green, unsigned char blue,     \
-              unsigned char alpha = wxALPHA_OPAQUE )                          \
+    wxColour( ChannelType red, ChannelType green, ChannelType blue,           \
+              ChannelType alpha = wxALPHA_OPAQUE )                            \
         { Set(red, green, blue, alpha); }                                     \
     wxColour( unsigned long colRGB ) { Set(colRGB); }                         \
     wxColour(const wxString &colourName) { Set(colourName); }                 \
@@ -47,19 +47,10 @@ const unsigned char wxALPHA_OPAQUE = 0xff;
 
 class WXDLLEXPORT wxColourBase : public wxGDIObject
 {
-protected:
-
-    virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue) = 0;
-
-    // this will be overridden in alpha supporting classes
-    virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue, unsigned char WXUNUSED(alpha)) 
-    {
-        InitWith( red, green, blue ) ;
-    }
-
-    virtual bool FromString(const wxChar *);
-
 public:
+    // type of a single colour component
+    typedef unsigned char ChannelType;
+
     wxColourBase() {}
     virtual ~wxColourBase() {}
 
@@ -67,23 +58,26 @@ public:
     // Set() functions
     // ---------------
 
-    void Set(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = wxALPHA_OPAQUE)
-        { InitWith(red,green,blue, alpha); }
+    void Set(ChannelType red,
+             ChannelType green,
+             ChannelType blue,
+             ChannelType alpha = wxALPHA_OPAQUE)
+        { InitRGBA(red,green,blue, alpha); }
 
     // implemented in colourcmn.cpp
     bool Set(const wxChar *str)
         { return FromString(str); }
 
     bool Set(const wxString &str)
-        { return Set((const wxChar *)str); }
+        { return FromString(str); }
 
     void Set(unsigned long colRGB)
     {
         // we don't need to know sizeof(long) here because we assume that the three
         // least significant bytes contain the R, G and B values
-        Set((unsigned char)colRGB,
-            (unsigned char)(colRGB >> 8),
-            (unsigned char)(colRGB >> 16));
+        Set((ChannelType)colRGB,
+            (ChannelType)(colRGB >> 8),
+            (ChannelType)(colRGB >> 16));
     }
 
 
@@ -93,10 +87,10 @@ public:
 
     virtual bool Ok() const = 0;
 
-    virtual unsigned char Red() const = 0;
-    virtual unsigned char Green() const = 0;
-    virtual unsigned char Blue() const = 0;
-    virtual unsigned char Alpha() const
+    virtual ChannelType Red() const = 0;
+    virtual ChannelType Green() const = 0;
+    virtual ChannelType Blue() const = 0;
+    virtual ChannelType Alpha() const
         { return wxALPHA_OPAQUE ; }
 
     // implemented in colourcmn.cpp
@@ -111,35 +105,40 @@ public:
     wxDEPRECATED( static wxColour CreateByName(const wxString& name) );
     wxDEPRECATED( void InitFromName(const wxString& col) );
 #endif
+
+protected:
+    virtual void
+    InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) = 0;
+
+    virtual bool FromString(const wxChar *s);
 };
 
 
 
 #if defined(__WXPALMOS__)
-#include "wx/generic/colour.h"
+    #include "wx/generic/colour.h"
 #elif defined(__WXMSW__)
-#include "wx/msw/colour.h"
+    #include "wx/msw/colour.h"
 #elif defined(__WXMOTIF__)
-#include "wx/motif/colour.h"
+    #include "wx/motif/colour.h"
 #elif defined(__WXGTK20__)
-#include "wx/gtk/colour.h"
+    #include "wx/gtk/colour.h"
 #elif defined(__WXGTK__)
-#include "wx/gtk1/colour.h"
+    #include "wx/gtk1/colour.h"
 #elif defined(__WXMGL__)
-#include "wx/generic/colour.h"
+    #include "wx/generic/colour.h"
 #elif defined(__WXDFB__)
-#include "wx/generic/colour.h"
+    #include "wx/generic/colour.h"
 #elif defined(__WXX11__)
-#include "wx/x11/colour.h"
+    #include "wx/x11/colour.h"
 #elif defined(__WXMAC__)
-#include "wx/mac/colour.h"
+    #include "wx/mac/colour.h"
 #elif defined(__WXCOCOA__)
-#include "wx/cocoa/colour.h"
+    #include "wx/cocoa/colour.h"
 #elif defined(__WXPM__)
-#include "wx/os2/colour.h"
+    #include "wx/os2/colour.h"
 #endif
 
 #define wxColor wxColour
 
-#endif
-    // _WX_COLOUR_H_BASE_
+#endif // _WX_COLOUR_H_BASE_
index 66aa3800d4c483e3e6beb94fe99e6addf9ae6ac2..1f4f4ed5c1a9790410d80b60c04cb647996fbbae 100644 (file)
@@ -57,12 +57,8 @@ protected:
     // Helper function
     void Init();
 
-    virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue)
-    {
-        InitWith(red, green, blue, wxALPHA_OPAQUE);
-    }
-
-    virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha);
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     bool m_isInit;
index 8eaa38e963c85f565116e5b2422c663ebcb2950e..f41c52410df9798046de818191c8a750dca78e7d 100644 (file)
@@ -48,8 +48,10 @@ public:
 #endif
 
 protected:
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
+
     virtual bool FromString(const wxChar *str);
-    virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
 
 private:
     DECLARE_DYNAMIC_CLASS(wxColour)
index 4fc19fc767329268740ab5ccbf7d11c797cd44df..cf91604445bc8aff4e90a8b91f382b52c6dd9364 100644 (file)
@@ -65,7 +65,8 @@ protected:
     virtual wxObjectRefData *CreateRefData() const;
     virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
 
-    virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     DECLARE_DYNAMIC_CLASS(wxColour)
index 219761c48f040fb0aaedff0266900658e1920800..54fb53afba96cda533e50d87241c8a9784094ce4 100644 (file)
@@ -55,12 +55,8 @@ protected :
     // Helper function
     void Init();
 
-    void InitWith( unsigned char red, unsigned char green, unsigned char blue ) 
-    {
-        InitWith( red, green, blue , wxALPHA_OPAQUE ) ;
-    }
-
-    void InitWith( unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha );
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     bool          m_isInit;
@@ -72,7 +68,7 @@ private:
 public:
     WXCOLORREF m_pixel ;
     void FromRGBColor( const WXCOLORREF* color ) ;
-    
+
 
 private:
     DECLARE_DYNAMIC_CLASS(wxColour)
index 8bdddeb06b2b955b9a611beb1d1c7735fb87455f..9d89cccac4e746cb7048c4ff45265f51d5db93cd 100644 (file)
@@ -62,7 +62,8 @@ protected:
     // Helper function
     void Init();
 
-    virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     bool          m_isInit;
index d3d25623829e1df12445795ce218b3cfce7082f0..1a1460430517d12e1f69bf4a570d0044c54a5cc8 100644 (file)
@@ -63,7 +63,8 @@ protected:
     // Helper function
     void Init();
 
-    virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue);
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 private:
     bool          m_isInit;
index f8d69fa6e2caf187f6ff2a92ec86dc1559cde104..611a2e2512792e09ebb4a33440149ac7d4105dd9 100644 (file)
@@ -65,7 +65,8 @@ private:
     unsigned char  m_cBlue;
     unsigned char  m_cGreen;
 
-    virtual void InitWith( unsigned char cRed, unsigned char cGreen, unsigned char cBlue);
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
 
 public:
     WXCOLORREF                      m_vPixel ;
index 9d9824199de811e0be270ee58f6beedd979c40f9..17c4f534c0671ec589daf3ff52244b1f2a7f16d8 100644 (file)
@@ -64,8 +64,10 @@ protected:
     virtual wxObjectRefData *CreateRefData() const;
     virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
 
+    virtual void
+    InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
+
     virtual bool FromString(const wxChar *str);
-    virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
 
 private:
     DECLARE_DYNAMIC_CLASS(wxColour)
index 92c5ee515c2b70efe975b3351ff15dc0d737bd3b..914408e291fbb1fc10d727aa80c340f800d7ba2b 100644 (file)
@@ -63,7 +63,7 @@ wxColour::~wxColour ()
     [m_cocoaNSColor release];
 }
 
-void wxColour::InitWith(unsigned char r,
+void wxColour::InitRGBA(unsigned char r,
                         unsigned char g,
                         unsigned char b,
                         unsigned char a)
index e51a7e3938bd4faebf06aaee5bf97cdb9221b0e0..6cda3d1e84adf32793bfea27cf4ea9b77c2e5cd0 100644 (file)
@@ -59,7 +59,9 @@ wxColour::~wxColour()
 {
 }
 
-void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b,
+void wxColour::InitRGBA(unsigned char r,
+                        unsigned char g,
+                        unsigned char b,
                         unsigned char a)
 {
     m_red = r;
index af912732579e32b16a574aba12d0ecba3bd349ed..e09ef66effa636aae85e286748284c3e98149736 100644 (file)
@@ -112,7 +112,8 @@ bool wxColour::operator == ( const wxColour& col ) const
            refData->m_blue == that_refData->m_blue;
 }
 
-void wxColour::InitWith( unsigned char red, unsigned char green, unsigned char blue )
+void wxColour::InitRGBA(unsigned char red, unsigned char green, unsigned char blue,
+                        unsigned char WXUNUSED(alpha))
 {
     UnRef();
 
index 7adf4b1dc27064f8826c653971b2e42438aa0456..82712095cd80d61c8b08333b7d29235b24c2a89a 100644 (file)
@@ -169,7 +169,8 @@ wxObjectRefData *wxColour::CloneRefData(const wxObjectRefData *data) const
     return new wxColourRefData(*(wxColourRefData *)data);
 }
 
-void wxColour::InitWith( unsigned char red, unsigned char green, unsigned char blue )
+void wxColour::InitRGBA(unsigned char red, unsigned char green, unsigned char blue,
+                        unsigned char WXUNUSED(alpha))
 {
     AllocExclusive();
 
index 9fa04b0464024270b06ade79e0d9890011f49130..9d1435aa82a0581129e7576c0365224bd6a365f7 100644 (file)
@@ -44,7 +44,7 @@ wxColour::~wxColour ()
 {
 }
 
-void wxColour::InitWith (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
+void wxColour::InitRGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 {
     m_red = r;
     m_green = g;
index 63d34f901e6e15efa57158c3c5a68467ec234fcb..32c0d39b78a3236fc1b4285e0d0008972601d38a 100644 (file)
@@ -64,7 +64,8 @@ wxColour::~wxColour()
 {
 }
 
-void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b)
+void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
+                        unsigned char WXUNUSED(a))
 {
     m_red = r;
     m_green = g;
index ad1c5221f9bb3964e746a4a4e13d7de3b825ec40..d79ebc9af7edd36a66457132e2fa630a00d198d1 100644 (file)
@@ -77,7 +77,8 @@ wxColour::~wxColour()
 {
 }
 
-void wxColour::InitWith(unsigned char r, unsigned char g, unsigned char b)
+void wxColour::InitRGBA(unsigned char r, unsigned char g, unsigned char b,
+                        unsigned char WXUNUSED(a))
 {
     m_red = r;
     m_green = g;
index 205a2475bbd0bdf7cde0dbca8f1e765c79ecf050..d1add0c9c3e7fb9c3dc25c8f361acf00dc8de09f 100644 (file)
@@ -57,9 +57,10 @@ wxColour::~wxColour()
 {
 } // end of wxColour::~wxColour
 
-void wxColour::InitWith( unsigned char cRed,
+void wxColour::InitRGBA( unsigned char cRed,
                          unsigned char cGreen,
-                         unsigned char cBlue )
+                         unsigned char cBlue,
+                         unsigned char WXUNUSED(calpha) )
 {
     m_cRed    = cRed;
     m_cGreen  = cGreen;
index 84a183959b2c68459f1c80729aebe243656d476c..6000924c832e2b9fd0858a4f260685073edb794c 100644 (file)
@@ -172,7 +172,8 @@ wxObjectRefData *wxColour::CloneRefData(const wxObjectRefData *data) const
     return new wxColourRefData(*(wxColourRefData *)data);
 }
 
-void wxColour::InitWith( unsigned char red, unsigned char green, unsigned char blue )
+void wxColour::InitRGBA(unsigned char red, unsigned char green, unsigned char blue,
+                        unsigned char WXUNUSED(alpha))
 {
     AllocExclusive();