Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsMenuParent_h___ |
michael@0 | 7 | #define nsMenuParent_h___ |
michael@0 | 8 | |
michael@0 | 9 | class nsMenuFrame; |
michael@0 | 10 | |
michael@0 | 11 | /* |
michael@0 | 12 | * nsMenuParent is an interface implemented by nsMenuBarFrame and nsMenuPopupFrame |
michael@0 | 13 | * as both serve as parent frames to nsMenuFrame. |
michael@0 | 14 | * |
michael@0 | 15 | * Don't implement this interface on other classes unless you also fix up references, |
michael@0 | 16 | * as this interface is directly cast to and from nsMenuBarFrame and nsMenuPopupFrame. |
michael@0 | 17 | */ |
michael@0 | 18 | |
michael@0 | 19 | class nsMenuParent { |
michael@0 | 20 | |
michael@0 | 21 | public: |
michael@0 | 22 | // returns the menu frame of the currently active item within the menu |
michael@0 | 23 | virtual nsMenuFrame *GetCurrentMenuItem() = 0; |
michael@0 | 24 | // sets the currently active menu frame. |
michael@0 | 25 | NS_IMETHOD SetCurrentMenuItem(nsMenuFrame* aMenuItem) = 0; |
michael@0 | 26 | // indicate that the current menu frame is being destroyed, so clear the |
michael@0 | 27 | // current menu item |
michael@0 | 28 | virtual void CurrentMenuIsBeingDestroyed() = 0; |
michael@0 | 29 | // deselects the current item and closes its popup if any, then selects the |
michael@0 | 30 | // new item aMenuItem. For a menubar, if another menu is already open, the |
michael@0 | 31 | // new menu aMenuItem is opened. In this case, if aSelectFirstItem is true, |
michael@0 | 32 | // select the first item in it. For menupopups, the menu is not opened and |
michael@0 | 33 | // the aSelectFirstItem argument is not used. |
michael@0 | 34 | NS_IMETHOD ChangeMenuItem(nsMenuFrame* aMenuItem, bool aSelectFirstItem) = 0; |
michael@0 | 35 | |
michael@0 | 36 | // returns true if the menupopup is open. For menubars, returns false. |
michael@0 | 37 | virtual bool IsOpen() = 0; |
michael@0 | 38 | // returns true if the menubar is currently active. For menupopups, returns false. |
michael@0 | 39 | virtual bool IsActive() = 0; |
michael@0 | 40 | // returns true if this is a menubar. If false, it is a popup |
michael@0 | 41 | virtual bool IsMenuBar() = 0; |
michael@0 | 42 | // returns true if this is a menu, which has a tag of menupopup or popup. |
michael@0 | 43 | // Otherwise, this returns false |
michael@0 | 44 | virtual bool IsMenu() = 0; |
michael@0 | 45 | // returns true if this is a context menu |
michael@0 | 46 | virtual bool IsContextMenu() = 0; |
michael@0 | 47 | |
michael@0 | 48 | // indicate that the menubar should become active or inactive |
michael@0 | 49 | NS_IMETHOD SetActive(bool aActiveFlag) = 0; |
michael@0 | 50 | |
michael@0 | 51 | // notify that the menu has been closed and any active state should be |
michael@0 | 52 | // cleared. This should return true if the menu should be deselected |
michael@0 | 53 | // by the caller. |
michael@0 | 54 | virtual bool MenuClosed() = 0; |
michael@0 | 55 | |
michael@0 | 56 | // Lock this menu and its parents until they're closed or unlocked. |
michael@0 | 57 | // A menu being "locked" means that all events inside it that would change the |
michael@0 | 58 | // selected menu item should be ignored. |
michael@0 | 59 | // This is used when closing the popup is delayed because of a blink or fade |
michael@0 | 60 | // animation. |
michael@0 | 61 | virtual void LockMenuUntilClosed(bool aLock) = 0; |
michael@0 | 62 | virtual bool IsMenuLocked() = 0; |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | #endif |
michael@0 | 66 |