3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
17 * Copyright(c) 2006-2011 Sencha Inc.
18 * licensing@sencha.com
19 * http://www.sencha.com/license
22 Ext.define('Ext.ux.desktop.App', {
24 observable: 'Ext.util.Observable'
28 'Ext.container.Viewport',
30 'Ext.ux.desktop.Desktop'
37 constructor: function (config) {
44 me.mixins.observable.constructor.call(this, config);
47 Ext.Function.defer(me.init, 10, me);
49 Ext.onReady(me.init, me);
54 var me = this, desktopCfg;
56 if (me.useQuickTips) {
60 me.modules = me.getModules();
62 me.initModules(me.modules);
65 desktopCfg = me.getDesktopConfig();
66 me.desktop = new Ext.ux.desktop.Desktop(desktopCfg);
68 me.viewport = new Ext.container.Viewport({
73 Ext.EventManager.on(window, 'beforeunload', me.onUnload, me);
76 me.fireEvent('ready', me);
80 * This method returns the configuration object for the Desktop object. A derived
81 * class can override this method, call the base version to build the config and
82 * then modify the returned object before returning it.
84 getDesktopConfig: function () {
85 var me = this, cfg = {
87 taskbarConfig: me.getTaskbarConfig()
90 Ext.apply(cfg, me.desktopConfig);
94 getModules: Ext.emptyFn,
97 * This method returns the configuration object for the Start Button. A derived
98 * class can override this method, call the base version to build the config and
99 * then modify the returned object before returning it.
101 getStartConfig: function () {
102 var me = this, cfg = {
107 Ext.apply(cfg, me.startConfig);
109 Ext.each(me.modules, function (module) {
110 if (module.launcher) {
111 cfg.menu.push(module.launcher);
119 * This method returns the configuration object for the TaskBar. A derived class
120 * can override this method, call the base version to build the config and then
121 * modify the returned object before returning it.
123 getTaskbarConfig: function () {
124 var me = this, cfg = {
126 startConfig: me.getStartConfig()
129 Ext.apply(cfg, me.taskbarConfig);
133 initModules : function(modules) {
135 Ext.each(modules, function (module) {
140 getModule : function(name) {
141 var ms = this.modules;
142 for (var i = 0, len = ms.length; i < len; i++) {
144 if (m.id == name || m.appType == name) {
151 onReady : function(fn, scope) {
153 fn.call(scope, this);
163 getDesktop : function() {
167 onUnload : function(e) {
168 if (this.fireEvent('beforeunload', this) === false) {