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