1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #import <Cocoa/Cocoa.h>
8 #include "nsMacDockSupport.h"
9 #include "nsObjCExceptions.h"
11 NS_IMPL_ISUPPORTS1(nsMacDockSupport, nsIMacDockSupport)
14 nsMacDockSupport::GetDockMenu(nsIStandaloneNativeMenu ** aDockMenu)
19 return mDockMenu->QueryInterface(NS_GET_IID(nsIStandaloneNativeMenu),
20 reinterpret_cast<void **>(aDockMenu));
25 nsMacDockSupport::SetDockMenu(nsIStandaloneNativeMenu * aDockMenu)
28 mDockMenu = do_QueryInterface(aDockMenu, &rv);
33 nsMacDockSupport::ActivateApplication(bool aIgnoreOtherApplications)
35 NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
37 [[NSApplication sharedApplication] activateIgnoringOtherApps:aIgnoreOtherApplications];
40 NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
44 nsMacDockSupport::SetBadgeText(const nsAString& aBadgeText)
46 NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
48 NSDockTile *tile = [[NSApplication sharedApplication] dockTile];
49 mBadgeText = aBadgeText;
50 if (aBadgeText.IsEmpty())
51 [tile setBadgeLabel: nil];
53 [tile setBadgeLabel:[NSString stringWithCharacters:mBadgeText.get() length:mBadgeText.Length()]];
56 NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
60 nsMacDockSupport::GetBadgeText(nsAString& aBadgeText)
62 aBadgeText = mBadgeText;