]> git.saurik.com Git - wxWidgets.git/commitdiff
artmac extended for cocoa
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 26 Jan 2011 16:15:39 +0000 (16:15 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 26 Jan 2011 16:15:39 +0000 (16:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66775 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/artprov.h
include/wx/osx/cocoa/private.h
include/wx/osx/iphone/private.h
src/osx/artmac.cpp
src/osx/carbon/utilscocoa.mm

index fcc93518f692d882dc12784cf1cd05fdc74a9a71..2dbf51a23a44927fcb2043b2f5120a09e9a9694c 100644 (file)
@@ -253,7 +253,7 @@ private:
 
 #if !defined(__WXUNIVERSAL__) && \
     ((defined(__WXGTK__) && defined(__WXGTK20__)) || defined(__WXMSW__) || \
-     (defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON))
+     defined(__WXMAC__))
   // *some* (partial) native implementation of wxArtProvider exists; this is
   // not the same as wxArtProvider::HasNativeProvider()!
   #define wxHAS_NATIVE_ART_PROVIDER_IMPL
index 6b6bef8e8280e93e04de236d2bb0cfb47a295347..139eb57823edc2e741059da730aa2adee5566a9e 100644 (file)
@@ -41,6 +41,7 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
                                CGImageRef      inImage) ;
 WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image );
 CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage );
+wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
 
 class WXDLLIMPEXP_FWD_CORE wxDialog;
 
index fd9c022af230b4381dd9fcf0b70dd9abbceb2c1a..fca0be2880d1fe00597d87b9cfb159c67a83b13b 100644 (file)
@@ -26,6 +26,7 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
                                CGImageRef      inImage) ;
 
 WX_UIImage WXDLLIMPEXP_CORE wxOSXGetUIImageFromCGImage( CGImageRef image );
+wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
 
 class WXDLLIMPEXP_CORE wxWidgetIPhoneImpl : public wxWidgetImpl
 {
index 04acf5caf43f6a83b97fae5d2611ebd97c4af206..267516cb7a590bff0ee0633c38b35a7a7c9a78bb 100644 (file)
@@ -25,7 +25,7 @@
     #include "wx/image.h"
 #endif
 
-#if wxOSX_USE_COCOA_OR_CARBON
+#include "wx/osx/private.h"
 
 // ----------------------------------------------------------------------------
 // wxMacArtProvider
 class wxMacArtProvider : public wxArtProvider
 {
 protected:
+#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()
@@ -43,6 +53,8 @@ protected:
     wxArtProvider::Push(new wxMacArtProvider);
 }
 
+#if wxOSX_USE_COCOA_OR_CARBON
+
 // ----------------------------------------------------------------------------
 // helper macros
 // ----------------------------------------------------------------------------
@@ -103,6 +115,7 @@ wxIconBundle wxMacArtProvider::CreateIconBundle(const wxArtID& id, const wxArtCl
     return wxMacArtProvider_CreateIconBundle(id);
 }
 
+#endif
 
 // ----------------------------------------------------------------------------
 // wxArtProvider::GetNativeSizeHint()
@@ -129,4 +142,3 @@ wxSize wxArtProvider::GetNativeSizeHint(const wxArtClient& client)
     return wxDefaultSize;
 }
 
-#endif // wxOSX_USE_COCOA_CARBON
index 49fc2247d066943a578cbb173037f6bd6b11986a..41bda29155484d1b3911d20670e819bf6c8cb887 100644 (file)
@@ -353,10 +353,28 @@ WX_UIImage  wxOSXGetUIImageFromCGImage( CGImageRef image )
     return( newImage );
 }
 
+wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& size)
+{
+#if 0
+    // unfortunately this only accesses images in the app bundle, not the system wide globals
+    wxCFStringRef cfname(name);
+    return wxBitmap( [[UIImage imageNamed:cfname.AsNSString()] CGImage] );
+#else
+    return wxBitmap();
+#endif
+}
+
 #endif
 
 #if wxOSX_USE_COCOA
 
+wxBitmap wxOSXCreateSystemBitmap(const wxString& name, const wxString &client, const wxSize& size)
+{
+    wxCFStringRef cfname(name);
+    wxCFRef<CGImageRef> image( wxOSXCreateCGImageFromNSImage([NSImage imageNamed:cfname.AsNSString()]) );
+    return wxBitmap( image );
+}
+
 //  From "Cocoa Drawing Guide:Working with Images"
 WX_NSImage  wxOSXGetNSImageFromCGImage( CGImageRef image )
 {