User Tools

Site Tools


developer_center:recipe_book:extensions_and_core:display_panes

Display Panes

Determing the size of the display pane you're in

var width = document.documentElement.boxObject.width;
var height = document.documentElement.boxObject.height;

Auto toggling visibility of a display pane

function tabSelectListener(e)
{
	var browser = window.top.gBrowser.selectedTab.linkedBrowser;
	var split = window.top.document.getElementById("displaypane_right_sidebar_splitter");
	if (browser.contentDocument.location.toString().indexOf(
		"chrome://songbird/content/xul/sbLibraryPage.xul") != -1)
	{
		split.setAttribute("state", "open");
	} else {
		split.setAttribute("state", "collapsed");
	}
}

function realLoad(e) {
	var tabContainer = window.top.gBrowser.tabContainer;
	tabSelectListener();
	tabContainer.addEventListener("TabSelect", tabSelectListener, false);
}

window.addEventListener("load",
	function(e) {
		window.top.gBrowser.addEventListener("load", function(e) {
			realLoad(e);
		}, false);
	}, false);

var paneMgr = Components.classes["@songbirdnest.com/Songbird/DisplayPane/Manager;1"]
		.getService(Components.interfaces.sbIDisplayPaneManager);    

paneMgr.registerContent("chrome://test-stevel/content/whizzy.xul", 
                        "Whizzy",
                        "http://wikipedia.org/favicon.ico",
                        350,
                        300,
                        "sidebar",
                        true);
developer_center/recipe_book/extensions_and_core/display_panes.txt · Last modified: 2013/12/28 08:32 by geekshadow