X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4092a27504cfac416b0e1888a04ad0715711836d..7198c3368055d88249a338eb33b21f051f674806:/src/cocoa/taskbar.mm?ds=inline diff --git a/src/cocoa/taskbar.mm b/src/cocoa/taskbar.mm index 1a5cd8e500..b48ecd30d1 100644 --- a/src/cocoa/taskbar.mm +++ b/src/cocoa/taskbar.mm @@ -9,10 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "taskbar.h" -#endif - #include "wx/wxprec.h" #ifdef wxHAS_TASK_BAR_ICON @@ -42,6 +38,11 @@ #include "wx/cocoa/NSApplication.h" #include "wx/cocoa/autorelease.h" +// A category for methods that are only present in Panther's SDK +@interface NSStatusItem(wxNSStatusItemPrePantherCompatibility) +- (void)popUpStatusItemMenu:(NSMenu *)menu; +@end + class wxTaskBarIconWindow; // ============================================================================ @@ -63,7 +64,7 @@ public: protected: inline wxMenu* CreatePopupMenu() { wxASSERT(m_taskBarIcon); - m_taskBarIcon->CreatePopupMenu(); + return m_taskBarIcon->CreatePopupMenu(); } wxTaskBarIcon *m_taskBarIcon; wxTaskBarIconWindow *m_iconWindow; @@ -215,7 +216,7 @@ wxTaskBarIconDockImpl::wxTaskBarIconDockImpl(wxTaskBarIcon *taskBarIcon) : wxTaskBarIconCocoaImpl(taskBarIcon) { m_originalDockIcon = nil; - wxASSERT_MSG(!sm_dockIcon,"You should never have more than one dock icon!"); + wxASSERT_MSG(!sm_dockIcon, wxT("You should never have more than one dock icon!")); sm_dockIcon = this; } @@ -310,8 +311,9 @@ bool wxTaskBarIconCustomStatusItemImpl::RemoveIcon() bool wxTaskBarIconCustomStatusItemImpl::PopupMenu(wxMenu *menu) { - wxASSERT(menu); - menu->SetInvokingWindow(m_iconWindow); + wxCHECK_MSG(menu, false, "can't popup a NULL menu"); + + wxMenuInvokingWindowSetter setInvokingWin(*menu, m_iconWindow); menu->UpdateUI(); if([m_cocoaNSStatusItem respondsToSelector:@selector(popUpStatusItemMenu:)]) @@ -327,7 +329,6 @@ bool wxTaskBarIconCustomStatusItemImpl::PopupMenu(wxMenu *menu) eventNumber:0 clickCount:1 pressure:0.0]; [NSMenu popUpContextMenu:menu->GetNSMenu() withEvent:nsevent forView:m_iconWindow->GetNSView()]; } - menu->SetInvokingWindow(NULL); return true; } @@ -389,7 +390,7 @@ void wxTaskBarIconWindowCustom::OnPaint(wxPaintEvent &event) // This neatly solves the problem of DLL separation. If the wxAdvanced // library (which this file is part of) is loaded then this category is -// defined and we get dock menu behavior without app.mm ever having to +// defined and we get dock menu behaviour without app.mm ever having to // know we exist. C++ did sucketh so. :-) @interface wxNSApplicationDelegate(wxTaskBarIconNSApplicationDelegateCategory)