]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/splash.cpp
fixed compilation warnings with GTK+ 2.0
[wxWidgets.git] / src / generic / splash.cpp
index 144bac64698b91f96baf0a8d00a1cff2fd235a86..fa641bdf1e069c009241dc9acde7016e84846166 100644 (file)
@@ -98,7 +98,9 @@ void wxSplashScreen::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
  */
 
 BEGIN_EVENT_TABLE(wxSplashScreenWindow, wxWindow)
-    //EVT_PAINT(wxSplashScreenWindow::OnPaint)
+#ifdef __WXGTK__
+    EVT_PAINT(wxSplashScreenWindow::OnPaint)
+#endif
     EVT_ERASE_BACKGROUND(wxSplashScreenWindow::OnEraseBackground)
     EVT_CHAR(wxSplashScreenWindow::OnChar)
     EVT_MOUSE_EVENTS(wxSplashScreenWindow::OnMouseEvent)
@@ -108,13 +110,16 @@ wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* par
     wxWindow(parent, id, pos, size, style)
 {
     m_bitmap = bitmap;
-}
 
-void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
-    wxPaintDC dc(this);
-    if (m_bitmap.Ok())
-        dc.DrawBitmap(m_bitmap, 0, 0);
+#if !defined(__WXGTK__) && wxUSE_PALETTE
+    bool hiColour = (wxDisplayDepth() >= 16) ;
+
+    if (bitmap.GetPalette() && !hiColour)
+    {
+        SetPalette(* bitmap.GetPalette());
+    }
+#endif
+
 }
 
 // VZ: why don't we do it under wxGTK?
@@ -131,7 +136,6 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
 
     if (bitmap.GetPalette() && !hiColour)
     {
-        dc.SetPalette(* bitmap.GetPalette());
         dcMem.SetPalette(* bitmap.GetPalette());
     }
 #endif // USE_PALETTE_IN_SPLASH
@@ -143,12 +147,18 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
 #ifdef USE_PALETTE_IN_SPLASH
     if (bitmap.GetPalette() && !hiColour)
     {
-        dc.SetPalette(wxNullPalette);
         dcMem.SetPalette(wxNullPalette);
     }
 #endif // USE_PALETTE_IN_SPLASH
 }
 
+void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+    wxPaintDC dc(this);
+    if (m_bitmap.Ok())
+        wxDrawSplashBitmap(dc, m_bitmap, 0, 0);
+}
+
 void wxSplashScreenWindow::OnEraseBackground(wxEraseEvent& event)
 {
     if (event.GetDC())