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

📄 menu.moz.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
_p.getMnemonic = function(){    return this._xulElement.getAttribute("accesskey");} ;_p.setSubMenu = function(oMenu){    if (this._subMenu != oMenu)    {        if (this._subMenu)            this._subMenu._parent = null;        if (this._subMenu && oMenu)        {            this._xulElement.replaceChild(oMenu._xulElement, this._subMenu._xulElement);            oMenu._parent = this;        }        else if (this._subMenu && !oMenu)        {            var mi = document.createElementNS(xulNs, "menuitem");            BiMenuItem._copyProperties(this._xulElement, mi);            if (this._xulElement.parentNode)                this._xulElement.parentNode.replaceChild(mi, this._xulElement);            this._xulElement = mi;        }        else        {            var m = document.createElementNS(xulNs, "menu");            BiMenuItem._copyProperties(this._xulElement, m);            if (this._xulElement.parentNode)                this._xulElement.parentNode.replaceChild(m, this._xulElement);            this._xulElement = m;            this._xulElement.appendChild(oMenu._xulElement);        }        this._subMenu = oMenu;    }};BiMenuItem._copyProperties = function(fromEl, toEl){    toEl.setAttribute("id", fromEl.getAttribute("id"));    toEl.setAttribute("type", fromEl.getAttribute("type"));    toEl.setAttribute("label", fromEl.getAttribute("label"));    toEl.setAttribute("accesskey", fromEl.getAttribute("accesskey"));    toEl.setAttribute("acceltext", fromEl.getAttribute("acceltext"));    toEl.setAttribute("oncommand", fromEl.getAttribute("oncommand"));    if (fromEl.hasAttribute("disabled"))        toEl.setAttribute("disabled", fromEl.getAttribute("disabled"));    if (fromEl.hasAttribute("checked"))        toEl.setAttribute("checked", fromEl.getAttribute("checked"));    toEl.visible = fromEl.visible;    toEl.tooltipText = fromEl.tooltipText;    toEl.setAttribute("style", fromEl.getAttribute("style"));    toEl.setAttribute("class", fromEl.getAttribute("class"));};BiMenuItem.prototype.getSubMenu = function(){    return this._subMenu;} ;_p.setVisible = function(b){    this._xulElement.hidden = !b;} ;_p.getVisible = function(){    return !this._xulElement.hidden;} ;_p.getIsVisible = function(){    return this.getVisible() && this._parent && this._parent.getIsVisible();} ;_p.setEnabled = function(b){    if (this.getEnabled() != b)    {        if (!b)            this._xulElement.setAttribute("disabled", "true");        else            this._xulElement.removeAttribute("disabled");        this.dispatchEvent(new BiEvent("enabledchanged"));    }};_p.getEnabled = function(){    return !this._xulElement.hasAttribute("disabled");    ;};_p.setShortcutText = function(s){    this._xulElement.setAttribute("acceltext", s);} ;_p.getShortcutText = function(){    return this._xulElement.getAttribute("acceltext");} ;_p.setToolTipText = function(s){    this._xulElement.tooltipText = s;} ;_p.getToolTipText = function(){    return this._xulElement.tooltipText;} ;_p._onaction = function(){    var t = new BiTimer(1);    t.addEventListener("tick", function()    {        t.dispose();        t = null;        this.dispatchEvent(new BiEvent("action"));        if (this._command)            this._command.execute();    },                 this);    t.start();};_p.dispose = function(){    if (this._disposed)        return;    BiEventTarget.prototype.dispose.call(this);    this.__onaction = null;    if (this._xulElement && this._xulElement.parentNode)        this._xulElement.parentNode.removeChild(this._xulElement);    this._xulElement = null;};_p.addXmlNode = function(oNode, oXmlResourceParser){    if (oNode.nodeType == 3)    {        if (!(/^\s*$/.test(oNode.data)))        {            this.setText(this.getText() + oNode.data);        }    }    else if (oNode.nodeType == 1 && !this.getSubMenu())    {        var m = oXmlResourceParser.fromNode(oNode);        if (m instanceof BiMenu)            this.setSubMenu(m);    }};BiMenuItem.prototype.getCommand = function(){    return this._command;} ;_p.setCommand = BiComponent.prototype.setCommand;_p._syncWithCommmand = function(){    if (this._command)    {        this.setEnabled(this._command.getEnabled());        this.setShortcutText(this._command.getShortcut());    }};_p.setAttribute = function(sName, sValue, oXmlResourceParser){    switch (sName)    {        case "icon":        this.setIcon(BiImage.fromUri(sValue));        break;        case "command":        if (sValue.charAt(0) == "#")            sValue = sValue.substr(1);        var c = oXmlResourceParser.getComponentById(sValue);        this.setCommand(c);        break;        default:            BiEventTarget.prototype.setAttribute.apply(this, arguments);    }};function BiMenuSeparator(){    BiMenuItem.call(this);    this._xulElement = document.createElementNS(xulNs, "menuseparator");}var _p = BiMenuSeparator.prototype = new BiMenuItem;_p._className = "BiMenuSeparator";function BiCheckBoxMenuItem(sText, bChecked, oSubMenu){    BiMenuItem.call(this, sText, oSubMenu);    this._xulElement.setAttribute("type", "checkbox");    if (bChecked)        this._xulElement.setAttribute("checked", "true");}var _p = BiCheckBoxMenuItem.prototype = new BiMenuItem("");_p._className = "BiCheckBoxMenuItem";_p._userValue = null;BiCheckBoxMenuItem.prototype.getUserValue = function(){    return this._userValue;} ;_p.setUserValue = function(v){    if (this._userValue != v)    {        this._userValue = v;        if (this._command)            this._command.setUserValue(v);    }};_p.getChecked = function(){    return this._xulElement.hasAttribute("checked");} ;_p.setChecked = function(b){    if (this.getChecked() != b)    {        if (b)            this._xulElement.setAttribute("checked", "true");        else            this._xulElement.removeAttribute("checked");        this.dispatchEvent(new BiEvent("change"));        if (this._command)            this._command.setChecked(b);    }};_p.getValue = _p.getChecked;_p.setValue = _p.setChecked;_p._onaction = function(){    this.dispatchEvent(new BiEvent("action"));    if (this._command)        this._command.execute();    this.dispatchEvent(new BiEvent("change"));    if (this._command)        this._command.setChecked(this.getChecked());};_p._syncWithCommmand = function(){    if (this._command)    {        this.setEnabled(this._command.getEnabled());        this.setShortcutText(this._command.getShortcut());        this.setChecked(this._command.getChecked());        this.setUserValue(this._command.getUserValue());    }};function BiRadioButtonMenuItem(sText, bChecked, oSubMenu){    BiMenuItem.call(this, sText, oSubMenu);    this._xulElement.setAttribute("type", "radio");    if (bChecked)        this._xulElement.setAttribute("checked", "true");    this._checked = bChecked;}var _p = BiRadioButtonMenuItem.prototype = new BiMenuItem("");_p._className = "BiRadioButtonMenuItem";_p._group = null;_p._checked = false;_p._userValue = null;BiRadioButtonMenuItem.prototype.getUserValue = function(){    return this._userValue;} ;_p.setUserValue = function(v){    if (this._userValue != v)    {        this._userValue = v;        if (this._command)            this._command.setUserValue(v);    }};_p.getChecked = function(){    return this._xulElement.hasAttribute("checked");} ;_p.setChecked = function(b){    if (this._checked != b)    {        if (b)            this._xulElement.setAttribute("checked", "true");        else            this._xulElement.removeAttribute("checked");        this._checked = b;        this.dispatchEvent(new BiEvent("change"));        if (this._group && b)            this._group.setSelected(this);        if (this._command)            this._command.setChecked(b);    }};_p.getValue = _p.getChecked;_p.setValue = _p.setChecked;_p.setGroup = function(oRadioGroup){    if (this._group != oRadioGroup)    {        if (this._group)            this._group.remove(this);        this._group = oRadioGroup;        if (this._group)        {            this._group.add(this);        }    }};BiRadioButtonMenuItem.prototype.getGroup = function(){    return this._group;} ;_p._onaction = function(){    this.setChecked(true);    this.dispatchEvent(new BiEvent("action"));    if (this._command)        this._command.execute();};_p.setAttribute = function(sName, sValue, oParser){    switch (sName)    {        case "group":        if (sValue.charAt(0) == "#")            sValue = sValue.substr(1);        var c = oParser.getComponentById(sValue);        this.setGroup(c);        break;        default:            BiMenuItem.prototype.setAttribute.apply(this, arguments);    }};_p._syncWithCommmand = function(){    if (this._command)    {        this.setEnabled(this._command.getEnabled());        this.setShortcutText(this._command.getShortcut());        this.setChecked(this._command.getChecked());        this.setUserValue(this._command.getUserValue());    }};function BiMenuBar(){    BiComponent.call(this);    this._xulElement = document.createElementNS(xulNs, "menubar");    this.id = menuCache.getId();    menuCache[this.id] = this;}var _p = BiMenuBar.prototype = new BiComponent;_p._className = "BiMenuBar";_p._acceptsEnter = true;_p._acceptsEsc = true;_p.add = function(oChild, oBefore, bAnonymous){    if (oBefore)        this._xulElement.insertBefore(oChild._xulElement, oBefore._xulElement);    else        this._xulElement.appendChild(oChild._xulElement);    BiComponent.prototype.add.call(this, oChild, oBefore, bAnonymous);};_p.remove = function(oChild){    this._xulElement.removeChild(oChild._xulElement);    BiComponent.prototype.remove.call(this, oChild);    return oChild;};_p._addHtmlElement = function(oChild, oBefore){} ;_p._create = function(oDocument){    BiComponent.prototype._create.call(this, oDocument);    this._element.appendChild(this._xulElement);};_p._createChildren = function(oDocument, bLayout){    BiComponent.prototype._createChildren.call(this, oDocument, bLayout);} ;_p.layoutAllChildren = _p.layoutAllChildrenX = _p.layoutAllChildrenY = function(){} ;_p._invalidate = function(){} ;_p.addXmlNode = function(oNode, oXmlResourceParser){    if (oNode.nodeType == 1)    {        var c = oXmlResourceParser.fromNode(oNode);        if (c instanceof BiMenuButton)            this.add(c);        else            BiComponent.prototype.addXmlNode.apply(this, arguments);    }};function BiMenuButton(sText, oSubMenu){    BiMenuItem.call(this, sText, oSubMenu);};var _p = BiMenuButton.prototype = new BiMenuItem;_p._className = "BiMenuButton";_p._addHtmlElementToParent = function(){} ;

⌨️ 快捷键说明

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