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 nsMenuParent_h___
7 #define nsMenuParent_h___
12 * nsMenuParent is an interface implemented by nsMenuBarFrame and nsMenuPopupFrame
13 * as both serve as parent frames to nsMenuFrame.
15 * Don't implement this interface on other classes unless you also fix up references,
16 * as this interface is directly cast to and from nsMenuBarFrame and nsMenuPopupFrame.
22 // returns the menu frame of the currently active item within the menu
23 virtual nsMenuFrame
*GetCurrentMenuItem() = 0;
24 // sets the currently active menu frame.
25 NS_IMETHOD
SetCurrentMenuItem(nsMenuFrame
* aMenuItem
) = 0;
26 // indicate that the current menu frame is being destroyed, so clear the
28 virtual void CurrentMenuIsBeingDestroyed() = 0;
29 // deselects the current item and closes its popup if any, then selects the
30 // new item aMenuItem. For a menubar, if another menu is already open, the
31 // new menu aMenuItem is opened. In this case, if aSelectFirstItem is true,
32 // select the first item in it. For menupopups, the menu is not opened and
33 // the aSelectFirstItem argument is not used.
34 NS_IMETHOD
ChangeMenuItem(nsMenuFrame
* aMenuItem
, bool aSelectFirstItem
) = 0;
36 // returns true if the menupopup is open. For menubars, returns false.
37 virtual bool IsOpen() = 0;
38 // returns true if the menubar is currently active. For menupopups, returns false.
39 virtual bool IsActive() = 0;
40 // returns true if this is a menubar. If false, it is a popup
41 virtual bool IsMenuBar() = 0;
42 // returns true if this is a menu, which has a tag of menupopup or popup.
43 // Otherwise, this returns false
44 virtual bool IsMenu() = 0;
45 // returns true if this is a context menu
46 virtual bool IsContextMenu() = 0;
48 // indicate that the menubar should become active or inactive
49 NS_IMETHOD
SetActive(bool aActiveFlag
) = 0;
51 // notify that the menu has been closed and any active state should be
52 // cleared. This should return true if the menu should be deselected
54 virtual bool MenuClosed() = 0;
56 // Lock this menu and its parents until they're closed or unlocked.
57 // A menu being "locked" means that all events inside it that would change the
58 // selected menu item should be ignored.
59 // This is used when closing the popup is delayed because of a blink or fade
61 virtual void LockMenuUntilClosed(bool aLock
) = 0;
62 virtual bool IsMenuLocked() = 0;