raimund@1286: /* raimund@1286: * Always On Top extension for Ext JS 4.x raimund@1286: * raimund@1286: * Copyright (c) 2011 Eirik Lorentsen (http://www.eirik.net/) raimund@1286: * raimund@1286: * Examples and documentation at: http://www.eirik.net/Ext/ux/util/AlwaysOnTop.html raimund@1286: * raimund@1286: * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) raimund@1286: * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. raimund@1286: * raimund@1286: * Version: 1.1 raimund@1286: * Last changed date: 2011-12-22 raimund@1286: */ raimund@1286: raimund@1286: Ext.define('Ext.ux.util.AlwaysOnTop', { raimund@1286: extend: 'Ext.app.Controller', raimund@1286: raimund@1286: alwaysOnTopManager: null, raimund@1286: raimund@1286: init: function() { raimund@1286: this.control({ raimund@1286: 'component{isFloating()}': { raimund@1286: 'render': function (component, options) { raimund@1286: this.onComponentRender(component, options); raimund@1286: } raimund@1286: } raimund@1286: }); raimund@1286: /* Uncommenting the code below makes sure that all Ext.window.MessageBoxes stay on top. */ raimund@1286: /* raimund@1286: Ext.override(Ext.window.MessageBox, { raimund@1286: alwaysOnTop: true raimund@1286: }); raimund@1286: */ raimund@1286: /* Uncommenting the code below makes sure that all form errormessages stay on top. raimund@1286: Necessary if you have a form inside a alwaysOnTop window. */ raimund@1286: /* raimund@1286: Ext.override(Ext.tip.ToolTip, { raimund@1286: alwaysOnTop: true raimund@1286: }); raimund@1286: */ raimund@1286: }, raimund@1286: raimund@1286: onComponentRender: function (component, options) { raimund@1286: if (component.alwaysOnTop) { raimund@1286: if (!this.alwaysOnTopManager) { raimund@1286: this.alwaysOnTopManager = Ext.create('Ext.ZIndexManager'); raimund@1286: } raimund@1286: this.alwaysOnTopManager.register(component); raimund@1286: } raimund@1286: if (this.alwaysOnTopManager) { raimund@1286: /* Making sure the alwaysOnTopManager always has the highest zseed */ raimund@1286: if (Ext.ZIndexManager.zBase > this.alwaysOnTopManager.zseed) { raimund@1286: this.alwaysOnTopManager.zseed = this.alwaysOnTopManager.getNextZSeed(); raimund@1286: } raimund@1286: } raimund@1286: } raimund@1286: raimund@1286: });