📄 coreclasses.js
字号:
/* * Bindows 1.01 * 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._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(); }};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -