1999-08-06 18:16:27 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-06 18:16:27 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* 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
|
1999-11-18 21:05:43 +00:00
|
|
|
* for the specific language governing rights and limitations under the
|
2004-04-18 14:30:37 +00:00
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org Code.
|
1999-08-06 18:16:27 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* 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):
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* 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 ***** */
|
1999-08-06 18:16:27 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// nsPopupSetFrame
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef nsPopupSetFrame_h__
|
|
|
|
#define nsPopupSetFrame_h__
|
|
|
|
|
|
|
|
#include "prtypes.h"
|
|
|
|
#include "nsIAtom.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
1999-08-19 22:10:24 +00:00
|
|
|
#include "nsIPopupSetFrame.h"
|
1999-08-06 18:16:27 +00:00
|
|
|
#include "nsBoxFrame.h"
|
|
|
|
#include "nsFrameList.h"
|
|
|
|
#include "nsIMenuParent.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
|
2005-10-26 21:46:39 +00:00
|
|
|
nsIFrame* NS_NewPopupSetFrame(nsIPresShell* aPresShell);
|
1999-08-06 18:16:27 +00:00
|
|
|
|
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;
|
2005-02-18 14:28:36 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
|
1999-08-19 22:10:24 +00:00
|
|
|
class nsPopupSetFrame : public nsBoxFrame, public nsIPopupSetFrame
|
1999-08-06 18:16:27 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-03-02 03:01:30 +00:00
|
|
|
nsPopupSetFrame(nsIPresShell* aShell);
|
1999-08-06 18:16:27 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Init(nsPresContext* aPresContext,
|
1999-08-06 18:16:27 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aContext,
|
1999-08-06 18:16:27 +00:00
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2000-03-31 07:02:06 +00:00
|
|
|
// nsIBox
|
2000-07-07 22:24:06 +00:00
|
|
|
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
2004-06-19 09:07:47 +00:00
|
|
|
#ifdef DEBUG_LAYOUT
|
2000-03-31 07:02:06 +00:00
|
|
|
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
|
2004-06-19 09:07:47 +00:00
|
|
|
#endif
|
2000-03-02 03:01:30 +00:00
|
|
|
|
2001-08-18 01:04:47 +00:00
|
|
|
// Used to destroy our popup frames.
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Destroy(nsPresContext* aPresContext);
|
1999-08-06 18:16:27 +00:00
|
|
|
|
|
|
|
// 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);
|
2002-10-04 00:56:43 +00:00
|
|
|
NS_IMETHOD DestroyPopup(nsIFrame* aPopup, PRBool aDestroyEntireChain);
|
2001-08-18 01:04:47 +00:00
|
|
|
|
|
|
|
NS_IMETHOD AddPopupFrame(nsIFrame* aPopup);
|
2001-09-22 00:32:23 +00:00
|
|
|
NS_IMETHOD RemovePopupFrame(nsIFrame* aPopup);
|
2001-08-18 01:04:47 +00:00
|
|
|
|
2001-12-04 22:32:49 +00:00
|
|
|
PRBool OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent);
|
2001-08-18 01:04:47 +00:00
|
|
|
PRBool OnDestroy(nsIContent* aPopupContent);
|
2001-12-04 22:32:49 +00:00
|
|
|
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);
|
1999-08-06 18:16:27 +00:00
|
|
|
|
2001-09-15 00:45:54 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
}
|
2001-09-15 00:45:54 +00:00
|
|
|
#endif
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-09 22:02:40 +00:00
|
|
|
|
1999-08-06 18:16:27 +00:00
|
|
|
protected:
|
2000-04-25 07:10:48 +00:00
|
|
|
|
1999-09-09 01:07:06 +00:00
|
|
|
void MarkAsGenerated(nsIContent* aPopupContent);
|
1999-09-25 03:39:35 +00:00
|
|
|
void UpdateDismissalListener(nsIMenuParent* aMenuParent);
|
|
|
|
|
1999-08-06 18:16:27 +00:00
|
|
|
protected:
|
2004-06-19 09:07:47 +00:00
|
|
|
#ifdef DEBUG_LAYOUT
|
2000-03-31 07:02:06 +00:00
|
|
|
nsresult SetDebug(nsBoxLayoutState& aState, nsIFrame* aList, PRBool aDebug);
|
2004-06-19 09:07:47 +00:00
|
|
|
#endif
|
2000-03-02 03:01:30 +00:00
|
|
|
|
2001-08-18 01:04:47 +00:00
|
|
|
nsPopupFrameList* mPopupList;
|
1999-08-19 22:10:24 +00:00
|
|
|
|
1999-08-06 18:16:27 +00:00
|
|
|
}; // class nsPopupSetFrame
|
|
|
|
|
|
|
|
#endif
|