toolkit/content/macWindowMenu.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e31ee54ba8e2
1 // -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 function macWindowMenuDidShow()
8 {
9 var windowManagerDS =
10 Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
11 .getService(Components.interfaces.nsIWindowDataSource);
12 var sep = document.getElementById("sep-window-list");
13 // Using double parens to avoid warning
14 while ((sep = sep.nextSibling)) {
15 var url = sep.getAttribute('id');
16 var win = windowManagerDS.getWindowForResource(url);
17 if (win.document.documentElement.getAttribute("inwindowmenu") == "false")
18 sep.hidden = true;
19 else if (win == window)
20 sep.setAttribute("checked", "true");
21 }
22 }
23
24 function toOpenWindow( aWindow )
25 {
26 // deminiaturize the window, if it's in the Dock
27 if (aWindow.windowState == STATE_MINIMIZED)
28 aWindow.restore();
29 aWindow.document.commandDispatcher.focusedWindow.focus();
30 }
31
32 function ShowWindowFromResource( node )
33 {
34 var windowManagerDS =
35 Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator']
36 .getService(Components.interfaces.nsIWindowDataSource);
37
38 var desiredWindow = null;
39 var url = node.getAttribute('id');
40 desiredWindow = windowManagerDS.getWindowForResource( url );
41 if (desiredWindow)
42 toOpenWindow(desiredWindow);
43 }
44
45 function zoomWindow()
46 {
47 if (window.windowState == STATE_NORMAL)
48 window.maximize();
49 else
50 window.restore();
51 }

mercurial