// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "taskbar.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef wxHAS_TASK_BAR_ICON
#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;
// ============================================================================
protected:
inline wxMenu* CreatePopupMenu()
{ wxASSERT(m_taskBarIcon);
- m_taskBarIcon->CreatePopupMenu();
+ return m_taskBarIcon->CreatePopupMenu();
}
wxTaskBarIcon *m_taskBarIcon;
wxTaskBarIconWindow *m_iconWindow;
: 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;
}
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:)])
eventNumber:0 clickCount:1 pressure:0.0];
[NSMenu popUpContextMenu:menu->GetNSMenu() withEvent:nsevent forView:m_iconWindow->GetNSView()];
}
- menu->SetInvokingWindow(NULL);
return true;
}