+// Event handler for menus
+// NB: Since wxWindows in mac HAVE to have parents we need this to be
+// a top level window...
+//-----------------------------------------------------------------------------
+
+class wxTaskBarIconWindow : public wxTopLevelWindow
+{
+public:
+ wxTaskBarIconWindow(wxTaskBarIconImpl* impl)
+ : wxTopLevelWindow(NULL, -1, wxT("")), m_impl(impl)
+ {
+ Connect(-1, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(wxTaskBarIconWindow::OnMenuEvent)
+ );
+ }
+
+ void OnMenuEvent(wxCommandEvent& event)
+ {
+ m_impl->m_parent->ProcessEvent(event);
+ }
+
+private:
+ wxTaskBarIconImpl* m_impl;
+};
+
+//-----------------------------------------------------------------------------
+//
+// wxDockBarIconImpl
+//
+//-----------------------------------------------------------------------------
+
+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);
+
+
+//=============================================================================
+//
+// Implementation
+//
+//=============================================================================
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+// wxTaskBarIconImpl
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+//-----------------------------------------------------------------------------
+// wxTaskBarIconImpl Constructor
+//
+// Initializes members and creates the event window
+//-----------------------------------------------------------------------------
+wxTaskBarIconImpl::wxTaskBarIconImpl(wxTaskBarIcon* parent)
+ : m_parent(parent), m_menuEventWindow(new wxTaskBarIconWindow(this))
+{
+}