widget/cocoa/nsMenuBaseX.h

branch
TOR_BUG_9701
changeset 10
ac0c01689b40
equal deleted inserted replaced
-1:000000000000 0:ec19d4fa926f
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/. */
5
6 #ifndef nsMenuBaseX_h_
7 #define nsMenuBaseX_h_
8
9 #import <Foundation/Foundation.h>
10
11 #include "nsCOMPtr.h"
12 #include "nsIContent.h"
13
14 enum nsMenuObjectTypeX {
15 eMenuBarObjectType,
16 eSubmenuObjectType,
17 eMenuItemObjectType,
18 eStandaloneNativeMenuObjectType,
19 };
20
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; }
33
34 protected:
35 nsCOMPtr<nsIContent> mContent;
36 };
37
38
39 //
40 // Object stored as "representedObject" for all menu items
41 //
42
43 class nsMenuGroupOwnerX;
44
45 @interface MenuItemInfo : NSObject
46 {
47 nsMenuGroupOwnerX * mMenuGroupOwner;
48 }
49
50 - (id) initWithMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner;
51 - (nsMenuGroupOwnerX *) menuGroupOwner;
52 - (void) setMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner;
53
54 @end
55
56
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.
60
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 };
71
72 #endif // nsMenuBaseX_h_

mercurial