2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Dean Tessman <dean_tessman@hotmail.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2008-12-05 08:37:31 -08:00
|
|
|
#ifndef nsMenuParent_h___
|
|
|
|
#define nsMenuParent_h___
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-04 08:49:38 -07:00
|
|
|
class nsMenuFrame;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
2008-12-05 08:37:31 -08:00
|
|
|
* nsMenuParent is an interface implemented by nsMenuBarFrame and nsMenuPopupFrame
|
2007-07-04 08:49:38 -07:00
|
|
|
* as both serve as parent frames to nsMenuFrame.
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
2007-07-04 08:49:38 -07:00
|
|
|
* Don't implement this interface on other classes unless you also fix up references,
|
|
|
|
* as this interface is directly cast to and from nsMenuBarFrame and nsMenuPopupFrame.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
|
2008-12-05 08:37:31 -08:00
|
|
|
class nsMenuParent {
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
public:
|
2007-07-04 08:49:38 -07:00
|
|
|
// returns the menu frame of the currently active item within the menu
|
|
|
|
virtual nsMenuFrame *GetCurrentMenuItem() = 0;
|
|
|
|
// sets the currently active menu frame.
|
|
|
|
NS_IMETHOD SetCurrentMenuItem(nsMenuFrame* aMenuItem) = 0;
|
|
|
|
// indicate that the current menu frame is being destroyed, so clear the
|
|
|
|
// current menu item
|
|
|
|
virtual void CurrentMenuIsBeingDestroyed() = 0;
|
|
|
|
// deselects the current item and closes its popup if any, then selects the
|
|
|
|
// new item aMenuItem. For a menubar, if another menu is already open, the
|
|
|
|
// new menu aMenuItem is opened. In this case, if aSelectFirstItem is true,
|
2007-11-17 07:47:38 -08:00
|
|
|
// select the first item in it. For menupopups, the menu is not opened and
|
2007-07-04 08:49:38 -07:00
|
|
|
// the aSelectFirstItem argument is not used.
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD ChangeMenuItem(nsMenuFrame* aMenuItem, bool aSelectFirstItem) = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
|
|
|
|
// returns true if the menupopup is open. For menubars, returns false.
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsOpen() = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
// returns true if the menubar is currently active. For menupopups, returns false.
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsActive() = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
// returns true if this is a menubar. If false, it is a popup
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsMenuBar() = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
// returns true if this is a menu, which has a tag of menupopup or popup.
|
|
|
|
// Otherwise, this returns false
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsMenu() = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
// returns true if this is a context menu
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsContextMenu() = 0;
|
2007-07-04 08:49:38 -07:00
|
|
|
|
|
|
|
// indicate that the menubar should become active or inactive
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetActive(bool aActiveFlag) = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-07-04 08:49:38 -07:00
|
|
|
// notify that the menu has been closed and any active state should be
|
|
|
|
// cleared. This should return true if the menu should be deselected
|
|
|
|
// by the caller.
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool MenuClosed() = 0;
|
2010-04-19 07:12:58 -07:00
|
|
|
|
|
|
|
// Lock this menu and its parents until they're closed or unlocked.
|
|
|
|
// A menu being "locked" means that all events inside it that would change the
|
|
|
|
// selected menu item should be ignored.
|
|
|
|
// This is used when closing the popup is delayed because of a blink or fade
|
|
|
|
// animation.
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void LockMenuUntilClosed(bool aLock) = 0;
|
|
|
|
virtual bool IsMenuLocked() = 0;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|