X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/969cfbc0855b9dbbfd4fd599cdbc31261b585985..95d8425febe48f9c1e954bce5fb9661f3cd2bea9:/src/mac/carbon/taskbar.cpp diff --git a/src/mac/carbon/taskbar.cpp b/src/mac/carbon/taskbar.cpp index 7cce1813fd..9c46425f45 100644 --- a/src/mac/carbon/taskbar.cpp +++ b/src/mac/carbon/taskbar.cpp @@ -143,6 +143,8 @@ wxTaskBarIcon::wxTaskBarIcon(const wxTaskBarIconType& nType) this, (&(EventHandlerRef&)m_pEventHandlerRef)); wxASSERT(err == noErr); + + Connect(wxEVT_TASKBAR_RIGHT_DOWN, wxTaskBarIconEventHandler(wxTaskBarIcon::OnRightDown)); } wxTaskBarIcon::~wxTaskBarIcon() @@ -181,11 +183,14 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) CGImageRef pImage; -#if wxMAC_USE_CORE_GRAPHICS +#if 0 // is always available under OSX now -- crashes on 10.2 in CFRetain() - RN pImage = (CGImageRef) bmp.CGImageCreate() ; #else - wxMask* mask = bmp.GetMask(); - if (!mask) + WXHBITMAP iconport ; + WXHBITMAP maskport ; + iconport = bmp.GetHBITMAP( &maskport ) ; + + if (!maskport) { // Make a mask with no transparent pixels wxBitmap mbmp(icon.GetWidth(), icon.GetHeight()); @@ -195,12 +200,10 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) dc.Clear(); dc.SelectObject(wxNullBitmap); bmp.SetMask( new wxMask(mbmp, *wxWHITE) ) ; + iconport = bmp.GetHBITMAP( &maskport ) ; } //create the icon from the bitmap and mask bitmap contained within - WXHBITMAP iconport ; - WXHBITMAP maskport ; - iconport = bmp.GetHBITMAP( &maskport ) ; err = CreateCGImageFromPixMaps( GetGWorldPixMap(MAC_WXHBITMAP(iconport)), GetGWorldPixMap(MAC_WXHBITMAP(maskport)), @@ -288,4 +291,10 @@ bool wxTaskBarIcon::PopupMenu(wxMenu *menu) return true; } +//Skip the event so that popupmenu isn't called in parent, avoiding double-creation of the menus +void wxTaskBarIcon::OnRightDown(wxTaskBarIconEvent& evt) +{ + evt.Skip(); +} + #endif //wxHAS_TASK_BAR_ICON