Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / desktop / Notepad.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.Notepad', {
9     extend: 'Ext.ux.desktop.Module',
10
11     requires: [
12         'Ext.form.field.HtmlEditor'
13         //'Ext.form.field.TextArea'
14     ],
15
16     id:'notepad',
17
18     init : function(){
19         this.launcher = {
20             text: 'Notepad',
21             iconCls:'notepad',
22             handler : this.createWindow,
23             scope: this
24         }
25     },
26
27     createWindow : function(){
28         var desktop = this.app.getDesktop();
29         var win = desktop.getWindow('notepad');
30         if(!win){
31             win = desktop.createWindow({
32                 id: 'notepad',
33                 title:'Notepad',
34                 width:600,
35                 height:400,
36                 iconCls: 'notepad',
37                 animCollapse:false,
38                 border: false,
39                 //defaultFocus: 'notepad-editor', EXTJSIV-1300
40
41                 // IE has a bug where it will keep the iframe's background visible when the window
42                 // is set to visibility:hidden. Hiding the window via position offsets instead gets
43                 // around this bug.
44                 hideMode: 'offsets',
45
46                 layout: 'fit',
47                 items: [
48                     {
49                         xtype: 'htmleditor',
50                         //xtype: 'textarea',
51                         id: 'notepad-editor',
52                         value: [
53                             'Some <b>rich</b> <font color="red">text</font> goes <u>here</u><br>',
54                             'Give it a try!'
55                         ].join('')
56                     }
57                 ]
58             });
59         }
60         win.show();
61         return win;
62     }
63 });