/* Copyright 2006 por Connecty Networks. Todos os direitos reservados */
function Settings() { this.init(); this.cfg = { hasSizeBtn: false, hasRefreshBtn: false, hasSettingsBtn: false, hasDrag: false, title: "Defini&ccedil;&otilde;es do Origo", module: "Settings"
}
this.domContent = [ { tag: "div", className: "menu_panel", style: {textAlign: "center"}, innerHTML: "<h1>T&iacute;tulo do meu Origo</h1>", childs: [ createColorSelectDom("Definir cor do t&iacute;tulo", "title", "select_title_color"), { tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" }, createFontSelectDom("Tipo de letra", "title", "select_title_font"), { tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" }, createFontSizeSelectDom("Tamanho do tipo de letra", "title", "select_title_font_size"), { tag: "div", className: "menu_panel", style: {textAlign: "center"}, innerHTML: "T&iacute;tulo do meu Origo: ", childs: [ { tag: "input", type: "text", size: "60", id: "title_text", events: { onkeyup: "applyTitleText()" }
}
]
}, { tag: "div", className: "menu_panel", style: {textAlign: "center"}, childs: [ { tag: "input", type: "button", value: " Guardar ", events: { onclick: "save()" }
}
]
}
]
}, { tag: "hr", width: "100%"}, { tag: "div", className: "menu_panel", style: {textAlign: "center"}, innerHTML: "<h1>Fundo do meu Origo</h1>", childs: [ createColorSelectDom("Definir cor de fundo do meu Origo", "background", "select_page_color"), { tag: "div", className: "menu_panel", innerHTML: "ou definir imagem para fundo:", style: {textAlign: "center"}}, { tag: "div", className: "menu_panel", style: {textAlign: "center"}, innerHTML: "Endere&ccedil;o da imagem: ", childs: [ { tag: "input", type: "text", size: "60", id: "select_background", value: "http://"}, { tag: "input", type: "button", value: " Prever ", events: { onclick: "setBckgroundImage()" }
}
]
}, { tag: "div", className: "menu_panel", style: {textAlign: "center"}, childs: [ { tag: "input", type: "button", value: " Guardar ", events: { onclick: "save()" }
}
]
}
]
}
]
this.getSignature = function() { return SYSWIDGET_WKEY+4;}
this.defaultProfile["title"] = "O meu Origo"; this.defaultProfile["title_color"] = "#FF6600"; this.defaultProfile["title_font"] = "Arial, Helvetica"; this.defaultProfile["title_font_size"] = "26px"; this.defaultProfile["background_style"] = "color"; this.defaultProfile["background"] = "#FFFFFF"; this.onBuildInterface = function() { this.elements.window.style.width = "600"; this.setTitle(this.cfg.title); this.buildDomModel(this.elements.content, this.domContent); this.applyTitleLook(); this.elements.title_text.value = this.profile.title; this.applyTitleText(); this.applyBackgoundLook();}
this.close = function() { desktop.closeCurrentPage();}
this.onSelectColor = function(target, color) { switch(target) { case "title":
this.profile.title_color = color; this.applyTitleLook(); break; case "background":
this.profile.background_style = "color"; this.profile.background = color; this.applyBackgoundLook(); break;}
}
this.onSelectFont = function(target, font) { switch(target) { case "title":
this.profile.title_font = font; this.applyTitleLook(); break;}
}
this.onSelectFontSize = function(target, fontSize) { switch(target) { case "title":
this.profile.title_font_size = fontSize; this.applyTitleLook(); break;}
}
this.applyTitleLook = function() { with(desktop.elements.main_title) { innerHTML = this.profile.title; style.fontFamily = this.profile.title_font; style.fontSize = this.profile.title_font_size; style.color = this.profile.title_color;}
}
this.applyTitleText = function() { this.profile.title = trim(this.elements.title_text.value); document.title = this.profile.title; desktop.elements.main_title.innerHTML = this.profile.title;}
this.setBckgroundImage = function() { this.profile.background_style = "img"; this.profile.background = trim(this.elements.select_background.value); this.applyBackgoundLook();}
this.applyBackgoundLook = function() { if(this.profile.background_style == "color") { document.body.style.backgroundImage = ''; document.body.style.backgroundColor = this.profile.background;} else { document.body.style.backgroundColor = ''; document.body.style.backgroundImage = "url("+this.profile.background+")";}
}
}
Settings.prototype = new Widget();