/////////////////////////////////////////////////////////////////////////
-// File: src/cocoa/taskbar.mm
+// File: src/osx/cocoa/taskbar.mm
// Purpose: Implements wxTaskBarIcon class
// Author: David Elliott
// Modified by:
/////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
-#ifdef wxUSE_TASKBARICON
+#if wxUSE_TASKBARICON
#ifndef WX_PRECOMP
#include "wx/menu.h"
#include "wx/taskbar.h"
-#import <AppKit/NSApplication.h>
-#import <AppKit/NSImage.h>
-#import <AppKit/NSMenu.h>
-#import <AppKit/NSMenuItem.h>
-#import <AppKit/NSStatusBar.h>
-#import <AppKit/NSStatusItem.h>
-#import <AppKit/NSView.h>
-#import <Foundation/NSArray.h>
-#import <Foundation/NSEnumerator.h>
-
-#import <AppKit/NSEvent.h>
-#import <AppKit/NSWindow.h>
-#import <AppKit/NSGraphicsContext.h>
-
-#include "wx/cocoa/NSApplication.h"
-#include "wx/cocoa/autorelease.h"
+#include "wx/osx/private.h"
// A category for methods that are only present in Panther's SDK
@interface NSStatusItem(wxNSStatusItemPrePantherCompatibility)
inline wxTaskBarIcon* GetTaskBarIcon() { return m_taskBarIcon; }
wxMenu * CreatePopupMenu()
{ return m_taskBarIcon->CreatePopupMenu(); }
-
- DECLARE_NO_COPY_CLASS(wxTaskBarIconImpl)
-
+
+ wxDECLARE_NO_COPY_CLASS(wxTaskBarIconImpl);
+
protected:
wxTaskBarIcon *m_taskBarIcon;
wxTaskBarIconWindow *m_iconWindow;
// Operations
bool wxTaskBarIcon::IsIconInstalled() const
-{
+{
return false;
}
return (WX_NSMenu)dockMenu->GetHMenu();
}
-bool wxTaskBarIconDockImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
+bool wxTaskBarIconDockImpl::SetIcon(const wxIcon& WXUNUSED(icon), const wxString& WXUNUSED(tooltip))
{
- wxAutoNSAutoreleasePool pool;
+ wxMacAutoreleasePool pool;
m_originalDockIcon = [[[NSApplication sharedApplication] applicationIconImage] retain];
//[[NSApplication sharedApplication] setApplicationIconImage:icon.GetNSImage()];
return true;
return true;
}
-bool wxTaskBarIconDockImpl::PopupMenu(wxMenu *menu)
+bool wxTaskBarIconDockImpl::PopupMenu(wxMenu *WXUNUSED(menu))
{
wxFAIL_MSG(wxT("You cannot force the Dock icon menu to popup"));
return false;
{
}
-bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxString& tooltip)
+bool wxTaskBarIconCustomStatusItemImpl::SetIcon(const wxIcon& icon, const wxString& WXUNUSED(tooltip))
{
- wxAutoNSAutoreleasePool pool;
+ wxMacAutoreleasePool pool;
if(!m_cocoaNSStatusItem)
{
m_cocoaNSStatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
m_taskBarIconImpl->GetTaskBarIcon()->ProcessEvent(tbiEvent);
}
-void wxTaskBarIconWindowCustom::OnPaint(wxPaintEvent &event)
+void wxTaskBarIconWindowCustom::OnPaint(wxPaintEvent &WXUNUSED(event))
{
wxPaintDC dc(this);
// FIXME: This is a temporary hack until we can see real icons
dc.DrawIcon(m_icon,0,0);
}
-// ============================================================================
-// wxTaskBarIconNSApplicationDelegateCategory
-// ============================================================================
-
-// This neatly solves the problem of DLL separation. If the wxAdvanced
-// library (which this file is part of) is loaded then this category is
-// defined and we get dock menu behavior without app.mm ever having to
-// know we exist. C++ did sucketh so. :-)
-
-@interface wxNSApplicationDelegate(wxTaskBarIconNSApplicationDelegateCategory)
-- (NSMenu*)applicationDockMenu:(NSApplication *)sender;
-@end
-
-@implementation wxNSApplicationDelegate(wxTaskBarIconNSApplicationDelegateCategory)
-- (NSMenu*)applicationDockMenu:(NSApplication *)sender
-{
- return wxTaskBarIconDockImpl::CocoaGetDockNSMenu();
-}
-@end
-
#endif //def wxHAS_TASK_BAR_ICON