]> git.saurik.com Git - wxWidgets.git/commitdiff
added ctor wxColour(unsigned long colRGB) and the corresponding Set()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Jun 1998 23:08:53 +0000 (23:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Jun 1998 23:08:53 +0000 (23:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@98 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/colour.h

index 5bf97af25d5babd79d07f0b7e8f31c3ffef5dcf1..c4632bde4d3a69cd7b6ba5e592b03a6d1bc03cb7 100644 (file)
@@ -23,6 +23,7 @@ class WXDLLEXPORT wxColour: public wxObject
 public:
   wxColour(void);
   wxColour(const unsigned char r, const unsigned char g, const unsigned char b);
+  wxColour(unsigned long colRGB) { Set(colRGB); }
   wxColour(const wxColour& col);
   wxColour(const wxString& col);
   ~wxColour(void) ;
@@ -31,6 +32,14 @@ public:
   inline int Ok(void) const { return (m_isInit) ; }
 
   void Set(unsigned char r, unsigned char g, unsigned char b);
+  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)); 
+  }
 
   // Let's remove this inelegant function
 #if WXWIN_COMPATIBILITY