User:Gerbrant/gui/window.js

new function {

var docLoaded = false;

document.write("\ \ .gerbrant-window\ {\	position:absolute;\	z-index:15;\ 	left:1em;top:3em;\	padding:1px;\	border:1px solid #888;\	background:#fff;\ }\ .gerbrant-titlebar\ {\	border:1px solid #88f;\	background:#ddf;\	color:#000;\ }\ .gerbrant-windowcontent\ {\	padding:1em;\	background:#eee;\	color:#000;\ }\ ");

hookEvent("load", function {	docLoaded = true; });

loadModule("Gerbrant.gui.taskbar", function(tb) {

module("Gerbrant.gui.window", function(t) {	var s;	var divWindow = document.createElement("DIV");	var divTitle = document.createElement("DIV");	var divContent = document.createElement("DIV");	var visible = true;

divTitle.className = "gerbrant-titlebar"; divContent.className = "gerbrant-windowcontent"; divWindow.className = "gerbrant-window"; divWindow.appendChild(divTitle); divWindow.appendChild(divContent);

this.getCaption = function{return divTitle.innerHTML;}; this.setCaption = function(t){divTitle.innerHTML = t;};

this.getVisible = function{return visible;}; this.setVisible = function(b){divWindow.style.display = ((visible = b) ? "" : "none");};

this.getContent = function{return divContent;}; this.getContentHTML = function{return divContent.innerHTML;}; this.setContentHTML = function(t){divContent.innerHTML = t;};

this.setCaption(t);

function show {		document.getElementById("column-one").appendChild(divWindow); }	if(docLoaded) show; else hookEvent("load", show); tb.addWindow(this); });

});

}