⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coreclasses.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
            else            {                oChild.removeStyleProperty("pixelHeight");                oChild.removeStyleProperty("height");                h = oChild.getHeight();            }            oChild.setStyleProperty("pixelTop", ch - h - oChild._bottom);            oChild.setStyleProperty("pixelHeight", h);            heightChanged = true;        }        else if (oChild._height)        {            h = oChild._height;            oChild.setStyleProperty("pixelHeight", h);            heightChanged = true;        }        if (BiBrowserCheck.ie && heightChanged)            oChild._element.runtimeStyle.display = h == 0 ? "none" : "";        return heightChanged;    };}else{    _p._layoutChildY = function(oChild)    {        var heightChanged = false;        var h;        var ch = this.getClientHeight();        if (oChild._top != null)        {            oChild.setStyleProperty("top", oChild._top + "px");            if (oChild._bottom != null)            {                h = ch - oChild._top - oChild._bottom;                oChild.setStyleProperty("height", Math.max(0, h) + "px");                heightChanged = true;            }            else if (oChild._height != null)            {                h = oChild._height;                oChild.setStyleProperty("height", Math.max(0, h) + "px");                heightChanged = true;            }        }        else if (oChild._bottom != null)        {            var h;            if (oChild._height != null)                h = oChild._height;            else            {                oChild.removeStyleProperty("height");                h = oChild.getHeight();            }            oChild.setStyleProperty("top", ch - h - oChild._bottom + "px");            oChild.setStyleProperty("height", Math.max(0, h) + "px");            heightChanged = true;        }        else if (oChild._height)        {            h = oChild._height;            oChild.setStyleProperty("height", Math.max(0, h) + "px");            heightChanged = true;        }        return heightChanged;    };}_p.layoutChild = function(oChild){    var x = this._layoutChildX(oChild);    var y = this._layoutChildY(oChild);    if (oChild._children.length > 0)    {        if (x && y)            oChild.layoutAllChildren();        else if (x)            oChild.layoutAllChildrenX();        else if (y)            oChild.layoutAllChildrenY();    }};_p.layoutAllChildrenX = function(){    var cs = this._children;    var l = cs.length;    for (var i = 0; i < l; i++)        cs[i].layoutComponentX();};_p.layoutAllChildrenY = function(){    var cs = this._children;    var l = cs.length;    for (var i = 0; i < l; i++)        cs[i].layoutComponentY();};_p.layoutAllChildren = function(){    var cs = this._children;    var l = cs.length;    for (var i = 0; i < l; i++)        cs[i].layoutComponent();};_p.getLeft = function(){    if (this._created)        return this._element.offsetLeft;    else        return this._left;};_p.getRight = function(){    if (this._created && this._parent)    {        return this._parent.getClientWidth() - this.getLeft() - this.getWidth();    }    throw new Error("Visual property on non created component");};_p.getTop = function(){    if (this._created)        return this._element.offsetTop;    else        return this._top;};_p.getBottom = function(){    if (this._created && this._parent)    {        return this._parent.getClientHeight() - this.getTop() - this.getHeight();    }    throw new Error("Visual property on non created component");};_p.getWidth = function(){    if (this._created)        return this._element.offsetWidth;    else        return this._width;};_p.getHeight = function(){    if (this._created)        return this._element.offsetHeight;    else        return this._height;};_p.getClientWidth = function(){    if (!this._created)        throw new Error("Visual property on non created component");    return this._element.clientWidth;};_p.getClientHeight = function(){    if (!this._created)        throw new Error("Visual property on non created component");    return this._element.clientHeight;};_p.getInsetLeft = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this._element.clientLeft;    else    {        var rtl = this.getRightToLeft();        var el = this._element;        var cs = this._document.defaultView.getComputedStyle(el, "");        if (!rtl)            return parseInt(cs.borderLeftWidth);        return el.offsetWidth - el.clientWidth - parseInt(cs.borderRightWidth);    }};_p.getInsetRight = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)    {        return this._element.offsetWidth - this._element.clientLeft - this._element.clientWidth;    }    else    {        var rtl = this.getRightToLeft();        var el = this._element;        var cs = this._document.defaultView.getComputedStyle(el, "");        if (rtl)            return parseInt(cs.borderRightWidth);        return el.offsetWidth - el.clientWidth - parseInt(cs.borderLeftWidth);    }};_p.getInsetTop = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this._element.clientTop;    else    {        return parseInt(window.getComputedStyle(this._element, "").borderTopWidth);    }};_p.getInsetBottom = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)    {        return this._element.offsetHeight - this._element.clientTop - this._element.clientHeight;    }    else    {        var el = this._element;        var cs = this._document.defaultView.getComputedStyle(el, "");        return el.offsetHeight - el.clientHeight - parseInt(cs.borderTopWidth);    }};_p.getClientLeft = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this._element.getBoundingClientRect().left;    else    {        var el = this._element;        var doc = this._document;        var win = doc.defaultView;        var bo = doc.getBoxObjectFor(el);        var bl = parseInt(win.getComputedStyle(el, "").borderLeftWidth);        var sum = 0;        var p = this._element.parentNode;        while (p.nodeType == 1)        {            sum += p.scrollLeft;            p = p.parentNode;        }        return bo.x - bl - sum;    }};_p.getClientTop = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this._element.getBoundingClientRect().top;    else    {        var el = this._element;        var doc = this._document;        var win = doc.defaultView;        var bo = doc.getBoxObjectFor(el);        var bt = parseInt(win.getComputedStyle(el, "").borderTopWidth);        var sum = 0;        var p = this._element.parentNode;        while (p.nodeType == 1)        {            sum += p.scrollTop;            p = p.parentNode;        }        return bo.y - bt - sum;    }};_p.getScreenLeft = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this.getClientLeft() + this._document.parentWindow.screenLeft;    else    {        var sum = 0;        var p = this._element.parentNode;        while (p.nodeType == 1)        {            sum += p.scrollLeft;            p = p.parentNode;        }        return this._document.getBoxObjectFor(this._element).screenX - sum;    }};_p.getScreenTop = function(){    if (!this._created)        throw new Error("Visual property on non created component");    if (BiBrowserCheck.ie)        return this.getClientTop() + this._document.parentWindow.screenTop;    else    {        var sum = 0;        var p = this._element.parentNode;        while (p.nodeType == 1)        {            sum += p.scrollTop;            p = p.parentNode;        }        return this._document.getBoxObjectFor(this._element).screenY - sum;    }};_p._getScreenClientArea = function(){    return{        left: this.getScreenLeft() + this.getInsetLeft(), top: this.getScreenTop() + this.getInsetTop(), width: this.getClientWidth(), height: this.getClientHeight()    };} ;if (BiBrowserCheck.ie){    _p.getPreferredWidth = function()    {        if (this._preferredWidth != null)            return this._preferredWidth;        if (!this._created)            throw new Error("Visual property on non created component");        return this.getInsetLeft() + this.getScrollWidth() + this.getInsetRight();    };    _p.getPreferredHeight = function()    {        if (this._preferredHeight != null)            return this._preferredHeight;        if (!this._created)            throw new Error("Visual property on non created component");        return this.getInsetTop() + this.getScrollHeight() + this.getInsetBottom();    };}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);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -