Added configurablility of nsXPBaseWindow

This commit is contained in:
rods%netscape.com 1998-11-03 16:19:56 +00:00
Родитель bc6ca3753f
Коммит 867e0b2971
3 изменённых файлов: 35 добавлений и 21 удалений

Просмотреть файл

@ -174,7 +174,7 @@ static NS_DEFINE_IID(kIToolbarItemIID, NS_ITOOLBARITEM_IID);
static NS_DEFINE_IID(kIPopUpMenuIID, NS_IPOPUPMENU_IID); static NS_DEFINE_IID(kIPopUpMenuIID, NS_IPOPUPMENU_IID);
static NS_DEFINE_IID(kIMenuButtonIID, NS_IMENUBUTTON_IID); static NS_DEFINE_IID(kIMenuButtonIID, NS_IMENUBUTTON_IID);
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID); static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID); //static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
static const char* gsAOLFormat = "AOLMAIL"; static const char* gsAOLFormat = "AOLMAIL";
static const char* gsHTMLFormat = "text/html"; static const char* gsHTMLFormat = "text/html";
@ -1070,7 +1070,7 @@ void nsBrowserWindow::DoFind()
kIXPBaseWindowIID, kIXPBaseWindowIID,
(void**) &dialog); (void**) &dialog);
if (rv == NS_OK) { if (rv == NS_OK) {
dialog->Init(mAppShell, nsnull, findHTML, title, rect, PRUint32(~0), PR_FALSE); dialog->Init(eXPBaseWindowType_window, mAppShell, nsnull, findHTML, title, rect, PRUint32(~0), PR_FALSE);
dialog->SetVisible(PR_TRUE); dialog->SetVisible(PR_TRUE);
if (NS_OK == dialog->QueryInterface(kIXPBaseWindowIID, (void**) &mXPDialog)) { if (NS_OK == dialog->QueryInterface(kIXPBaseWindowIID, (void**) &mXPDialog)) {
} }

Просмотреть файл

@ -27,6 +27,7 @@
#include "nsXPBaseWindow.h" #include "nsXPBaseWindow.h"
#endif #endif
#include "nsINetSupport.h"
#include "nsIAppShell.h" #include "nsIAppShell.h"
#include "nsIWidget.h" #include "nsIWidget.h"
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
@ -46,6 +47,7 @@
#include "nsHTMLContentSinkStream.h" #include "nsHTMLContentSinkStream.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMEventReceiver.h" #include "nsIDOMEventReceiver.h"
#include "nsIDOMElement.h"
#include "nsWindowListener.h" #include "nsWindowListener.h"
@ -63,6 +65,8 @@
static NS_DEFINE_IID(kXPBaseWindowCID, NS_XPBASE_WINDOW_CID); static NS_DEFINE_IID(kXPBaseWindowCID, NS_XPBASE_WINDOW_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID); static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID); static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID);
static NS_DEFINE_IID(kDialogCID, NS_DIALOG_CID);
static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID); static NS_DEFINE_IID(kIXPBaseWindowIID, NS_IXPBASE_WINDOW_IID);
static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID); static NS_DEFINE_IID(kIStreamObserverIID, NS_ISTREAMOBSERVER_IID);
@ -78,7 +82,7 @@ static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID);
static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID); static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID);
static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID); static NS_DEFINE_IID(kIDOMElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID); //static NS_DEFINE_IID(kINetSupportIID, NS_INETSUPPORT_IID);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
nsXPBaseWindow::nsXPBaseWindow() : nsXPBaseWindow::nsXPBaseWindow() :
@ -185,25 +189,33 @@ HandleXPDialogEvent(nsGUIEvent *aEvent)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
nsresult nsXPBaseWindow::Init(nsIAppShell* aAppShell, nsresult nsXPBaseWindow::Init(nsXPBaseWindowType aType,
nsIPref* aPrefs, nsIAppShell* aAppShell,
const nsString& aDialogURL, nsIPref* aPrefs,
const nsString& aTitle, const nsString& aDialogURL,
const nsRect& aBounds, const nsString& aTitle,
PRUint32 aChromeMask, const nsRect& aBounds,
PRBool aAllowPlugins) PRUint32 aChromeMask,
PRBool aAllowPlugins)
{ {
mAllowPlugins = aAllowPlugins; mAllowPlugins = aAllowPlugins;
mWindowType = aType;
mAppShell = aAppShell; mAppShell = aAppShell;
NS_IF_ADDREF(mAppShell); NS_IF_ADDREF(mAppShell);
mPrefs = aPrefs; mPrefs = aPrefs;
NS_IF_ADDREF(mPrefs); NS_IF_ADDREF(mPrefs);
// Create top level window // Create top level window
nsresult rv = nsRepository::CreateInstance(kWindowCID, nsnull, kIWidgetIID, nsresult rv;
if (aType == eXPBaseWindowType_window) {
nsRepository::CreateInstance(kWindowCID, nsnull, kIWidgetIID,
(void**)&mWindow); (void**)&mWindow);
} else {
nsRepository::CreateInstance(kDialogCID, nsnull, kIWidgetIID,
(void**)&mWindow);
}
if (NS_OK != rv) { if (NS_OK != rv) {
return rv; return rv;
} }
@ -583,7 +595,7 @@ NS_IMETHODIMP nsXPBaseWindow::NewWebShell(nsIWebShell*& aNewWebShell)
nsRect bounds; nsRect bounds;
GetBounds(bounds); GetBounds(bounds);
rv = dialogWindow->Init(mAppShell, mPrefs, mDialogURL, mTitle, bounds, 0, mAllowPlugins); rv = dialogWindow->Init(mWindowType, mAppShell, mPrefs, mDialogURL, mTitle, bounds, 0, mAllowPlugins);
if (NS_OK == rv) { if (NS_OK == rv) {
dialogWindow->SetVisible(PR_TRUE); dialogWindow->SetVisible(PR_TRUE);
nsIWebShell *shell; nsIWebShell *shell;

Просмотреть файл

@ -61,13 +61,14 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// nsIBrowserWindow // nsIBrowserWindow
NS_IMETHOD Init(nsIAppShell* aAppShell, NS_IMETHOD Init(nsXPBaseWindowType aType,
nsIPref* aPrefs, nsIAppShell* aAppShell,
const nsString& aDialogURL, nsIPref* aPrefs,
const nsString& aTitle, const nsString& aDialogURL,
const nsRect& aBounds, const nsString& aTitle,
PRUint32 aChromeMask, const nsRect& aBounds,
PRBool aAllowPlugins = PR_TRUE); PRUint32 aChromeMask,
PRBool aAllowPlugins = PR_TRUE);
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY); NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY);
NS_IMETHOD SetDimensions(PRInt32 aWidth, PRInt32 aHeight); NS_IMETHOD SetDimensions(PRInt32 aWidth, PRInt32 aHeight);
@ -162,6 +163,7 @@ protected:
nsIPref* mPrefs; //not addref'ed! nsIPref* mPrefs; //not addref'ed!
PRBool mAllowPlugins; PRBool mAllowPlugins;
nsXPBaseWindowType mWindowType;
}; };