Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / examples / desktop / App.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
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.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 /*!
16  * Ext JS Library 4.0
17  * Copyright(c) 2006-2011 Sencha Inc.
18  * licensing@sencha.com
19  * http://www.sencha.com/license
20  */
21
22 Ext.define('MyDesktop.App', {
23     extend: 'Ext.ux.desktop.App',
24
25     requires: [
26         'Ext.window.MessageBox',
27
28         'Ext.ux.desktop.ShortcutModel',
29
30         'MyDesktop.SystemStatus',
31         'MyDesktop.VideoWindow',
32         'MyDesktop.GridWindow',
33         'MyDesktop.TabWindow',
34         'MyDesktop.AccordionWindow',
35         'MyDesktop.Notepad',
36         'MyDesktop.BogusMenuModule',
37         'MyDesktop.BogusModule',
38
39 //        'MyDesktop.Blockalanche',
40         'MyDesktop.Settings'
41     ],
42
43     init: function() {
44         // custom logic before getXYZ methods get called...
45
46         this.callParent();
47
48         // now ready...
49     },
50
51     getModules : function(){
52         return [
53             new MyDesktop.VideoWindow(),
54             //new MyDesktop.Blockalanche(),
55             new MyDesktop.SystemStatus(),
56             new MyDesktop.GridWindow(),
57             new MyDesktop.TabWindow(),
58             new MyDesktop.AccordionWindow(),
59             new MyDesktop.Notepad(),
60             new MyDesktop.BogusMenuModule(),
61             new MyDesktop.BogusModule()
62         ];
63     },
64
65     getDesktopConfig: function () {
66         var me = this, ret = me.callParent();
67
68         return Ext.apply(ret, {
69             //cls: 'ux-desktop-black',
70
71             contextMenuItems: [
72                 { text: 'Change Settings', handler: me.onSettings, scope: me }
73             ],
74
75             shortcuts: Ext.create('Ext.data.Store', {
76                 model: 'Ext.ux.desktop.ShortcutModel',
77                 data: [
78                     { name: 'Grid Window', iconCls: 'grid-shortcut', module: 'grid-win' },
79                     { name: 'Accordion Window', iconCls: 'accordion-shortcut', module: 'acc-win' },
80                     { name: 'Notepad', iconCls: 'notepad-shortcut', module: 'notepad' },
81                     { name: 'System Status', iconCls: 'cpu-shortcut', module: 'systemstatus'}
82                 ]
83             }),
84
85             wallpaper: 'wallpapers/Blue-Sencha.jpg',
86             wallpaperStretch: false
87         });
88     },
89
90     // config for the start menu
91     getStartConfig : function() {
92         var me = this, ret = me.callParent();
93
94         return Ext.apply(ret, {
95             title: 'Don Griffin',
96             iconCls: 'user',
97             height: 300,
98             toolConfig: {
99                 width: 100,
100                 items: [
101                     {
102                         text:'Settings',
103                         iconCls:'settings',
104                         handler: me.onSettings,
105                         scope: me
106                     },
107                     '-',
108                     {
109                         text:'Logout',
110                         iconCls:'logout',
111                         handler: me.onLogout,
112                         scope: me
113                     }
114                 ]
115             }
116         });
117     },
118
119     getTaskbarConfig: function () {
120         var ret = this.callParent();
121
122         return Ext.apply(ret, {
123             quickStart: [
124                 { name: 'Accordion Window', iconCls: 'accordion', module: 'acc-win' },
125                 { name: 'Grid Window', iconCls: 'icon-grid', module: 'grid-win' }
126             ],
127             trayItems: [
128                 { xtype: 'trayclock', flex: 1 }
129             ]
130         });
131     },
132
133     onLogout: function () {
134         Ext.Msg.confirm('Logout', 'Are you sure you want to logout?');
135     },
136
137     onSettings: function () {
138         var dlg = new MyDesktop.Settings({
139             desktop: this.desktop
140         });
141         dlg.show();
142     }
143 });
144