зеркало из https://github.com/mozilla/gecko-dev.git
Added temporary menu hook up as an experiement
This commit is contained in:
Родитель
1cdf45be97
Коммит
08c883041b
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "nsIAppShell.h"
|
#include "nsIAppShell.h"
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
|
#include "nsIWebShellWindow.h"
|
||||||
#include "nsWebShellWindow.h"
|
#include "nsWebShellWindow.h"
|
||||||
|
|
||||||
#include "nsWidgetsCID.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(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
|
||||||
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
|
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
|
||||||
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_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
|
NS_IMETHODIMP
|
||||||
nsAppShellService::Shutdown(void)
|
nsAppShellService::Shutdown(void)
|
||||||
{
|
{
|
||||||
|
//mAppShell->Exit();
|
||||||
|
while (mWindowList->Count() > 0) {
|
||||||
|
nsISupports * winSupports = mWindowList->ElementAt(0);
|
||||||
|
nsCOMPtr<nsIWidget> window(do_QueryInterface(winSupports));
|
||||||
|
if (window) {
|
||||||
|
mWindowList->RemoveElementAt(0);
|
||||||
|
CloseTopLevelWindow(window);
|
||||||
|
} else {
|
||||||
|
nsCOMPtr<nsIWebShellWindow> webShellWin(do_QueryInterface(winSupports));
|
||||||
|
if (webShellWin) {
|
||||||
|
nsIWidget * win;
|
||||||
|
webShellWin->GetWidget(win);
|
||||||
|
CloseTopLevelWindow(win);
|
||||||
|
}
|
||||||
|
//nsCOMPtr<nsIWebShellContainer> wsc(do_QueryInterface(winSupports));
|
||||||
|
//if (wsc) {
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,11 +278,18 @@ nsAppShellService::RegisterTopLevelWindow(nsIWidget* aWindow)
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
else {
|
else {
|
||||||
nsWebShellWindow* window = (nsWebShellWindow *) data;
|
nsWebShellWindow* window = (nsWebShellWindow *) data;
|
||||||
|
nsIWebShellWindow * webShellWin;
|
||||||
|
rv = window->QueryInterface(kIWebShellWindowIID, (void **) &webShellWin);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
mWindowList->AppendElement(webShellWin);
|
||||||
|
}
|
||||||
|
|
||||||
// nsCOMPtr<nsIWebShellContainer> wsc(window); DRaM
|
// nsCOMPtr<nsIWebShellContainer> wsc(window); DRaM
|
||||||
nsIWebShellContainer* wsc;
|
/*nsIWebShellContainer* wsc;
|
||||||
rv = window->QueryInterface(kIWebShellContainerIID, (void **) &wsc);
|
rv = window->QueryInterface(kIWebShellContainerIID, (void **) &wsc);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
mWindowList->AppendElement(wsc);
|
mWindowList->AppendElement(wsc);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -640,6 +640,26 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi
|
||||||
// Make nsMenuItem a child of nsMenu
|
// Make nsMenuItem a child of nsMenu
|
||||||
//pnsMenu->AddMenuItem(pnsMenuItem); // XXX adds an additional item
|
//pnsMenu->AddMenuItem(pnsMenuItem); // XXX adds an additional item
|
||||||
ConnectCommandToOneGUINode(menuitemNode);
|
ConnectCommandToOneGUINode(menuitemNode);
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// This block contains temporary menu hookup code.
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(menuitemNode));
|
||||||
|
if (!domElement)
|
||||||
|
return;
|
||||||
|
|
||||||
|
nsAutoString cmdAtom("cmd");
|
||||||
|
nsString cmdName;
|
||||||
|
|
||||||
|
domElement->GetAttribute(cmdAtom, cmdName);
|
||||||
|
nsCOMPtr<nsIXULCommand> cmd(FindCommandByName(cmdName));
|
||||||
|
if (cmd) {
|
||||||
|
nsCOMPtr<nsIMenuListener> listener(do_QueryInterface(cmd));
|
||||||
|
pnsMenuItem->AddMenuListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче