]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxColour::wxColour(unsigned long)
authorRobin Dunn <robin@alldunn.com>
Thu, 4 Feb 1999 19:03:55 +0000 (19:03 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 4 Feb 1999 19:03:55 +0000 (19:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/colour.h
include/wx/gtk1/colour.h
include/wx/motif/colour.h
include/wx/msw/colour.h

index ff686d2e0670032693d904ccb96b2ad4a49979f8..9a6503eb418cdac055c277cf00c2caab1e3b5be7 100644 (file)
@@ -44,6 +44,8 @@ public:
   wxColour();
     // from RGB
   wxColour( unsigned char red, unsigned char green, unsigned char blue );
+  wxColour( unsigned long colRGB ) { Set(colRGB); }
+
     // implicit conversion from the colour name
   wxColour( const wxString &colourName ) { InitFromName(colourName); }
   wxColour( const char *colourName ) { InitFromName(colourName); }
@@ -61,6 +63,15 @@ public:
 
   // accessors
   void Set( unsigned char red, unsigned char green, unsigned char blue );
+  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));
+  }
+
   unsigned char Red() const;
   unsigned char Green() const;
   unsigned char Blue() const;
index ff686d2e0670032693d904ccb96b2ad4a49979f8..9a6503eb418cdac055c277cf00c2caab1e3b5be7 100644 (file)
@@ -44,6 +44,8 @@ public:
   wxColour();
     // from RGB
   wxColour( unsigned char red, unsigned char green, unsigned char blue );
+  wxColour( unsigned long colRGB ) { Set(colRGB); }
+
     // implicit conversion from the colour name
   wxColour( const wxString &colourName ) { InitFromName(colourName); }
   wxColour( const char *colourName ) { InitFromName(colourName); }
@@ -61,6 +63,15 @@ public:
 
   // accessors
   void Set( unsigned char red, unsigned char green, unsigned char blue );
+  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));
+  }
+
   unsigned char Red() const;
   unsigned char Green() const;
   unsigned char Blue() const;
index 7059f61441cc43eb6e83dac3274b62657dddcfc7..893cd7afa2e75958b1a60e3979597dbb71b5a8a3 100644 (file)
@@ -29,6 +29,8 @@ public:
   wxColour();
     // from RGB
   wxColour( unsigned char red, unsigned char green, unsigned char blue );
+  wxColour( unsigned long colRGB ) { Set(colRGB); }
+
     // implicit conversion from the colour name
   wxColour( const wxString &colourName ) { InitFromName(colourName); }
   wxColour( const char *colourName ) { InitFromName(colourName); }
index 08f4e8ef17e4a1dad89a68aae97f29040df9e678..52f15ed96fb825f8ea9ff3e15a7daf00bd6a281d 100644 (file)
@@ -25,13 +25,16 @@ public:
   wxColour();
     // from RGB
   wxColour( unsigned char red, unsigned char green, unsigned char blue );
+  wxColour( unsigned long colRGB ) { Set(colRGB); }
+
     // implicit conversion from the colour name
   wxColour( const wxString &colourName ) { InitFromName(colourName); }
   wxColour( const char *colourName ) { InitFromName(colourName); }
 
+
     // copy ctors and assignment operators
   wxColour( const wxColour& col );
-//  wxColour( const wxColour* col );
+  wxColour( const wxColour* col );
   wxColour& operator = ( const wxColour& col );
 
     // dtor
@@ -63,8 +66,8 @@ public:
   // comparison
   bool operator == (const wxColour& colour)
   {
-    return (m_red == colour.m_red && 
-            m_green == colour.m_green && 
+    return (m_red == colour.m_red &&
+            m_green == colour.m_green &&
             m_blue == colour.m_blue);
   }
   bool operator != (const wxColour& colour) { return !(*this == colour); }