more cgimageref support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -475,12 +475,15 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
|||||||
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
|
dc.DrawBitmap( m_bmpNormal, 0, 0, true );
|
||||||
dc.SelectObject( wxNullBitmap );
|
dc.SelectObject( wxNullBitmap );
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
wxMacCreateBitmapButton( &info, bmp, kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, bmp );
|
||||||
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
|
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
|
||||||
#if wxMAC_USE_NATIVE_TOOLBAR
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
if (m_toolbarItemRef != NULL)
|
if (m_toolbarItemRef != NULL)
|
||||||
{
|
{
|
||||||
|
if ( info.contentType == kControlContentIconRef )
|
||||||
HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef );
|
HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef );
|
||||||
|
else
|
||||||
|
HIToolbarItemSetImage( m_toolbarItemRef, info.u.imageRef );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wxMacReleaseBitmapButton( &info );
|
wxMacReleaseBitmapButton( &info );
|
||||||
@@ -488,12 +491,15 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
||||||
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
|
SetControlData( m_controlHandle, 0, kControlIconContentTag, sizeof(info), (Ptr)&info );
|
||||||
#if wxMAC_USE_NATIVE_TOOLBAR
|
#if wxMAC_USE_NATIVE_TOOLBAR
|
||||||
if (m_toolbarItemRef != NULL)
|
if (m_toolbarItemRef != NULL)
|
||||||
{
|
{
|
||||||
|
if ( info.contentType == kControlContentIconRef )
|
||||||
HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef );
|
HIToolbarItemSetIconRef( m_toolbarItemRef, info.u.iconRef );
|
||||||
|
else
|
||||||
|
HIToolbarItemSetImage( m_toolbarItemRef, info.u.imageRef );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
wxMacReleaseBitmapButton( &info );
|
wxMacReleaseBitmapButton( &info );
|
||||||
@@ -1484,11 +1490,15 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
{
|
{
|
||||||
wxASSERT( tool->GetControlHandle() == NULL );
|
wxASSERT( tool->GetControlHandle() == NULL );
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap() );
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
if ( UMAGetSystemVersion() >= 0x1000 )
|
||||||
{
|
{
|
||||||
|
// contrary to the docs this control only works with iconrefs
|
||||||
|
ControlButtonContentInfo info;
|
||||||
|
wxMacCreateBitmapButton( &info, tool->GetNormalBitmap(), kControlContentIconRef );
|
||||||
CreateIconControl( window, &toolrect, &info, false, &controlHandle );
|
CreateIconControl( window, &toolrect, &info, false, &controlHandle );
|
||||||
|
wxMacReleaseBitmapButton( &info );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1512,7 +1522,10 @@ bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
|
|||||||
HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(),
|
HIObjectGetEventTarget(item), GetwxMacToolBarEventHandlerUPP(),
|
||||||
GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL );
|
GetEventTypeCount(toolBarEventList), toolBarEventList, tool, NULL );
|
||||||
HIToolbarItemSetLabel( item, wxMacCFStringHolder(tool->GetLabel(), m_font.GetEncoding()) );
|
HIToolbarItemSetLabel( item, wxMacCFStringHolder(tool->GetLabel(), m_font.GetEncoding()) );
|
||||||
|
if ( info.contentType == kControlContentIconRef )
|
||||||
HIToolbarItemSetIconRef( item, info.u.iconRef );
|
HIToolbarItemSetIconRef( item, info.u.iconRef );
|
||||||
|
else
|
||||||
|
HIToolbarItemSetImage( item, info.u.imageRef );
|
||||||
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
|
HIToolbarItemSetCommandID( item, kHIToolbarCommandPressAction );
|
||||||
tool->SetToolbarItemRef( item );
|
tool->SetToolbarItemRef( item );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user