mac cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,6 +43,83 @@ IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
|||||||
// under Quartz then content is transformed into a CGImageRef representing the same data
|
// under Quartz then content is transformed into a CGImageRef representing the same data
|
||||||
// which can be transferred to the GPU by the OS for fast rendering
|
// which can be transferred to the GPU by the OS for fast rendering
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
|
||||||
|
{
|
||||||
|
friend class WXDLLIMPEXP_FWD_CORE wxIcon;
|
||||||
|
friend class WXDLLIMPEXP_FWD_CORE wxCursor;
|
||||||
|
public:
|
||||||
|
wxBitmapRefData(int width , int height , int depth);
|
||||||
|
wxBitmapRefData();
|
||||||
|
wxBitmapRefData(const wxBitmapRefData &tocopy);
|
||||||
|
|
||||||
|
virtual ~wxBitmapRefData();
|
||||||
|
|
||||||
|
void Free();
|
||||||
|
bool Ok() const { return IsOk(); }
|
||||||
|
bool IsOk() const { return m_ok; }
|
||||||
|
void SetOk( bool isOk) { m_ok = isOk; }
|
||||||
|
|
||||||
|
void SetWidth( int width ) { m_width = width; }
|
||||||
|
void SetHeight( int height ) { m_height = height; }
|
||||||
|
void SetDepth( int depth ) { m_depth = depth; }
|
||||||
|
|
||||||
|
int GetWidth() const { return m_width; }
|
||||||
|
int GetHeight() const { return m_height; }
|
||||||
|
int GetDepth() const { return m_depth; }
|
||||||
|
|
||||||
|
void *GetRawAccess() const;
|
||||||
|
void *BeginRawAccess();
|
||||||
|
void EndRawAccess();
|
||||||
|
|
||||||
|
bool HasAlpha() const { return m_hasAlpha; }
|
||||||
|
void UseAlpha( bool useAlpha );
|
||||||
|
|
||||||
|
public:
|
||||||
|
#if wxUSE_PALETTE
|
||||||
|
wxPalette m_bitmapPalette;
|
||||||
|
#endif // wxUSE_PALETTE
|
||||||
|
|
||||||
|
wxMask * m_bitmapMask; // Optional mask
|
||||||
|
CGImageRef CreateCGImage() const;
|
||||||
|
|
||||||
|
// returns true if the bitmap has a size that
|
||||||
|
// can be natively transferred into a true icon
|
||||||
|
// if no is returned GetIconRef will still produce
|
||||||
|
// an icon but it will be generated via a PICT and
|
||||||
|
// rescaled to 16 x 16
|
||||||
|
bool HasNativeSize();
|
||||||
|
|
||||||
|
// caller should increase ref count if needed longer
|
||||||
|
// than the bitmap exists
|
||||||
|
IconRef GetIconRef();
|
||||||
|
|
||||||
|
// returns a Pict from the bitmap content
|
||||||
|
PicHandle GetPictHandle();
|
||||||
|
|
||||||
|
CGContextRef GetBitmapContext() const;
|
||||||
|
|
||||||
|
int GetBytesPerRow() const { return m_bytesPerRow; }
|
||||||
|
private :
|
||||||
|
bool Create(int width , int height , int depth);
|
||||||
|
void Init();
|
||||||
|
|
||||||
|
int m_width;
|
||||||
|
int m_height;
|
||||||
|
int m_bytesPerRow;
|
||||||
|
int m_depth;
|
||||||
|
bool m_hasAlpha;
|
||||||
|
wxMemoryBuffer m_memBuf;
|
||||||
|
int m_rawAccessCount;
|
||||||
|
bool m_ok;
|
||||||
|
mutable CGImageRef m_cgImageRef;
|
||||||
|
|
||||||
|
IconRef m_iconRef;
|
||||||
|
PicHandle m_pictHandle;
|
||||||
|
|
||||||
|
CGContextRef m_hBitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#define wxMAC_USE_PREMULTIPLIED_ALPHA 1
|
#define wxMAC_USE_PREMULTIPLIED_ALPHA 1
|
||||||
static const int kBestByteAlignement = 16;
|
static const int kBestByteAlignement = 16;
|
||||||
static const int kMaskBytesPerPixel = 1;
|
static const int kMaskBytesPerPixel = 1;
|
||||||
@@ -52,7 +129,9 @@ static int GetBestBytesPerRow( int rawBytes )
|
|||||||
return (((rawBytes)+kBestByteAlignement-1) & ~(kBestByteAlignement-1) );
|
return (((rawBytes)+kBestByteAlignement-1) & ~(kBestByteAlignement-1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_BMPBUTTON
|
#if wxUSE_GUI
|
||||||
|
|
||||||
|
// this is used for more controls than just the wxBitmap button, also for notebooks etc
|
||||||
|
|
||||||
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType )
|
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType )
|
||||||
{
|
{
|
||||||
@@ -95,7 +174,7 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
|
|||||||
else if ( forceType == kControlContentCGImageRef )
|
else if ( forceType == kControlContentCGImageRef )
|
||||||
{
|
{
|
||||||
info->contentType = kControlContentCGImageRef ;
|
info->contentType = kControlContentCGImageRef ;
|
||||||
info->u.imageRef = (CGImageRef) bmap->CGImageCreate() ;
|
info->u.imageRef = (CGImageRef) bmap->CreateCGImage() ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -112,7 +191,7 @@ CGImageRef wxMacCreateCGImageFromBitmap( const wxBitmap& bitmap )
|
|||||||
wxBitmapRefData * bmap = bitmap.GetBitmapData() ;
|
wxBitmapRefData * bmap = bitmap.GetBitmapData() ;
|
||||||
if ( bmap == NULL )
|
if ( bmap == NULL )
|
||||||
return NULL ;
|
return NULL ;
|
||||||
return (CGImageRef) bmap->CGImageCreate();
|
return (CGImageRef) bmap->CreateCGImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacReleaseBitmapButton( ControlButtonContentInfo*info )
|
void wxMacReleaseBitmapButton( ControlButtonContentInfo*info )
|
||||||
@@ -505,7 +584,7 @@ PicHandle wxBitmapRefData::GetPictHandle()
|
|||||||
{
|
{
|
||||||
// QT does not correctly export the mask
|
// QT does not correctly export the mask
|
||||||
// TODO if we get around to it create a synthetic PICT with the CopyBits and Mask commands
|
// TODO if we get around to it create a synthetic PICT with the CopyBits and Mask commands
|
||||||
CGImageRef imageRef = CGImageCreate();
|
CGImageRef imageRef = CreateCGImage();
|
||||||
err = GraphicsExportSetInputCGImage( exporter, imageRef );
|
err = GraphicsExportSetInputCGImage( exporter, imageRef );
|
||||||
err = GraphicsExportSetOutputHandle(exporter, (Handle)m_pictHandle);
|
err = GraphicsExportSetOutputHandle(exporter, (Handle)m_pictHandle);
|
||||||
err = GraphicsExportDoExport(exporter, NULL);
|
err = GraphicsExportDoExport(exporter, NULL);
|
||||||
@@ -536,7 +615,7 @@ void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(
|
|||||||
delete membuf ;
|
delete membuf ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGImageRef wxBitmapRefData::CGImageCreate() const
|
CGImageRef wxBitmapRefData::CreateCGImage() const
|
||||||
{
|
{
|
||||||
wxASSERT( m_ok ) ;
|
wxASSERT( m_ok ) ;
|
||||||
wxASSERT( m_rawAccessCount >= 0 ) ;
|
wxASSERT( m_rawAccessCount >= 0 ) ;
|
||||||
@@ -902,11 +981,25 @@ void wxBitmap::EndRawAccess()
|
|||||||
M_BITMAPDATA->EndRawAccess() ;
|
M_BITMAPDATA->EndRawAccess() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
WXCGIMAGEREF wxBitmap::CGImageCreate() const
|
CGImageRef wxBitmap::CreateCGImage() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
|
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
|
||||||
|
|
||||||
return M_BITMAPDATA->CGImageCreate() ;
|
return M_BITMAPDATA->CreateCGImage() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
IconRef wxBitmap::GetIconRef() const
|
||||||
|
{
|
||||||
|
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
|
||||||
|
|
||||||
|
return M_BITMAPDATA->GetIconRef() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
IconRef wxBitmap::CreateIconRef() const
|
||||||
|
{
|
||||||
|
IconRef icon = GetIconRef();
|
||||||
|
verify_noerr( AcquireIconRef(icon) );
|
||||||
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
||||||
|
@@ -24,16 +24,15 @@
|
|||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
|
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject)
|
||||||
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
|
class WXDLLEXPORT wxCursorRefData: public wxGDIRefData
|
||||||
{
|
{
|
||||||
DECLARE_NO_COPY_CLASS(wxCursorRefData)
|
|
||||||
|
|
||||||
friend class wxBitmap;
|
|
||||||
friend class wxCursor;
|
friend class wxCursor;
|
||||||
|
|
||||||
|
DECLARE_NO_COPY_CLASS(wxCursorRefData)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxCursorRefData();
|
wxCursorRefData();
|
||||||
virtual ~wxCursorRefData();
|
virtual ~wxCursorRefData();
|
||||||
@@ -199,8 +198,6 @@ CursHandle wxGetStockCursor( int number )
|
|||||||
|
|
||||||
wxCursorRefData::wxCursorRefData()
|
wxCursorRefData::wxCursorRefData()
|
||||||
{
|
{
|
||||||
SetWidth( 16 );
|
|
||||||
SetHeight( 16 );
|
|
||||||
m_hCursor = NULL;
|
m_hCursor = NULL;
|
||||||
#if wxMAC_USE_COCOA
|
#if wxMAC_USE_COCOA
|
||||||
#else
|
#else
|
||||||
|
@@ -647,7 +647,7 @@ void wxBitmapDataObject::SetBitmap( const wxBitmap& rBitmap )
|
|||||||
wxBitmapDataObjectBase::SetBitmap( rBitmap );
|
wxBitmapDataObjectBase::SetBitmap( rBitmap );
|
||||||
if (m_bitmap.Ok())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
CGImageRef cgImageRef = (CGImageRef) m_bitmap.CGImageCreate();
|
CGImageRef cgImageRef = (CGImageRef) m_bitmap.CreateCGImage();
|
||||||
|
|
||||||
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
|
||||||
CGImageDestinationRef destination = CGImageDestinationCreateWithData( data , kUTTypeTIFF , 1 , NULL );
|
CGImageDestinationRef destination = CGImageDestinationCreateWithData( data , kUTTypeTIFF , 1 , NULL );
|
||||||
|
@@ -169,7 +169,7 @@ static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDes
|
|||||||
columnDescription.headerBtnDesc.btnFontStyle.style = normal;
|
columnDescription.headerBtnDesc.btnFontStyle.style = normal;
|
||||||
columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
|
columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef;
|
||||||
if (columnPtr->GetBitmap().Ok())
|
if (columnPtr->GetBitmap().Ok())
|
||||||
columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetBitmapData()->GetIconRef();
|
columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef();
|
||||||
// done:
|
// done:
|
||||||
return true;
|
return true;
|
||||||
} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
|
} /* InitializeColumnDescription(DataBrowserListViewColumnDesc&, wxDataViewColumn const*, DataBrowserPropertyID, wxMacCFStringHolder const&) */
|
||||||
@@ -536,7 +536,7 @@ bool wxDataViewBitmapRenderer::Render(void)
|
|||||||
|
|
||||||
bitmap << this->GetValue();
|
bitmap << this->GetValue();
|
||||||
if (bitmap.Ok())
|
if (bitmap.Ok())
|
||||||
return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetBitmapData()->GetIconRef()) == noErr);
|
return (::SetDataBrowserItemDataIcon(this->GetDataReference(),bitmap.GetIconRef()) == noErr);
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
} /* if */
|
} /* if */
|
||||||
@@ -734,7 +734,7 @@ void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap)
|
|||||||
|
|
||||||
wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
|
wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description."));
|
||||||
if (this->GetBitmap().Ok())
|
if (this->GetBitmap().Ok())
|
||||||
headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetBitmapData()->GetIconRef();
|
headerDescription.btnContentInfo.u.iconRef = this->GetBitmap().GetIconRef();
|
||||||
else
|
else
|
||||||
headerDescription.btnContentInfo.u.iconRef = NULL;
|
headerDescription.btnContentInfo.u.iconRef = NULL;
|
||||||
wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon."));
|
wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(this->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon."));
|
||||||
|
@@ -117,7 +117,7 @@ public :
|
|||||||
{
|
{
|
||||||
wxASSERT( bmp && bmp->Ok() );
|
wxASSERT( bmp && bmp->Ok() );
|
||||||
|
|
||||||
Init( (CGImageRef) bmp->CGImageCreate() , transform );
|
Init( (CGImageRef) bmp->CreateCGImage() , transform );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImagePattern takes ownership of CGImageRef passed in
|
// ImagePattern takes ownership of CGImageRef passed in
|
||||||
@@ -1650,7 +1650,7 @@ void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDo
|
|||||||
{
|
{
|
||||||
EnsureIsValid();
|
EnsureIsValid();
|
||||||
|
|
||||||
CGImageRef image = (CGImageRef)( bmp.CGImageCreate() );
|
CGImageRef image = (CGImageRef)( bmp.CreateCGImage() );
|
||||||
HIRect r = CGRectMake( x , y , w , h );
|
HIRect r = CGRectMake( x , y , w , h );
|
||||||
if ( bmp.GetDepth() == 1 )
|
if ( bmp.GetDepth() == 1 )
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,56 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
|
|||||||
|
|
||||||
#define M_ICONDATA ((wxIconRefData *)m_refData)
|
#define M_ICONDATA ((wxIconRefData *)m_refData)
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxIconRefData : public wxGDIRefData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxIconRefData();
|
||||||
|
wxIconRefData( WXHICON iconref, int desiredWidth, int desiredHeight );
|
||||||
|
virtual ~wxIconRefData() { Free(); }
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
virtual void Free();
|
||||||
|
|
||||||
|
void SetWidth( int width ) { m_width = width; }
|
||||||
|
void SetHeight( int height ) { m_height = height; }
|
||||||
|
|
||||||
|
int GetWidth() const { return m_width; }
|
||||||
|
int GetHeight() const { return m_height; }
|
||||||
|
|
||||||
|
WXHICON GetHICON() const { return (WXHICON) m_iconRef; }
|
||||||
|
private :
|
||||||
|
IconRef m_iconRef;
|
||||||
|
int m_width;
|
||||||
|
int m_height;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxIconRefData::wxIconRefData( WXHICON icon, int desiredWidth, int desiredHeight )
|
||||||
|
{
|
||||||
|
m_iconRef = MAC_WXHICON( icon ) ;
|
||||||
|
|
||||||
|
// Standard sizes
|
||||||
|
SetWidth( desiredWidth == -1 ? 32 : desiredWidth ) ;
|
||||||
|
SetHeight( desiredHeight == -1 ? 32 : desiredHeight ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxIconRefData::Init()
|
||||||
|
{
|
||||||
|
m_iconRef = NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxIconRefData::Free()
|
||||||
|
{
|
||||||
|
if ( m_iconRef )
|
||||||
|
{
|
||||||
|
ReleaseIconRef( m_iconRef ) ;
|
||||||
|
m_iconRef = NULL ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
wxIcon::wxIcon()
|
wxIcon::wxIcon()
|
||||||
{
|
{
|
||||||
@@ -60,12 +110,7 @@ wxIcon::wxIcon(WXHICON icon, const wxSize& size)
|
|||||||
if (icon)
|
if (icon)
|
||||||
AcquireIconRef( (IconRef) icon ) ;
|
AcquireIconRef( (IconRef) icon ) ;
|
||||||
|
|
||||||
m_refData = new wxIconRefData( icon ) ;
|
m_refData = new wxIconRefData( icon, size.x, size.y ) ;
|
||||||
if ( (size.x != -1) && (size.y != -1) )
|
|
||||||
{
|
|
||||||
M_ICONDATA->SetWidth( size.x ) ;
|
|
||||||
M_ICONDATA->SetHeight( size.y ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxIcon::~wxIcon()
|
wxIcon::~wxIcon()
|
||||||
@@ -180,7 +225,7 @@ bool wxIcon::LoadFile(
|
|||||||
}
|
}
|
||||||
if ( iconRef )
|
if ( iconRef )
|
||||||
{
|
{
|
||||||
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
|
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,7 +236,7 @@ bool wxIcon::LoadFile(
|
|||||||
verify_noerr( GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef ) ) ;
|
verify_noerr( GetIconRef( kOnSystemDisk, kSystemIconsCreator, theId, &iconRef ) ) ;
|
||||||
if ( iconRef )
|
if ( iconRef )
|
||||||
{
|
{
|
||||||
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
|
m_refData = new wxIconRefData( (WXHICON) iconRef, desiredWidth, desiredHeight ) ;
|
||||||
|
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -244,35 +289,8 @@ void wxIcon::CopyFromBitmap( const wxBitmap& bmp )
|
|||||||
UnRef() ;
|
UnRef() ;
|
||||||
|
|
||||||
// as the bitmap owns that ref, we have to acquire it as well
|
// as the bitmap owns that ref, we have to acquire it as well
|
||||||
IconRef iconRef = bmp.GetBitmapData()->GetIconRef() ;
|
IconRef iconRef = bmp.CreateIconRef() ;
|
||||||
AcquireIconRef( iconRef ) ;
|
m_refData = new wxIconRefData( (WXHICON) iconRef, bmp.GetWidth(), bmp.GetHeight() ) ;
|
||||||
|
|
||||||
m_refData = new wxIconRefData( (WXHICON) iconRef ) ;
|
|
||||||
M_ICONDATA->SetWidth( bmp.GetWidth() ) ;
|
|
||||||
M_ICONDATA->SetHeight( bmp.GetHeight() ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxIconRefData::wxIconRefData( WXHICON icon )
|
|
||||||
{
|
|
||||||
m_iconRef = MAC_WXHICON( icon ) ;
|
|
||||||
|
|
||||||
// Standard sizes
|
|
||||||
SetWidth( 32 ) ;
|
|
||||||
SetHeight( 32 ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxIconRefData::Init()
|
|
||||||
{
|
|
||||||
m_iconRef = NULL ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxIconRefData::Free()
|
|
||||||
{
|
|
||||||
if ( m_iconRef )
|
|
||||||
{
|
|
||||||
ReleaseIconRef( m_iconRef ) ;
|
|
||||||
m_iconRef = NULL ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
|
||||||
|
@@ -980,13 +980,13 @@ bool wxListCtrl::SetColumn(int col, wxListItem& item)
|
|||||||
|
|
||||||
if (item.GetMask() & wxLIST_MASK_IMAGE && item.GetImage() != -1 )
|
if (item.GetMask() & wxLIST_MASK_IMAGE && item.GetImage() != -1 )
|
||||||
{
|
{
|
||||||
columnDesc.btnContentInfo.contentType = kControlContentIconRef;
|
|
||||||
wxImageList* imageList = GetImageList(wxIMAGE_LIST_SMALL);
|
wxImageList* imageList = GetImageList(wxIMAGE_LIST_SMALL);
|
||||||
if (imageList && imageList->GetImageCount() > 0 )
|
if (imageList && imageList->GetImageCount() > 0 )
|
||||||
{
|
{
|
||||||
wxBitmap bmp = imageList->GetBitmap( item.GetImage() );
|
wxBitmap bmp = imageList->GetBitmap( item.GetImage() );
|
||||||
IconRef icon = bmp.GetBitmapData()->GetIconRef();
|
IconRef icon = bmp.GetIconRef();
|
||||||
columnDesc.btnContentInfo.u.iconRef = icon;
|
columnDesc.btnContentInfo.u.iconRef = icon;
|
||||||
|
columnDesc.btnContentInfo.contentType = kControlContentIconRef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2754,7 +2754,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
|||||||
wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL);
|
wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL);
|
||||||
if (imageList && imageList->GetImageCount() > 0){
|
if (imageList && imageList->GetImageCount() > 0){
|
||||||
wxBitmap bmp = imageList->GetBitmap(imgIndex);
|
wxBitmap bmp = imageList->GetBitmap(imgIndex);
|
||||||
IconRef icon = bmp.GetBitmapData()->GetIconRef();
|
IconRef icon = bmp.GetIconRef();
|
||||||
|
|
||||||
CGContextSaveGState(context);
|
CGContextSaveGState(context);
|
||||||
CGContextTranslateCTM(context, 0,iconCGRect.origin.y + CGRectGetMaxY(iconCGRect));
|
CGContextTranslateCTM(context, 0,iconCGRect.origin.y + CGRectGetMaxY(iconCGRect));
|
||||||
@@ -2895,7 +2895,7 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI
|
|||||||
wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL);
|
wxImageList* imageList = list->GetImageList(wxIMAGE_LIST_SMALL);
|
||||||
if (imageList && imageList->GetImageCount() > 0){
|
if (imageList && imageList->GetImageCount() > 0){
|
||||||
wxBitmap bmp = imageList->GetBitmap(imgIndex);
|
wxBitmap bmp = imageList->GetBitmap(imgIndex);
|
||||||
IconRef icon = bmp.GetBitmapData()->GetIconRef();
|
IconRef icon = bmp.GetIconRef();
|
||||||
::SetDataBrowserItemDataIcon(itemData, icon);
|
::SetDataBrowserItemDataIcon(itemData, icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -380,7 +380,7 @@ bool wxDockTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& WXUNUSED(too
|
|||||||
|
|
||||||
// get the CGImageRef for the wxBitmap:
|
// get the CGImageRef for the wxBitmap:
|
||||||
// OSX builds only, but then the dock only exists in OSX
|
// OSX builds only, but then the dock only exists in OSX
|
||||||
CGImageRef pImage = (CGImageRef) bmp.CGImageCreate();
|
CGImageRef pImage = (CGImageRef) bmp.CreateCGImage();
|
||||||
wxASSERT( pImage != NULL );
|
wxASSERT( pImage != NULL );
|
||||||
|
|
||||||
// actually set the dock image
|
// actually set the dock image
|
||||||
|
Reference in New Issue
Block a user