]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/artmac.cpp
The alignment controls are now left-aligned if the floating controls are not shown.
[wxWidgets.git] / src / osx / artmac.cpp
index f5e459009d45b138bd43e091690e09a2369ee00b..d72da8b768e93393c02476885f88a0fe7ea4867c 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxArtProvider instance with native Mac stock icons
 // Author:      Alan Shouls
 // Created:     2006-10-30
 // Purpose:     wxArtProvider instance with native Mac stock icons
 // Author:      Alan Shouls
 // Created:     2006-10-30
-// RCS-ID:      $Id$
 // Copyright:   (c) wxWindows team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) wxWindows team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -25,7 +24,7 @@
     #include "wx/image.h"
 #endif
 
     #include "wx/image.h"
 #endif
 
-#if wxOSX_USE_COCOA_OR_CARBON
+#include "wx/osx/private.h"
 
 // ----------------------------------------------------------------------------
 // wxMacArtProvider
 
 // ----------------------------------------------------------------------------
 // wxMacArtProvider
 class wxMacArtProvider : public wxArtProvider
 {
 protected:
 class wxMacArtProvider : public wxArtProvider
 {
 protected:
-    virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client,
-                                  const wxSize& size);
+#if wxOSX_USE_COCOA_OR_CARBON
     virtual wxIconBundle CreateIconBundle(const wxArtID& id,
                                           const wxArtClient& client);
     virtual wxIconBundle CreateIconBundle(const wxArtID& id,
                                           const wxArtClient& client);
+#endif
+#if wxOSX_USE_COCOA_OR_IPHONE
+    virtual wxBitmap CreateBitmap(const wxArtID& id,
+                                  const wxArtClient& client,
+                                  const wxSize& size)
+    {
+        return wxOSXCreateSystemBitmap(id, client, size);
+    }
+#endif
 };
 
 /* static */ void wxArtProvider::InitNativeProvider()
 {
 };
 
 /* static */ void wxArtProvider::InitNativeProvider()
 {
-    wxArtProvider::Push(new wxMacArtProvider);
+    PushBack(new wxMacArtProvider);
 }
 
 }
 
+#if wxOSX_USE_COCOA_OR_CARBON
+
 // ----------------------------------------------------------------------------
 // helper macros
 // ----------------------------------------------------------------------------
 
 #define CREATE_STD_ICON(iconId, xpmRc) \
     { \
 // ----------------------------------------------------------------------------
 // helper macros
 // ----------------------------------------------------------------------------
 
 #define CREATE_STD_ICON(iconId, xpmRc) \
     { \
-        wxIconBundle icon(_T(iconId), wxBITMAP_TYPE_ICON_RESOURCE); \
+        wxIconBundle icon(wxT(iconId), wxBITMAP_TYPE_ICON_RESOURCE); \
         return icon; \
     }
 
         return icon; \
     }
 
@@ -72,21 +81,22 @@ static wxIconBundle wxMacArtProvider_CreateIconBundle(const wxArtID& id)
     ART_MSGBOX(wxART_FOLDER,      wxICON_FOLDER,      folder)
     ART_MSGBOX(wxART_FOLDER_OPEN, wxICON_FOLDER_OPEN, folder_open)
     ART_MSGBOX(wxART_NORMAL_FILE, wxICON_NORMAL_FILE, deffile)
     ART_MSGBOX(wxART_FOLDER,      wxICON_FOLDER,      folder)
     ART_MSGBOX(wxART_FOLDER_OPEN, wxICON_FOLDER_OPEN, folder_open)
     ART_MSGBOX(wxART_NORMAL_FILE, wxICON_NORMAL_FILE, deffile)
+    ART_MSGBOX(wxART_EXECUTABLE_FILE, wxICON_EXECUTABLE_FILE, exefile)
+
+    ART_MSGBOX(wxART_CDROM,       wxICON_CDROM,       cdrom)
+    ART_MSGBOX(wxART_FLOPPY,      wxICON_FLOPPY,      floppy)
+    ART_MSGBOX(wxART_HARDDISK,    wxICON_HARDDISK,    harddisk)
+    ART_MSGBOX(wxART_REMOVABLE,   wxICON_REMOVABLE,   removable)
+
+    ART_MSGBOX(wxART_DELETE,      wxICON_DELETE,      delete)
+
+    ART_MSGBOX(wxART_GO_BACK,     wxICON_GO_BACK,     back)
+    ART_MSGBOX(wxART_GO_FORWARD,  wxICON_GO_FORWARD,  forward)
+    ART_MSGBOX(wxART_GO_HOME,     wxICON_GO_HOME,     home)
+
+    ART_MSGBOX(wxART_HELP_SETTINGS, wxICON_HELP_SETTINGS, htmoptns)
+    ART_MSGBOX(wxART_HELP_PAGE,   wxICON_HELP_PAGE,   htmpage)
 
 
-    ART_MSGBOX(wxART_CDROM,       wxICON_CDROM,       cdrom) 
-    ART_MSGBOX(wxART_FLOPPY,      wxICON_FLOPPY,      floppy) 
-    ART_MSGBOX(wxART_HARDDISK,    wxICON_HARDDISK,    harddisk) 
-    ART_MSGBOX(wxART_REMOVABLE,   wxICON_REMOVABLE,   removable) 
-    ART_MSGBOX(wxART_DELETE,      wxICON_DELETE,      delete) 
-    ART_MSGBOX(wxART_GO_BACK,     wxICON_GO_BACK,     back) 
-    ART_MSGBOX(wxART_GO_FORWARD,  wxICON_GO_FORWARD,  forward) 
-    ART_MSGBOX(wxART_GO_HOME,     wxICON_GO_HOME,     home) 
-
-    ART_MSGBOX(wxART_HELP_SETTINGS, wxICON_HELP_SETTINGS, htmoptns) 
-    ART_MSGBOX(wxART_HELP_PAGE,   wxICON_HELP_PAGE,   htmpage) 
-       
     return wxNullIconBundle;
 }
 
     return wxNullIconBundle;
 }
 
@@ -104,24 +114,7 @@ wxIconBundle wxMacArtProvider::CreateIconBundle(const wxArtID& id, const wxArtCl
     return wxMacArtProvider_CreateIconBundle(id);
 }
 
     return wxMacArtProvider_CreateIconBundle(id);
 }
 
-// ----------------------------------------------------------------------------
-// CreateBitmap
-// ----------------------------------------------------------------------------
-
-wxBitmap wxMacArtProvider::CreateBitmap(const wxArtID& id,
-                                        const wxArtClient& client,
-                                        const wxSize& reqSize)
-{
-    wxIconBundle ic(CreateIconBundle(id, client));
-    if (ic.IsOk())
-    {
-        wxIcon theIcon(ic.GetIcon(reqSize));
-        return wxBitmap(theIcon);
-    }
-
-    return wxNullBitmap;
-}
-
+#endif
 
 // ----------------------------------------------------------------------------
 // wxArtProvider::GetNativeSizeHint()
 
 // ----------------------------------------------------------------------------
 // wxArtProvider::GetNativeSizeHint()
@@ -136,8 +129,15 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
         // "32 x 32 pixels is the recommended size"
         return wxSize(32, 32);
     }
         // "32 x 32 pixels is the recommended size"
         return wxSize(32, 32);
     }
+    else if ( client == wxART_BUTTON || client == wxART_MENU )
+    {
+        // Mac UI doesn't use any images in neither buttons nor menus in
+        // general but the code using wxArtProvider can use wxART_BUTTON to
+        // find the icons of a roughly appropriate size for the buttons and
+        // 16x16 seems to be the best choice for this kind of use
+        return wxSize(16, 16);
+    }
 
     return wxDefaultSize;
 }
 
 
     return wxDefaultSize;
 }
 
-#endif // wxOSX_USE_COCOA_CARBON