X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/489468feaa08b8f504735eecca522fb8d0f825d2..71a09c3579dd5cb4cd8fa7fdc143561cbff74e12:/src/osx/carbon/taskbar.cpp diff --git a/src/osx/carbon/taskbar.cpp b/src/osx/carbon/taskbar.cpp index 9bb02f5124..f8a8c4821e 100644 --- a/src/osx/carbon/taskbar.cpp +++ b/src/osx/carbon/taskbar.cpp @@ -1,10 +1,9 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/taskbar.cpp +// Name: src/osx/carbon/taskbar.cpp // Purpose: wxTaskBarIcon // Author: Ryan Norton // Modified by: // Created: 09/25/2004 -// RCS-ID: $Id$ // Copyright: (c) 2004 Ryan Norton // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -22,7 +21,7 @@ #include "wx/icon.h" #endif -#include "wx/mac/private.h" +#include "wx/osx/private.h" class wxTaskBarIconImpl { @@ -41,7 +40,7 @@ public: wxTaskBarIcon *m_parent; class wxTaskBarIconWindow *m_menuEventWindow; - DECLARE_NO_COPY_CLASS(wxTaskBarIconImpl) + wxDECLARE_NO_COPY_CLASS(wxTaskBarIconImpl); }; //----------------------------------------------------------------------------- @@ -60,7 +59,7 @@ public: : wxTopLevelWindow(NULL, wxID_ANY, wxEmptyString), m_impl(impl) { Connect( - -1, wxEVT_COMMAND_MENU_SELECTED, + -1, wxEVT_MENU, wxCommandEventHandler(wxTaskBarIconWindow::OnMenuEvent) ); } @@ -141,7 +140,7 @@ wxDockEventHandler(EventHandlerCallRef WXUNUSED(inHandlerCallRef), wxDockTaskBarIcon* pTB = (wxDockTaskBarIcon*) pData; const UInt32 eventClass = GetEventClass(inEvent); const UInt32 eventKind = GetEventKind(inEvent); - + OSStatus err = eventNotHandledErr; // Handle wxTaskBar menu events (note that this is a global event handler @@ -186,9 +185,15 @@ wxDockEventHandler(EventHandlerCallRef WXUNUSED(inHandlerCallRef), if (item && itemMenu ) { if ( eventKind == kEventCommandProcess ) - err = itemMenu->MacHandleCommandProcess( item, id ); + { + if ( itemMenu->HandleCommandProcess( item ) ) + err = noErr; + } else if ( eventKind == kEventCommandUpdateStatus ) - err = itemMenu->MacHandleCommandUpdateStatus( item, id ); + { + if ( itemMenu->HandleCommandUpdateStatus( item ) ) + err = noErr; + } } } } @@ -235,7 +240,7 @@ wxDockEventHandler(EventHandlerCallRef WXUNUSED(inHandlerCallRef), // Performs a top-to-bottom copy of the input menu and all of its // submenus. // -// This is mostly needed for 2.4 compatability. However wxPython and others +// This is mostly needed for 2.4 compatibility. However wxPython and others // still use this way of setting the taskbarmenu. //----------------------------------------------------------------------------- wxMenu * wxDeepCopyMenu( wxMenu *menu ) @@ -341,8 +346,7 @@ wxMenu * wxDockTaskBarIcon::DoCreatePopupMenu() if (theNewMenu) { - if (m_pMenu) - delete m_pMenu; + delete m_pMenu; m_pMenu = theNewMenu; m_pMenu->SetInvokingWindow(m_menuEventWindow); } @@ -376,7 +380,7 @@ bool wxDockTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& WXUNUSED(too // convert the wxIcon into a wxBitmap so we can perform some // wxBitmap operations with it wxBitmap bmp( icon ); - wxASSERT( bmp.Ok() ); + wxASSERT( bmp.IsOk() ); // get the CGImageRef for the wxBitmap: // OSX builds only, but then the dock only exists in OSX @@ -404,11 +408,7 @@ bool wxDockTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& WXUNUSED(too //----------------------------------------------------------------------------- bool wxDockTaskBarIcon::RemoveIcon() { - if (m_pMenu) - { - delete m_pMenu; - m_pMenu = NULL; - } + wxDELETE(m_pMenu); // restore old icon to the dock OSStatus err = RestoreApplicationDockTileImage(); @@ -436,8 +436,7 @@ bool wxDockTaskBarIcon::PopupMenu(wxMenu *menu) { wxASSERT(menu != NULL); - if (m_pMenu) - delete m_pMenu; + delete m_pMenu; // start copy of menu m_pMenu = wxDeepCopyMenu(menu); @@ -463,14 +462,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler) // // Note that we only support DOCK currently as others require cocoa and // also some require hacks and other such things. (MenuExtras are -// actually seperate programs that also require a special undocumented id +// actually separate programs that also require a special undocumented id // hack and other such fun stuff). //----------------------------------------------------------------------------- -wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType nType) +wxTaskBarIcon::wxTaskBarIcon(wxTaskBarIconType WXUNUSED_UNLESS_DEBUG(nType)) { wxASSERT_MSG( - nType == DOCK, - wxT("Only the DOCK implementation of wxTaskBarIcon on Mac-Carbon is currently supported!") ); + nType == wxTBI_DOCK, + wxT("Only the wxTBI_DOCK implementation of wxTaskBarIcon on Mac-Carbon is currently supported!") ); m_impl = new wxDockTaskBarIcon(this); }