2000-08-31 02:07:04 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2000-01-22 03:15:41 +00:00
|
|
|
*
|
2004-04-17 16:52:41 +00:00
|
|
|
* ***** 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.
|
|
|
|
*
|
2000-01-22 03:15:41 +00:00
|
|
|
* The Original Code is the Mozilla browser.
|
2004-04-17 16:52:41 +00:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications, Inc.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
2000-01-22 03:15:41 +00:00
|
|
|
* Contributor(s):
|
|
|
|
* Travis Bogard <travis@netscape.com>
|
2004-04-17 16:52:41 +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 ***** */
|
2000-01-22 03:15:41 +00:00
|
|
|
|
|
|
|
#ifndef nsXULWindow_h__
|
|
|
|
#define nsXULWindow_h__
|
|
|
|
|
2000-01-25 21:59:31 +00:00
|
|
|
// Local Includes
|
|
|
|
#include "nsChromeTreeOwner.h"
|
|
|
|
#include "nsContentTreeOwner.h"
|
|
|
|
|
|
|
|
// Helper classes
|
2000-01-22 03:15:41 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2000-01-25 21:59:31 +00:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
#include "nsString.h"
|
2000-02-25 03:11:21 +00:00
|
|
|
#include "nsWeakReference.h"
|
2000-01-25 21:59:31 +00:00
|
|
|
|
|
|
|
// Interfaces needed
|
2000-01-22 03:15:41 +00:00
|
|
|
#include "nsIBaseWindow.h"
|
|
|
|
#include "nsIDocShell.h"
|
2000-01-25 21:59:31 +00:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
2000-09-01 01:54:35 +00:00
|
|
|
#include "nsIDOMWindowInternal.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIEventQueueService.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-05 21:28:38 +00:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2000-02-08 13:40:10 +00:00
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsIXULWindow.h"
|
2001-04-10 18:30:25 +00:00
|
|
|
#include "nsIPrompt.h"
|
|
|
|
#include "nsIAuthPrompt.h"
|
2001-07-16 02:40:48 +00:00
|
|
|
#include "nsGUIEvent.h"
|
2004-08-21 14:47:51 +00:00
|
|
|
#include "nsIXULBrowserWindow.h"
|
2005-02-23 05:29:44 +00:00
|
|
|
#include "nsIWeakReference.h"
|
2000-01-25 21:59:31 +00:00
|
|
|
|
|
|
|
// nsXULWindow
|
2000-01-22 03:15:41 +00:00
|
|
|
|
2002-06-26 22:34:09 +00:00
|
|
|
class nsXULWindow : public nsIBaseWindow,
|
|
|
|
public nsIInterfaceRequestor,
|
2005-02-19 22:42:01 +00:00
|
|
|
public nsIXULWindow,
|
2002-06-26 22:34:09 +00:00
|
|
|
public nsSupportsWeakReference
|
2000-01-22 03:15:41 +00:00
|
|
|
{
|
|
|
|
friend class nsChromeTreeOwner;
|
|
|
|
friend class nsContentTreeOwner;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2000-01-22 03:15:41 +00:00
|
|
|
NS_DECL_NSIXULWINDOW
|
|
|
|
NS_DECL_NSIBASEWINDOW
|
|
|
|
|
2005-02-19 22:42:01 +00:00
|
|
|
void LockUntilChromeLoad() { mLockedUntilChromeLoad = PR_TRUE; }
|
|
|
|
PRBool IsLocked() const { return mLockedUntilChromeLoad; }
|
|
|
|
|
2000-01-22 03:15:41 +00:00
|
|
|
protected:
|
2003-10-07 01:20:16 +00:00
|
|
|
enum persistentAttributes {
|
|
|
|
PAD_MISC = 0x1,
|
|
|
|
PAD_POSITION = 0x2,
|
|
|
|
PAD_SIZE = 0x4
|
|
|
|
};
|
|
|
|
|
2000-01-22 03:15:41 +00:00
|
|
|
nsXULWindow();
|
2000-01-27 05:59:42 +00:00
|
|
|
virtual ~nsXULWindow();
|
2000-01-22 03:15:41 +00:00
|
|
|
|
|
|
|
NS_IMETHOD EnsureChromeTreeOwner();
|
|
|
|
NS_IMETHOD EnsureContentTreeOwner();
|
2000-01-30 07:29:38 +00:00
|
|
|
NS_IMETHOD EnsurePrimaryContentTreeOwner();
|
2001-04-10 18:30:25 +00:00
|
|
|
NS_IMETHOD EnsurePrompter();
|
|
|
|
NS_IMETHOD EnsureAuthPrompter();
|
2000-02-10 07:47:24 +00:00
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
void OnChromeLoaded();
|
2001-01-31 03:25:07 +00:00
|
|
|
void StaggerPosition(PRInt32 &aRequestedX, PRInt32 &aRequestedY,
|
|
|
|
PRInt32 aSpecWidth, PRInt32 aSpecHeight);
|
2002-01-09 01:31:24 +00:00
|
|
|
PRBool LoadPositionFromXUL();
|
|
|
|
PRBool LoadSizeFromXUL();
|
2003-10-07 01:20:16 +00:00
|
|
|
PRBool LoadMiscPersistentAttributesFromXUL();
|
2003-04-09 05:14:24 +00:00
|
|
|
nsresult LoadChromeHidingFromXUL();
|
2002-08-07 01:59:22 +00:00
|
|
|
NS_IMETHOD LoadWindowClassFromXUL();
|
2001-04-14 00:57:30 +00:00
|
|
|
NS_IMETHOD LoadIconFromXUL();
|
2003-10-07 01:20:16 +00:00
|
|
|
NS_IMETHOD SavePersistentAttributes();
|
2000-02-08 13:40:10 +00:00
|
|
|
|
2000-09-01 01:54:35 +00:00
|
|
|
NS_IMETHOD GetWindowDOMWindow(nsIDOMWindowInternal** aDOMWindow);
|
2000-03-16 05:45:26 +00:00
|
|
|
NS_IMETHOD GetWindowDOMElement(nsIDOMElement** aDOMElement);
|
|
|
|
NS_IMETHOD GetDOMElementById(char* aID, nsIDOMElement** aDOMElement);
|
2000-01-27 05:59:42 +00:00
|
|
|
NS_IMETHOD ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
2000-02-05 03:26:35 +00:00
|
|
|
PRBool aPrimary, const PRUnichar* aID);
|
|
|
|
NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, PRInt32 aCX,
|
|
|
|
PRInt32 aCY);
|
2000-07-12 23:56:14 +00:00
|
|
|
NS_IMETHOD ExitModalLoop(nsresult aStatus);
|
2000-02-08 13:40:10 +00:00
|
|
|
NS_IMETHOD CreateNewChromeWindow(PRInt32 aChromeFlags,
|
2004-10-29 19:28:38 +00:00
|
|
|
nsIAppShell* aAppShell, nsIXULWindow **_retval);
|
2000-02-08 13:40:10 +00:00
|
|
|
NS_IMETHOD CreateNewContentWindow(PRInt32 aChromeFlags,
|
2004-10-29 19:28:38 +00:00
|
|
|
nsIAppShell* aAppShell, nsIXULWindow **_retval);
|
2000-01-22 03:15:41 +00:00
|
|
|
|
2003-09-24 14:31:03 +00:00
|
|
|
void EnableParent(PRBool aEnable);
|
|
|
|
PRBool ConstrainToZLevel(PRBool aImmediate, nsWindowZ *aPlacement,
|
|
|
|
nsIWidget *aReqBelow, nsIWidget **aActualBelow);
|
|
|
|
void PlaceWindowLayersBehind(PRUint32 aLowLevel, PRUint32 aHighLevel,
|
|
|
|
nsIXULWindow *aBehind);
|
|
|
|
void SetContentScrollbarVisibility(PRBool aVisible);
|
|
|
|
PRBool GetContentScrollbarVisibility();
|
2003-10-07 01:20:16 +00:00
|
|
|
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
|
2005-02-02 09:39:30 +00:00
|
|
|
nsresult ApplyChromeFlags();
|
2000-02-25 03:11:21 +00:00
|
|
|
|
2000-01-22 03:15:41 +00:00
|
|
|
nsChromeTreeOwner* mChromeTreeOwner;
|
|
|
|
nsContentTreeOwner* mContentTreeOwner;
|
2000-01-30 07:29:38 +00:00
|
|
|
nsContentTreeOwner* mPrimaryContentTreeOwner;
|
2000-01-22 03:15:41 +00:00
|
|
|
nsCOMPtr<nsIWidget> mWindow;
|
|
|
|
nsCOMPtr<nsIDocShell> mDocShell;
|
2000-09-01 01:54:35 +00:00
|
|
|
nsCOMPtr<nsIDOMWindowInternal> mDOMWindow;
|
2000-02-25 03:11:21 +00:00
|
|
|
nsCOMPtr<nsIWeakReference> mParentWindow;
|
2001-04-10 18:30:25 +00:00
|
|
|
nsCOMPtr<nsIPrompt> mPrompter;
|
|
|
|
nsCOMPtr<nsIAuthPrompt> mAuthPrompter;
|
2004-08-21 14:47:51 +00:00
|
|
|
nsCOMPtr<nsIXULBrowserWindow> mXULBrowserWindow;
|
2005-02-22 00:17:35 +00:00
|
|
|
nsCOMPtr<nsIDocShellTreeItem> mPrimaryContentShell;
|
|
|
|
nsVoidArray mContentShells; // array of doc shells by id
|
2000-07-12 23:56:14 +00:00
|
|
|
nsresult mModalStatus;
|
2002-01-04 02:34:02 +00:00
|
|
|
PRPackedBool mContinueModalLoop;
|
|
|
|
PRPackedBool mDebuting; // being made visible right now
|
|
|
|
PRPackedBool mChromeLoaded; // True when chrome has loaded
|
|
|
|
PRPackedBool mShowAfterLoad;
|
|
|
|
PRPackedBool mIntrinsicallySized;
|
|
|
|
PRPackedBool mCenterAfterLoad;
|
|
|
|
PRPackedBool mIsHiddenWindow;
|
2005-02-19 22:42:01 +00:00
|
|
|
PRPackedBool mLockedUntilChromeLoad;
|
2002-09-11 02:27:14 +00:00
|
|
|
PRUint32 mContextFlags;
|
2003-02-24 20:15:39 +00:00
|
|
|
PRUint32 mBlurSuppressionLevel;
|
2003-10-07 01:20:16 +00:00
|
|
|
PRUint32 mPersistentAttributesDirty; // persistentAttributes
|
|
|
|
PRUint32 mPersistentAttributesMask;
|
2005-02-02 09:39:30 +00:00
|
|
|
PRUint32 mChromeFlags;
|
2005-02-01 08:50:50 +00:00
|
|
|
nsString mTitle;
|
2000-01-25 21:59:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// nsContentShellInfo
|
2005-02-23 05:29:44 +00:00
|
|
|
// Used (in an nsVoidArray) to map shell IDs to nsIDocShellTreeItems.
|
2000-01-25 21:59:31 +00:00
|
|
|
|
|
|
|
class nsContentShellInfo
|
|
|
|
{
|
|
|
|
public:
|
2001-10-31 02:46:21 +00:00
|
|
|
nsContentShellInfo(const nsAString& aID,
|
2005-02-23 05:29:44 +00:00
|
|
|
nsIWeakReference* aContentShell);
|
2000-01-25 21:59:31 +00:00
|
|
|
~nsContentShellInfo();
|
|
|
|
|
|
|
|
public:
|
2005-02-23 05:29:44 +00:00
|
|
|
nsAutoString id; // The identifier of the content shell
|
|
|
|
nsWeakPtr child; // content shell (weak reference to nsIDocShellTreeItem)
|
2000-01-22 03:15:41 +00:00
|
|
|
};
|
|
|
|
|
2000-02-08 13:40:10 +00:00
|
|
|
// nsEventQueueStack
|
|
|
|
// a little utility object to push an event queue and pop it when it
|
|
|
|
// goes out of scope. should probably be in a file of utility functions.
|
|
|
|
class nsEventQueueStack
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsEventQueueStack();
|
|
|
|
~nsEventQueueStack();
|
|
|
|
|
|
|
|
nsresult Success();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIEventQueueService> mService;
|
2000-06-05 21:53:25 +00:00
|
|
|
nsCOMPtr<nsIEventQueue> mQueue;
|
2000-02-08 13:40:10 +00:00
|
|
|
};
|
|
|
|
|
2000-01-22 03:15:41 +00:00
|
|
|
#endif /* nsXULWindow_h__ */
|