1 | /* |
---|
2 | * Ext JS Library 0.30 |
---|
3 | * Copyright(c) 2006-2009, Ext JS, LLC. |
---|
4 | * licensing@extjs.com |
---|
5 | * |
---|
6 | * http://extjs.com/license |
---|
7 | */ |
---|
8 | |
---|
9 | Ext.air.Notify = Ext.extend(Ext.air.NativeWindow, { |
---|
10 | winType: 'notify', |
---|
11 | type: 'lightweight', |
---|
12 | width: 400, |
---|
13 | height: 50, |
---|
14 | chrome: 'none', |
---|
15 | transparent: true, |
---|
16 | alwaysOnTop: true, |
---|
17 | extraHeight: 22, |
---|
18 | hideDelay: 3000, |
---|
19 | msgId: 'msg', |
---|
20 | iconId: 'icon', |
---|
21 | icon: Ext.BLANK_IMAGE_URL, |
---|
22 | boxCls: 'x-box', |
---|
23 | extAllCSS: '../extjs/resources/css/ext-all.css', |
---|
24 | xtpl: new Ext.XTemplate( |
---|
25 | '<html><head><link rel="stylesheet" href="{extAllCSS}" /></head>', |
---|
26 | '<body>', |
---|
27 | '<div class="{boxCls}-tl"><div class="{boxCls}-tr"><div class="{boxCls}-tc"></div></div></div><div class="{boxCls}-ml"><div class="{boxCls}-mr"><div class="{boxCls}-mc">', |
---|
28 | '<div id="{msgId}">', |
---|
29 | '<span>{msg}</span>', |
---|
30 | '<div id="{iconId}" style="float: right;"><img src="{icon}"></div>', |
---|
31 | '</div>', |
---|
32 | '</div></div></div><div class="{boxCls}-bl"><div class="{boxCls}-br"><div class="{boxCls}-bc"></div></div></div>', |
---|
33 | '</body>', |
---|
34 | '</html>' |
---|
35 | ), |
---|
36 | constructor: function(config) { |
---|
37 | config = config || {}; |
---|
38 | Ext.apply(this, config); |
---|
39 | config.html = this.xtpl.apply(this); |
---|
40 | Ext.air.Notify.superclass.constructor.call(this, config); |
---|
41 | this.getNative().alwaysInFront = true; |
---|
42 | this.onCompleteDelegate = this.onComplete.createDelegate(this); |
---|
43 | this.loader.addEventListener(air.Event.COMPLETE, this.onCompleteDelegate); |
---|
44 | }, |
---|
45 | onComplete: function(event) { |
---|
46 | this.loader.removeEventListener(air.Event.COMPLETE, this.onCompleteDelegate); |
---|
47 | this.show(event); |
---|
48 | }, |
---|
49 | show: function(event) { |
---|
50 | var h = event.target.window.document.getElementById(this.msgId).clientHeight + this.extraHeight; |
---|
51 | var main = air.Screen.mainScreen; |
---|
52 | var xy = [0,0]; |
---|
53 | xy[0] = main.visibleBounds.bottomRight.x - this.width; |
---|
54 | xy[1] = main.visibleBounds.bottomRight.y - this.height; |
---|
55 | this.moveTo(xy[0], xy[1]); |
---|
56 | Ext.air.Notify.superclass.show.call(this); |
---|
57 | this.close.defer(this.hideDelay, this); |
---|
58 | } |
---|
59 | }); |
---|