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/. */
5 
6 #ifndef nsStandaloneNativeMenu_h_
7 #define nsStandaloneNativeMenu_h_
8 
9 #include "nsMenuGroupOwnerX.h"
10 #include "nsMenuX.h"
11 #include "nsIStandaloneNativeMenu.h"
12 
13 class nsStandaloneNativeMenu : public nsMenuGroupOwnerX, public nsIStandaloneNativeMenu
14 {
15 public:
16   nsStandaloneNativeMenu();
17 
18   NS_DECL_ISUPPORTS_INHERITED
19   NS_DECL_NSISTANDALONENATIVEMENU
20 
21   // nsMenuObjectX
MenuObjectType()22   nsMenuObjectTypeX MenuObjectType() override { return eStandaloneNativeMenuObjectType; }
NativeData()23   void * NativeData() override { return mMenu != nullptr ? mMenu->NativeData() : nullptr; }
24   virtual void IconUpdated() override;
25 
GetMenuXObject()26   nsMenuX * GetMenuXObject() { return mMenu; }
27 
28   // If this menu is the menu of a system status bar item (NSStatusItem),
29   // let the menu know about the status item so that it can propagate
30   // any icon changes to the status item.
31   void SetContainerStatusBarItem(NSStatusItem* aItem);
32 
33 protected:
34   virtual ~nsStandaloneNativeMenu();
35 
36   nsMenuX * mMenu;
37   NSStatusItem* mContainerStatusBarItem;
38 };
39 
40 #endif
41