Bug 1700051: part 28) Refactor `WordSplitState<T>::GetDOMWordSeparatorOffset` to...
[gecko.git] / widget / cocoa / nsMenuUtilsX.h
blob368246b1e697d223923b7a5c58fc2e674adb049a
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/. */
6 #ifndef nsMenuUtilsX_h_
7 #define nsMenuUtilsX_h_
9 #include "nscore.h"
10 #include "nsStringFwd.h"
12 #import <Cocoa/Cocoa.h>
14 class nsIContent;
15 class nsMenuBarX;
16 class nsMenuX;
18 // Namespace containing utility functions used in our native menu implementation.
19 namespace nsMenuUtilsX {
20 void DispatchCommandTo(nsIContent* aTargetContent, NSEventModifierFlags aModifierFlags);
21 NSString* GetTruncatedCocoaLabel(const nsString& itemLabel);
22 uint8_t GeckoModifiersForNodeAttribute(const nsString& modifiersAttribute);
23 unsigned int MacModifiersForGeckoModifiers(uint8_t geckoModifiers);
24 nsMenuBarX* GetHiddenWindowMenuBar(); // returned object is not retained
25 NSMenuItem* GetStandardEditMenuItem(); // returned object is not retained
26 bool NodeIsHiddenOrCollapsed(nsIContent* aContent);
28 // Find the menu item by following the path aLocationString from aRootMenu.
29 // aLocationString is a '|'-separated list of integers, where each integer is
30 // the index of the menu item in the menu.
31 // aIsMenuBar needs to be true if aRootMenu is the app's mainMenu, so that the
32 // app menu can be skipped during the search.
33 NSMenuItem* NativeMenuItemWithLocation(NSMenu* aRootMenu, NSString* aLocationString,
34 bool aIsMenuBar);
36 // Traverse the menu tree and check that there are no cycles or NSMenu(Item) objects that are used
37 // more than once. If inconsistencies are found, these functions crash the process.
38 void CheckNativeMenuConsistency(NSMenu* aMenu);
39 void CheckNativeMenuConsistency(NSMenuItem* aMenuItem);
41 // Print out debugging information about the native menu tree structure.
42 void DumpNativeMenu(NSMenu* aMenu);
43 void DumpNativeMenuItem(NSMenuItem* aMenuItem);
45 } // namespace nsMenuUtilsX
47 #endif // nsMenuUtilsX_h_