]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/icon.cpp
1. DoSetSize() simplified, DoGetBestSize() introduced
[wxWidgets.git] / src / msw / icon.cpp
index 587bf7b4c4fa31a982a3d961d1b97e84358c5f98..a788d29ed15ce87b2ae397816a4982a0f1ac2ce5 100644 (file)
 #include "wx/msw/private.h"
 #include "assert.h"
 
-#if USE_XPM_IN_MSW
-#define FOR_MSW 1
-#include "..\..\contrib\wxxpm\libxpm.34b\lib\xpm34.h"
-#endif
-
-#if USE_RESOURCE_LOADING_IN_MSW
+#if wxUSE_RESOURCE_LOADING_IN_MSW
 #include "wx/msw/curico.h"
 #include "wx/msw/curicop.h"
 #endif
@@ -119,12 +114,12 @@ void wxIcon::SetHICON(WXHICON ico)
 bool wxICOFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
     int desiredWidth, int desiredHeight)
 {
-#if USE_RESOURCE_LOADING_IN_MSW
+#if wxUSE_RESOURCE_LOADING_IN_MSW
   if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) )
   {
     wxIcon *icon = (wxIcon *)bitmap;
     wxIconRefData *data = (wxIconRefData *)icon->GetRefData();
-    data->m_hIcon = (WXHICON)ReadIconFile((char *)name.c_str(), wxGetInstance(),
+    data->m_hIcon = (WXHICON)ReadIconFile((wxChar *)name.c_str(), wxGetInstance(),
                                           &data->m_width, &data->m_height);
 
     data->m_ok = data->m_hIcon != 0;
@@ -142,7 +137,7 @@ bool wxICOResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
 {
   if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) )
   {
-#if defined(__WIN32__)
+#if defined(__WIN32__) && !defined(__SC__)
     if (desiredWidth > -1 && desiredHeight > -1)
     {
         M_ICONHANDLERDATA->m_hIcon = (WXHICON) ::LoadImage(wxGetInstance(), name, IMAGE_ICON, desiredWidth, desiredHeight, LR_DEFAULTCOLOR);
@@ -178,6 +173,13 @@ bool wxICOResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long
       M_ICONHANDLERDATA->m_width = 32;
       M_ICONHANDLERDATA->m_height = 32;
 #endif
+      // Override the found values with desired values
+      if (desiredWidth > -1 && desiredHeight > -1)
+      {
+          M_ICONHANDLERDATA->m_width = desiredWidth;
+          M_ICONHANDLERDATA->m_height = desiredHeight;
+      }
+
       M_ICONHANDLERDATA->m_ok = (M_ICONHANDLERDATA->m_hIcon != 0);
       return M_ICONHANDLERDATA->m_ok;
   }