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 mozilla_widget_NativeMenuSupport_h
7 #define mozilla_widget_NativeMenuSupport_h
9 #include "mozilla/RefPtr.h"
13 #if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
14 # define HAS_NATIVE_MENU_SUPPORT 1
27 class NativeMenuSupport final
{
29 // Given a top-level window widget and a menu bar DOM node, sets up native
30 // menus. Once created, native menus are controlled via the DOM, including
32 static void CreateNativeMenuBar(nsIWidget
* aParent
,
33 dom::Element
* aMenuBarElement
);
35 // Given a menupopup DOM node, create a NativeMenu instance that can be shown
36 // as a native context menu.
37 static already_AddRefed
<NativeMenu
> CreateNativeContextMenu(
38 dom::Element
* aPopup
);
40 // Whether or not native context menus are enabled.
41 static bool ShouldUseNativeContextMenus();
45 } // namespace mozilla
47 #endif // mozilla_widget_NativeMenuSupport_h