?? coreclasses.js
字號:
else {_p.getPreferredWidth=function(){if(this._preferredWidth!=null)
return this._preferredWidth;if(!this._created)
throw new Error("Visual property on non created component");var tempSpan=this._document.createElement("SPAN");tempSpan.style.position="relative";tempSpan.style.cssFloat="left";var el=this._element;while(el.hasChildNodes())
tempSpan.appendChild(el.firstChild);el.appendChild(tempSpan);var w=tempSpan.offsetWidth;el.removeChild(tempSpan);while(tempSpan.hasChildNodes())
el.appendChild(tempSpan.firstChild);return this.getInsetLeft()+w+parseInt(this.getStyleProperty("paddingLeft"))+parseInt(this.getStyleProperty("paddingRight"))+this.getInsetRight();};_p.getPreferredHeight=function(){if(this._preferredHeight!=null)
return this._preferredHeight;if(!this._created)
throw new Error("Visual property on non created component");var tempSpan=this._document.createElement("SPAN");tempSpan.style.position="relative";tempSpan.style.cssFloat="left";var el=this._element;while(el.hasChildNodes())
tempSpan.appendChild(el.firstChild);el.appendChild(tempSpan);var h=tempSpan.offsetHeight;el.removeChild(tempSpan);while(tempSpan.hasChildNodes())
el.appendChild(tempSpan.firstChild);return this.getInsetTop()+h+parseInt(this.getStyleProperty("paddingTop"))+parseInt(this.getStyleProperty("paddingBottom"))+this.getInsetBottom();};}
BiComponent.prototype.setPreferredWidth=function(v){this._preferredWidth=v;};BiComponent.prototype.setPreferredHeight=function(v){this._preferredHeight=v;};_p.setPreferredSize=function(nWidth,nHeight){this.setPreferredWidth(nWidth);this.setPreferredHeight(nHeight);};_p.pack=function(){this.setSize(this.getPreferredWidth(),this.getPreferredHeight());};BiComponent.prototype.getMinimumWidth=function(){return this._minimumWidth;};BiComponent.prototype.setMinimumWidth=function(v){this._minimumWidth=v;};BiComponent.prototype.getMaximumWidth=function(){return this._maximumWidth;};BiComponent.prototype.setMaximumWidth=function(v){this._maximumWidth=v;};BiComponent.prototype.getMinimumHeight=function(){return this._minimumHeight;};BiComponent.prototype.setMinimumHeight=function(v){this._minimumHeight=v;};BiComponent.prototype.getMaximumHeight=function(){return this._maximumHeight;};BiComponent.prototype.setMaximumHeight=function(v){this._maximumHeight=v;};_p.setBorder=function(oBorder){if(this._border)
this._border.removeBorder(this);this._border=oBorder;if(oBorder)
this._border.paintBorder(this);};_p.getBorder=function(){return this._border?this._border:new BiBorder;};_p.setOverflow=function(sOverflow){if(BiBrowserCheck.ie)
{this.setOverflowX(sOverflow);this.setOverflowY(sOverflow);}
else {this._overflow=sOverflow;this._overflowX=sOverflow;this._overflowY=sOverflow;if(sOverflow=="hidden")
sOverflow="-moz-scrollbars-none";this.setStyleProperty("overflow",sOverflow);}};_p.getOverflow=function(){if(BiBrowserCheck.ie)
{var x=this.getOverflowX();var y=this.setOverflowY();return x==y?x:null;}
else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-horizontal"||s=="-moz-scrollbars-vertical")
return null;else if(s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.setOverflowX=function(sOverflowX)
{if(BiBrowserCheck.ie)
this.setStyleProperty("overflowX",sOverflowX);else {var s;this._overflowX=sOverflowX;if(this._overflowX=="hidden"&&this._overflowY=="hidden")
s="-moz-scrollbars-none";else if(this._overflowX==this._overflowY)
s=sOverflowX;else if(this._overflowX=="scroll"||this._overflowY=="scroll")
s="scroll";else if(this._overflowX=="auto"||this._overflowY=="auto")
s="auto";else if(this._overflowX=="hidden"&&this._overflowY=="scroll")
s="-moz-scrollbars-vertical";else s="-moz-scrollbars-horizontal";this.setStyleProperty("overflow",s);}};_p.setOverflowY=function(sOverflowY)
{if(BiBrowserCheck.ie)
this.setStyleProperty("overflowY",sOverflowY);else {var s;this._overflowY=sOverflowY;if(this._overflowX=="hidden"&&this._overflowY=="hidden")
s="-moz-scrollbars-none";else if(this._overflowX==this._overflowY)
s=sOverflowX;else if(this._overflowX=="scroll"||this._overflowY=="scroll")
s="scroll";else if(this._overflowX=="auto"||this._overflowY=="auto")
s="auto";else if(this._overflowX=="hidden"&&this._overflowY=="scroll")
s="-moz-scrollbars-vertical";else s="-moz-scrollbars-horizontal";this.setStyleProperty("overflow",s);}};_p.getOverflowX=function()
{if(BiBrowserCheck.ie)
return this.getStyleProperty("overflowX");else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-horizontal")
return"scroll";else if(s=="-moz-scrollbars-vertical"||s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.getOverflowY=function()
{if(BiBrowserCheck.ie)
return this.getStyleProperty("overflowY");else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-vertical")
return"scroll";else if(s=="-moz-scrollbars-horizontal"||s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.setScrollLeft=function(nScrollLeft){if(!this._created)
throw new Error("Visual property on non created component");this._element.scrollLeft=nScrollLeft;};_p.setScrollTop=function(nScrollTop){if(!this._created)
throw new Error("Visual property on non created component");this._element.scrollTop=nScrollTop;};_p.getScrollLeft=function(){if(!this._created)
throw new Error("Visual property on non created component");return this._element.scrollLeft;};_p.getScrollTop=function(){if(!this._created)
throw new Error("Visual property on non created component");return this._element.scrollTop;};_p.getScrollWidth=function(){if(!this._created)
throw new Error("Visual property on non created component");if((new BiBrowserCheck).getIe55()){var max=this._element.scrollWidth;var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
max=Math.max(max,cs[i].getLeft()+cs[i].getWidth());return max;}
else return this._element.scrollWidth;};_p.getScrollHeight=function(){if(!this._created)
throw new Error("Visual property on non created component");if((new BiBrowserCheck).getIe55()){var max=this._element.scrollHeight;var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
max=Math.max(max,cs[i].getTop()+cs[i].getHeight());return max;}
else return this._element.scrollHeight;};_p.scrollIntoView=function(bTopLeft){this.scrollIntoViewX(bTopLeft);this.scrollIntoViewY(bTopLeft);};_p.scrollIntoViewX=function(bLeft){if(!this._created){return;}
var p=this._parent;if(!p)return;var l=this.getLeft();var w=this.getWidth();var sl=p.getScrollLeft();var cw=p.getClientWidth();if(bLeft)
p.setScrollLeft(l);else if(bLeft==false)
p.setScrollLeft(l+w-cw);else if(w>cw||l<sl)
p.setScrollLeft(l);else if(l+w>sl+cw)
p.setScrollLeft(l+w-cw);};_p.scrollIntoViewY=function(bTop){if(!this._created){return;}
var p=this._parent;if(!p)return;var t=this.getTop();var h=this.getHeight();var st=p.getScrollTop();var ch=p.getClientHeight();if(bTop)
p.setScrollTop(t);else if(bTop==false)
p.setScrollTop(t+h-ch);else if(h>ch||t<st)
p.setScrollTop(t);else if(t+h>st+ch)
p.setScrollTop(t+h-ch);};_p.setTabIndex=function(nTabIndex){this._tabIndex=nTabIndex;if(BiBrowserCheck.ie)
{this.setHtmlProperty("unselectable",nTabIndex<0||!this._enabled);this.setHtmlProperty("tabIndex",nTabIndex<0?-1:1);}
else {this.setStyleProperty("MozUserFocus",nTabIndex<0?"ignore":"normal");}};_p.getTabIndex=function(){return this._tabIndex;};_p.setHideFocus=function(bHideFocus)
{this._hideFocus=bHideFocus;if(BiBrowserCheck.ie)
this.setHtmlProperty("hideFocus",bHideFocus);else {if(bHideFocus)
this.setStyleProperty("MozOutline","none");else this.removeStyleProperty("MozOutline");}};_p.getHideFocus=function()
{return this._hideFocus;};_p._focusComponent=function()
{if(BiBrowserCheck.ie)
{try
{this._element.focus();}
catch(ex){}}
else {if(this._element.focus)
{try
{this._element.focus();}
catch(ex){}}
else {this.getTopLevelComponent()._eventManager.
_mozOnFocus(null,this,this._element);}}};_p._blurComponent=function()
{if(this.getDisposed())
return;if(BiBrowserCheck.ie)
{this._element.blur();}
else {if(this._element.blur)
{try{this._element.blur();}
catch(ex){}}
else {this.getTopLevelComponent()._eventManager.
_mozOnBlur(null,this,this._element);}}};_p.setFocused=function(bFocused)
{if(bFocused&&!this.getCanFocus())
throw new Error("Cannot set focus to component");if(this._focused!=bFocused){if(bFocused)
this._focusComponent();else{this.getTopLevelComponent()._eventManager._setFocusedComponent(null);this._blurComponent();}}};BiComponent.prototype.getFocused=function(){return this._focused;};_p.getContainsFocus=function(){var fr=this.getFocusRoot();if(fr)
return this.contains(fr.getActiveComponent());return false;};_p.getCanFocus=function(){return this._created&&this.getTabIndex()>=0&&this.getIsEnabled()&&this.getIsVisible();};_p.getFocusRoot=function(){if(this._parent)
return this._parent.getFocusRoot();return null;};_p.getActiveComponent=function(){var fr=this.getFocusRoot();if(fr)
return fr.getActiveComponent();return null;};_p.isFocusRoot=function(){return false;};BiComponent.prototype.getFocusManager=function(){return this._focusManager;};BiComponent.prototype.setFocusManager=function(v){this._focusManager=v;};_p.setCanSelect=function(bCanSelect)
{this._canSelect=bCanSelect;if(BiBrowserCheck.ie)
{if(bCanSelect)
this.removeHtmlProperty("unselectable");else this.setHtmlProperty("unselectable","on");}
else {if(bCanSelect)
this.removeStyleProperty("MozUserSelect");else this.setStyleProperty("MozUserSelect","none");}};BiComponent.prototype.getCanSelect=function(){return this._canSelect;};_p.setEnabled=function(bEnabled)
{if(this._enabled!=bEnabled)
{if(this.getTabIndex()>=0)
{if(BiBrowserCheck.ie)
{if(!bEnabled||!this._canSelect)
this.setHtmlProperty("unselectable","on");else this.removeHtmlProperty("unselectable");}
if(this.getFocused()&&!bEnabled){this.setFocused(false);}}
this._enabled=bEnabled;this.setHtmlProperty("disabled",!bEnabled);if(BiBrowserCheck.moz)
{if(bEnabled)
this._removeHtmlAttribute("disabled");else this._setHtmlAttribute("disabled","true");}
this.dispatchEvent(new BiEvent("enabledchanged"));var tlc;if(bEnabled&&this.getCanFocus()&&(tlc=this.getTopLevelComponent())&&tlc.getActiveComponent()==this)
{this.setFocused(true);}}};BiComponent.prototype.getEnabled=function(){return this._enabled;};_p.getIsEnabled=function()
{if(!this.getEnabled())
return false;var p=this.getParent();if(p)
return p.getIsEnabled();return true;};_p.setCapture=function(bCapture){if(this._created){this._element.onlosecapture=BiComponent.__oninlineevent;this._capture=bCapture;if(bCapture){if(BiBrowserCheck.ie)
this._element.setCapture();this.getTopLevelComponent()._eventManager.setCaptureComponent(this);}
else{if(BiBrowserCheck.ie)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -