1 jls.loader.provide('jls.win32.ShellNotifyIcon');
  2 
  3 jls.loader.requireLibrary('jls_win32');
  4 
  5 /*jls.win32.ShellNotifyIcon = jls.lang.Class.create(
  6 {
  7     initialize : function(window, id, flags, cbMsg) {
  8         if (! (window instanceof jls.win32.Window)) {
  9             throw new jls.lang.Exception('Invalid window argument type (' + (typeof window) + ')');
 10         }
 11         this._item = new jls.lang.Struct([
 12                                           {name: 'cbSize', type: 'UnsignedInt'},
 13                                           {name: 'hWnd', type: 'Pointer'},
 14                                           {name: 'uID', type: 'UnsignedInt'},
 15                                           {name: 'uFlags', type: 'UnsignedInt'},
 16                                           {name: 'uCallbackMessage', type: 'UnsignedInt'},
 17                                           {name: 'hIcon', type: 'Pointer'},
 18                                           {name: 'szTip', type: 'UnsignedShort', size: 64},
 19                                           {name: 'dwState', type: 'UnsignedInt'},
 20                                           {name: 'dwStateMask', type: 'UnsignedInt'},
 21                                           {name: 'szInfo', type: 'UnsignedShort', size: 64},
 22                                           {name: 'uTimeout', type: 'UnsignedInt'},
 23                                           {name: 'szInfoTitle', type: 'UnsignedShort', size: 64},
 24                                           {name: 'dwInfoFlags', type: 'UnsignedInt'},
 25                                           {name: 'guidItem', type: 'UnsignedInt'},
 26                                           {name: 'hBalloonIcon', type: 'Pointer'}
 27                                       ]);
 28     	this._item.put('cbSize', this._item.size());
 29     	this._item.put('hWnd', window._no.handle());
 30     	this._item.put('uID', id);
 31     	this._item.put('uFlags', flags);
 32     	this._item.put('uCallbackMessage', cbMsg);
 33     },
 34     notify : function(message) {
 35         return _native.win32.shellNotifyIcon(message, this._item.buffer().byteArray());
 36     },
 37     setTip : function(text) {
 38         //this._no.setTip(text);
 39         return this;
 40     },
 41     setIcon : function(icon) {
 42         if (! (icon instanceof jls.win32.Image)) {
 43             throw new jls.lang.Exception('Invalid icon argument type (' + (typeof window) + ')');
 44         }
 45     	this._item.put('hIcon', icon._no.handle());
 46         return this;
 47     }
 48 });*/
 49 
 50 jls.win32.ShellNotifyIcon = jls.lang.Class.create(
 51 {
 52     initialize : function(window, id, flags, cbMsg) {
 53         if (! (window instanceof jls.win32.Window)) {
 54             throw new jls.lang.Exception('Invalid window argument type (' + (typeof window) + ')');
 55         }
 56         this._no = new _native.win32.ShellNotifyIcon(window._no, id, flags, cbMsg);
 57     },
 58     notify : function(message) {
 59         this._no.notify(message);
 60         return this;
 61     },
 62     setTip : function(text) {
 63         this._no.setTip(text);
 64         return this;
 65     },
 66     setIcon : function(icon) {
 67         if (! (icon instanceof jls.win32.Image)) {
 68             throw new jls.lang.Exception('Invalid icon argument type (' + (typeof window) + ')');
 69         }
 70         this._no.setIcon(icon._no);
 71         return this;
 72     }
 73 });
 74 
 75 Object.extend(jls.win32.ShellNotifyIcon,
 76 {
 77 	NIM_ADD :      0x00000000,
 78 	NIM_MODIFY :   0x00000001,
 79 	NIM_DELETE :   0x00000002,
 80 	NIF_MESSAGE :  0x00000001,
 81 	NIF_ICON :     0x00000002,
 82 	NIF_TIP :      0x00000004,
 83 	NIF_STATE :    0x00000008,
 84 	NIF_INFO :     0x00000010,
 85 	NIF_REALTIME : 0x00000040,
 86 	NIF_SHOWTIP :  0x00000080
 87 });
 88 
 89