?? coreclasses.js
字號:
/* * Bindows 1.10 * http://www.bindows.net/ * Copyright (c) 2003-2004 MB Technologies * * Bindows(tm) belongs to MB Technologies (Georgia, USA). All rights reserved. * You are not allowed to copy or modify this code. Commercial use requires * license. */function BiBorder(nWidth,sStyle,sColor)
{BiObject.call(this);this._props={};this._set("border",(nWidth!=null?nWidth+"px ":"")+(sStyle?sStyle+" ":"")+(sColor?sColor:""));this._leftWidth=this._rightWidth=this._topWidth=this._bottomWidth=nWidth;this._leftStyle=this._rightStyle=this._topStyle=this._bottomStyle=sStyle;this._leftColor=this._rightColor=this._topColor=this._bottomColor=sColor;if(BiBrowserCheck.moz)
{this._mozSyncLeftColors();this._mozSyncRightColors();this._mozSyncTopColors();this._mozSyncBottomColors();}}
_p=BiBorder.prototype=new BiObject;_p._className="BiBorder";BiBorder.prototype.getLeftWidth=function(){return this._leftWidth;};BiBorder.prototype.getLeftStyle=function(){return this._leftStyle;};BiBorder.prototype.getLeftColor=function(){return this._leftColor;};BiBorder.prototype.getRightWidth=function(){return this._rightWidth;};BiBorder.prototype.getRightStyle=function(){return this._rightStyle;};BiBorder.prototype.getRightColor=function(){return this._rightColor;};BiBorder.prototype.getTopWidth=function(){return this._topWidth;};BiBorder.prototype.getTopStyle=function(){return this._topStyle;};BiBorder.prototype.getTopColor=function(){return this._topColor;};BiBorder.prototype.getBottomWidth=function(){return this._bottomWidth;};BiBorder.prototype.setBottomWidth=function(v){this._bottomWidth=v;};BiBorder.prototype.getBottomStyle=function(){return this._bottomStyle;};BiBorder.prototype.setBottomStyle=function(v){this._bottomStyle=v;};BiBorder.prototype.getBottomColor=function(){return this._bottomColor;};BiBorder.prototype.setBottomColor=function(v){this._bottomColor=v;};_p.setLeft=function(nWidth,sStyle,sColor)
{this._set("borderLeft",(nWidth!=null?nWidth+"px ":"")+(sStyle?sStyle+" ":"")+(sColor?sColor:""));this._leftWidth=nWidth;this._leftStyle=sStyle;this._leftColor=sColor;if(BiBrowserCheck.moz)
this._mozSyncLeftColors();};_p.setRight=function(nWidth,sStyle,sColor)
{this._set("borderRight",(nWidth!=null?nWidth+"px ":"")+(sStyle?sStyle+" ":"")+(sColor?sColor:""));this._rightWidth=nWidth;this._rightStyle=sStyle;this._rightColor=sColor;if(BiBrowserCheck.moz)
this._mozSyncRightColors();};_p.setTop=function(nWidth,sStyle,sColor)
{this._set("borderTop",(nWidth!=null?nWidth+"px ":"")+(sStyle?sStyle+" ":"")+(sColor?sColor:""));this._topWidth=nWidth;this._topStyle=sStyle;this._topColor=sColor;if(BiBrowserCheck.moz)
this._mozSyncTopColors();};_p.setBottom=function(nWidth,sStyle,sColor)
{this._set("borderBottom",(nWidth!=null?nWidth+"px ":"")+(sStyle?sStyle+" ":"")+(sColor?sColor:""));this._bottomWidth=nWidth;this._bottomStyle=sStyle;this._bottomColor=sColor;if(BiBrowserCheck.moz)
this._mozSyncBottomColors();};_p.setWidth=function(nWidth){this._set("borderWidth",nWidth+"px");this._leftWidth=this._rightWidth=this._topWidth=this._bottomWidth=nWidth;};_p.setStyle=function(sStyle){this._set("borderStyle",sStyle);this._leftStyle=this._rightStyle=this._topStyle=this._bottomStyle=sStyle;if(BiBrowserCheck.moz)
{this._mozSyncLeftColors();this._mozSyncRightColors();this._mozSyncTopColors();this._mozSyncBottomColors();}};_p.setColor=function(sColor){this._set("borderColor",sColor);this._leftColor=this._rightColor=this._topColor=this._bottomColor=sColor;if(BiBrowserCheck.moz)
{this._mozSyncLeftColors();this._mozSyncRightColors();this._mozSyncTopColors();this._mozSyncBottomColors();}};_p.setLeftWidth=function(nWidth){this.setLeft(nWidth,this._leftStyle,this._leftColor);};_p.setRightWidth=function(nWidth){this.setRight(nWidth,this._rightStyle,this._rightColor);};_p.setTopWidth=function(nWidth){this.setTop(nWidth,this._topStyle,this._topColor);};_p.setBottomWidth=function(nWidth){this.setBottom(nWidth,this._bottomStyle,this._bottomColor);};_p.setLeftStyle=function(sStyle)
{this.setLeft(this._leftWidth,sStyle,this._leftColor);if(BiBrowserCheck.moz)
this._mozSyncLeftColors();};_p.setRightStyle=function(sStyle)
{this.setRight(this._rightWidth,sStyle,this._rightColor);if(BiBrowserCheck.moz)
this._mozSyncRightColors();};_p.setTopStyle=function(sStyle)
{this.setTop(this._topWidth,sStyle,this._topColor);if(BiBrowserCheck.moz)
this._mozSyncTopColors();};_p.setBottomStyle=function(sStyle)
{this.setBottom(this._bottomWidth,sStyle,this._bottomColor);if(BiBrowserCheck.moz)
this._mozSyncBottomColors();};_p.setLeftColor=function(sColor)
{this.setLeft(this._leftWidth,this._leftStyle,sColor);if(BiBrowserCheck.moz)
this._mozSyncLeftColors();};_p.setRightColor=function(sColor)
{this.setRight(this._rightWidth,this._rightStyle,sColor);if(BiBrowserCheck.moz)
this._mozSyncRightColors();};_p.setTopColor=function(sColor)
{this.setTop(this._topWidth,this._topStyle,sColor);if(BiBrowserCheck.moz)
this._mozSyncTopColors();};_p.setBottomColor=function(sColor)
{this.setBottom(this._bottomWidth,this._bottomStyle,sColor);if(BiBrowserCheck.moz)
this._mozSyncBottomColors();};_p._setLeftColors=function(sColors){this._set("MozBorderLeftColors",sColors);};_p._setRightColors=function(sColors){this._set("MozBorderRightColors",sColors);};_p._setTopColors=function(sColors){this._set("MozBorderTopColors",sColors);};_p._setBottomColors=function(sColors){this._set("MozBorderBottomColors",sColors);};_p.paintBorder=function(oComponent){for(var p in this._props){oComponent.setStyleProperty(p,this._props[p]);}};_p.removeBorder=function(oComponent){for(var p in this._props){oComponent.removeStyleProperty(p);}};_p._set=function(sName,sValue){if(sValue==""||sValue==null)
delete this._props[sName];else this._props[sName]=sValue;};_p._mozSyncLeftColors=function()
{if(this._leftColor)
this._setLeftColors("");else {switch(this._leftStyle)
{case"groove":this._setLeftColors("ThreeDShadow ThreeDHighlight");break;case"ridge":this._setLeftColors("ThreeDHighlight ThreeDShadow");break;case"inset":this._setLeftColors("ThreeDShadow ThreeDDarkShadow");break;case"outset":this._setLeftColors("ThreeDLightShadow ThreeDHighlight");break;default:this._setLeftColors("");}}};_p._mozSyncRightColors=function()
{if(this._rightColor)
this._setRightColors("");else {switch(this._rightStyle)
{case"groove":this._setRightColors("ThreeDHighlight ThreeDShadow");break;case"ridge":this._setRightColors("ThreeDShadow ThreeDHighlight");break;case"inset":this._setRightColors("ThreeDHighlight ThreeDLightShadow");break;case"outset":this._setRightColors("ThreeDDarkShadow ThreeDShadow");break;default:this._setRightColors("");}}};_p._mozSyncTopColors=function()
{if(this._topColor)
this._setTopColors("");else {switch(this._topStyle)
{case"groove":this._setTopColors("ThreeDShadow ThreeDHighlight");break;case"ridge":this._setTopColors("ThreeDHighlight ThreeDShadow");break;case"inset":this._setTopColors("ThreeDShadow ThreeDDarkShadow");break;case"outset":this._setTopColors("ThreeDLightShadow ThreeDHighlight");break;default:this._setTopColors("");}}};_p._mozSyncBottomColors=function()
{if(this._bottomColor)
this._setBottomColors("");else {switch(this._bottomStyle)
{case"groove":this._setBottomColors("ThreeDHighlight ThreeDShadow");break;case"ridge":this._setBottomColors("ThreeDShadow ThreeDHighlight");break;case"inset":this._setBottomColors("ThreeDHighlight ThreeDLightShadow");break;case"outset":this._setBottomColors("ThreeDDarkShadow ThreeDShadow");break;default:this._setBottomColors("");}}};BiBorder.THIN_INSET_BORDER=new BiBorder(1,"solid","ThreeDShadow");BiBorder.THIN_INSET_BORDER.setRightColor("ThreeDHighlight");BiBorder.THIN_INSET_BORDER.setBottomColor("ThreeDHighlight");BiBorder.THIN_OUTSET_BORDER=new BiBorder(1,"solid","ThreeDShadow");BiBorder.THIN_OUTSET_BORDER.setLeftColor("ThreeDHighlight");BiBorder.THIN_OUTSET_BORDER.setTopColor("ThreeDHighlight");BiBorder.INSET_BORDER=new BiBorder(2,"inset");BiBorder.OUTSET_BORDER=new BiBorder(2,"outset");BiBorder.GROOVE_BORDER=new BiBorder(2,"groove");BiBorder.RIDGE_BORDER=new BiBorder(2,"ridge");BiBorder.fromString=function(s)
{var b=new BiBorder;var parts=s.split(/\s+/);for(var i=0;i<parts.length;i++)
{part=parts[i];switch(part)
{case"groove":case"ridge":case"inset":case"outset":case"solid":case"dotted":case"dashed":case"double":case"none":b.setStyle(part);break;default:var n=parseFloat(part);if(n==part||part.indexOf("px")!= -1)
b.setWidth(n);else b.setColor(part);break;}}
return b;};function BiComponent(sName){BiEventTarget.call(this);if(sName)this._name=sName;this._children=[];this._style={};this._htmlProperties={id:"bi-component-"+ ++BiComponent._componentCount,className:"bi-component",unselectable:"on"};this._htmlAttributes={};}
var _p=BiComponent.prototype=new BiEventTarget;BiComponent._componentCount=0;BiComponent.__oninlineevent=function(e){return this._biComponent._oninlineevent(e);};_p._className="BiComponent";_p._parent=null;_p._name="";_p._enabled=true;_p._capture=false;_p._canSelect=false;_p._focused=false;_p._created=false;_p._tabIndex= -1;_p._hideFocus=false;_p._tagName="DIV";_p._toolTip=null;_p._toolTipText=null;_p._opacity=1;_p._visible=true;_p._left=null;_p._right=null;_p._top=null;_p._bottom=null;_p._width=null;_p._height=null;_p._measuredWidth=null;_p._measuredHeight=null;_p._minimumWidth=0;_p._maximumWidth=Infinity;_p._minimumHeight=0;_p._maximumHeight=Infinity;_p._acceptsEnter=false;_p._acceptsEsc=false;_p._focusManager=null;_p._lazyCreate=false;_p.add=function(oChild,oBefore,bAnonymous)
{var p=oChild._parent;if(oBefore==null){if(p!=null)
p.remove(oChild);this._children.push(oChild);}
else{if(oBefore._parent!=this)
throw new Error("Can only add components before siblings");if(p!=null)
p.remove(oChild);this._children.insertBefore(oChild,oBefore);}
oChild._anonymous=Boolean(bAnonymous);oChild._parent=this;if(this._created)
oChild._addHtmlElementToParent(this,oBefore);};_p.remove=function(oChild){if(oChild._parent!=this)
throw new Error("Can only remove children");this._children.remove(oChild);oChild._parent=null;oChild._anonymous=false;if(this._created)
this._removeHtmlElement(oChild);return oChild;};_p.removeAll=function()
{var cs=this.getChildren();var l=cs.length;for(var i=0;i<l;i++)
{this.remove(cs[i]);cs[i].dispose();}};_p.getParent=function()
{if(this._parent==null||!this._parent._anonymous)
return this._parent;return this._parent.getParent();};_p.getChildren=function()
{var res=[];var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
{if(!cs[i]._anonymous)
res.push(cs[i]);}
return res;};_p.hasChildren=function(){var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
{if(!cs[i]._anonymous)
return true;}
return false;};_p.getTopLevelComponent=function(){if(this._parent==null)return null;return this._parent.getTopLevelComponent();};_p.contains=function(oDescendant){if(oDescendant==null)return false;if(oDescendant==this)return true;var p=oDescendant._parent;return this.contains(p);};_p.getFirstChild=function()
{var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
{if(!cs[i]._anonymous)
return cs[i];}
return null;};_p.getLastChild=function()
{var cs=this._children;var l=cs.length;for(var i=l-1;i>=0;i--)
{if(!cs[i]._anonymous)
return cs[i];}
return null;};_p.getPreviousSibling=function(){var p=this._parent;if(p==null)return null;var cs=p._children;for(var i=cs.indexOf(this)-1;i>=0;i--)
{if(!cs[i]._anonymous)
return cs[i];}
return null;};_p.getNextSibling=function()
{var p=this._parent;if(p==null)return null;var cs=p._children;var l=cs.length;for(var i=cs.indexOf(this)+1;i<l;i++)
{if(!cs[i]._anonymous)
return cs[i];}
return null;};_p.setCssClassName=function(s){this.setHtmlProperty("className",s);};_p.getCssClassName=function(){return this.getHtmlProperty("className");};_p.setStyleProperty=function(sProp,sValue)
{this._style[sProp]=sValue;if(this._created)
this._element.style[sProp]=sValue;};_p.getStyleProperty=function(sProp){if(this._created)
{if(BiBrowserCheck.ie)
return this._element.currentStyle[sProp];else return this._document.defaultView.getComputedStyle(this._element,"")[sProp];}
else return this._style[sProp];};_p.removeStyleProperty=function(sProp){delete this._style[sProp];if(this._created)
this._element.style[sProp]="";};_p.getHtmlProperty=function(sProp){return this._htmlProperties[sProp];};_p.setHtmlProperty=function(sProp,sValue)
{this._htmlProperties[sProp]=sValue;if(this._created)
this._element[sProp]=sValue;};_p.removeHtmlProperty=function(sProp){delete this._htmlProperties[sProp];if(this._created)
{if(BiBrowserCheck.ie)
this._element.removeAttribute(sProp);else delete this._element[sProp];}};_p._getHtmlAttribute=function(sName){if(this._created)
return this._element.getAttribute(sName);else return this._htmlAttributes[sName];};_p._setHtmlAttribute=function(sName,sValue)
{this._htmlAttributes[sName]=sValue;if(this._created)
this._element.setAttribute(sName,sValue);};_p._removeHtmlAttribute=function(sName){delete this._htmlAttributes[sName];if(this._created)
this._element.removeAttribute(sName);};_p.setForeColor=function(sForeColor){this.setStyleProperty("color",sForeColor);};_p.getForeColor=function(){return this.getStyleProperty("color");};_p.setBackColor=function(sBackColor){this.setStyleProperty("backgroundColor",sBackColor);};_p.getBackColor=function(){return this.getStyleProperty("backgroundColor");};_p.setZIndex=function(nZIndex)
{this.setStyleProperty("zIndex",nZIndex);};_p.getZIndex=function()
{if(BiBrowserCheck.moz&&this._created)
return Number(this._element.style.zIndex);else return Number(this.getStyleProperty("zIndex"));};_p.setVisible=function(bVisible){this._visible=bVisible;this.setStyleProperty("visibility",bVisible?"inherit":"hidden");if(this._lazyCreate&&!this.getCreated()&&bVisible)
{var p=this.getParent();if(p&&p.getCreated())
{this._addHtmlElementToParent(p,this.getNextSibling(),true);}}};_p.getVisible=function(){return this.getStyleProperty("visibility")!="hidden";};_p.getIsVisible=function(){if(!this.getVisible())return false;var p=this._parent;return p!=null&&p.getIsVisible();};_p.getShowing=function(){throw new Error("BiComponent getShowing is depreciated. Use getIsVisible instead");};_p.setCursor=function(sCursor){this.setStyleProperty("cursor",sCursor=="pointer"&&BiBrowserCheck.ie55?"hand":sCursor);};_p.getCursor=function(){var c=this.getStyleProperty("cursor");return c=="hand"?"pointer":c;};_p.setBackgroundImage=function(sUri){sUri=String(sUri);if(sUri==""||sUri=="null")
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -