📄 gui2.moz.js
字号:
e.preventDefault();}}
var t=e.getTarget();switch(e.getKeyCode())
{case BiKeyboardEvent.ENTER:if(this._acceptButton&&this._acceptButton.getEnabled()&&!t._acceptsEnter&&!e.getAltKey())
{this._acceptButton.dispatchEvent(new BiEvent("action"));if(this._acceptButton&&typeof this._acceptButton.getCommand=="function"&&this._acceptButton.getCommand())
{this._acceptButton.getCommand().execute()}
e.preventDefault();e.stopPropagation();}
break;case BiKeyboardEvent.ESC:if(this._cancelButton&&this._cancelButton.getEnabled()&&!t._acceptsEsc)
{this._cancelButton.dispatchEvent(new BiEvent("action"));if(this._cancelButton&&typeof this._cancelButton.getCommand=="function"&&this._cancelButton.getCommand())
{this._cancelButton.getCommand().execute()}
e.preventDefault();e.stopPropagation();}
break;}};_p._onKeyEvent=function(e){e.stopPropagation();};_p.dispose=function(){if(this._disposed)return;try{this._element.outerHTML="";}
catch(ex){}
BiComponent.prototype.dispose.call(this);for(var c in this._commands)
delete this._commands;this._commands=null;this._focusManager.dispose();this._resizeHandler.dispose();this._moveHandler.dispose();if(this._opaqueIframe){this._opaqueIframe.dispose();this._opaqueIframe=null;}
this._activeComponent=null;this._lastActive=null;this._icon=null;this._focusManager=null;this._resizeHandler=null;this._moveHandler=null;this._acceptButton=null;this._cancelButton=null;};_p.addXmlNode=function(oNode,oXmlResourceParser)
{if(oNode.nodeType==1)
{var o=oXmlResourceParser.fromNode(oNode);if(o instanceof BiComponent)
this._contentPane.add(o);else if(o instanceof BiCommand)
this.addCommand(o);}};function BiWindowManager(oComponent){if(_biInPrototype)return;BiObject.call(this);this._windows=[];this._menuItemsHash={};this._lastStatesHash={};this._component=oComponent;}
_p=_biExtend(BiWindowManager,BiObject,"BiWindowManager");_p._component=null;_p._lastLeft=0;_p._lastTop=0;_p._positionOffset=25;_p._activeWindow=null;BiWindowManager.prototype.getComponent=function(){return this._component;};BiWindowManager.prototype.setComponent=function(v){this._component=v;};BiWindowManager.prototype.getWindows=function(){return this._windows;};BiWindowManager.prototype.getActiveWindow=function(){return this._activeWindow;};_p.setActiveWindow=function(oWindow){if(oWindow!=null)
oWindow.setActive(true);else if(this._activeWindow!=null)
this._activeWindow.setActive(false);};_p.getWindowsMenu=function(){if(this._windowsMenu==null)
this._createWindowsMenu();return this._windowsMenu;};_p.add=function(oWindow){if(this._windows.contains(oWindow))
return;this._windows.push(oWindow);if(oWindow._left==null)
this._positionWindowX(oWindow);if(oWindow._top==null)
this._positionWindowY(oWindow);oWindow.addEventListener("close",this._onclose,this);oWindow.addEventListener("statechanged",this._onstatechanged,this);oWindow.addEventListener("activated",this._onactivatechanged,this);oWindow.addEventListener("deactivated",this._onactivatechanged,this);oWindow.addEventListener("captionchanged",this._oncaptionchanged,this);if(oWindow.getActive())
this._activeWindow=oWindow;if(this._windowsMenu){var mi=new BiRadioButtonMenuItem(oWindow.getCaption(),oWindow.getActive());mi.addEventListener("action",this._onmenuitemaction,this)
this._menuItemsHash[oWindow.toHashCode()]=mi;mi._menuItemForWindow=oWindow;if(this._windows.length>0)
this._separatorItem.setVisible(true);this._windowsMenu.add(mi);}};_p.remove=function(oWindow){if(!this._windows.contains(oWindow))
return oWindow;if(this._windowsMenu){var mi=this._menuItemsHash[oWindow.toHashCode()];this._windowsMenu.remove(mi);mi._menuItemForWindow=null;mi.dispose();}
oWindow.removeEventListener("close",this._onclose,this);oWindow.removeEventListener("statechanged",this._onstatechanged,this);oWindow.removeEventListener("activated",this._onactivatechanged,this);oWindow.removeEventListener("deactivated",this._onactivatechanged,this);oWindow.removeEventListener("captionchanged",this._oncaptionchanged,this);if(this._activeWindow==oWindow)
this._activeWindow=null;this._windows.remove(oWindow);if(this._windowsMenu){delete this._menuItemsHash[oWindow.toHashCode()];if(this._windows.length==0)
this._separatorItem.setVisible(false);}
return oWindow;};_p._positionWindowX=function(oWindow){if(!oWindow.getMovable())
return;if(oWindow.getCreated()&&oWindow.getWidth()+this._lastLeft>this._component.getClientWidth())
this._lastLeft=0;oWindow.setLeft(this._lastLeft);this._lastLeft+=this._positionOffset;};_p._positionWindowY=function(oWindow){if(!oWindow.getMovable())
return;if(oWindow.getCreated()&&oWindow.getHeight()+this._lastTop>this._component.getClientHeight())
this._lastTop=0;oWindow.setTop(this._lastTop);this._lastTop+=this._positionOffset;};_p.cascade=function(){var sorted=this._getShownWindows();sorted.sort(this._compareByZIndex);this._lastLeft=0;this._lastTop=0;var w=this._component.getClientWidth()*0.75;var h=this._component.getClientHeight()*0.75;for(var i=0;i<sorted.length;i++){if(sorted[i].getState()=="maximized")
sorted[i].setState("normal");if(sorted[i].getResizable())
sorted[i].setSize(w,h);this._positionWindowX(sorted[i]);this._positionWindowY(sorted[i]);}};_p.tileVertically=function(){var sorted=this._getShownWindows();sorted.sort(this._compareByZIndex);sorted.reverse();var l=sorted.length;if(l==0)return;var cw=this._component.getClientWidth();var ch=this._component.getClientHeight();var w=cw/l;var x=0;for(var i=0;i<l;i++){if(sorted[i].getState()=="maximized")
sorted[i].setState("normal");if(sorted[i].getResizable()&&sorted[i].getMovable())
sorted[i].setBounds(x,0,w,ch);else if(sorted[i].getResizable())
sorted[i].setSize(w,ch);else if(sorted[i].getMovable())
sorted[i].setLocation(x,0);x+=w;}};_p.tileHorizontally=function(){var sorted=this._getShownWindows();sorted.sort(this._compareByZIndex);sorted.reverse();var l=sorted.length;if(l==0)return;var cw=this._component.getClientWidth();var ch=this._component.getClientHeight();var h=ch/l;var y=0;for(var i=0;i<l;i++){if(sorted[i].getState()=="maximized")
sorted[i].setState("normal");if(sorted[i].getResizable()&&sorted[i].getMovable())
sorted[i].setBounds(0,y,cw,h);else if(sorted[i].getResizable())
sorted[i].setSize(cw,h);else if(sorted[i].getMovable())
sorted[i].setLocation(0,y);y+=h;}};_p.closeAll=function(){for(var i=this._windows.length-1;i>=0;i--)
this._windows[i].close();};_p.minimizeAll=function(){for(var i=this._windows.length-1;i>=0;i--)
this._windows[i].setState("minimized");};_p._compareByZIndex=function(w1,w2){return w1.getZIndex()-w2.getZIndex();};_p.getLastState=function(oWindow){return this._lastStatesHash[oWindow.toHashCode()];};_p.activateNext=function(){var sorted=this._getShownWindows();if(sorted.length<1)
return;sorted.sort(this._compareByZIndex);sorted[sorted.length-1].setActive(true);};_p._createWindowsMenu=function(){this._windowsMenu=new BiMenu;this._cascadeItem=new BiMenuItem;this._cascadeItem.setIcon(new BiImage(application.getTheme().getAppearanceProperty("window-manager","cascade-icon")));this._windowsMenu.add(this._cascadeItem);this._tileHorizontallyItem=new BiMenuItem;this._tileHorizontallyItem.setIcon(new BiImage(application.getTheme().getAppearanceProperty("window-manager","tile-horizontally-icon")));this._windowsMenu.add(this._tileHorizontallyItem);this._tileVerticallyItem=new BiMenuItem;this._tileVerticallyItem.setIcon(new BiImage(application.getTheme().getAppearanceProperty("window-manager","tile-vertically-icon")));this._windowsMenu.add(this._tileVerticallyItem);this._closeAllItem=new BiMenuItem;this._closeAllItem.setIcon(new BiImage(application.getTheme().getAppearanceProperty("window-manager","close-all-icon")));this._windowsMenu.add(this._closeAllItem);this._separatorItem=new BiMenuSeparator;this._separatorItem.setVisible(false);this._windowsMenu.add(this._separatorItem);application.getStringBundle().addEventListener("change",this._updateStrings,this);this._updateStrings();this._cascadeItem.addEventListener("action",this.cascade,this);this._tileHorizontallyItem.addEventListener("action",this.tileHorizontally,this);this._tileVerticallyItem.addEventListener("action",this.tileVertically,this);this._closeAllItem.addEventListener("action",this.closeAll,this);for(var i=0;i<this._windows.length;i++){var win=this._windows[i];var mi=new BiRadioButtonMenuItem(win.getCaption(),win.getActive());mi.addEventListener("action",this._onmenuitemaction,this)
this._menuItemsHash[win.toHashCode()]=mi;mi._menuItemForWindow=win;this._windowsMenu.add(mi);}
if(this._windows.length>0)
this._separatorItem.setVisible(true);};_p._updateStrings=function()
{if(!this._windowsMenu)
return;this._cascadeItem.setText(this._getString("WindowManagerCascade"));this._cascadeItem.setMnemonic(this._getString("WindowManagerCascadeMnemonic"));this._tileHorizontallyItem.setText(this._getString("WindowManagerTileHorizontally"));this._tileHorizontallyItem.setMnemonic(this._getString("WindowManagerTileHorizontallyMnemonic"));this._tileVerticallyItem.setText(this._getString("WindowManagerTileVertically"));this._tileVerticallyItem.setMnemonic(this._getString("WindowManagerTileVerticallyMnemonic"));this._tileVerticallyItem.setIcon(new BiImage(application.getTheme().getAppearanceProperty("window-manager","tile-vertically-icon")));this._closeAllItem.setText(this._getString("WindowManagerCloseAll"));this._closeAllItem.setMnemonic(this._getString("WindowManagerCloseAllMnemonic"));};_p._getShownWindows=function(){var res=[];for(var i=0;i<this._windows.length;i++){if(this._windows[i].getIsVisible())
res.push(this._windows[i]);}
return res;};_p._onclose=function(e){var win=e.getTarget()
this.remove(win);};_p._onstatechanged=function(e){var win=e.getTarget();if(win.getState()!="minimized")
this._lastStatesHash[win.toHashCode()]=win.getState();else{if(win.getActive())
this.activateNext();if(win.getActive())
win.setActive(false);}};_p._onmenuitemaction=function(e){var mi=e.getTarget();var win=mi._menuItemForWindow;if(win.getState()=="minimized")
win.setState(this.getLastState(win));win.setActive(true);};_p._onactivatechanged=function(e){var win=e.getTarget();if(this._windowsMenu){var mi=this._menuItemsHash[win.toHashCode()];mi.setValue(win.getActive());}
if(win.getActive())
this._activeWindow=win;};_p._oncaptionchanged=function(e){var win=e.getTarget();if(this._windowsMenu){var mi=this._menuItemsHash[win.toHashCode()];mi.setText(win.getCaption());}};_p.dispose=function(){if(this._disposed)return;BiObject.prototype.dispose.call(this);application.getStringBundle().removeEventListener("change",this._updateStrings,this);this._windows=null;this._menuItemsHash=null;this._lastStatesHash=null;this._component=null;this._activeWindow=null;if(this._windowsMenu){var cs=this._windowsMenu.getChildren();for(var i=cs.length-1;i>=0;i--){cs[i]._menuItemForWindow=null;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -