+ wxMenu * CreatePopupMenu()
+ { return m_parent->CreatePopupMenu(); }
+
+ wxTaskBarIcon *m_parent;
+ class wxTaskBarIconWindow *m_menuEventWindow;
+
+ DECLARE_NO_COPY_CLASS(wxTaskBarIconImpl)
+};
+
+//-----------------------------------------------------------------------------
+//
+// wxTaskBarIconWindow
+//
+// 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, wxID_ANY, wxEmptyString), 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;
+};
+
+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))