Bug 1869647 - Mark hasStorageAccess.sub.https.window.html as intermittent after wpt...
[gecko.git] / widget / gtk / NativeMenuGtk.h
blob3f1f3213c141a70961c55f280b71d9b9f915e808
2 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_widget_NativeMenuGtk_h
8 #define mozilla_widget_NativeMenuGtk_h
10 #include "mozilla/widget/NativeMenu.h"
11 #include "mozilla/EventForwards.h"
12 #include "GRefPtr.h"
14 namespace mozilla {
16 namespace dom {
17 class Element;
20 namespace widget {
22 class MenuModel;
24 class NativeMenuGtk : public NativeMenu {
25 public:
26 // Whether we can use native menu popups on GTK.
27 static bool CanUse();
29 explicit NativeMenuGtk(dom::Element* aElement);
31 // NativeMenu
32 MOZ_CAN_RUN_SCRIPT_BOUNDARY void ShowAsContextMenu(
33 nsIFrame* aClickedFrame, const CSSIntPoint& aPosition,
34 bool aIsContextMenu) override;
35 bool Close() override;
36 void ActivateItem(dom::Element* aItemElement, Modifiers aModifiers,
37 int16_t aButton, ErrorResult& aRv) override;
38 void OpenSubmenu(dom::Element* aMenuElement) override;
39 void CloseSubmenu(dom::Element* aMenuElement) override;
40 RefPtr<dom::Element> Element() override;
41 void AddObserver(NativeMenu::Observer* aObserver) override {
42 mObservers.AppendElement(aObserver);
44 void RemoveObserver(NativeMenu::Observer* aObserver) override {
45 mObservers.RemoveElement(aObserver);
48 MOZ_CAN_RUN_SCRIPT void OnUnmap();
50 protected:
51 virtual ~NativeMenuGtk();
53 MOZ_CAN_RUN_SCRIPT void FireEvent(EventMessage);
55 bool mPoppedUp = false;
56 RefPtr<GtkWidget> mNativeMenu;
57 RefPtr<MenuModel> mMenuModel;
58 nsTArray<NativeMenu::Observer*> mObservers;
61 } // namespace widget
62 } // namespace mozilla
64 #endif