+ //
+ // NB: Here we have to perform a deep copy of the menu,
+ // copying each and every menu item from menu to m_pMenu.
+ // Other implementations use wxWindow::PopupMenu here,
+ // which idle execution until the user selects something,
+ // but since the mac handles this internally, we can't -
+ // and have no way at all to idle it while the dock menu
+ // is being shown before menu goes out of scope (it may
+ // not be on the heap, and may expire right after this function
+ // is done - we need it to last until the carbon event is triggered -
+ // that's when the user right clicks).
+ //
+ // Also, since there is no equal (assignment) operator
+ // on either wxMenu or wxMenuItem, we have to do all the
+ // dirty work ourselves.
+ //
+
+ // perform a deep copy of the menu
+ wxMenuItemList& theList = menu->GetMenuItems();
+ wxMenuItemList::compatibility_iterator theNode = theList.GetFirst();
+
+ // create the main menu
+ wxMenu* m_pMenu = new wxMenu(menu->GetTitle());
+
+ while (theNode != NULL)
+ {
+ wxMenuItem* theItem = theNode->GetData();
+ m_pMenu->Append(
+ new wxMenuItem(
+ m_pMenu, // parent menu
+ theItem->GetId(), // id
+ theItem->GetText(), // text label
+ theItem->GetHelp(), // status bar help string
+ theItem->GetKind(), // menu flags - checkable, separator, etc.
+ wxDeepCopyMenu(theItem->GetSubMenu()) // submenu
+ ));
+ theNode = theNode->GetNext();
+ }
+
+ return m_pMenu;
+}
+
+//-----------------------------------------------------------------------------
+// wxDockTaskBarIcon ctor
+//
+// Initializes the dock implementation of wxTaskBarIcon.
+//
+// Here we create some mac-specific event handlers and UPPs.
+//-----------------------------------------------------------------------------
+wxDockTaskBarIcon::wxDockTaskBarIcon(wxTaskBarIcon* parent)
+ : wxTaskBarIconImpl(parent),
+ m_eventHandlerRef(NULL), m_pMenu(NULL),
+ m_theLastMenu(GetApplicationDockTileMenu()), m_iconAdded(false)