X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..cd95f7e65c4e1ee61a5d90eb13687ff468cb13ad:/src/osx/artmac.cpp?ds=inline diff --git a/src/osx/artmac.cpp b/src/osx/artmac.cpp index a68ca81346..267516cb7a 100644 --- a/src/osx/artmac.cpp +++ b/src/osx/artmac.cpp @@ -19,14 +19,13 @@ #pragma hdrstop #endif +#include "wx/artprov.h" + #ifndef WX_PRECOMP #include "wx/image.h" #endif -#if !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON - -#include "wx/artprov.h" -#include "wx/image.h" +#include "wx/osx/private.h" // ---------------------------------------------------------------------------- // wxMacArtProvider @@ -35,10 +34,18 @@ 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); +#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() @@ -46,13 +53,15 @@ protected: wxArtProvider::Push(new wxMacArtProvider); } +#if wxOSX_USE_COCOA_OR_CARBON + // ---------------------------------------------------------------------------- // 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; \ } @@ -73,6 +82,21 @@ 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_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) return wxNullIconBundle; } @@ -91,24 +115,30 @@ wxIconBundle wxMacArtProvider::CreateIconBundle(const wxArtID& id, const wxArtCl return wxMacArtProvider_CreateIconBundle(id); } +#endif + // ---------------------------------------------------------------------------- -// CreateBitmap +// wxArtProvider::GetNativeSizeHint() // ---------------------------------------------------------------------------- -wxBitmap wxMacArtProvider::CreateBitmap(const wxArtID& id, - const wxArtClient& client, - const wxSize& reqSize) +/*static*/ +wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client) { - wxIconBundle ic(CreateIconBundle(id, client)); - if (ic.IsOk()) + if ( client == wxART_TOOLBAR ) { - wxIcon theIcon(ic.GetIcon(reqSize)); - return wxBitmap(theIcon); + // See http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIcons/chapter_15_section_9.html: + // "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 wxNullBitmap; + return wxDefaultSize; } -#endif // !defined(__WXUNIVERSAL__) - -