Files
sousa-gecko/widget/cocoa/nsMenuUtilsX.h
T
Emilio Cobos Álvarez 2861287f6d Bug 2054311 - Sort headers in widget/. r=stransky,win-reviewers,geckoview-reviewers,gstoll,owlish
Autogenerated with:

    cp dom/.clang-format widget/ && mach format widget/**.{cpp,h,mm}

Manual changes:

 * Had to add a manual override in nsWaylandDisplay.h /
   DMABufFormats.cpp to include mozwayland before protocols.
 * Missing includes in nsWindowWayland/X11.h / nsDragService.
 * nsFilePicker missed an nsWindow forward declaration.
 * Various overrides in widget/windows because windows headers are order
   dependent.

Differential Revision: https://phabricator.services.mozilla.com/D311688
2026-07-14 16:17:37 +00:00

54 lines
2.1 KiB
Objective-C

/* 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 nsMenuUtilsX_h_
#define nsMenuUtilsX_h_
#include "nsStringFwd.h"
#include "nscore.h"
#import <Cocoa/Cocoa.h>
class nsIContent;
class nsMenuBarX;
class nsMenuX;
// Namespace containing utility functions used in our native menu
// implementation.
namespace nsMenuUtilsX {
void DispatchCommandTo(nsIContent* aTargetContent,
NSEventModifierFlags aModifierFlags, int16_t aButton);
NSString* GetTruncatedCocoaLabel(const nsString& itemLabel);
uint8_t GeckoModifiersForNodeAttribute(const nsString& modifiersAttribute);
unsigned int MacModifiersForGeckoModifiers(uint8_t geckoModifiers);
nsMenuBarX* GetHiddenWindowMenuBar(); // returned object is not retained
bool NodeIsHiddenOrCollapsed(nsIContent* aContent);
NSAttributedString* AttributedStringForContent(nsIContent* aContent,
NSString* aLabel);
// Find the menu item by following the path aLocationString from aRootMenu.
// aLocationString is a '|'-separated list of integers, where each integer is
// the index of the menu item in the menu.
// aIsMenuBar needs to be true if aRootMenu is the app's mainMenu, so that the
// app menu can be skipped during the search.
NSMenuItem* NativeMenuItemWithLocation(NSMenu* aRootMenu,
NSString* aLocationString,
bool aIsMenuBar);
// Traverse the menu tree and check that there are no cycles or NSMenu(Item)
// objects that are used more than once. If inconsistencies are found, these
// functions crash the process.
void CheckNativeMenuConsistency(NSMenu* aMenu);
void CheckNativeMenuConsistency(NSMenuItem* aMenuItem);
// Print out debugging information about the native menu tree structure.
void DumpNativeMenu(NSMenu* aMenu);
void DumpNativeMenuItem(NSMenuItem* aMenuItem);
extern bool gIsSynchronouslyActivatingNativeMenuItemDuringTest;
} // namespace nsMenuUtilsX
#endif // nsMenuUtilsX_h_