]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/statbmp.cpp
[ 1216436 ] cleanup 'shadow variable' warnings from gcc in headers.
[wxWidgets.git] / src / os2 / statbmp.cpp
index 5d523be4ffd9fb8f72fc31d458580724b3acee00..ed401f97db67a139d73dfbffc3f2a87e2335ac1d 100644 (file)
@@ -16,6 +16,7 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/dcclient.h"
 #include "wx/window.h"
 #include "wx/os2/private.h"
 
 #include "wx/window.h"
 #include "wx/os2/private.h"
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
 
+BEGIN_EVENT_TABLE(wxStaticBitmap, wxWindow)
+    EVT_PAINT(wxStaticBitmap::OnPaint)
+END_EVENT_TABLE()
+
 static wxGDIImage* ConvertImage(
   const wxGDIImage&                 rBitmap
 )
 static wxGDIImage* ConvertImage(
   const wxGDIImage&                 rBitmap
 )
@@ -92,8 +97,6 @@ bool wxStaticBitmap::Create(
 
     int                             nX= rPos.x;
     int                             nY = rPos.y;
 
     int                             nX= rPos.x;
     int                             nY = rPos.y;
-    int                             nWidth = rSize.x;
-    int                             nHeight = rSize.y;
     char                            zId[16];
 
     m_windowStyle = lStyle;
     char                            zId[16];
 
     m_windowStyle = lStyle;
@@ -105,9 +108,8 @@ bool wxStaticBitmap::Create(
     //
     int                             nWinstyle = SS_ICON;
 
     //
     int                             nWinstyle = SS_ICON;
 
-    sprintf(zId, "#%d", rBitmap.GetId());
     m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
     m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
-                                       ,WC_STATIC
+                                       ,(PSZ)wxCanvasClassName
                                        ,zId
                                        ,nWinstyle | WS_VISIBLE
                                        ,0,0,0,0
                                        ,zId
                                        ,nWinstyle | WS_VISIBLE
                                        ,0,0,0,0
@@ -129,6 +131,8 @@ bool wxStaticBitmap::Create(
 
     // Subclass again for purposes of dialog editing mode
     SubclassWin(m_hWnd);
 
     // Subclass again for purposes of dialog editing mode
     SubclassWin(m_hWnd);
+    SetSize(nX, nY, m_pImage->GetWidth(), m_pImage->GetHeight());
+
     return(TRUE);
 } // end of wxStaticBitmap::Create
 
     return(TRUE);
 } // end of wxStaticBitmap::Create
 
@@ -153,6 +157,29 @@ wxSize wxStaticBitmap::DoGetBestSize() const
     return wxWindow::DoGetBestSize();
 }
 
     return wxWindow::DoGetBestSize();
 }
 
+void wxStaticBitmap::OnPaint (
+  wxPaintEvent&                     WXUNUSED(rEvent)
+)
+{
+    wxPaintDC                       vDc(this);
+    wxBitmap*                       pBitmap;
+
+    if (m_pImage->IsKindOf(CLASSINFO(wxIcon)))
+    {
+        wxIcon*                     pIcon;
+
+        pIcon = wxDynamicCast(m_pImage, wxIcon);
+        pBitmap = new wxBitmap(*pIcon);
+        vDc.DrawBitmap(*pBitmap, 0, 0);
+        delete pBitmap;
+    }
+    else
+    {
+        pBitmap = wxDynamicCast(m_pImage, wxBitmap);
+        vDc.DrawBitmap(*pBitmap, 0, 0);
+    }
+} // end of wxStaticBitmap::OnPaint
+
 void wxStaticBitmap::SetImage(
   const wxGDIImage&                 rBitmap
 )
 void wxStaticBitmap::SetImage(
   const wxGDIImage&                 rBitmap
 )