From eeeee0a6e9c0be1d1917902c15c50ff88e10878f Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Wed, 17 Feb 1999 16:12:10 +0000 Subject: [PATCH] Added temporary menu hook up as an experiement --- xpfe/appshell/src/nsAppShellService.cpp | 32 ++++++++++++++++++++++++- xpfe/appshell/src/nsWebShellWindow.cpp | 20 ++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 6a035fc5311..70940dc4655 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -29,6 +29,7 @@ #include "nsIAppShell.h" #include "nsIWidget.h" +#include "nsIWebShellWindow.h" #include "nsWebShellWindow.h" #include "nsWidgetsCID.h" @@ -48,6 +49,7 @@ static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID); static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID); +static NS_DEFINE_IID(kIWebShellWindowIID, NS_IWEBSHELL_WINDOW_IID); @@ -162,6 +164,27 @@ nsAppShellService::DispatchNativeEvent(void * aEvent) NS_IMETHODIMP nsAppShellService::Shutdown(void) { + //mAppShell->Exit(); + while (mWindowList->Count() > 0) { + nsISupports * winSupports = mWindowList->ElementAt(0); + nsCOMPtr window(do_QueryInterface(winSupports)); + if (window) { + mWindowList->RemoveElementAt(0); + CloseTopLevelWindow(window); + } else { + nsCOMPtr webShellWin(do_QueryInterface(winSupports)); + if (webShellWin) { + nsIWidget * win; + webShellWin->GetWidget(win); + CloseTopLevelWindow(win); + } + //nsCOMPtr wsc(do_QueryInterface(winSupports)); + //if (wsc) { + // + //} + break; + } + } return NS_OK; } @@ -255,11 +278,18 @@ nsAppShellService::RegisterTopLevelWindow(nsIWidget* aWindow) rv = NS_ERROR_NULL_POINTER; else { nsWebShellWindow* window = (nsWebShellWindow *) data; + nsIWebShellWindow * webShellWin; + rv = window->QueryInterface(kIWebShellWindowIID, (void **) &webShellWin); + if (NS_SUCCEEDED(rv)) { + mWindowList->AppendElement(webShellWin); + } + // nsCOMPtr wsc(window); DRaM - nsIWebShellContainer* wsc; + /*nsIWebShellContainer* wsc; rv = window->QueryInterface(kIWebShellContainerIID, (void **) &wsc); if (NS_SUCCEEDED(rv)) mWindowList->AppendElement(wsc); + */ } return rv; } diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 9e44ae84e76..5aed747032f 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -640,6 +640,26 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi // Make nsMenuItem a child of nsMenu //pnsMenu->AddMenuItem(pnsMenuItem); // XXX adds an additional item ConnectCommandToOneGUINode(menuitemNode); + //----------------------------------------------------------- + // This block contains temporary menu hookup code. + //----------------------------------------------------------- + { + nsCOMPtr domElement(do_QueryInterface(menuitemNode)); + if (!domElement) + return; + + nsAutoString cmdAtom("cmd"); + nsString cmdName; + + domElement->GetAttribute(cmdAtom, cmdName); + nsCOMPtr cmd(FindCommandByName(cmdName)); + if (cmd) { + nsCOMPtr listener(do_QueryInterface(cmd)); + pnsMenuItem->AddMenuListener(listener); + } + + } + //----------------------------------------------------------- } }