theme = new QxAppearanceTheme("default", "qooxdoo default appearance"); theme.registerAppearance ( "menu-button-normal", { setup : function() { this.fontNormal = "12px serif"; this.fontSelected = "12px serif bold"; this.fontHover = "12px serif bold"; }, initial : function(vWidget,vTheme) { var vReturn = { horizontalChildrenAlign : 'center' }; vReturn.lblFont = this.fontNormal; return vReturn; } } ); theme.registerAppearance ( "menu-button-selected", { setup : function() { this.fontNormal = "12px serif"; this.fontSelected = "12px serif bold"; this.fontHover = "12px serif bold"; }, initial : function(vWidget,vTheme) { var vReturn = { horizontalChildrenAlign : 'center' }; vReturn.lblFont = this.fontSelected; return vReturn; } } ); theme.registerAppearance ( "menu-button-hover", { setup : function() { this.fontNormal = "12px serif"; this.fontSelected = "12px serif bold"; this.fontHover = "12px serif bold"; }, initial : function(vWidget,vTheme) { var vReturn = { horizontalChildrenAlign : 'center' }; vReturn.lblFont = this.fontHover; return vReturn; } } ); function MenuButton(vText) { QxVerticalBoxLayout.call(this); this.lbl = new QxLabel(); this.img = new QxImage(); this.lbl.setFont("12px serif"); this.lbl.setCursor(QxConst.CURSOR_DEFAULT); this.lbl.setAnonymous(true); this.setAppearance("menu-button-normal"); this.setLabel(vText); this.add(this.img,this.lbl); this.addEventListener(QxConst.EVENT_TYPE_MOUSEOVER,function(e) { this.setPushState('hover'); }); this.addEventListener(QxConst.EVENT_TYPE_MOUSEOUT,function(e) { this.setPushState('normal'); }); this.addEventListener(QxConst.EVENT_TYPE_MOUSEUP,function(e) { this.setMenuState('selected'); }); this.setHeight(44); this.setWidth(60); } MenuButton.extend(QxVerticalBoxLayout,"MenuButton"); MenuButton.addProperty({ name : "label", type : QxConst.TYPEOF_STRING }); MenuButton.addProperty({ name : "srcNormal", type : QxConst.TYPEOF_STRING, defaultValue : false }); MenuButton.addProperty({ name : "srcHover", type : QxConst.TYPEOF_STRING, defaultValue : false }); MenuButton.addProperty({ name : "srcSelected", type : QxConst.TYPEOF_STRING, defaultValue : false }); MenuButton.addProperty({ name : "pushState", type : QxConst.TYPEOF_STRING, defaultValue : "normal" }); MenuButton.addProperty({ name : "menuState", type : QxConst.TYPEOF_STRING, defaultValue : "normal" }); MenuButton.addProperty({ name : "lblFont", type : QxConst.TYPEOF_STRING, defaultValue : "" }); MenuButton.addProperty({ name : "dispUrl", type : QxConst.TYPEOF_STRING, defaultValue : "" }); MenuButton.changeProperty({ name : "appearance", type : QxConst.TYPEOF_STRING, defaultValue : "menu-button-normal" }); proto._modifyLabel = function(propValue, propOldValue, propData) { this.lbl.setHtml(propValue); return true; } proto._modifyLblFont = function(propValue, propOldValue, propData) { this.lbl.setFont(propValue); return true; } proto._modifySrcNormal = function(propValue, propOldValue, propData) { if ((this.getPushState() == "normal")&& (this.getMenuState() != "selected")) { this.img.setSource(propValue); } return true; } proto._modifySrcHover = function(propValue, propOldValue, propData) { if ((this.getPushState() == "hover")&& (this.getMenuState() != "selected")) { this.img.setSource(propValue); } return true; } proto._modifySrcSelected = function(propValue, propOldValue, propData) { if ((this.getPushState() != "hover")&& (this.getMenuState() == "selected")) { this.img.setSource(propValue); } return true; } proto._modifyPushState = function(propValue, propOldValue, propData) { var ps = propValue; var ms = this.getMenuState(); if ((ps == "hover")&& (ms != "selected")) { this.img.setSource(this.getSrcHover()); //this.lbl.setFont(this.fontHover); this.setAppearance("menu-button-hover"); var btns = window.top._bd_menu_buttons; var c = btns.length; for (var i=0;i { if (btns[i] != this) { btns[i].setPushState('normal'); } } } else { if (ms == "selected") { this.img.setSource(this.getSrcSelected()); this.setAppearance("menu-button-selected"); //this.lbl.setFont(this.fontSelected); } else { this.img.setSource(this.getSrcNormal()); //this.lbl.setFont(this.fontNormal); this.setAppearance("menu-button-normal"); } } return true; } proto._modifyMenuState = function(propValue, propOldValue, propData) { var ps = this.getPushState(); var ms = propValue; if ((ps == "hover")&& (ms != "selected")) { this.img.setSource(this.getSrcHover()); this.setAppearance("menu-button-hover"); } else { if (ms == "selected") { this.img.setSource(this.getSrcSelected()); var btns = window.top._bd_menu_buttons; var c = btns.length; for (var i=0;i { if (btns[i] != this) { btns[i].setMenuState('normal'); } } window.top._bd_iframe.setSource(this.getDispUrl()); this.setAppearance("menu-button-selected"); } else { this.img.setSource(this.getSrcNormal()); this.setAppearance("menu-button-normal"); } } return true; } /* page sections */ function bd_init(app) { var secheight = 73; var w = new QxCanvasLayout(); w.set({backgroundColor: (new QxColor('#999999')),left:0,top:0,width:'100%',height:secheight}); var w1 = new QxCanvasLayout(); w1.set({backgroundColor: (new QxColor('#e1e6fd')),left:0,top:0,width:'100%',height:secheight-2}); //w.add(w1); var h = new QxIframe(); h.set({left:66,top:74,right:0,bottom:0,source:'template/home.php'}); window.top._bd_iframe = h; var l = new QxCanvasLayout(); l.set({backgroundColor:'#999999',left:64,top:10,bottom:0,width:2}); app.add(l,w,w1,h); } function bd_getLogoDisp() { var l = new QxHorizontalBoxLayout(); var w = new QxImage("images/bdlogo.png"); l.set({top:5,left:0,width:'100%',height:'auto',horizontalChildrenAlign:'center'}); l.add(w); return l; } function bd_getMenuDisp() { window.top._bd_menu_buttons = []; var l = new QxVerticalBoxLayout(); //var lg = new QxHorizontalBoxLayout(); //lg.set({ width:'100%',height:'auto',top:80,left:0,horizontalChildrenAlign:'center' }); l.set({top:80,left:0,width:'auto',height:'auto',spacing:18,horizontalChildrenAlign:'center'}); var i0 = new MenuButton("Home"); i0.setSrcNormal('images/home_normal.png'); i0.setSrcHover('images/home_hover.png'); i0.setSrcSelected('images/home_selected.png'); i0.setDispUrl('template/home.php'); window.top._bd_menu_buttons.push(i0); l.add(i0); var i1 = new MenuButton("WebMail"); i1.setSrcNormal('images/contact_normal.png'); i1.setSrcHover('images/contact_hover.png'); i1.setSrcSelected('images/contact_selected.png'); i1.setDispUrl('http://webmail.bitdaddy.com'); window.top._bd_menu_buttons.push(i1); l.add(i1); //lg.add(l); return l; } function bd_getMainSectionDisp() { return 0; }