3 * Copyright(c) 2006-2011 Sencha Inc.
5 * http://www.sencha.com/license
8 Ext.define('Ext.ux.desktop.App', {
10 observable: 'Ext.util.Observable'
14 'Ext.container.Viewport',
16 'Ext.ux.desktop.Desktop'
23 constructor: function (config) {
30 me.mixins.observable.constructor.call(this, config);
33 Ext.Function.defer(me.init, 10, me);
35 Ext.onReady(me.init, me);
40 var me = this, desktopCfg;
42 if (me.useQuickTips) {
46 me.modules = me.getModules();
48 me.initModules(me.modules);
51 desktopCfg = me.getDesktopConfig();
52 me.desktop = new Ext.ux.desktop.Desktop(desktopCfg);
54 me.viewport = new Ext.container.Viewport({
59 Ext.EventManager.on(window, 'beforeunload', me.onUnload, me);
62 me.fireEvent('ready', me);
66 * This method returns the configuration object for the Desktop object. A derived
67 * class can override this method, call the base version to build the config and
68 * then modify the returned object before returning it.
70 getDesktopConfig: function () {
71 var me = this, cfg = {
73 taskbarConfig: me.getTaskbarConfig()
76 Ext.apply(cfg, me.desktopConfig);
80 getModules: Ext.emptyFn,
83 * This method returns the configuration object for the Start Button. A derived
84 * class can override this method, call the base version to build the config and
85 * then modify the returned object before returning it.
87 getStartConfig: function () {
88 var me = this, cfg = {
93 Ext.apply(cfg, me.startConfig);
95 Ext.each(me.modules, function (module) {
96 if (module.launcher) {
97 cfg.menu.push(module.launcher);
105 * This method returns the configuration object for the TaskBar. A derived class
106 * can override this method, call the base version to build the config and then
107 * modify the returned object before returning it.
109 getTaskbarConfig: function () {
110 var me = this, cfg = {
112 startConfig: me.getStartConfig()
115 Ext.apply(cfg, me.taskbarConfig);
119 initModules : function(modules) {
121 Ext.each(modules, function (module) {
126 getModule : function(name) {
127 var ms = this.modules;
128 for (var i = 0, len = ms.length; i < len; i++) {
130 if (m.id == name || m.appType == name) {
137 onReady : function(fn, scope) {
139 fn.call(scope, this);
149 getDesktop : function() {
153 onUnload : function(e) {
154 if (this.fireEvent('beforeunload', this) === false) {