1999-07-18 06:35:03 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1999-07-18 06:35:03 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* 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.
|
1999-07-18 06:35:03 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-07-18 06:35:03 +00:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 03:40:37 +00:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-07-18 06:35:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// nsMenuPopupFrame
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef nsMenuPopupFrame_h__
|
|
|
|
#define nsMenuPopupFrame_h__
|
|
|
|
|
|
|
|
#include "prtypes.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2000-02-09 09:34:35 +00:00
|
|
|
#include "nsIDOMEventReceiver.h"
|
|
|
|
#include "nsMenuListener.h"
|
1999-07-18 06:35:03 +00:00
|
|
|
|
1999-07-21 02:56:23 +00:00
|
|
|
#include "nsBoxFrame.h"
|
1999-07-21 07:42:16 +00:00
|
|
|
#include "nsIMenuParent.h"
|
1999-09-25 03:39:35 +00:00
|
|
|
#include "nsIWidget.h"
|
1999-07-18 06:35:03 +00:00
|
|
|
|
1999-12-04 23:49:50 +00:00
|
|
|
nsresult NS_NewMenuPopupFrame(nsIPresShell* aPresShell, nsIFrame** aResult) ;
|
1999-07-18 06:35:03 +00:00
|
|
|
|
1999-07-20 09:35:35 +00:00
|
|
|
class nsIViewManager;
|
|
|
|
class nsIView;
|
1999-09-21 01:03:00 +00:00
|
|
|
class nsIMenuParent;
|
|
|
|
class nsIMenuFrame;
|
2000-02-08 09:30:15 +00:00
|
|
|
class nsIDOMXULDocument;
|
|
|
|
|
1999-07-18 06:35:03 +00:00
|
|
|
|
1999-07-21 07:42:16 +00:00
|
|
|
class nsMenuPopupFrame : public nsBoxFrame, public nsIMenuParent
|
1999-07-18 06:35:03 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsMenuPopupFrame();
|
|
|
|
|
1999-07-21 07:42:16 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIMenuParentInterface
|
1999-09-21 01:03:00 +00:00
|
|
|
NS_IMETHOD SetCurrentMenuItem(nsIMenuFrame* aMenuItem);
|
|
|
|
NS_IMETHOD GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult);
|
|
|
|
NS_IMETHOD GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult);
|
1999-07-23 08:36:39 +00:00
|
|
|
NS_IMETHOD SetActive(PRBool aActiveFlag) { return NS_OK; }; // We don't care.
|
|
|
|
NS_IMETHOD GetIsActive(PRBool& isActive) { isActive = PR_FALSE; return NS_OK; };
|
|
|
|
NS_IMETHOD IsMenuBar(PRBool& isMenuBar) { isMenuBar = PR_FALSE; return NS_OK; };
|
1999-08-12 20:45:47 +00:00
|
|
|
|
1999-09-21 01:03:00 +00:00
|
|
|
NS_IMETHOD GetParentPopup(nsIMenuParent** aResult);
|
|
|
|
|
1999-08-12 20:45:47 +00:00
|
|
|
// Closes up the chain of open cascaded menus.
|
1999-07-24 01:59:32 +00:00
|
|
|
NS_IMETHOD DismissChain();
|
1999-07-21 07:42:16 +00:00
|
|
|
|
1999-08-12 20:45:47 +00:00
|
|
|
// Hides the chain of cascaded menus without closing them up.
|
|
|
|
NS_IMETHOD HideChain();
|
|
|
|
|
2000-02-09 09:34:35 +00:00
|
|
|
NS_IMETHOD InstallKeyboardNavigator();
|
|
|
|
NS_IMETHOD RemoveKeyboardNavigator();
|
|
|
|
|
1999-09-25 03:39:35 +00:00
|
|
|
NS_IMETHOD GetWidget(nsIWidget **aWidget);
|
|
|
|
|
1999-09-21 01:03:00 +00:00
|
|
|
// The dismissal listener gets created and attached to the window.
|
|
|
|
NS_IMETHOD CreateDismissalListener();
|
|
|
|
|
1999-07-21 07:42:16 +00:00
|
|
|
// Overridden methods
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1999-07-20 07:28:39 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
1999-07-20 09:35:35 +00:00
|
|
|
nsDidReflowStatus aStatus);
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
1999-09-10 08:47:12 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1999-09-10 08:47:12 +00:00
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
|
1999-09-10 08:47:12 +00:00
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, nsIFrame** aFrame);
|
1999-09-21 01:03:00 +00:00
|
|
|
|
1999-07-20 09:35:35 +00:00
|
|
|
void GetViewOffset(nsIViewManager* aManager, nsIView* aView, nsPoint& aPoint);
|
1999-10-26 04:44:41 +00:00
|
|
|
static void GetNearestEnclosingView(nsIPresContext* aPresContext, nsIFrame* aStartFrame, nsIView** aResult);
|
1999-09-10 08:47:12 +00:00
|
|
|
|
1999-12-08 11:30:47 +00:00
|
|
|
nsresult SyncViewWithFrame(nsIPresContext* aPresContext, const nsString& aPopupAnchor,
|
|
|
|
const nsString& aPopupAlign,
|
1999-09-10 08:47:12 +00:00
|
|
|
nsIFrame* aFrame, PRInt32 aXPos, PRInt32 aYPos);
|
1999-07-20 09:35:35 +00:00
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHOD CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGrabMouseEvents);
|
1999-07-21 08:51:41 +00:00
|
|
|
|
2000-02-09 09:34:35 +00:00
|
|
|
NS_IMETHOD KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag);
|
|
|
|
NS_IMETHOD ShortcutNavigation(PRUint32 aLetter, PRBool& aHandledFlag);
|
1999-07-23 07:49:43 +00:00
|
|
|
|
2000-02-09 09:34:35 +00:00
|
|
|
NS_IMETHOD Escape(PRBool& aHandledFlag);
|
|
|
|
NS_IMETHOD Enter();
|
1999-07-23 07:49:43 +00:00
|
|
|
|
2000-02-09 09:34:35 +00:00
|
|
|
nsIMenuFrame* FindMenuWithShortcut(PRUint32 aLetter);
|
1999-07-22 09:01:55 +00:00
|
|
|
|
1999-07-26 01:35:39 +00:00
|
|
|
PRBool IsValidItem(nsIContent* aContent);
|
|
|
|
PRBool IsDisabled(nsIContent* aContent);
|
|
|
|
|
1999-07-18 06:35:03 +00:00
|
|
|
protected:
|
1999-11-18 21:05:43 +00:00
|
|
|
// return true if the alignment is horizontal false if vertical
|
|
|
|
virtual PRBool GetInitialAlignment();
|
|
|
|
|
2000-02-08 09:30:15 +00:00
|
|
|
// given x,y in client coordinates, compensate for nested documents like framesets.
|
|
|
|
void AdjustClientXYForNestedDocuments ( nsIDOMXULDocument* inPopupDoc, nsIPresShell* inPopupShell,
|
|
|
|
PRInt32 inClientX, PRInt32 inClientY,
|
|
|
|
PRInt32* outAdjX, PRInt32* outAdjY ) ;
|
|
|
|
|
1999-09-21 01:03:00 +00:00
|
|
|
nsIMenuFrame* mCurrentMenu; // The current menu that is active.
|
1999-07-21 08:51:41 +00:00
|
|
|
PRBool mIsCapturingMouseEvents; // Whether or not we're grabbing the mouse events.
|
1999-10-26 04:44:41 +00:00
|
|
|
// XXX Hack
|
|
|
|
nsIPresContext* mPresContext; // weak reference
|
2000-02-09 09:34:35 +00:00
|
|
|
|
|
|
|
nsMenuListener* mKeyboardNavigator; // The listener that tells us about key events.
|
|
|
|
nsIDOMEventReceiver* mTarget;
|
|
|
|
|
1999-07-18 06:35:03 +00:00
|
|
|
}; // class nsMenuPopupFrame
|
|
|
|
|
|
|
|
#endif
|