artmac extended for cocoa
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66775 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
516e9d1335
commit
ca9eebc346
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "wx/image.h"
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMacArtProvider
|
||||
@ -34,8 +34,18 @@
|
||||
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
|
||||
|
@ -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 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user