3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.Desktop = function(app){
\r
9 this.taskbar = new Ext.ux.TaskBar(app);
\r
10 var taskbar = this.taskbar;
\r
12 var desktopEl = Ext.get('x-desktop');
\r
13 var taskbarEl = Ext.get('ux-taskbar');
\r
14 var shortcuts = Ext.get('x-shortcuts');
\r
16 var windows = new Ext.WindowGroup();
\r
19 function minimizeWin(win){
\r
20 win.minimized = true;
\r
24 function markActive(win){
\r
25 if(activeWindow && activeWindow != win){
\r
26 markInactive(activeWindow);
\r
28 taskbar.setActiveButton(win.taskButton);
\r
30 Ext.fly(win.taskButton.el).addClass('active-win');
\r
31 win.minimized = false;
\r
34 function markInactive(win){
\r
35 if(win == activeWindow){
\r
36 activeWindow = null;
\r
37 Ext.fly(win.taskButton.el).removeClass('active-win');
\r
41 function removeWin(win){
\r
42 taskbar.removeTaskButton(win.taskButton);
\r
47 desktopEl.setHeight(Ext.lib.Dom.getViewHeight()-taskbarEl.getHeight());
\r
49 Ext.EventManager.onWindowResize(layout);
\r
51 this.layout = layout;
\r
53 this.createWindow = function(config, cls){
\r
54 var win = new (cls||Ext.Window)(
\r
55 Ext.applyIf(config||{}, {
\r
61 win.render(desktopEl);
\r
62 win.taskButton = taskbar.addTaskButton(win);
\r
64 win.cmenu = new Ext.menu.Menu({
\r
70 win.animateTarget = win.taskButton.el;
\r
94 this.getManager = function(){
\r
98 this.getWindow = function(id){
\r
99 return windows.get(id);
\r
102 this.getWinWidth = function(){
\r
103 var width = Ext.lib.Dom.getViewWidth();
\r
104 return width < 200 ? 200 : width;
\r
107 this.getWinHeight = function(){
\r
108 var height = (Ext.lib.Dom.getViewHeight()-taskbarEl.getHeight());
\r
109 return height < 100 ? 100 : height;
\r
112 this.getWinX = function(width){
\r
113 return (Ext.lib.Dom.getViewWidth() - width) / 2
\r
116 this.getWinY = function(height){
\r
117 return (Ext.lib.Dom.getViewHeight()-taskbarEl.getHeight() - height) / 2;
\r
123 shortcuts.on('click', function(e, t){
\r
124 if(t = e.getTarget('dt', shortcuts)){
\r
126 var module = app.getModule(t.id.replace('-shortcut', ''));
\r
128 module.createWindow();
\r