Bug 1751217 Part 3: Make HDR-capable macOS screens report 30 pixelDepth. r=mstange
[gecko.git] / widget / gtk / NativeMenuGtk.h
blob900d4f73b3749823c2c91e7b5516bdf65ee81357
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 nsPresContext*, const CSSIntPoint& aPosition) override;
34 bool Close() override;
35 void ActivateItem(dom::Element* aItemElement, Modifiers aModifiers,
36 int16_t aButton, ErrorResult& aRv) override;
37 void OpenSubmenu(dom::Element* aMenuElement) override;
38 void CloseSubmenu(dom::Element* aMenuElement) override;
39 RefPtr<dom::Element> Element() override;
40 void AddObserver(NativeMenu::Observer* aObserver) override {
41 mObservers.AppendElement(aObserver);
43 void RemoveObserver(NativeMenu::Observer* aObserver) override {
44 mObservers.RemoveElement(aObserver);
47 MOZ_CAN_RUN_SCRIPT void OnUnmap();
49 protected:
50 virtual ~NativeMenuGtk();
52 MOZ_CAN_RUN_SCRIPT void FireEvent(EventMessage);
54 bool mPoppedUp = false;
55 RefPtr<GtkWidget> mNativeMenu;
56 RefPtr<MenuModel> mMenuModel;
57 nsTArray<NativeMenu::Observer*> mObservers;
60 } // namespace widget
61 } // namespace mozilla
63 #endif