]> git.saurik.com Git - wxWidgets.git/commitdiff
cleanups, proper event handling/cleanup
authorRyan Norton <wxprojects@comcast.net>
Sun, 26 Sep 2004 08:27:15 +0000 (08:27 +0000)
committerRyan Norton <wxprojects@comcast.net>
Sun, 26 Sep 2004 08:27:15 +0000 (08:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/taskbarosx.h
src/mac/carbon/taskbar.cpp

index 4576eabc5e4e5cc5e9bb444b678b6def1accc43b..2a31ec26de3620afe4db788fa3056f28e46272c7 100644 (file)
@@ -52,6 +52,7 @@ public:
 protected:
     wxTaskBarIconType m_nType;
     void* m_pEvent;
+    void* m_pEventHandlerRef;
     wxMenu* m_pMenu;
     bool m_iconAdded;
         
index 2d78d89fdc2716fdb54d69a00d97583f998f2151..0eeca244c57429ab9aa7c143deb7b32de4db9c38 100644 (file)
@@ -32,7 +32,7 @@
 //TODO:  Implement  Apple Software Guidelines - show the top window it it's not shown,
 //and force it to be unminimized - and all unminimized windows should be brought to 
 //the front
-//http://developer.apple.com/documentation/MacOSX/Conceptual/AppleSWDesign/MacOSXEnvironment/chapter_6_section_4.html
+//
 //TODO:
 IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
 
@@ -114,22 +114,26 @@ pascal OSStatus wxDockEventHandler(       EventHandlerCallRef inHandlerCallRef,
 DEFINE_ONE_SHOT_HANDLER_GETTER( wxDockEventHandler );
 
 wxTaskBarIcon::wxTaskBarIcon(const wxTaskBarIconType& nType)
-    : m_nType(nType), m_pEvent(NULL), m_pMenu(NULL), m_iconAdded(false)
+    : m_nType(nType), m_pEvent(NULL), m_pEventHandlerRef(NULL), m_pMenu(NULL), m_iconAdded(false)
 {
     //Register the events that will return the dock menu
        EventTypeSpec tbEventList[] = { { kEventClassCommand, kEventProcessCommand },
                                     { kEventClassApplication, kEventAppGetDockTileMenu } };
        
-       OSStatus err = InstallApplicationEventHandler(
+#ifdef __WXDEBUG__
+       OSStatus err =
+#endif
+      InstallApplicationEventHandler(
             GetwxDockEventHandlerUPP(),
             GetEventTypeCount(tbEventList), tbEventList, 
-                       this, NULL);
+                       this, (&(EventHandlerRef&)m_pEventHandlerRef));
                        
        wxASSERT(err == noErr);
 }
+
 wxTaskBarIcon::~wxTaskBarIcon()
 {
-       //TODO:uninstall event handler
+    RemoveEventHandler((EventHandlerRef&)m_pEventHandlerRef);
 }
 
 void wxTaskBarIcon::SetInternalEvent(void* pEvent)
@@ -163,6 +167,8 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
     #else
     //TODO: (IT WORKS!)  Make work without mask - mayby by using a wxDC?
     
+    wxASSERT(icon.GetMask() != NULL);
+    
        CGImageRef pImage;
        //create the icon from the bitmap and mask bitmap contained within
        OSStatus err = CreateCGImageFromPixMaps(