Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / widget / NativeMenuSupport.h
blobc6429b5d4d036f4d1cc940171380ffac28f11057
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"
11 class nsIWidget;
13 #if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
14 # define HAS_NATIVE_MENU_SUPPORT 1
15 #endif
17 namespace mozilla {
19 namespace dom {
20 class Element;
23 namespace widget {
25 class NativeMenu;
27 class NativeMenuSupport final {
28 public:
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
31 // destruction.
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();
44 } // namespace widget
45 } // namespace mozilla
47 #endif // mozilla_widget_NativeMenuSupport_h