Bug 1591736 - Fix AddonManagerWebAPI::IsAPIEnabled in out-of-process iframes r=mixedpuppy
[gecko.git] / layout / xul / nsMenuParent.h
blob89dcbacd9040ce7ecd98505a9d6454d6decc318c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 nsMenuParent_h___
8 #define nsMenuParent_h___
10 class nsMenuFrame;
13 * nsMenuParent is an interface implemented by nsMenuBarFrame and
14 * nsMenuPopupFrame as both serve as parent frames to nsMenuFrame.
16 * Don't implement this interface on other classes unless you also fix up
17 * references, as this interface is directly cast to and from nsMenuBarFrame and
18 * nsMenuPopupFrame.
21 class nsMenuParent {
22 public:
23 // returns the menu frame of the currently active item within the menu
24 virtual nsMenuFrame* GetCurrentMenuItem() = 0;
25 // sets the currently active menu frame.
26 NS_IMETHOD SetCurrentMenuItem(nsMenuFrame* aMenuItem) = 0;
27 // indicate that the current menu frame is being destroyed, so clear the
28 // current menu item
29 virtual void CurrentMenuIsBeingDestroyed() = 0;
30 // deselects the current item and closes its popup if any, then selects the
31 // new item aMenuItem. For a menubar, if another menu is already open, the
32 // new menu aMenuItem is opened. In this case, if aSelectFirstItem is true,
33 // select the first item in it. For menupopups, the menu is not opened and
34 // the aSelectFirstItem argument is not used. The aFromKey argument indicates
35 // that the keyboard was used to navigate to the new menu item.
36 NS_IMETHOD ChangeMenuItem(nsMenuFrame* aMenuItem, bool aSelectFirstItem,
37 bool aFromKey) = 0;
39 // returns true if the menupopup is open. For menubars, returns false.
40 virtual bool IsOpen() = 0;
41 // returns true if the menubar is currently active. For menupopups, returns
42 // false.
43 virtual bool IsActive() = 0;
44 // returns true if this is a menubar. If false, it is a popup
45 virtual bool IsMenuBar() = 0;
46 // returns true if this is a menu, which has a tag of menupopup or popup.
47 // Otherwise, this returns false
48 virtual bool IsMenu() = 0;
49 // returns true if this is a context menu
50 virtual bool IsContextMenu() = 0;
52 // indicate that the menubar should become active or inactive
53 NS_IMETHOD SetActive(bool aActiveFlag) = 0;
55 // notify that the menu has been closed and any active state should be
56 // cleared. This should return true if the menu should be deselected
57 // by the caller.
58 virtual bool MenuClosed() = 0;
60 // Lock this menu and its parents until they're closed or unlocked.
61 // A menu being "locked" means that all events inside it that would change the
62 // selected menu item should be ignored.
63 // This is used when closing the popup is delayed because of a blink or fade
64 // animation.
65 virtual void LockMenuUntilClosed(bool aLock) = 0;
66 virtual bool IsMenuLocked() = 0;
69 #endif