Mercurial > lada > lada-client
annotate resources/lib/ext/util/AlwaysOnTop.js @ 1286:8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 26 Jan 2017 17:33:18 +0100 |
parents | |
children |
rev | line source |
---|---|
1286
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Always On Top extension for Ext JS 4.x |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * Copyright (c) 2011 Eirik Lorentsen (http://www.eirik.net/) |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * Examples and documentation at: http://www.eirik.net/Ext/ux/util/AlwaysOnTop.html |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 * |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 * Version: 1.1 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 * Last changed date: 2011-12-22 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 Ext.define('Ext.ux.util.AlwaysOnTop', { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 extend: 'Ext.app.Controller', |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 alwaysOnTopManager: null, |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 init: function() { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 this.control({ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 'component{isFloating()}': { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 'render': function (component, options) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 this.onComponentRender(component, options); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 }); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 /* Uncommenting the code below makes sure that all Ext.window.MessageBoxes stay on top. */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 /* |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 Ext.override(Ext.window.MessageBox, { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 alwaysOnTop: true |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 /* Uncommenting the code below makes sure that all form errormessages stay on top. |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 Necessary if you have a form inside a alwaysOnTop window. */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 /* |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 Ext.override(Ext.tip.ToolTip, { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 alwaysOnTop: true |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 }); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 }, |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 onComponentRender: function (component, options) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 if (component.alwaysOnTop) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 if (!this.alwaysOnTopManager) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 this.alwaysOnTopManager = Ext.create('Ext.ZIndexManager'); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 this.alwaysOnTopManager.register(component); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 if (this.alwaysOnTopManager) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 /* Making sure the alwaysOnTopManager always has the highest zseed */ |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 if (Ext.ZIndexManager.zBase > this.alwaysOnTopManager.zseed) { |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 this.alwaysOnTopManager.zseed = this.alwaysOnTopManager.getNextZSeed(); |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 } |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 |
8b21a3fa6e1f
Added library to enable 'AlwaysOnTop' for windows.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 }); |