+private:
+ wxTaskBarIconImpl *m_impl;
+};
+
+class wxDockTaskBarIcon : public wxTaskBarIconImpl
+{
+public:
+ wxDockTaskBarIcon(wxTaskBarIcon* parent);
+ virtual ~wxDockTaskBarIcon();
+
+ virtual bool IsIconInstalled() const;
+ virtual bool SetIcon(const wxIcon& icon, const wxString& tooltip);
+ virtual bool RemoveIcon();
+ virtual bool PopupMenu(wxMenu *menu);
+
+ wxMenu* DoCreatePopupMenu();
+
+ EventHandlerRef m_eventHandlerRef;
+ EventHandlerUPP m_eventupp;
+ wxWindow *m_eventWindow;
+ wxMenu *m_pMenu;
+ MenuRef m_theLastMenu;
+ bool m_iconAdded;
+};
+
+// Forward declarations for utility functions for dock implementation
+pascal OSStatus wxDockEventHandler(
+ EventHandlerCallRef inHandlerCallRef,
+ EventRef inEvent, void* pData );
+wxMenu * wxDeepCopyMenu( wxMenu *menu );
+
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// wxTaskBarIconImpl
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+wxTaskBarIconImpl::wxTaskBarIconImpl(wxTaskBarIcon* parent)
+ : m_parent(parent), m_menuEventWindow(new wxTaskBarIconWindow(this))
+{
+}
+
+wxTaskBarIconImpl::~wxTaskBarIconImpl()
+{
+ delete m_menuEventWindow;
+}
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// wxDockTaskBarIcon
+//
+// OS X Dock implementation of wxTaskBarIcon using Carbon
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//-----------------------------------------------------------------------------
+// wxDockEventHandler
+//
+// This is the global Mac/Carbon event handler for the dock.
+// We need this for two reasons:
+// 1) To handle wxTaskBarIcon menu events (see below for why)
+// 2) To handle events from the dock when it requests a menu
+//-----------------------------------------------------------------------------
+pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
+ EventRef inEvent, void *pData )
+{
+ // Get the parameters we want from the event
+ wxDockTaskBarIcon* pTB = (wxDockTaskBarIcon*) pData;
+ const UInt32 eventClass = GetEventClass(inEvent);
+ const UInt32 eventKind = GetEventKind(inEvent);
+
+ // Handle wxTaskBar menu events (note that this is a global event handler
+ // so it will actually get called by all commands/menus)
+ if ((eventClass == kEventClassCommand) && (eventKind == kEventCommandProcess))