]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/palette.cpp
changed wxFileSelector() etc. functions to use wxString (so that any forms of strings...
[wxWidgets.git] / src / motif / palette.cpp
index 988cc153c076d2cc2dfc45889486bcc8ab898cfd..378172ff5b06e79122042772bd81e2c569a708fe 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        palette.cpp
+// Name:        src/motif/palette.cpp
 // Purpose:     wxPalette
 // Author:      Julian Smart
 // Modified by:
@@ -34,17 +34,16 @@ recommended; only the window manager should do this...  Also, it is
 not the functionality that wxPalette::Create() aims to provide.
  */
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "palette.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #include "wx/palette.h"
-#include "wx/window.h"
-#include "wx/app.h"
-#include "wx/utils.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/window.h"
+#endif
 
 #ifdef __VMS__
 #pragma message disable nosimpint
@@ -151,9 +150,9 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     pix_array_n = n;
     xcol.flags = DoRed | DoGreen | DoBlue;
     for(int i = 0; i < n; i++) {
-        xcol.red = (unsigned short)red[i] << 8;
-        xcol.green = (unsigned short)green[i] << 8;
-        xcol.blue = (unsigned short)blue[i] << 8;
+        xcol.red = (unsigned short)(red[i] << 8);
+        xcol.green = (unsigned short)(green[i] << 8);
+        xcol.blue = (unsigned short)(blue[i] << 8);
         pix_array[i] = (XAllocColor(display, cmap, &xcol) == 0) ? 0 : xcol.pixel;
     }
 
@@ -169,13 +168,15 @@ bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *gre
     return true;
 }
 
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char WXUNUSED(red),
+                        unsigned char WXUNUSED(green),
+                        unsigned char WXUNUSED(blue)) const
 {
     if ( !m_refData )
-        return FALSE;
+        return wxNOT_FOUND;
 
     // TODO
-    return FALSE;
+    return wxNOT_FOUND;
 }
 
 bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
@@ -294,9 +295,9 @@ bool wxPalette::TransferBitmap8(unsigned char *data, unsigned long sz,
         struct rgb24 { unsigned char r, g, b; } *dptr = (struct rgb24 *)dest;
         while(sz-- > 0) {
             if((int)*data < pix_array_n) {
-                dptr->r = pix_array[*data] & 0xFF;
-                dptr->g = (pix_array[*data] >> 8) & 0xFF;
-                dptr->b = (pix_array[*data] >> 16) & 0xFF;
+                dptr->r = (unsigned char)(pix_array[*data] & 0xFF);
+                dptr->g = (unsigned char)((pix_array[*data] >> 8) & 0xFF);
+                dptr->b = (unsigned char)((pix_array[*data] >> 16) & 0xFF);
             }
             data++;
             dptr++;
@@ -360,4 +361,3 @@ void wxPalette::PutXColormap(WXDisplay* display, WXColormap cm, bool dp)
 
     M_PALETTEDATA->m_palettes.Append(c);
 }
-