1 jls.loader.provide('jls.win32.Window');
  2 
  3 jls.loader.requireLibrary('jls_win32');
  4 
  5 jls.loader.require('jls.gui.Event');
  6 jls.loader.require('jls.win32.Font');
  7 jls.loader.require('jls.win32.Pen');
  8 jls.loader.require('jls.win32.Brush');
  9 jls.loader.require('jls.win32.Image');
 10 
 11 jls.win32.Window = jls.lang.Class.create(
 12 {
 13     /*
 14      * If the window has the WS_CAPTION style of dwStyle set, the specified name (if non-empty) appears in the window's title bar.
 15      * If the window being created is a control (such as button, static control or edit control), lpszWindowName is used to specify the text of the control.
 16      */
 17     // TODO Make arguments as a parameter object, keep classname?
 18     initialize : function(classname, name, style, x, y, w, h, parent, menuOrId, exStyle, param) {
 19         jls.win32.Window.initializeThreadWindow();
 20         // TODO Keep top level windows and destroy thread window when there is no more top level window
 21         // TODO Add children to parent to avoid garbage collection
 22         if (typeof style == 'undefined') {
 23             style = parent ? jls.win32.Window.WS_CHILD | jls.win32.Window.WS_VISIBLE : jls.win32.Window.WS_OVERLAPPEDWINDOW;
 24         }
 25         this._no = jls.win32.Window._createWindow(classname, name, style, x, y, w, h, (parent ? parent._no : undefined), menuOrId, exStyle, param);
 26         if (this._no == null) {
 27             throw new jls.lang.Exception('Fail to create window');
 28         }
 29         this._dc = null;
 30         this._eventsHandlers = {};
 31     },
 32     isWindowVisible : function() {
 33         return this._no.isWindowVisible();
 34     },
 35     show : function(mode) {
 36         return this._no.show(mode);
 37     },
 38     update : function() {
 39         this._no.update();
 40         return this;
 41     },
 42     validate : function() {
 43         this._no.validateRect();
 44         return this;
 45     },
 46     close : function(mode) {
 47         this.sendMessage(jls.win32.Window.WM_CLOSE, 0, 0);
 48     },
 49     handle : function() {
 50         return this._no.handle();
 51     },
 52     getTextLength : function() {
 53     	return this._no.sendMessage(jls.win32.Window.WM_GETTEXTLENGTH, 0, 0);
 54     },
 55     getText : function() {
 56         return this._no.getText();
 57     },
 58     setText : function(text) {
 59         return this._no.setText(text);
 60     },
 61     setIcon : function(icon, size) {
 62     	if (! ((icon instanceof jls.win32.Image) && (icon.getType() == jls.win32.Image.IMAGE_ICON))) {
 63     		throw new jls.lang.Exception();
 64     	}
 65         return this.sendMessage(jls.win32.Window.WM_SETICON, size || jls.win32.Window.ICON_SMALL, icon);
 66     },
 67     setPosition : function(x, y, w, h, uiFlags, insertAfter) {
 68         return this._no.setPosition(x, y, w, h, uiFlags, insertAfter);
 69     },
 70     rect : function(client) {
 71         return this._no.rect(client);
 72     },
 73     setMenu : function(menu) {
 74     	if (! (menu instanceof jls.win32.Menu)) {
 75     		throw new jls.lang.Exception('Invalid menu argument');
 76     	}
 77         return this._no.setMenu(menu._no);
 78     },
 79     /*
 80      * TODO Add capture
 81      * HWND WINAPI SetCapture(HWND hWnd);
 82      * BOOL WINAPI ReleaseCapture(void);
 83      * BOOL WINAPI TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack);
 84      * WM_CAPTURECHANGED
 85      */
 86     setCapture : function() {
 87     	this._no.setCapture();
 88     },
 89     trackMouseEvent : function(flags, hoverTime) {
 90     	flags = flags || jls.win32.Window.TME_LEAVE;
 91         return this._no.trackMouseEvent(flags, hoverTime);
 92     },
 93     getDeviceContext : function() {
 94         if (this._dc == null) {
 95             this._dc = new jls.win32.DeviceContext(this);
 96         }
 97         return this._dc;
 98     },
 99     postMessage : function(uMsg, wParam, lParam, unicode, sct) {
100         if (jls.win32.Window._hasWin32NativeObject(wParam)) {
101             wParam = wParam._no;
102         }
103         if (jls.win32.Window._hasWin32NativeObject(lParam)) {
104             lParam = lParam._no;
105         }
106         return this._no.postMessage(uMsg, wParam, lParam, unicode, sct);
107     },
108     sendMessage : function(uMsg, wParam, lParam, unicode, sct) {
109         if (jls.win32.Window._hasWin32NativeObject(wParam)) {
110             wParam = wParam._no;
111         }
112         if (jls.win32.Window._hasWin32NativeObject(lParam)) {
113             lParam = lParam._no;
114         }
115         return this._no.sendMessage(uMsg, wParam, lParam, unicode, sct);
116     },
117     setWindowFunction : function(fn) {
118         this._no.setWindowFunction(fn || null);
119         return this;
120     }
121 });
122 
123 Object.extend(jls.win32.Window,
124 {
125     _threadWindow : null,
126     _thread : null,
127     _createWindow : function(classname, name, style, x, y, w, h, parent, menu, exStyle, param) {
128         return jls.win32.Window._threadWindow.sendMessage(jls.win32.Window.WM_CREATE_WINDOW, null, {
129             classname: classname,
130             name: name,
131             style: style,
132             x: x,
133             y: y,
134             w: w,
135             h: h,
136             parent: parent,
137             menu: menu,
138             exStyle: exStyle,
139             param: param
140         });
141     },
142     _hasWin32NativeObject : function(obj) {
143         return (obj instanceof jls.win32.Font) || (obj instanceof jls.win32.Brush) || (obj instanceof jls.win32.Pen) || (obj instanceof jls.win32.Image);
144     },
145     invokeAndWait : function(fn) {
146         jls.win32.Window.initializeThreadWindow();
147         return jls.win32.Window._threadWindow.sendMessage(jls.win32.Window.WM_INVOKE, null, {
148             fn: fn
149         });
150     },
151     invokeLater : function(fn) {
152         jls.win32.Window.initializeThreadWindow();
153         jls.win32.Window._threadWindow.postMessage(jls.win32.Window.WM_INVOKE, null, {
154             fn: fn
155         });
156     },
157     releaseCapture : function() {
158     	_native.win32.Window.releaseCapture();
159     },
160     // TODO Move this function elsewhere
161     shellExecute : function(file, showCmd, directory, operation, parameters) {
162     	_native.win32.shellExecute(file/*, showCmd, directory, operation, parameters*/);
163     },
164     splitWord : function(value) {
165     	return [(value >> 16) & 65535, value & 65535];
166     },
167     hiWord : function(value) {
168     	return (value >> 16) & 65535;
169     },
170     loWord : function(value) {
171     	return value & 65535;
172     },
173     makeWord : function(hi, lo) {
174     	return ((hi & 65535) << 16) + (lo & 65535);
175     },
176     getMessageName : function(message, from, prefix) {
177     	from = from || jls.win32.Window;
178     	prefix = prefix || 'WM_';
179         for (var key in from) {
180             if (key.startsWith(prefix) && (from[key] == message)) {
181                 return key;
182             }
183         }
184     	return '0x' + message.toString(16);
185     },
186     initializeThreadWindow : function() {
187         if (jls.win32.Window._threadWindow != null) {
188             return;
189         }
190         _native.win32.registerClass('JLSThreadWindowsClass');
191         jls.win32.Window.WM_CREATE_WINDOW = jls.win32.Window.WM_JS_OBJECT;
192         jls.win32.Window.WM_INVOKE = jls.win32.Window.WM_JS_OBJECT + 1;
193         var mon = new jls.lang.Monitor();
194         jls.win32.Window._thread = new jls.lang.Thread();
195         jls.win32.Window._thread.run = function() {
196             jls.logger.trace('Create window thread');
197             jls.win32.Window._threadWindow = new _native.win32.Window('JLSThreadWindowsClass', '');
198         
199             jls.win32.Window._threadWindow.setWindowFunction(function(iMsg, wParam, lParam) {
200                 if (iMsg == jls.win32.Window.WM_DESTROY) {
201                     jls.logger.debug('Destroying window');
202                     _native.win32.postQuitMessage();
203                     jls.logger.debug('...destroyed');
204                     return false;
205                 }
206                 if (iMsg == jls.win32.Window.WM_CREATE_WINDOW) {
207                     if (typeof lParam == 'object') {
208                         jls.logger.debug('create window...');
209                         var w = new _native.win32.Window(lParam.classname, lParam.name, lParam.style,
210                             lParam.x, lParam.y, lParam.w, lParam.h, lParam.parent, lParam.menu, lParam.exStyle, lParam.param);
211                         jls.logger.debug('...created');
212                         return w;
213                     } else {
214                         jls.logger.debug('invalid lParam type ' + (typeof lParam));
215                     }
216                 }
217                 if (iMsg == jls.win32.Window.WM_INVOKE) {
218                     if ((typeof lParam == 'object') && ('fn' in lParam)) {
219                         jls.logger.debug('Invoke');
220                         return lParam.fn();
221                     } else {
222                         jls.logger.debug('invalid lParam type ' + (typeof lParam));
223                     }
224                 }
225             });
226             mon.notify();
227             
228             jls.logger.debug('Start polling win32 messages');
229             _native.win32.pollMessage();
230             jls.logger.debug('End polling win32 messages');
231         }
232         jls.logger.debug('Start win32 messages polling thread');
233         jls.win32.Window._thread.start();
234         jls.logger.trace('Wait for polling to start...');
235         mon.wait();
236         jls.logger.debug('Window initialized');
237     },
238     destroyThreadWindow : function() {
239         if (jls.win32.Window._threadWindow == null) {
240             return;
241         }
242         jls.win32.Window._threadWindow.sendMessage(jls.win32.Window.WM_DESTROY);
243         jls.win32.Window._threadWindow = null;
244     },
245     loadLibrary : function(name) {
246         return _native.win32.loadLibrary(name);
247     },
248     registerClass : function(name, style, syscolor, icon) {
249         _native.win32.registerClass(
250         		name, false,
251         		style ? style : jls.win32.Window.CS_HREDRAW | jls.win32.Window.CS_VREDRAW,
252         		syscolor ? syscolor : jls.win32.Window.COLOR_BTNFACE,
253         		icon ? icon._no : undefined);
254     },
255 
256     CS_BYTEALIGNCLIENT: 0x1000,
257     CS_BYTEALIGNWINDOW: 0x2000,
258     CS_CLASSDC: 0x0040,
259     CS_DBLCLKS: 0x0008,
260     CS_DROPSHADOW: 0x00020000,
261     CS_GLOBALCLASS: 0x4000,
262     CS_HREDRAW: 0x0002,
263     CS_NOCLOSE: 0x0200,
264     CS_OWNDC: 0x0020,
265     CS_PARENTDC: 0x0080,
266     CS_SAVEBITS: 0x0800,
267     CS_VREDRAW: 0x0001,
268 
269     /*COLOR_3DDKSHADOW: 21,
270     COLOR_3DFACE: 15,
271     COLOR_3DHIGHLIGHT: 20,
272     COLOR_3DHILIGHT: 20,
273     COLOR_3DLIGHT: 22,
274     COLOR_3DSHADOW: 16,
275     COLOR_ACTIVEBORDER: 10,
276     COLOR_ACTIVECAPTION: 2,
277     COLOR_APPWORKSPACE: 12,
278     COLOR_BACKGROUND: 1,*/
279     COLOR_BTNFACE: 15,
280     /*COLOR_BTNHIGHLIGHT: 20,
281     COLOR_BTNHILIGHT: 20,
282     COLOR_BTNSHADOW: 16,
283     COLOR_BTNTEXT: 18,
284     COLOR_CAPTIONTEXT: 9,
285     COLOR_DESKTOP: 1,
286     COLOR_GRADIENTACTIVECAPTION: 27,
287     COLOR_GRADIENTINACTIVECAPTION: 28,
288     COLOR_GRAYTEXT: 17,
289     COLOR_HIGHLIGHT: 13,
290     COLOR_HIGHLIGHTTEXT: 14,
291     COLOR_HOTLIGHT: 26,
292     COLOR_INACTIVEBORDER: 11,
293     COLOR_INACTIVECAPTION: 3,
294     COLOR_INACTIVECAPTIONTEXT: 19,
295     COLOR_INFOBK: 24,
296     COLOR_INFOTEXT: 23,
297     COLOR_MENU: 4,
298     COLOR_MENUHILIGHT: 29,
299     COLOR_MENUBAR: 30,
300     COLOR_MENUTEXT: 7,
301     COLOR_SCROLLBAR: 0,
302     COLOR_WINDOW: 5,
303     COLOR_WINDOWFRAME: 6,
304     COLOR_WINDOWTEXT: 8,*/
305     
306     WS_BORDER                : 0x00800000,
307     WS_CAPTION               : 0x00c00000,
308     WS_CHILD                 : 0x40000000,
309     WS_CHILDWINDOW           : 0x40000000,
310     WS_CLIPCHILDREN          : 0x02000000,
311     WS_CLIPSIBLINGS          : 0x04000000,
312     WS_DISABLED              : 0x08000000,
313     WS_DLGFRAME              : 0x00400000,
314     WS_GROUP                 : 0x00020000,
315     WS_HSCROLL               : 0x00100000,
316     WS_MAXIMIZE              : 0x01000000,
317     WS_MAXIMIZEBOX           : 0x00010000,
318     WS_MINIMIZE              : 0x20000000,
319     WS_MINIMIZEBOX           : 0x00020000,
320     WS_OVERLAPPEDWINDOW      : 0x00cf0000,
321     WS_POPUP                 : 0x80000000,
322     WS_POPUPWINDOW           : 0x80880000,
323     WS_SYSMENU               : 0x00080000,
324     WS_TABSTOP               : 0x00010000,
325     WS_THICKFRAME            : 0x00040000,
326     WS_VISIBLE               : 0x10000000,
327     WS_VSCROLL               : 0x00200000,
328     
329     WS_EX_ACCEPTFILES        : 0x00000010,
330     WS_EX_APPWINDOW          : 0x00040000,
331     WS_EX_CLIENTEDGE         : 0x00000200,
332     WS_EX_COMPOSITED         : 0x02000000,
333     WS_EX_CONTEXTHELP        : 0x00000400,
334     WS_EX_CONTROLPARENT      : 0x00010000,
335     WS_EX_DLGMODALFRAME      : 0x00000001,
336     WS_EX_LAYERED            : 0x00080000,
337     WS_EX_LAYOUTRTL          : 0x00400000,
338     WS_EX_LEFT               : 0x00000000,
339     WS_EX_LEFTSCROLLBAR      : 0x00004000,
340     WS_EX_LTRREADING         : 0x00000000,
341     WS_EX_MDICHILD           : 0x00000040,
342     WS_EX_NOACTIVATE         : 0x08000000,
343     WS_EX_NOINHERITLAYOUT    : 0x00100000,
344     WS_EX_NOPARENTNOTIFY     : 0x00000004,
345     WS_EX_OVERLAPPEDWINDOW   : 0x00000300,
346     WS_EX_PALETTEWINDOW      : 0x00000188,
347     WS_EX_RIGHT              : 0x00001000,
348     WS_EX_RIGHTSCROLLBAR     : 0x00000000,
349     WS_EX_RTLREADING         : 0x00002000,
350     WS_EX_STATICEDGE         : 0x00020000,
351     WS_EX_TOOLWINDOW         : 0x00000080,
352     WS_EX_TOPMOST            : 0x00000008,
353     WS_EX_TRANSPARENT        : 0x00000020,
354     WS_EX_WINDOWEDGE         : 0x00000100,
355     /*
356     WM_CREATE                : 0x00000001,
357     WM_CLOSE                 : 0x00000010,
358     WM_QUIT                  : 0x00000012,
359     WM_DESTROY               : 0x00000002,
360     WM_COMMAND               : 0x00000111,
361     WM_SYSCOMMAND            : 0x00000112,
362     WM_MOUSEMOVE             : 0x00000200,
363     WM_LBUTTONUP             : 0x00000202,
364     WM_LBUTTONDOWN           : 0x00000201,
365     WM_LBUTTONDBLCLK         : 0x00000203,
366     WM_RBUTTONUP             : 0x00000205,
367     WM_RBUTTONDOWN           : 0x00000204,
368     WM_RBUTTONDBLCLK         : 0x00000206,
369     WM_MBUTTONUP             : 0x00000208,
370     WM_MBUTTONDOWN           : 0x00000207,
371     WM_MBUTTONDBLCLK         : 0x00000209,
372     WM_MOVE                  : 0x00000003,
373     WM_SIZE                  : 0x00000005,
374     WM_CHAR                  : 0x00000102,
375     WM_KEYUP                 : 0x00000101,
376     WM_KEYDOWN               : 0x00000100,
377     WM_DROPFILES             : 0x00000233,
378     WM_QUERYENDSESSION       : 0x00000011,
379     WM_SETCURSOR             : 0x00000020,
380     WM_SETFOCUS              : 0x00000007,
381     WM_TIMER                 : 0x00000113,
382     WM_USER                  : 0x00000400,
383     WM_APP                   : 0x00008000,
384     WM_PAINT                 : 0x0000000f,
385     */
386     WM_APP                   : 0x00008000,
387     WM_ACTIVATE              : 0x00000006,
388     WM_ACTIVATEAPP           : 0x0000001c,
389     WM_AFXFIRST              : 0x00000360,
390     WM_AFXLAST               : 0x0000037f,
391     WM_ASKCBFORMATNAME       : 0x0000030c,
392     WM_CANCELJOURNAL         : 0x0000004b,
393     WM_CANCELMODE            : 0x0000001f,
394     WM_CAPTURECHANGED        : 0x00000215,
395     WM_CHANGECBCHAIN         : 0x0000030d,
396     WM_CHAR                  : 0x00000102,
397     WM_CHARTOITEM            : 0x0000002f,
398     WM_CHILDACTIVATE         : 0x00000022,
399     WM_CLEAR                 : 0x00000303,
400     WM_CLOSE                 : 0x00000010,
401     WM_COMMAND               : 0x00000111,
402     WM_COMMNOTIFY            : 0x00000044,
403     WM_COMPACTING            : 0x00000041,
404     WM_COMPAREITEM           : 0x00000039,
405     WM_CONTEXTMENU           : 0x0000007b,
406     WM_COPY                  : 0x00000301,
407     WM_COPYDATA              : 0x0000004a,
408     WM_CREATE                : 0x00000001,
409     WM_CTLCOLORBTN           : 0x00000135,
410     WM_CTLCOLORDLG           : 0x00000136,
411     WM_CTLCOLOREDIT          : 0x00000133,
412     WM_CTLCOLORLISTBOX       : 0x00000134,
413     WM_CTLCOLORMSGBOX        : 0x00000132,
414     WM_CTLCOLORSCROLLBAR     : 0x00000137,
415     WM_CTLCOLORSTATIC        : 0x00000138, // A static control, or an edit control that is read-only or disabled, sends the WM_CTLCOLORSTATIC  message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the static control.
416     WM_CUT                   : 0x00000300,
417     WM_DEADCHAR              : 0x00000103,
418     WM_DELETEITEM            : 0x0000002d,
419     WM_DESTROY               : 0x00000002,
420     WM_DESTROYCLIPBOARD      : 0x00000307,
421     WM_DEVICECHANGE          : 0x00000219,
422     WM_DEVMODECHANGE         : 0x0000001b,
423     WM_DISPLAYCHANGE         : 0x0000007e,
424     WM_DRAWCLIPBOARD         : 0x00000308,
425     WM_DRAWITEM              : 0x0000002b,
426     WM_DROPFILES             : 0x00000233,
427     WM_ENABLE                : 0x0000000a,
428     WM_ENDSESSION            : 0x00000016,
429     WM_ENTERIDLE             : 0x00000121,
430     WM_ENTERMENULOOP         : 0x00000211,
431     WM_ENTERSIZEMOVE         : 0x00000231,
432     WM_ERASEBKGND            : 0x00000014,
433     WM_EXITMENULOOP          : 0x00000212,
434     WM_EXITSIZEMOVE          : 0x00000232,
435     WM_FONTCHANGE            : 0x0000001d,
436     WM_GETDLGCODE            : 0x00000087,
437     WM_GETFONT               : 0x00000031,
438     WM_GETHOTKEY             : 0x00000033,
439     WM_GETICON               : 0x0000007f,
440     WM_GETMINMAXINFO         : 0x00000024,
441     WM_GETTEXT               : 0x0000000d,
442     WM_GETTEXTLENGTH         : 0x0000000e,
443     WM_HANDHELDFIRST         : 0x00000358,
444     WM_HANDHELDLAST          : 0x0000035f,
445     WM_HELP                  : 0x00000053,
446     WM_HOTKEY                : 0x00000312,
447     WM_HSCROLL               : 0x00000114,
448     WM_HSCROLLCLIPBOARD      : 0x0000030e,
449     WM_ICONERASEBKGND        : 0x00000027,
450     WM_INITDIALOG            : 0x00000110,
451     WM_INITMENU              : 0x00000116,
452     WM_INITMENUPOPUP         : 0x00000117,
453     WM_INPUTLANGCHANGE       : 0x00000051,
454     WM_INPUTLANGCHANGEREQUEST: 0x00000050,
455     WM_KEYDOWN               : 0x00000100,
456     WM_KEYUP                 : 0x00000101,
457     WM_KILLFOCUS             : 0x00000008,
458     WM_MDIACTIVATE           : 0x00000222,
459     WM_MDICASCADE            : 0x00000227,
460     WM_MDICREATE             : 0x00000220,
461     WM_MDIDESTROY            : 0x00000221,
462     WM_MDIGETACTIVE          : 0x00000229,
463     WM_MDIICONARRANGE        : 0x00000228,
464     WM_MDIMAXIMIZE           : 0x00000225,
465     WM_MDINEXT               : 0x00000224,
466     WM_MDIREFRESHMENU        : 0x00000234,
467     WM_MDIRESTORE            : 0x00000223,
468     WM_MDISETMENU            : 0x00000230,
469     WM_MDITILE               : 0x00000226,
470     WM_MEASUREITEM           : 0x0000002c,
471     WM_MENUCHAR              : 0x00000120,
472     WM_MENUSELECT            : 0x0000011f,
473     WM_NEXTMENU              : 0x00000213,
474     WM_MOVE                  : 0x00000003,
475     WM_MOVING                : 0x00000216,
476     WM_NCACTIVATE            : 0x00000086,
477     WM_NCCALCSIZE            : 0x00000083,
478     WM_NCCREATE              : 0x00000081,
479     WM_NCDESTROY             : 0x00000082,
480     WM_NCHITTEST             : 0x00000084,
481     WM_NCLBUTTONDBLCLK       : 0x000000a3,
482     WM_NCLBUTTONDOWN         : 0x000000a1,
483     WM_NCLBUTTONUP           : 0x000000a2,
484     WM_NCMBUTTONDBLCLK       : 0x000000a9,
485     WM_NCMBUTTONDOWN         : 0x000000a7,
486     WM_NCMBUTTONUP           : 0x000000a8,
487     WM_NCMOUSEMOVE           : 0x000000a0,
488     WM_NCPAINT               : 0x00000085,
489     WM_NCRBUTTONDBLCLK       : 0x000000a6,
490     WM_NCRBUTTONDOWN         : 0x000000a4,
491     WM_NCRBUTTONUP           : 0x000000a5,
492     WM_NEXTDLGCTL            : 0x00000028,
493     WM_NEXTMENU              : 0x00000213,
494     WM_NOTIFY                : 0x0000004e,
495     WM_NOTIFYFORMAT          : 0x00000055,
496     WM_NULL                  : 0x00000000,
497     WM_PAINT                 : 0x0000000f,
498     WM_PAINTCLIPBOARD        : 0x00000309,
499     WM_PAINTICON             : 0x00000026,
500     WM_PALETTECHANGED        : 0x00000311,
501     WM_PALETTEISCHANGING     : 0x00000310,
502     WM_PARENTNOTIFY          : 0x00000210,
503     WM_PASTE                 : 0x00000302,
504     WM_PENWINFIRST           : 0x00000380,
505     WM_PENWINLAST            : 0x0000038f,
506     WM_POWER                 : 0x00000048,
507     WM_POWERBROADCAST        : 0x00000218,
508     WM_PRINT                 : 0x00000317,
509     WM_PRINTCLIENT           : 0x00000318,
510     WM_QUERYDRAGICON         : 0x00000037,
511     WM_QUERYENDSESSION       : 0x00000011,
512     WM_QUERYNEWPALETTE       : 0x0000030f,
513     WM_QUERYOPEN             : 0x00000013,
514     WM_QUEUESYNC             : 0x00000023,
515     WM_QUIT                  : 0x00000012,
516     WM_RENDERALLFORMATS      : 0x00000306,
517     WM_RENDERFORMAT          : 0x00000305,
518     WM_SETCURSOR             : 0x00000020,
519     WM_SETFOCUS              : 0x00000007,
520     WM_SETFONT               : 0x00000030,
521     WM_SETHOTKEY             : 0x00000032,
522     WM_SETICON               : 0x00000080,
523     WM_SETREDRAW             : 0x0000000b,
524     WM_SETTEXT               : 0x0000000c,
525     WM_SETTINGCHANGE         : 0x0000001a,
526     WM_SHOWWINDOW            : 0x00000018,
527     WM_SIZE                  : 0x00000005,
528     WM_SIZECLIPBOARD         : 0x0000030b,
529     WM_SIZING                : 0x00000214,
530     WM_SPOOLERSTATUS         : 0x0000002a,
531     WM_STYLECHANGED          : 0x0000007d,
532     WM_STYLECHANGING         : 0x0000007c,
533     WM_SYSCHAR               : 0x00000106,
534     WM_SYSCOLORCHANGE        : 0x00000015,
535     WM_SYSCOMMAND            : 0x00000112,
536     WM_SYSDEADCHAR           : 0x00000107,
537     WM_SYSKEYDOWN            : 0x00000104,
538     WM_SYSKEYUP              : 0x00000105,
539     WM_TCARD                 : 0x00000052,
540     WM_THEMECHANGED          : 0x0000031a,
541     WM_TIMECHANGE            : 0x0000001e,
542     WM_TIMER                 : 0x00000113,
543     WM_UNDO                  : 0x00000304,
544     WM_USER                  : 0x00000400,
545     WM_USERCHANGED           : 0x00000054,
546     WM_VKEYTOITEM            : 0x0000002e,
547     WM_VSCROLL               : 0x00000115,
548     WM_VSCROLLCLIPBOARD      : 0x0000030a,
549     WM_WINDOWPOSCHANGED      : 0x00000047,
550     WM_WINDOWPOSCHANGING     : 0x00000046,
551     WM_WININICHANGE          : 0x0000001a,
552     WM_KEYFIRST              : 0x00000100,
553     WM_KEYLAST               : 0x00000108,
554     WM_SYNCPAINT             : 0x00000088,
555     WM_MOUSEACTIVATE         : 0x00000021,
556     WM_MOUSEMOVE             : 0x00000200,
557     WM_LBUTTONDOWN           : 0x00000201,
558     WM_LBUTTONUP             : 0x00000202,
559     WM_LBUTTONDBLCLK         : 0x00000203,
560     WM_RBUTTONDOWN           : 0x00000204,
561     WM_RBUTTONUP             : 0x00000205,
562     WM_RBUTTONDBLCLK         : 0x00000206,
563     WM_MBUTTONDOWN           : 0x00000207,
564     WM_MBUTTONUP             : 0x00000208,
565     WM_MBUTTONDBLCLK         : 0x00000209,
566     WM_MOUSEWHEEL            : 0x0000020a,
567     WM_MOUSEFIRST            : 0x00000200,
568     WM_MOUSELAST             : 0x0000020a,
569     WM_MOUSELAST             : 0x0000020a,
570     WM_MOUSEHOVER            : 0x000002a1,
571     WM_MOUSELEAVE            : 0x000002a3,
572     
573     TME_CANCEL               : 0x80000000,
574     TME_HOVER                : 0x00000001,
575     TME_LEAVE                : 0x00000002,
576     TME_NONCLIENT            : 0x00000010,
577     TME_QUERY                : 0x40000000,
578     
579     ICON_BIG                 : 1,
580     ICON_SMALL               : 0,
581     
582     MK_CONTROL               : 0x0008,
583     MK_LBUTTON               : 0x0001,
584     MK_MBUTTON               : 0x0010,
585     MK_RBUTTON               : 0x0002,
586     MK_SHIFT                 : 0x0004,
587     MK_XBUTTON1              : 0x0020,
588     MK_XBUTTON2              : 0x0040,
589 
590     CW_USEDEFAULT            : 0x80000000
591 });
592 
593 Object.inheritConstants(jls.win32.Window, _native.win32.Window);
594 
595 /*
596 WC_BUTTON                : 'Button',
597 WC_STATIC                : 'Static',
598 WC_EDIT                  : 'Edit',
599 WC_LISTBOX               : 'ListBox',
600 WC_COMBOBOX              : 'ComboBox',
601 WC_SCROLLBAR             : 'ScrollBar',
602 WC_COMBOBOXEX            : 'ComboBoxEx32',
603 WC_HEADER                : 'SysHeader32',
604 WC_IPADDRESS             : 'SysIPAddress32',
605 WC_LISTVIEW              : 'SysListView32',
606 WC_TABCONTROL            : 'SysTabControl32',
607 WC_TREEVIEW              : 'SysTreeView32',
608 WC_PAGESCROLLER          : 'SysPager',
609 WC_NATIVEFONTCTL         : 'NativeFontCtl',
610 RICHEDIT_CLASS           : 'RichEdit20A',
611 PROGRESS_CLASS           : 'msctls_progress32',
612 TRACKBAR_CLASS           : 'msctls_trackbar32',
613 TOOLTIPS_CLASS           : 'tooltips_class32',
614 */