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

📄 coreclasses.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
_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")        this.removeStyleProperty("backgroundImage");    else        this.setStyleProperty("backgroundImage", "url(" + sUri + ")");};_p.getBackgroundImage = function(){    var s = this.getStyleProperty("backgroundImage");    return s.replace(/^url\(/i, "").replace(/\)$/, "");};_p.setOpacity = function(n){    if (this._opacity != n)    {        n = Math.max(0, Math.min(1, n));        this._opacity = n;        if (BiBrowserCheck.ie)        {            n = Math.round(n * 100);            if (n == 100)                this.removeStyleProperty("filter");            else                this.setStyleProperty("filter", "Alpha(Opacity=" + n + ")");        }        else        {            if (n == 1)                this.removeStyleProperty("MozOpacity");            else                this.setStyleProperty("MozOpacity", n);        }    }};BiComponent.prototype.getOpacity = function(){    return this._opacity;} ;_p.setLeft = function(nLeft){    if (this._left != nLeft)    {        this._left = nLeft;        this.layoutComponentX();    }};_p.setRight = function(nRight){    if (this._right != nRight)    {        this._right = nRight;        this.layoutComponentX();    }};_p.setTop = function(nTop){    if (this._top != nTop)    {        this._top = nTop;        this.layoutComponentY();    }};_p.setBottom = function(nBottom){    if (this._bottom != nBottom)    {        this._bottom = nBottom;        this.layoutComponentY();    }};_p.setWidth = function(nWidth){    if (this._width != nWidth)    {        this._width = nWidth;        this.layoutComponentX();    }};_p.setHeight = function(nHeight){    if (this._height != nHeight)    {        this._height = nHeight;        this.layoutComponentY();    }};_p.setSize = function(nWidth, nHeight){    if (this._width != nWidth || this._height != nHeight)    {        this._width = nWidth;        this._height = nHeight;        if (this._created)            this.layoutComponent();    }};_p.setLocation = function(nLeft, nTop){    if (this._left != nLeft || this._top != nTop)    {        this._left = nLeft;        this._top = nTop;        if (this._created)            this.layoutComponent();    }};_p.setBounds = function(nLeft, nTop, nWidth, nHeight){    if (this._left != nLeft || this._top != nTop || this._width != nWidth || this._height != nHeight)    {        this._left = nLeft;        this._top = nTop;        this._width = nWidth;        this._height = nHeight;        if (this._created)            this.layoutComponent();    }};_p.layoutComponentX = function(){    var p;    if (this._created && (p = this._parent))        p.layoutChildX(this);};_p.layoutComponentY = function(){    var p;    if (this._created && (p = this._parent))        p.layoutChildY(this);};_p.layoutComponent = function(){    var p;    if (this._created && (p = this._parent))        p.layoutChild(this);};_p.layoutChildX = function(oChild){    if (this._layoutChildX(oChild) && oChild._children.length > 0)        oChild.layoutAllChildrenX();};if (BiBrowserCheck.ie){    _p._layoutChildX = function(oChild)    {        var widthChanged = false;        var w;        var cw = this.getClientWidth();        if (oChild._left != null)        {            oChild.setStyleProperty("pixelLeft", oChild._left);            if (oChild._right != null)            {                w = cw - oChild._left - oChild._right;                oChild.setStyleProperty("pixelWidth", w);                widthChanged = true;            }            else if (oChild._width != null)            {                w = oChild._width;                oChild.setStyleProperty("pixelWidth", w);                widthChanged = true;            }        }        else if (oChild._right != null)        {            if (oChild._width != null)                w = oChild._width;            else            {                oChild.removeStyleProperty("pixelWidth");                oChild.removeStyleProperty("width");                w = oChild.getWidth();            }            oChild.setStyleProperty("pixelLeft", cw - w - oChild._right);            oChild.setStyleProperty("pixelWidth", w);            widthChanged = true;        }        else if (oChild._width)        {            w = oChild._width;            oChild.setStyleProperty("pixelWidth", w);            widthChanged = true;        }        return widthChanged;    };}else{    _p._layoutChildX = function(oChild)    {        var widthChanged = false;        var w;        var cw = this.getClientWidth()        if (oChild._left != null)        {            oChild.setStyleProperty("left", oChild._left + "px");            if (oChild._right != null)            {                w = cw - oChild._left - oChild._right;                oChild.setStyleProperty("width", Math.max(0, w) + "px");                widthChanged = true;            }            else if (oChild._width != null)            {                w = oChild._width;                oChild.setStyleProperty("width", Math.max(0, w) + "px");                widthChanged = true;            }        }        else if (oChild._right != null)        {            if (oChild._width != null)                w = oChild._width;            else            {                oChild.removeStyleProperty("width");                w = oChild.getWidth();            }            oChild.setStyleProperty("left", cw - w - oChild._right + "px");            oChild.setStyleProperty("width", Math.max(0, w) + "px");            widthChanged = true;        }        else if (oChild._width)        {            w = oChild._width;            oChild.setStyleProperty("width", Math.max(0, w) + "px");            widthChanged = true;        }        return widthChanged;    };}_p.layoutChildY = function(oChild){    if (this._layoutChildY(oChild) && oChild._children.length > 0)        oChild.layoutAllChildrenY();};if (BiBrowserCheck.ie){    _p._layoutChildY = function(oChild)    {        var heightChanged = false;        var h;        var ch = this.getClientHeight();        if (oChild._top != null)        {            oChild.setStyleProperty("pixelTop", oChild._top);            if (oChild._bottom != null)            {                h = ch - oChild._top - oChild._bottom;                oChild.setStyleProperty("pixelHeight", h);                heightChanged = true;            }            else if (oChild._height != null)            {                h = oChild._height;                oChild.setStyleProperty("pixelHeight", h);                heightChanged = true;            }        }        else if (oChild._bottom != null)        {            var h;            if (oChild._height != null)                h = oChild._height;

⌨️ 快捷键说明

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