cleanups, proper event handling/cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -52,6 +52,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
wxTaskBarIconType m_nType;
|
wxTaskBarIconType m_nType;
|
||||||
void* m_pEvent;
|
void* m_pEvent;
|
||||||
|
void* m_pEventHandlerRef;
|
||||||
wxMenu* m_pMenu;
|
wxMenu* m_pMenu;
|
||||||
bool m_iconAdded;
|
bool m_iconAdded;
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
//TODO: Implement Apple Software Guidelines - show the top window it it's not shown,
|
//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
|
//and force it to be unminimized - and all unminimized windows should be brought to
|
||||||
//the front
|
//the front
|
||||||
//http://developer.apple.com/documentation/MacOSX/Conceptual/AppleSWDesign/MacOSXEnvironment/chapter_6_section_4.html
|
//
|
||||||
//TODO:
|
//TODO:
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxTaskBarIcon, wxEvtHandler)
|
||||||
|
|
||||||
@@ -114,22 +114,26 @@ pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef,
|
|||||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxDockEventHandler );
|
DEFINE_ONE_SHOT_HANDLER_GETTER( wxDockEventHandler );
|
||||||
|
|
||||||
wxTaskBarIcon::wxTaskBarIcon(const wxTaskBarIconType& nType)
|
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
|
//Register the events that will return the dock menu
|
||||||
EventTypeSpec tbEventList[] = { { kEventClassCommand, kEventProcessCommand },
|
EventTypeSpec tbEventList[] = { { kEventClassCommand, kEventProcessCommand },
|
||||||
{ kEventClassApplication, kEventAppGetDockTileMenu } };
|
{ kEventClassApplication, kEventAppGetDockTileMenu } };
|
||||||
|
|
||||||
OSStatus err = InstallApplicationEventHandler(
|
#ifdef __WXDEBUG__
|
||||||
|
OSStatus err =
|
||||||
|
#endif
|
||||||
|
InstallApplicationEventHandler(
|
||||||
GetwxDockEventHandlerUPP(),
|
GetwxDockEventHandlerUPP(),
|
||||||
GetEventTypeCount(tbEventList), tbEventList,
|
GetEventTypeCount(tbEventList), tbEventList,
|
||||||
this, NULL);
|
this, (&(EventHandlerRef&)m_pEventHandlerRef));
|
||||||
|
|
||||||
wxASSERT(err == noErr);
|
wxASSERT(err == noErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTaskBarIcon::~wxTaskBarIcon()
|
wxTaskBarIcon::~wxTaskBarIcon()
|
||||||
{
|
{
|
||||||
//TODO:uninstall event handler
|
RemoveEventHandler((EventHandlerRef&)m_pEventHandlerRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTaskBarIcon::SetInternalEvent(void* pEvent)
|
void wxTaskBarIcon::SetInternalEvent(void* pEvent)
|
||||||
@@ -163,6 +167,8 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
|
|||||||
#else
|
#else
|
||||||
//TODO: (IT WORKS!) Make work without mask - mayby by using a wxDC?
|
//TODO: (IT WORKS!) Make work without mask - mayby by using a wxDC?
|
||||||
|
|
||||||
|
wxASSERT(icon.GetMask() != NULL);
|
||||||
|
|
||||||
CGImageRef pImage;
|
CGImageRef pImage;
|
||||||
//create the icon from the bitmap and mask bitmap contained within
|
//create the icon from the bitmap and mask bitmap contained within
|
||||||
OSStatus err = CreateCGImageFromPixMaps(
|
OSStatus err = CreateCGImageFromPixMaps(
|
||||||
|
Reference in New Issue
Block a user