]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/icon.cpp
fix for assert when setting tooltip for a readonly combo
[wxWidgets.git] / src / os2 / icon.cpp
index ffece6b1f3b98490e56b182e0b34f28279298318..26f744c91f4633cc6b6c12530076354529e68067 100644 (file)
@@ -29,9 +29,7 @@
 
 #include "wx/icon.h"
 
-#if !USE_SHARED_LIBRARIES
     IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase)
-#endif
 
 // ============================================================================
 // implementation
@@ -43,8 +41,8 @@
 
 void wxIconRefData::Free()
 {
-    if ( m_hIcon )
-        ::DestroyIcon((HICON) m_hIcon);
+    if (m_hIcon)
+        ::WinFreeFileIcon((HPOINTER)m_hIcon);
 }
 
 // ----------------------------------------------------------------------------
@@ -70,7 +68,15 @@ wxIcon::wxIcon(
 , int                               nDesiredHeight
 )
 {
-    LoadFile( rIconFile
+    //
+    // A very poor hack, but we have to have separate icon files from windows
+    // So we have a modified name where replace the last three characters
+    // with os2.  Also need the extension.
+    //
+    wxString                         sOs2Name = rIconFile.Mid(0, rIconFile.Length() - 3);
+
+    sOs2Name += "Os2.ico";
+    LoadFile( sOs2Name
              ,lFlags
              ,nDesiredWidth
              ,nDesiredHeight
@@ -88,14 +94,16 @@ bool wxIcon::LoadFile(
 , int                               nDesiredHeight
 )
 {
-    wxGDIImageHandler*              pHandler = FindHandler(type);
+    HPS                             hPs = NULLHANDLE;
 
     UnRef();
-    m_refData = new wxIconRefData;
+
+    wxGDIImageHandler*              pHandler = FindHandler(lType);
 
     if (pHandler)
         return(pHandler->Load( this
                               ,rFilename
+                              ,hPs
                               ,lType
                               ,nDesiredWidth
                               ,nDesiredHeight