1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/cocoa/nsMenuBaseX.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsMenuBaseX_h_ 1.10 +#define nsMenuBaseX_h_ 1.11 + 1.12 +#import <Foundation/Foundation.h> 1.13 + 1.14 +#include "nsCOMPtr.h" 1.15 +#include "nsIContent.h" 1.16 + 1.17 +enum nsMenuObjectTypeX { 1.18 + eMenuBarObjectType, 1.19 + eSubmenuObjectType, 1.20 + eMenuItemObjectType, 1.21 + eStandaloneNativeMenuObjectType, 1.22 +}; 1.23 + 1.24 +// All menu objects subclass this. 1.25 +// Menu bars are owned by their top-level nsIWidgets. 1.26 +// All other objects are memory-managed based on the DOM. 1.27 +// Content removal deletes them immediately and nothing else should. 1.28 +// Do not attempt to hold strong references to them or delete them. 1.29 +class nsMenuObjectX 1.30 +{ 1.31 +public: 1.32 + virtual ~nsMenuObjectX() { } 1.33 + virtual nsMenuObjectTypeX MenuObjectType()=0; 1.34 + virtual void* NativeData()=0; 1.35 + nsIContent* Content() { return mContent; } 1.36 + 1.37 +protected: 1.38 + nsCOMPtr<nsIContent> mContent; 1.39 +}; 1.40 + 1.41 + 1.42 +// 1.43 +// Object stored as "representedObject" for all menu items 1.44 +// 1.45 + 1.46 +class nsMenuGroupOwnerX; 1.47 + 1.48 +@interface MenuItemInfo : NSObject 1.49 +{ 1.50 + nsMenuGroupOwnerX * mMenuGroupOwner; 1.51 +} 1.52 + 1.53 +- (id) initWithMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner; 1.54 +- (nsMenuGroupOwnerX *) menuGroupOwner; 1.55 +- (void) setMenuGroupOwner:(nsMenuGroupOwnerX *)aMenuGroupOwner; 1.56 + 1.57 +@end 1.58 + 1.59 + 1.60 +// Special command IDs that we know Mac OS X does not use for anything else. 1.61 +// We use these in place of carbon's IDs for these commands in order to stop 1.62 +// Carbon from messing with our event handlers. See bug 346883. 1.63 + 1.64 +enum { 1.65 + eCommand_ID_About = 1, 1.66 + eCommand_ID_Prefs = 2, 1.67 + eCommand_ID_Quit = 3, 1.68 + eCommand_ID_HideApp = 4, 1.69 + eCommand_ID_HideOthers = 5, 1.70 + eCommand_ID_ShowAll = 6, 1.71 + eCommand_ID_Update = 7, 1.72 + eCommand_ID_Last = 8 1.73 +}; 1.74 + 1.75 +#endif // nsMenuBaseX_h_