Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #ifndef nsMenuBaseX_h_
7 #define nsMenuBaseX_h_
9 #import <Foundation/Foundation.h>
11 #include "nsCOMPtr.h"
12 #include "nsIContent.h"
14 enum nsMenuObjectTypeX {
15 eMenuBarObjectType,
16 eSubmenuObjectType,
17 eMenuItemObjectType,
18 eStandaloneNativeMenuObjectType,
19 };
21 // All menu objects subclass this.
22 // Menu bars are owned by their top-level nsIWidgets.
23 // All other objects are memory-managed based on the DOM.
24 // Content removal deletes them immediately and nothing else should.
25 // Do not attempt to hold strong references to them or delete them.
26 class nsMenuObjectX
27 {
28 public:
29 virtual ~nsMenuObjectX() { }
30 virtual nsMenuObjectTypeX MenuObjectType()=0;
31 virtual void* NativeData()=0;
32 nsIContent* Content() { return mContent; }
34 protected:
35 nsCOMPtr<nsIContent> mContent;
36 };
39 //
40 // Object stored as "representedObject" for all menu items
41 //
43 class nsMenuGroupOwnerX;
45 @interface MenuItemInfo : NSObject
46 {
47 nsMenuGroupOwnerX * mMenuGroupOwner;
48 }
50 - (id) initWithMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner;
51 - (nsMenuGroupOwnerX *) menuGroupOwner;
52 - (void) setMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner;
54 @end
57 // Special command IDs that we know Mac OS X does not use for anything else.
58 // We use these in place of carbon's IDs for these commands in order to stop
59 // Carbon from messing with our event handlers. See bug 346883.
61 enum {
62 eCommand_ID_About = 1,
63 eCommand_ID_Prefs = 2,
64 eCommand_ID_Quit = 3,
65 eCommand_ID_HideApp = 4,
66 eCommand_ID_HideOthers = 5,
67 eCommand_ID_ShowAll = 6,
68 eCommand_ID_Update = 7,
69 eCommand_ID_Last = 8
70 };
72 #endif // nsMenuBaseX_h_