From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- widget/cocoa/nsMenuBaseX.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 widget/cocoa/nsMenuBaseX.h (limited to 'widget/cocoa/nsMenuBaseX.h') diff --git a/widget/cocoa/nsMenuBaseX.h b/widget/cocoa/nsMenuBaseX.h new file mode 100644 index 0000000000..ee8798ecc1 --- /dev/null +++ b/widget/cocoa/nsMenuBaseX.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsMenuBaseX_h_ +#define nsMenuBaseX_h_ + +#import + +#include "nsCOMPtr.h" +#include "nsIContent.h" + +enum nsMenuObjectTypeX { + eMenuBarObjectType, + eSubmenuObjectType, + eMenuItemObjectType, + eStandaloneNativeMenuObjectType, +}; + +// All menu objects subclass this. +// Menu bars are owned by their top-level nsIWidgets. +// All other objects are memory-managed based on the DOM. +// Content removal deletes them immediately and nothing else should. +// Do not attempt to hold strong references to them or delete them. +class nsMenuObjectX { + public: + virtual ~nsMenuObjectX() {} + virtual nsMenuObjectTypeX MenuObjectType() = 0; + virtual void* NativeData() = 0; + nsIContent* Content() { return mContent; } + + /** + * Called when an icon of a menu item somewhere in this menu has updated. + * Menu objects with parents need to propagate the notification to their + * parent. + */ + virtual void IconUpdated() {} + + protected: + nsCOMPtr mContent; +}; + +// +// Object stored as "representedObject" for all menu items +// + +class nsMenuGroupOwnerX; + +@interface MenuItemInfo : NSObject { + nsMenuGroupOwnerX* mMenuGroupOwner; +} + +- (id)initWithMenuGroupOwner:(nsMenuGroupOwnerX*)aMenuGroupOwner; +- (nsMenuGroupOwnerX*)menuGroupOwner; +- (void)setMenuGroupOwner:(nsMenuGroupOwnerX*)aMenuGroupOwner; + +@end + +// Special command IDs that we know Mac OS X does not use for anything else. +// We use these in place of carbon's IDs for these commands in order to stop +// Carbon from messing with our event handlers. See bug 346883. + +enum { + eCommand_ID_About = 1, + eCommand_ID_Prefs = 2, + eCommand_ID_Quit = 3, + eCommand_ID_HideApp = 4, + eCommand_ID_HideOthers = 5, + eCommand_ID_ShowAll = 6, + eCommand_ID_Update = 7, + eCommand_ID_TouchBar = 8, + eCommand_ID_Last = 9 +}; + +#endif // nsMenuBaseX_h_ -- cgit v1.2.3