I found this file in google code with function:
function SetAlwaysOnTop() {
var chkTop = document.getElementById("itmAlwaysOnTop");
var xulWin = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow);
if(chkTop.getAttribute("checked") == "true") {
xulWin.zLevel = xulWin.raisedZ;
} else {
xulWin.zLevel = xulWin.normalZ;
}
}
The parts I need are simple:
var xulWin = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow);
xulWin.zLevel = xulWin.raisedZ;
But I do not find that where Ci defined. Any idea what this could be? Or any other idea on how to install a window always on top? (this "windows only" solution does not suit me).
- update
I am reading about nsIWindowMediator , which has some methods for processing a Z window. But it says that methods should be used from C ++, not javascript. Does this mean that the code should be used from XPCOM components (should I open a window as an XPCOM component)? Can anyone who has already used this confirm?
I am still reading.
- update
nsIWindowMediator ( XPCOM), , Z.
- .
- 'alwaysraised':
test.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
onload="open('top.xul','GreenfoxChannelWindow','chrome, alwaysraised');"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="MAIN WINDOW"/>
</window>
top.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="ON TOP"/>
</window>
.
- "zlevel":
test.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
onload="open('top.xul','GreenfoxChannelWindow','chrome');"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="MAIN WINDOW"/>
</window>
top.xul:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300" zlevel="6"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<label value="ON TOP"/>
</window>
. , , z test test.xul( top.xul zlevel = "6" )