1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Dean Tessman <dean_tessman@hotmail.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef nsMenuParent_h___
40 : #define nsMenuParent_h___
41 :
42 : class nsMenuFrame;
43 :
44 : /*
45 : * nsMenuParent is an interface implemented by nsMenuBarFrame and nsMenuPopupFrame
46 : * as both serve as parent frames to nsMenuFrame.
47 : *
48 : * Don't implement this interface on other classes unless you also fix up references,
49 : * as this interface is directly cast to and from nsMenuBarFrame and nsMenuPopupFrame.
50 : */
51 :
52 0 : class nsMenuParent {
53 :
54 : public:
55 : // returns the menu frame of the currently active item within the menu
56 : virtual nsMenuFrame *GetCurrentMenuItem() = 0;
57 : // sets the currently active menu frame.
58 : NS_IMETHOD SetCurrentMenuItem(nsMenuFrame* aMenuItem) = 0;
59 : // indicate that the current menu frame is being destroyed, so clear the
60 : // current menu item
61 : virtual void CurrentMenuIsBeingDestroyed() = 0;
62 : // deselects the current item and closes its popup if any, then selects the
63 : // new item aMenuItem. For a menubar, if another menu is already open, the
64 : // new menu aMenuItem is opened. In this case, if aSelectFirstItem is true,
65 : // select the first item in it. For menupopups, the menu is not opened and
66 : // the aSelectFirstItem argument is not used.
67 : NS_IMETHOD ChangeMenuItem(nsMenuFrame* aMenuItem, bool aSelectFirstItem) = 0;
68 :
69 : // returns true if the menupopup is open. For menubars, returns false.
70 : virtual bool IsOpen() = 0;
71 : // returns true if the menubar is currently active. For menupopups, returns false.
72 : virtual bool IsActive() = 0;
73 : // returns true if this is a menubar. If false, it is a popup
74 : virtual bool IsMenuBar() = 0;
75 : // returns true if this is a menu, which has a tag of menupopup or popup.
76 : // Otherwise, this returns false
77 : virtual bool IsMenu() = 0;
78 : // returns true if this is a context menu
79 : virtual bool IsContextMenu() = 0;
80 :
81 : // indicate that the menubar should become active or inactive
82 : NS_IMETHOD SetActive(bool aActiveFlag) = 0;
83 :
84 : // notify that the menu has been closed and any active state should be
85 : // cleared. This should return true if the menu should be deselected
86 : // by the caller.
87 : virtual bool MenuClosed() = 0;
88 :
89 : // Lock this menu and its parents until they're closed or unlocked.
90 : // A menu being "locked" means that all events inside it that would change the
91 : // selected menu item should be ignored.
92 : // This is used when closing the popup is delayed because of a blink or fade
93 : // animation.
94 : virtual void LockMenuUntilClosed(bool aLock) = 0;
95 : virtual bool IsMenuLocked() = 0;
96 : };
97 :
98 : #endif
99 :
|