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