gecko-dev/layout/xul/base/src/nsPopupSetFrame.h

148 lines
5.0 KiB
C
Raw Normal View History

/* -*- 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.org 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.
2000-03-21 13:24:48 +00:00
*
* Contributor(s):
*
* 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 ***** */
//
// nsPopupSetFrame
//
#ifndef nsPopupSetFrame_h__
#define nsPopupSetFrame_h__
#include "prtypes.h"
#include "nsIAtom.h"
#include "nsCOMPtr.h"
#include "nsIPopupSetFrame.h"
#include "nsBoxFrame.h"
#include "nsFrameList.h"
#include "nsIMenuParent.h"
#include "nsITimer.h"
#include "nsISupportsArray.h"
nsIFrame* NS_NewPopupSetFrame(nsIPresShell* aPresShell);
2001-08-18 01:04:47 +00:00
struct nsPopupFrameList {
nsPopupFrameList* mNextPopup; // The next popup in the list.
nsIFrame* mPopupFrame; // Our popup.
nsIContent* mPopupContent; // The content element for the <popup> itself.
nsIContent* mElementContent; // The content that is having something popped up over it <weak>
PRInt32 mXPos; // This child's x position
PRInt32 mYPos; // This child's y position
nsAutoString mPopupAnchor; // This child's anchor.
nsAutoString mPopupAlign; // This child's align.
nsAutoString mPopupType;
PRPackedBool mCreateHandlerSucceeded; // Did the create handler succeed?
PRPackedBool mIsOpen;
2001-08-18 01:04:47 +00:00
nsSize mLastPref;
public:
nsPopupFrameList(nsIContent* aPopupContent, nsPopupFrameList* aNext);
nsPopupFrameList* GetEntry(nsIContent* aPopupContent);
nsPopupFrameList* GetEntryByFrame(nsIFrame* aPopupFrame);
};
class nsPopupSetFrame : public nsBoxFrame, public nsIPopupSetFrame
{
public:
nsPopupSetFrame(nsIPresShell* aShell);
NS_DECL_ISUPPORTS
NS_IMETHOD Init(nsPresContext* aPresContext,
nsIContent* aContent,
nsIFrame* aParent,
nsStyleContext* aContext,
nsIFrame* aPrevInFlow);
2000-03-31 07:02:06 +00:00
// nsIBox
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
#ifdef DEBUG_LAYOUT
2000-03-31 07:02:06 +00:00
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
#endif
2001-08-18 01:04:47 +00:00
// Used to destroy our popup frames.
NS_IMETHOD Destroy(nsPresContext* aPresContext);
// Reflow methods
2001-08-18 01:04:47 +00:00
virtual void RepositionPopup(nsPopupFrameList* aEntry, nsBoxLayoutState& aState);
1999-09-21 01:03:00 +00:00
2001-08-18 01:04:47 +00:00
NS_IMETHOD ShowPopup(nsIContent* aElementContent, nsIContent* aPopupContent,
PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& anAnchorAlignment,
const nsString& aPopupAlignment);
NS_IMETHOD HidePopup(nsIFrame* aPopup);
NS_IMETHOD DestroyPopup(nsIFrame* aPopup, PRBool aDestroyEntireChain);
2001-08-18 01:04:47 +00:00
NS_IMETHOD AddPopupFrame(nsIFrame* aPopup);
NS_IMETHOD RemovePopupFrame(nsIFrame* aPopup);
2001-08-18 01:04:47 +00:00
PRBool OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent);
2001-08-18 01:04:47 +00:00
PRBool OnDestroy(nsIContent* aPopupContent);
PRBool OnCreated(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent);
2001-08-18 01:04:47 +00:00
PRBool OnDestroyed(nsIContent* aPopupContent);
1999-09-10 08:47:12 +00:00
2001-08-18 01:04:47 +00:00
void ActivatePopup(nsPopupFrameList* aEntry, PRBool aActivateFlag);
void OpenPopup(nsPopupFrameList* aEntry, PRBool aOpenFlag);
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult);
}
#endif
protected:
void MarkAsGenerated(nsIContent* aPopupContent);
void UpdateDismissalListener(nsIMenuParent* aMenuParent);
protected:
#ifdef DEBUG_LAYOUT
2000-03-31 07:02:06 +00:00
nsresult SetDebug(nsBoxLayoutState& aState, nsIFrame* aList, PRBool aDebug);
#endif
2001-08-18 01:04:47 +00:00
nsPopupFrameList* mPopupList;
}; // class nsPopupSetFrame
#endif