2010-02-07 19:38:14 -08:00
|
|
|
/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-02-07 19:38:14 -08:00
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
#include "nsMacDockSupport.h"
|
2010-03-04 16:10:42 -08:00
|
|
|
#include "nsObjCExceptions.h"
|
2010-02-07 19:38:14 -08:00
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS1(nsMacDockSupport, nsIMacDockSupport)
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMacDockSupport::GetDockMenu(nsIStandaloneNativeMenu ** aDockMenu)
|
|
|
|
{
|
2012-07-30 07:20:58 -07:00
|
|
|
*aDockMenu = nullptr;
|
2010-02-07 19:38:14 -08:00
|
|
|
|
|
|
|
if (mDockMenu)
|
|
|
|
return mDockMenu->QueryInterface(NS_GET_IID(nsIStandaloneNativeMenu),
|
|
|
|
reinterpret_cast<void **>(aDockMenu));
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMacDockSupport::SetDockMenu(nsIStandaloneNativeMenu * aDockMenu)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
mDockMenu = do_QueryInterface(aDockMenu, &rv);
|
|
|
|
return rv;
|
|
|
|
}
|
2010-03-04 16:10:42 -08:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2011-09-28 23:19:26 -07:00
|
|
|
nsMacDockSupport::ActivateApplication(bool aIgnoreOtherApplications)
|
2010-03-04 16:10:42 -08:00
|
|
|
{
|
|
|
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
|
|
|
|
|
|
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:aIgnoreOtherApplications];
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
|
|
|
}
|
2011-12-05 01:57:45 -08:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMacDockSupport::SetBadgeText(const nsAString& aBadgeText)
|
|
|
|
{
|
|
|
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
|
|
|
|
|
|
|
NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
|
|
|
|
mBadgeText = aBadgeText;
|
|
|
|
if (aBadgeText.IsEmpty())
|
|
|
|
[tile setBadgeLabel: nil];
|
|
|
|
else
|
|
|
|
[tile setBadgeLabel:[NSString stringWithCharacters:mBadgeText.get() length:mBadgeText.Length()]];
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsMacDockSupport::GetBadgeText(nsAString& aBadgeText)
|
|
|
|
{
|
|
|
|
aBadgeText = mBadgeText;
|
|
|
|
return NS_OK;
|
|
|
|
}
|