KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > SWT


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.swt;
12
13
14 import org.eclipse.swt.internal.*;
15
16 /**
17  * This class provides access to a small number of SWT system-wide
18  * methods, and in addition defines the public constants provided
19  * by SWT.
20  * <p>
21  * By defining constants like UP and DOWN in a single class, SWT
22  * can share common names and concepts at the same time minimizing
23  * the number of classes, names and constants for the application
24  * programmer.
25  * </p><p>
26  * Note that some of the constants provided by this class represent
27  * optional, appearance related aspects of widgets which are available
28  * either only on some window systems, or for a differing set of
29  * widgets on each window system. These constants are marked
30  * as <em>HINT</em>s. The set of widgets which support a particular
31  * <em>HINT</em> may change from release to release, although we typically
32  * will not withdraw support for a <em>HINT</em> once it is made available.
33  * </p>
34  */

35  
36 /* NOTE:
37  * Good javadoc coding style is to put the values of static final
38  * constants in the comments. This reinforces the fact that
39  * consumers are allowed to rely on the value (and they must
40  * since the values are compiled inline in their code). We
41  * can <em>not</em> change the values of these constants between
42  * releases.
43  */

44 public class SWT {
45     
46     /* Widget Event Constants */
47     
48     /**
49      * The null event type (value is 0).
50      *
51      * @since 3.0
52      */

53     public static final int None = 0;
54     
55     /**
56      * The key down event type (value is 1).
57      *
58      * @see org.eclipse.swt.widgets.Widget#addListener
59      * @see org.eclipse.swt.widgets.Display#addFilter
60      * @see org.eclipse.swt.widgets.Event
61      *
62      * @see org.eclipse.swt.widgets.Control#addKeyListener
63      * @see org.eclipse.swt.widgets.Tracker#addKeyListener
64      * @see org.eclipse.swt.events.KeyListener#keyPressed
65      * @see org.eclipse.swt.events.KeyEvent
66      */

67     public static final int KeyDown = 1;
68     
69     /**
70      * The key up event type (value is 2).
71      *
72      * @see org.eclipse.swt.widgets.Widget#addListener
73      * @see org.eclipse.swt.widgets.Display#addFilter
74      * @see org.eclipse.swt.widgets.Event
75      *
76      * @see org.eclipse.swt.widgets.Control#addKeyListener
77      * @see org.eclipse.swt.widgets.Tracker#addKeyListener
78      * @see org.eclipse.swt.events.KeyListener#keyReleased
79      * @see org.eclipse.swt.events.KeyEvent
80      */

81     public static final int KeyUp = 2;
82     
83     /**
84      * The mouse down event type (value is 3).
85      *
86      * @see org.eclipse.swt.widgets.Widget#addListener
87      * @see org.eclipse.swt.widgets.Display#addFilter
88      * @see org.eclipse.swt.widgets.Event
89      *
90      * @see org.eclipse.swt.widgets.Control#addMouseListener
91      * @see org.eclipse.swt.events.MouseListener#mouseDown
92      * @see org.eclipse.swt.events.MouseEvent
93      */

94     public static final int MouseDown = 3;
95     
96     /**
97      * The mouse up event type (value is 4).
98      *
99      * @see org.eclipse.swt.widgets.Widget#addListener
100      * @see org.eclipse.swt.widgets.Display#addFilter
101      * @see org.eclipse.swt.widgets.Event
102      *
103      * @see org.eclipse.swt.widgets.Control#addMouseListener
104      * @see org.eclipse.swt.events.MouseListener#mouseUp
105      * @see org.eclipse.swt.events.MouseEvent
106      */

107     public static final int MouseUp = 4;
108     
109     /**
110      * The mouse move event type (value is 5).
111      *
112      * @see org.eclipse.swt.widgets.Widget#addListener
113      * @see org.eclipse.swt.widgets.Display#addFilter
114      * @see org.eclipse.swt.widgets.Event
115      *
116      * @see org.eclipse.swt.widgets.Control#addMouseMoveListener
117      * @see org.eclipse.swt.events.MouseMoveListener#mouseMove
118      * @see org.eclipse.swt.events.MouseEvent
119      */

120     public static final int MouseMove = 5;
121     
122     /**
123      * The mouse enter event type (value is 6).
124      *
125      * @see org.eclipse.swt.widgets.Widget#addListener
126      * @see org.eclipse.swt.widgets.Display#addFilter
127      * @see org.eclipse.swt.widgets.Event
128      *
129      * @see org.eclipse.swt.widgets.Control#addMouseTrackListener
130      * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter
131      * @see org.eclipse.swt.events.MouseEvent
132      */

133     public static final int MouseEnter = 6;
134     
135     /**
136      * The mouse exit event type (value is 7).
137      *
138      * @see org.eclipse.swt.widgets.Widget#addListener
139      * @see org.eclipse.swt.widgets.Display#addFilter
140      * @see org.eclipse.swt.widgets.Event
141      *
142      * @see org.eclipse.swt.widgets.Control#addMouseTrackListener
143      * @see org.eclipse.swt.events.MouseTrackListener#mouseExit
144      * @see org.eclipse.swt.events.MouseEvent
145      */

146     public static final int MouseExit = 7;
147     
148     /**
149      * The mouse double click event type (value is 8).
150      *
151      * @see org.eclipse.swt.widgets.Widget#addListener
152      * @see org.eclipse.swt.widgets.Display#addFilter
153      * @see org.eclipse.swt.widgets.Event
154      *
155      * @see org.eclipse.swt.widgets.Control#addMouseListener
156      * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick
157      * @see org.eclipse.swt.events.MouseEvent
158      */

159     public static final int MouseDoubleClick = 8;
160     
161     /**
162      * The paint event type (value is 9).
163      *
164      * @see org.eclipse.swt.widgets.Widget#addListener
165      * @see org.eclipse.swt.widgets.Display#addFilter
166      * @see org.eclipse.swt.widgets.Event
167      *
168      * @see org.eclipse.swt.widgets.Control#addPaintListener
169      * @see org.eclipse.swt.events.PaintListener#paintControl
170      * @see org.eclipse.swt.events.PaintEvent
171      */

172     public static final int Paint = 9;
173     
174     /**
175      * The move event type (value is 10).
176      *
177      * @see org.eclipse.swt.widgets.Widget#addListener
178      * @see org.eclipse.swt.widgets.Display#addFilter
179      * @see org.eclipse.swt.widgets.Event
180      *
181      * @see org.eclipse.swt.widgets.Control#addControlListener
182      * @see org.eclipse.swt.widgets.TableColumn#addControlListener
183      * @see org.eclipse.swt.widgets.Tracker#addControlListener
184      * @see org.eclipse.swt.widgets.TreeColumn#addControlListener
185      * @see org.eclipse.swt.events.ControlListener#controlMoved
186      * @see org.eclipse.swt.events.ControlEvent
187      */

188     public static final int Move = 10;
189     
190     /**
191      * The resize event type (value is 11).
192      *
193      * @see org.eclipse.swt.widgets.Widget#addListener
194      * @see org.eclipse.swt.widgets.Display#addFilter
195      * @see org.eclipse.swt.widgets.Event
196      *
197      * @see org.eclipse.swt.widgets.Control#addControlListener
198      * @see org.eclipse.swt.widgets.TableColumn#addControlListener
199      * @see org.eclipse.swt.widgets.Tracker#addControlListener
200      * @see org.eclipse.swt.widgets.TreeColumn#addControlListener
201      * @see org.eclipse.swt.events.ControlListener#controlResized
202      * @see org.eclipse.swt.events.ControlEvent
203      */

204     public static final int Resize = 11;
205     
206     /**
207      * The dispose event type (value is 12).
208      *
209      * @see org.eclipse.swt.widgets.Widget#addListener
210      * @see org.eclipse.swt.widgets.Display#addListener
211      * @see org.eclipse.swt.widgets.Display#addFilter
212      * @see org.eclipse.swt.widgets.Event
213      *
214      * @see org.eclipse.swt.widgets.Widget#addDisposeListener
215      * @see org.eclipse.swt.events.DisposeListener#widgetDisposed
216      * @see org.eclipse.swt.events.DisposeEvent
217      */

218     public static final int Dispose = 12;
219     
220     /**
221      * The selection event type (value is 13).
222      *
223      * @see org.eclipse.swt.widgets.Widget#addListener
224      * @see org.eclipse.swt.widgets.Display#addFilter
225      * @see org.eclipse.swt.widgets.Event
226      *
227      * @see org.eclipse.swt.widgets.Button#addSelectionListener
228      * @see org.eclipse.swt.widgets.Combo#addSelectionListener
229      * @see org.eclipse.swt.widgets.CoolItem#addSelectionListener
230      * @see org.eclipse.swt.widgets.Link#addSelectionListener
231      * @see org.eclipse.swt.widgets.List#addSelectionListener
232      * @see org.eclipse.swt.widgets.MenuItem#addSelectionListener
233      * @see org.eclipse.swt.widgets.Sash#addSelectionListener
234      * @see org.eclipse.swt.widgets.Scale#addSelectionListener
235      * @see org.eclipse.swt.widgets.ScrollBar#addSelectionListener
236      * @see org.eclipse.swt.widgets.Slider#addSelectionListener
237      * @see org.eclipse.swt.widgets.TabFolder#addSelectionListener
238      * @see org.eclipse.swt.widgets.Table#addSelectionListener
239      * @see org.eclipse.swt.widgets.TableColumn#addSelectionListener
240      * @see org.eclipse.swt.widgets.ToolItem#addSelectionListener
241      * @see org.eclipse.swt.widgets.TrayItem#addSelectionListener
242      * @see org.eclipse.swt.widgets.Tree#addSelectionListener
243      * @see org.eclipse.swt.widgets.TreeColumn#addSelectionListener
244      * @see org.eclipse.swt.events.SelectionListener#widgetSelected
245      * @see org.eclipse.swt.events.SelectionEvent
246      */

247     public static final int Selection = 13;
248     
249     /**
250      * The default selection event type (value is 14).
251      *
252      * @see org.eclipse.swt.widgets.Widget#addListener
253      * @see org.eclipse.swt.widgets.Display#addFilter
254      * @see org.eclipse.swt.widgets.Event
255      *
256      * @see org.eclipse.swt.widgets.Combo#addSelectionListener
257      * @see org.eclipse.swt.widgets.List#addSelectionListener
258      * @see org.eclipse.swt.widgets.Spinner#addSelectionListener
259      * @see org.eclipse.swt.widgets.Table#addSelectionListener
260      * @see org.eclipse.swt.widgets.Text#addSelectionListener
261      * @see org.eclipse.swt.widgets.TrayItem#addSelectionListener
262      * @see org.eclipse.swt.widgets.Tree#addSelectionListener
263      * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected
264      * @see org.eclipse.swt.events.SelectionEvent
265      */

266     public static final int DefaultSelection = 14;
267     
268     /**
269      * The focus in event type (value is 15).
270      *
271      * @see org.eclipse.swt.widgets.Widget#addListener
272      * @see org.eclipse.swt.widgets.Display#addFilter
273      * @see org.eclipse.swt.widgets.Event
274      *
275      * @see org.eclipse.swt.widgets.Control#addFocusListener
276      * @see org.eclipse.swt.events.FocusListener#focusGained
277      * @see org.eclipse.swt.events.FocusEvent
278      */

279     public static final int FocusIn = 15;
280     
281     /**
282      * The focus out event type (value is 16).
283      *
284      * @see org.eclipse.swt.widgets.Widget#addListener
285      * @see org.eclipse.swt.widgets.Display#addFilter
286      * @see org.eclipse.swt.widgets.Event
287      *
288      * @see org.eclipse.swt.widgets.Control#addFocusListener
289      * @see org.eclipse.swt.events.FocusListener#focusLost
290      * @see org.eclipse.swt.events.FocusEvent
291      */

292     public static final int FocusOut = 16;
293     
294     /**
295      * The expand event type (value is 17).
296      *
297      * @see org.eclipse.swt.widgets.Widget#addListener
298      * @see org.eclipse.swt.widgets.Display#addFilter
299      * @see org.eclipse.swt.widgets.Event
300      *
301      * @see org.eclipse.swt.widgets.Tree#addTreeListener
302      * @see org.eclipse.swt.events.TreeListener#treeExpanded
303      * @see org.eclipse.swt.events.TreeEvent
304      */

305     public static final int Expand = 17;
306     
307     /**
308      * The collapse event type (value is 18).
309      *
310      * @see org.eclipse.swt.widgets.Widget#addListener
311      * @see org.eclipse.swt.widgets.Display#addFilter
312      * @see org.eclipse.swt.widgets.Event
313      *
314      * @see org.eclipse.swt.widgets.Tree#addTreeListener
315      * @see org.eclipse.swt.events.TreeListener#treeCollapsed
316      * @see org.eclipse.swt.events.TreeEvent
317      */

318     public static final int Collapse = 18;
319     
320     /**
321      * The iconify event type (value is 19).
322      *
323      * @see org.eclipse.swt.widgets.Widget#addListener
324      * @see org.eclipse.swt.widgets.Display#addFilter
325      * @see org.eclipse.swt.widgets.Event
326      *
327      * @see org.eclipse.swt.widgets.Shell#addShellListener
328      * @see org.eclipse.swt.events.ShellListener#shellIconified
329      * @see org.eclipse.swt.events.ShellEvent
330      */

331     public static final int Iconify = 19;
332     
333     /**
334      * The de-iconify event type (value is 20).
335      *
336      * @see org.eclipse.swt.widgets.Widget#addListener
337      * @see org.eclipse.swt.widgets.Display#addFilter
338      * @see org.eclipse.swt.widgets.Event
339      *
340      * @see org.eclipse.swt.widgets.Shell#addShellListener
341      * @see org.eclipse.swt.events.ShellListener#shellDeiconified
342      * @see org.eclipse.swt.events.ShellEvent
343      */

344     public static final int Deiconify = 20;
345     
346     /**
347      * The close event type (value is 21).
348      *
349      * @see org.eclipse.swt.widgets.Widget#addListener
350      * @see org.eclipse.swt.widgets.Display#addListener
351      * @see org.eclipse.swt.widgets.Display#addFilter
352      * @see org.eclipse.swt.widgets.Event
353      *
354      * @see org.eclipse.swt.widgets.Shell#addShellListener
355      * @see org.eclipse.swt.events.ShellListener#shellClosed
356      * @see org.eclipse.swt.events.ShellEvent
357      */

358     public static final int Close = 21;
359     
360     /**
361      * The show event type (value is 22).
362      *
363      * @see org.eclipse.swt.widgets.Widget#addListener
364      * @see org.eclipse.swt.widgets.Display#addFilter
365      * @see org.eclipse.swt.widgets.Event
366      *
367      * @see org.eclipse.swt.widgets.Menu#addMenuListener
368      * @see org.eclipse.swt.events.MenuListener#menuShown
369      * @see org.eclipse.swt.events.MenuEvent
370      */

371     public static final int Show = 22;
372     
373     /**
374      * The hide event type (value is 23).
375      *
376      * @see org.eclipse.swt.widgets.Widget#addListener
377      * @see org.eclipse.swt.widgets.Display#addFilter
378      * @see org.eclipse.swt.widgets.Event
379      *
380      * @see org.eclipse.swt.widgets.Menu#addMenuListener
381      * @see org.eclipse.swt.events.MenuListener#menuHidden
382      * @see org.eclipse.swt.events.MenuEvent
383      */

384     public static final int Hide = 23;
385     
386     /**
387      * The modify event type (value is 24).
388      *
389      * @see org.eclipse.swt.widgets.Widget#addListener
390      * @see org.eclipse.swt.widgets.Display#addFilter
391      * @see org.eclipse.swt.widgets.Event
392      *
393      * @see org.eclipse.swt.widgets.Combo#addModifyListener
394      * @see org.eclipse.swt.widgets.Spinner#addModifyListener
395      * @see org.eclipse.swt.widgets.Text#addModifyListener
396      * @see org.eclipse.swt.events.ModifyListener#modifyText
397      * @see org.eclipse.swt.events.ModifyEvent
398      */

399     public static final int Modify = 24;
400     
401     /**
402      * The verify event type (value is 25).
403      *
404      * @see org.eclipse.swt.widgets.Widget#addListener
405      * @see org.eclipse.swt.widgets.Display#addFilter
406      * @see org.eclipse.swt.widgets.Event
407      *
408      * @see org.eclipse.swt.widgets.Combo#addVerifyListener
409      * @see org.eclipse.swt.widgets.Text#addVerifyListener
410      * @see org.eclipse.swt.events.VerifyListener#verifyText
411      * @see org.eclipse.swt.events.VerifyEvent
412      */

413     public static final int Verify = 25;
414     
415     /**
416      * The activate event type (value is 26).
417      *
418      * @see org.eclipse.swt.widgets.Widget#addListener
419      * @see org.eclipse.swt.widgets.Display#addFilter
420      * @see org.eclipse.swt.widgets.Event
421      *
422      * @see org.eclipse.swt.widgets.Shell#addShellListener
423      * @see org.eclipse.swt.events.ShellListener#shellActivated
424      * @see org.eclipse.swt.events.ShellEvent
425      */

426     public static final int Activate = 26;
427     
428     /**
429      * The deactivate event type (value is 27).
430      *
431      * @see org.eclipse.swt.widgets.Widget#addListener
432      * @see org.eclipse.swt.widgets.Display#addFilter
433      * @see org.eclipse.swt.widgets.Event
434      *
435      * @see org.eclipse.swt.widgets.Shell#addShellListener
436      * @see org.eclipse.swt.events.ShellListener#shellDeactivated
437      * @see org.eclipse.swt.events.ShellEvent
438      */

439     public static final int Deactivate = 27;
440     
441     /**
442      * The help event type (value is 28).
443      *
444      * @see org.eclipse.swt.widgets.Widget#addListener
445      * @see org.eclipse.swt.widgets.Display#addFilter
446      * @see org.eclipse.swt.widgets.Event
447      *
448      * @see org.eclipse.swt.widgets.Control#addHelpListener
449      * @see org.eclipse.swt.widgets.Menu#addHelpListener
450      * @see org.eclipse.swt.widgets.MenuItem#addHelpListener
451      * @see org.eclipse.swt.events.HelpListener#helpRequested
452      * @see org.eclipse.swt.events.HelpEvent
453      */

454     public static final int Help = 28;
455     
456     /**
457      * The drag detect event type (value is 29).
458      *
459      * @see org.eclipse.swt.widgets.Widget#addListener
460      * @see org.eclipse.swt.widgets.Display#addFilter
461      * @see org.eclipse.swt.widgets.Event
462      *
463      * @see org.eclipse.swt.dnd.DragSource
464      */

465     public static final int DragDetect = 29;
466     
467     /**
468      * The arm event type (value is 30).
469      *
470      * @see org.eclipse.swt.widgets.Widget#addListener
471      * @see org.eclipse.swt.widgets.Display#addFilter
472      * @see org.eclipse.swt.widgets.Event
473      *
474      * @see org.eclipse.swt.widgets.MenuItem#addArmListener
475      * @see org.eclipse.swt.events.ArmListener#widgetArmed
476      * @see org.eclipse.swt.events.ArmEvent
477      */

478     public static final int Arm = 30;
479     
480     /**
481      * The traverse event type (value is 31).
482      *
483      * @see org.eclipse.swt.widgets.Widget#addListener
484      * @see org.eclipse.swt.widgets.Display#addFilter
485      * @see org.eclipse.swt.widgets.Event
486      *
487      * @see org.eclipse.swt.widgets.Control#addTraverseListener
488      * @see org.eclipse.swt.events.TraverseListener#keyTraversed
489      * @see org.eclipse.swt.events.TraverseEvent
490      */

491     public static final int Traverse = 31;
492     
493     /**
494      * The mouse hover event type (value is 32).
495      *
496      * @see org.eclipse.swt.widgets.Widget#addListener
497      * @see org.eclipse.swt.widgets.Display#addFilter
498      * @see org.eclipse.swt.widgets.Event
499      *
500      * @see org.eclipse.swt.widgets.Control#addMouseTrackListener
501      * @see org.eclipse.swt.events.MouseTrackListener#mouseHover
502      * @see org.eclipse.swt.events.MouseEvent
503      */

504     public static final int MouseHover = 32;
505
506     /**
507      * The hardware key down event type (value is 33).
508      *
509      * @see org.eclipse.swt.widgets.Widget#addListener
510      * @see org.eclipse.swt.widgets.Display#addFilter
511      * @see org.eclipse.swt.widgets.Event
512      */

513     public static final int HardKeyDown = 33;
514     
515     /**
516      * The hardware key up event type (value is 34).
517      *
518      * @see org.eclipse.swt.widgets.Widget#addListener
519      * @see org.eclipse.swt.widgets.Display#addFilter
520      * @see org.eclipse.swt.widgets.Event
521      */

522     public static final int HardKeyUp = 34;
523
524     /**
525      * The menu detect event type (value is 35).
526      *
527      * @see org.eclipse.swt.widgets.Widget#addListener
528      * @see org.eclipse.swt.widgets.Display#addFilter
529      * @see org.eclipse.swt.widgets.Event
530      *
531      * @since 3.0
532      */

533     public static final int MenuDetect = 35;
534     
535     /**
536      * The set data event type (value is 36).
537      *
538      * @see org.eclipse.swt.widgets.Widget#addListener
539      * @see org.eclipse.swt.widgets.Display#addFilter
540      * @see org.eclipse.swt.widgets.Event
541      *
542      * @see org.eclipse.swt.widgets.Table
543      * @see org.eclipse.swt.widgets.Tree
544      *
545      * @since 3.0
546      */

547     public static final int SetData = 36;
548
549     /**
550      * The mouse wheel event type (value is 37).
551      *
552      * @see org.eclipse.swt.widgets.Widget#addListener
553      * @see org.eclipse.swt.widgets.Display#addFilter
554      * @see org.eclipse.swt.widgets.Event
555      *
556      * @since 3.1
557      */

558     public static final int MouseWheel = 37;
559
560     /**
561      * The settings changed event type (value is 39).
562      * <p>
563      * The settings changed event is sent when an operating system
564      * property, such as a system font or color, has been changed.
565      * The event occurs after the property has been changed, but
566      * before any widget is redrawn. Applications that cache operating
567      * system properties can use this event to update their caches.
568      * A specific property change can be detected by querying the
569      * new value of a property and comparing it with the equivalent
570      * cached value. The operating system automatically redraws and
571      * lays out all widgets after this event is sent.
572      * </p>
573      *
574      * @see org.eclipse.swt.widgets.Display#addListener
575      * @see org.eclipse.swt.widgets.Event
576      *
577      * @since 3.2
578      */

579     public static final int Settings = 39;
580     
581     /**
582      * The erase item event type (value is 40).
583      *
584      * @see org.eclipse.swt.widgets.Widget#addListener
585      * @see org.eclipse.swt.widgets.Display#addFilter
586      * @see org.eclipse.swt.widgets.Event
587      *
588      * @since 3.2
589      */

590     public static final int EraseItem = 40;
591     
592     /**
593      * The measure item event type (value is 41).
594      *
595      * @see org.eclipse.swt.widgets.Widget#addListener
596      * @see org.eclipse.swt.widgets.Display#addFilter
597      * @see org.eclipse.swt.widgets.Event
598      *
599      * @since 3.2
600      */

601     public static final int MeasureItem = 41;
602     
603     /**
604      * The paint item event type (value is 42).
605      *
606      * @see org.eclipse.swt.widgets.Widget#addListener
607      * @see org.eclipse.swt.widgets.Display#addFilter
608      * @see org.eclipse.swt.widgets.Event
609      *
610      * @since 3.2
611      */

612     public static final int PaintItem = 42;
613     
614     /* Event Details */
615
616     /**
617      * Indicates that a user-interface component is being dragged,
618      * for example dragging the thumb of a scroll bar (value is 1).
619      */

620     public static final int DRAG = 1;
621     
622     /**
623      * Event detail field that indicates a user-interface component
624      * state is selected (value is 1&lt;&lt;1).
625      *
626      * @since 3.2
627      */

628     public static final int SELECTED = 1 << 1;
629     
630     /**
631      * Event detail field that indicates a user-interface component
632      * state is focused (value is 1&lt;&lt;2).
633      *
634      * @since 3.2
635      */

636     public static final int FOCUSED = 1 << 2;
637     
638     /**
639      * Event detail field that indicates a user-interface component
640      * draws the background (value is 1&lt;&lt;3).
641      *
642      * @since 3.2
643      */

644     public static final int BACKGROUND = 1 << 3;
645     
646     /**
647      * Event detail field that indicates a user-interface component
648      * draws the foreground (value is 1&lt;&lt;4).
649      *
650      * @since 3.2
651      */

652     public static final int FOREGROUND = 1 << 4;
653     
654     /**
655      * Event detail field that indicates a user-interface component
656      * state is hot (value is 1&lt;&lt;5).
657      *
658      * @since 3.3
659      */

660     public static final int HOT = 1 << 5;
661     
662     /* This code is intentionally commented */
663     //public static final int PRESSED = 1 << 3;
664
//public static final int ACTIVE = 1 << 4;
665
//public static final int DISABLED = 1 << 5;
666
//public static final int HOT = 1 << 6;
667
//public static final int DEFAULTED = 1 << 7;
668

669     /**
670      * Traversal event detail field value indicating that no
671      * traversal action should be taken
672      * (value is 0).
673      */

674     public static final int TRAVERSE_NONE = 0;
675     
676     /**
677      * Traversal event detail field value indicating that the
678      * key which designates that a dialog should be cancelled was
679      * pressed; typically, this is the ESC key
680      * (value is 1&lt;&lt;1).
681      */

682     public static final int TRAVERSE_ESCAPE = 1 << 1;
683
684     /**
685      * Traversal event detail field value indicating that the
686      * key which activates the default button in a dialog was
687      * pressed; typically, this is the ENTER key
688      * (value is 1&lt;&lt;2).
689      */

690     public static final int TRAVERSE_RETURN = 1 << 2;
691
692     /**
693      * Traversal event detail field value indicating that the
694      * key which designates that focus should be given to the
695      * previous tab group was pressed; typically, this is the
696      * SHIFT-TAB key sequence
697      * (value is 1&lt;&lt;3).
698      */

699     public static final int TRAVERSE_TAB_PREVIOUS = 1 << 3;
700
701     /**
702      * Traversal event detail field value indicating that the
703      * key which designates that focus should be given to the
704      * next tab group was pressed; typically, this is the
705      * TAB key
706      * (value is 1&lt;&lt;4).
707      */

708     public static final int TRAVERSE_TAB_NEXT = 1 << 4;
709
710     /**
711      * Traversal event detail field value indicating that the
712      * key which designates that focus should be given to the
713      * previous tab item was pressed; typically, this is either
714      * the LEFT-ARROW or UP-ARROW keys
715      * (value is 1&lt;&lt;5).
716      */

717     public static final int TRAVERSE_ARROW_PREVIOUS = 1 << 5;
718
719     /**
720      * Traversal event detail field value indicating that the
721      * key which designates that focus should be given to the
722      * previous tab item was pressed; typically, this is either
723      * the RIGHT-ARROW or DOWN-ARROW keys
724      * (value is 1&lt;&lt;6).
725      */

726     public static final int TRAVERSE_ARROW_NEXT = 1 << 6;
727
728     /**
729      * Traversal event detail field value indicating that a
730      * mnemonic key sequence was pressed
731      * (value is 1&lt;&lt;7).
732      */

733     public static final int TRAVERSE_MNEMONIC = 1 << 7;
734
735     /**
736      * Traversal event detail field value indicating that the
737      * key which designates that the previous page of a multi-page
738      * window should be shown was pressed; typically, this
739      * is the CTRL-PAGEUP key sequence
740      * (value is 1&lt;&lt;8).
741      */

742     public static final int TRAVERSE_PAGE_PREVIOUS = 1 << 8;
743     
744     /**
745      * Traversal event detail field value indicating that the
746      * key which designates that the next page of a multi-page
747      * window should be shown was pressed; typically, this
748      * is the CTRL-PAGEDOWN key sequence
749      * (value is 1&lt;&lt;9).
750      */

751     public static final int TRAVERSE_PAGE_NEXT = 1 << 9;
752
753     /**
754      * A constant known to be zero (0), typically used in operations
755      * which take bit flags to indicate that "no bits are set".
756      */

757     public static final int NONE = 0;
758     
759     /**
760      * A constant known to be zero (0), used in operations which
761      * take pointers to indicate a null argument.
762      */

763     public static final int NULL = 0;
764     
765     /**
766      * Indicates that a default should be used (value is -1).
767      */

768     public static final int DEFAULT = -1;
769
770     /**
771      * Indicates that a property is off (value is 0).
772      *
773      * @since 3.1
774      */

775     public static final int OFF = 0;
776     
777     /**
778      * Indicates that a property is on (value is 1).
779      *
780      * @since 3.1
781      */

782     public static final int ON = 1;
783
784     /**
785      * Indicates low quality (value is 1).
786      *
787      * @since 3.1
788      */

789     public static final int LOW = 1;
790
791     /**
792      * Indicates high quality (value is 2).
793      *
794      * @since 3.1
795      */

796     public static final int HIGH = 2;
797
798     /**
799      * Style constant for menu bar behavior (value is 1&lt;&lt;1).
800      * <p><b>Used By:</b><ul>
801      * <li><code>Menu</code></li>
802      * </ul></p>
803      */

804     public static final int BAR = 1 << 1;
805
806     /**
807      * Style constant for drop down menu/list behavior (value is 1&lt;&lt;2).
808      * <p><b>Used By:</b><ul>
809      * <li><code>Menu</code></li>
810      * <li><code>ToolItem</code></li>
811      * <li><code>CoolItem</code></li>
812      * <li><code>Combo</code></li>
813      * </ul></p>
814      */

815     public static final int DROP_DOWN = 1 << 2;
816
817     /**
818      * Style constant for pop up menu behavior (value is 1&lt;&lt;3).
819      * <p><b>Used By:</b><ul>
820      * <li><code>Menu</code></li>
821      * </ul></p>
822      */

823     public static final int POP_UP = 1 << 3;
824
825     /**
826      * Style constant for line separator behavior (value is 1&lt;&lt;1).
827      * <p><b>Used By:</b><ul>
828      * <li><code>Label</code></li>
829      * <li><code>MenuItem</code></li>
830      * <li><code>ToolItem</code></li>
831      * </ul></p>
832      */

833     public static final int SEPARATOR = 1 << 1;
834
835     /**
836      * Style constant for toggle button behavior (value is 1&lt;&lt;1).
837      * <p><b>Used By:</b><ul>
838      * <li><code>Button</code></li>
839      * </ul></p>
840      */

841     public static final int TOGGLE = 1 << 1;
842
843     /**
844      * Style constant for arrow button behavior (value is 1&lt;&lt;2).
845      * <p><b>Used By:</b><ul>
846      * <li><code>Button</code></li>
847      * </ul></p>
848      */

849     public static final int ARROW = 1 << 2;
850
851     /**
852      * Style constant for push button behavior (value is 1&lt;&lt;3).
853      * <p><b>Used By:</b><ul>
854      * <li><code>Button</code></li>
855      * <li><code>MenuItem</code></li>
856      * <li><code>ToolItem</code></li>
857      * </ul></p>
858      */

859     public static final int PUSH = 1 << 3;
860
861     /**
862      * Style constant for radio button behavior (value is 1&lt;&lt;4).
863      * <p><b>Used By:</b><ul>
864      * <li><code>Button</code></li>
865      * <li><code>MenuItem</code></li>
866      * <li><code>ToolItem</code></li>
867      * </ul></p>
868      */

869     public static final int RADIO = 1 << 4;
870
871     /**
872      * Style constant for check box behavior (value is 1&lt;&lt;5).
873      * <p><b>Used By:</b><ul>
874      * <li><code>Button</code></li>
875      * <li><code>MenuItem</code></li>
876      * <li><code>ToolItem</code></li>
877      * <li><code>Table</code></li>
878      * <li><code>Tree</code></li>
879      * </ul></p>
880      */

881     public static final int CHECK = 1 << 5;
882
883     /**
884      * Style constant for cascade behavior (value is 1&lt;&lt;6).
885      * <p><b>Used By:</b><ul>
886      * <li><code>MenuItem</code></li>
887      * </ul></p>
888      */

889     public static final int CASCADE = 1 << 6;
890
891     /**
892      * Style constant for multi-selection behavior in lists
893      * and multiple line support on text fields (value is 1&lt;&lt;1).
894      * <p><b>Used By:</b><ul>
895      * <li><code>Text</code></li>
896      * <li><code>List</code></li>
897      * <li><code>FileDialog</code></li>
898      * </ul></p>
899      */

900     public static final int MULTI = 1 << 1;
901
902     /**
903      * Style constant for single selection behavior in lists
904      * and single line support on text fields (value is 1&lt;&lt;2).
905      * <p><b>Used By:</b><ul>
906      * <li><code>Text</code></li>
907      * <li><code>List</code></li>
908      * <li><code>Table</code></li>
909      * <li><code>Tree</code></li>
910      * </ul></p>
911      */

912     public static final int SINGLE = 1 << 2;
913
914     /**
915      * Style constant for read-only behavior (value is 1&lt;&lt;3).
916      * <p><b>Used By:</b><ul>
917      * <li><code>Combo</code></li>
918      * <li><code>Text</code></li>
919      * </ul></p>
920      */

921     public static final int READ_ONLY = 1 << 3;
922
923     /**
924      * Style constant for automatic line wrap behavior (value is 1&lt;&lt;6).
925      * <p><b>Used By:</b><ul>
926      * <li><code>Label</code></li>
927      * <li><code>Text</code></li>
928      * <li><code>ToolBar</code></li>
929      * <li><code>Spinner</code></li>
930      * </ul></p>
931      */

932     public static final int WRAP = 1 << 6;
933
934     /**
935      * Style constant for search behavior (value is 1&lt;&lt;7).
936      * <p><b>Used By:</b><ul>
937      * <li><code>Text</code></li>
938      * </ul></p>
939      *
940      * @since 3.3
941      */

942     public static final int SEARCH = 1 << 7;
943
944     /**
945      * Style constant for simple (not drop down) behavior (value is 1&lt;&lt;6).
946      * <p><b>Used By:</b><ul>
947      * <li><code>Combo</code></li>
948      * </ul></p>
949      */

950     public static final int SIMPLE = 1 << 6;
951
952     /**
953      * Style constant for password behavior (value is 1&lt;&lt;22).
954      * <p><b>Used By:</b><ul>
955      * <li><code>Text</code></li>
956      * </ul></p>
957      *
958      * @since 3.0
959      */

960     public static final int PASSWORD = 1 << 22;
961     
962     /**
963      * Style constant for shadow in behavior (value is 1&lt;&lt;2).
964      * <br>Note that this is a <em>HINT</em>.
965      * <p><b>Used By:</b><ul>
966      * <li><code>Label</code></li>
967      * <li><code>Group</code></li>
968      * </ul></p>
969      */

970     public static final int SHADOW_IN = 1 << 2;
971
972     /**
973      * Style constant for shadow out behavior (value is 1&lt;&lt;3).
974      * <br>Note that this is a <em>HINT</em>.
975      * <p><b>Used By:</b><ul>
976      * <li><code>Label</code></li>
977      * <li><code>Group</code></li>
978      * <li><code>ToolBar</code></li>
979      * </ul></p>
980      */

981     public static final int SHADOW_OUT = 1 << 3;
982
983     /**
984      * Style constant for shadow etched in behavior (value is 1&lt;&lt;4).
985      * <br>Note that this is a <em>HINT</em>. It is ignored on all platforms except Motif.
986      * <p><b>Used By:</b><ul>
987      * <li><code>Group</code></li>
988      * </ul></p>
989      */

990     public static final int SHADOW_ETCHED_IN = 1 << 4;
991
992     /**
993      * Style constant for shadow etched out behavior (value is 1&lt;&lt;6).
994      * <br>Note that this is a <em>HINT</em>. It is ignored on all platforms except Motif.
995      * <p><b>Used By:</b><ul>
996      * <li><code>Group</code></li>
997      * </ul></p>
998      */

999     public static final int SHADOW_ETCHED_OUT = 1 << 6;
1000
1001    /**
1002     * Style constant for no shadow behavior (value is 1&lt;&lt;5).
1003     * <br>Note that this is a <em>HINT</em>.
1004     * <p><b>Used By:</b><ul>
1005     * <li><code>Label</code></li>
1006     * <li><code>Group</code></li>
1007     * </ul></p>
1008     */

1009    public static final int SHADOW_NONE = 1 << 5;
1010
1011    /**
1012     * Style constant for progress bar behavior (value is 1&lt;&lt;1).
1013     * <p><b>Used By:</b><ul>
1014     * <li><code>ProgressBar</code></li>
1015     * </ul></p>
1016     */

1017    public static final int INDETERMINATE = 1 << 1;
1018    
1019    /**
1020     * Style constant for tool window behavior (value is 1&lt;&lt;2).
1021     * <p>
1022     * A tool window is a window intended to be used as a floating toolbar.
1023     * It typically has a title bar that is shorter than a normal title bar,
1024     * and the window title is typically drawn using a smaller font.
1025     * <br>Note that this is a <em>HINT</em>.
1026     * </p><p><b>Used By:</b><ul>
1027     * <li><code>Decorations</code> and subclasses</li>
1028     * </ul></p>
1029     */

1030    public static final int TOOL = 1 << 2;
1031
1032    /**
1033     * Style constant to ensure no trimmings are used (value is 1&lt;&lt;3).
1034     * <br>Note that this overrides all other trim styles.
1035     * <p><b>Used By:</b><ul>
1036     * <li><code>Decorations</code> and subclasses</li>
1037     * </ul></p>
1038     */

1039    public static final int NO_TRIM = 1 << 3;
1040    
1041    /**
1042     * Style constant for resize box trim (value is 1&lt;&lt;4).
1043     * <p><b>Used By:</b><ul>
1044     * <li><code>Decorations</code> and subclasses</li>
1045     * <li><code>Tracker</code></li>
1046     * </ul></p>
1047     */

1048    public static final int RESIZE = 1 << 4;
1049
1050    /**
1051     * Style constant for title area trim (value is 1&lt;&lt;5).
1052     * <p><b>Used By:</b><ul>
1053     * <li><code>Decorations</code> and subclasses</li>
1054     * </ul></p>
1055     */

1056    public static final int TITLE = 1 << 5;
1057
1058    /**
1059     * Style constant for close box trim (value is 1&lt;&lt;6,
1060     * since we do not distinguish between CLOSE style and MENU style).
1061     * <p><b>Used By:</b><ul>
1062     * <li><code>Decorations</code> and subclasses</li>
1063     * </ul></p>
1064     */

1065    public static final int CLOSE = 1 << 6;
1066
1067    /**
1068     * Style constant for shell menu trim (value is 1&lt;&lt;6,
1069     * since we do not distinguish between CLOSE style and MENU style).
1070     * <p><b>Used By:</b><ul>
1071     * <li><code>Decorations</code> and subclasses</li>
1072     * </ul></p>
1073     */

1074    public static final int MENU = CLOSE;
1075
1076    /**
1077     * Style constant for minimize box trim (value is 1&lt;&lt;7).
1078     * <p><b>Used By:</b><ul>
1079     * <li><code>Decorations</code> and subclasses</li>
1080     * </ul></p>
1081     */

1082    public static final int MIN = 1 << 7;
1083
1084    /**
1085     * Style constant for maximize box trim (value is 1&lt;&lt;10).
1086     * <p><b>Used By:</b><ul>
1087     * <li><code>Decorations</code> and subclasses</li>
1088     * </ul></p>
1089     */

1090    public static final int MAX = 1 << 10;
1091
1092    /**
1093     * Style constant for horizontal scrollbar behavior (value is 1&lt;&lt;8).
1094     * <p><b>Used By:</b><ul>
1095     * <li><code>Scrollable</code> and subclasses</li>
1096     * </ul></p>
1097     */

1098    public static final int H_SCROLL = 1 << 8;
1099
1100    /**
1101     * Style constant for vertical scrollbar behavior (value is 1&lt;&lt;9).
1102     * <p><b>Used By:</b><ul>
1103     * <li><code>Scrollable</code> and subclasses</li>
1104     * </ul></p>
1105     */

1106    public static final int V_SCROLL = 1 << 9;
1107
1108    /**
1109     * Style constant for bordered behavior (value is 1&lt;&lt;11).
1110     * <br>Note that this is a <em>HINT</em>.
1111     * <p><b>Used By:</b><ul>
1112     * <li><code>Control</code> and subclasses</li>
1113     * </ul></p>
1114     */

1115    public static final int BORDER = 1 << 11;
1116
1117    /**
1118     * Style constant indicating that the window manager should clip
1119     * a widget's children with respect to its viewable area. (value is 1&lt;&lt;12).
1120     * <br>Note that this is a <em>HINT</em>.
1121     * <p><b>Used By:</b><ul>
1122     * <li><code>Control</code> and subclasses</li>
1123     * </ul></p>
1124     */

1125    public static final int CLIP_CHILDREN = 1 << 12;
1126
1127    /**
1128     * Style constant indicating that the window manager should clip
1129     * a widget's siblings with respect to its viewable area. (value is 1&lt;&lt;13).
1130     * <br>Note that this is a <em>HINT</em>.
1131     * <p><b>Used By:</b><ul>
1132     * <li><code>Control</code> and subclasses</li>
1133     * </ul></p>
1134     */

1135    public static final int CLIP_SIBLINGS = 1 << 13;
1136
1137    /**
1138     * Style constant for always on top behavior (value is 1&lt;&lt;14).
1139     * <br>Note that this is a <em>HINT</em>.
1140     * <p><b>Used By:</b><ul>
1141     * <li><code>Shell</code> and subclasses</li>
1142     * </ul></p>
1143     */

1144    public static final int ON_TOP = 1 << 14;
1145
1146    /**
1147     * Trim style convenience constant for the most common top level shell appearance
1148     * (value is CLOSE|TITLE|MIN|MAX|RESIZE).
1149     * <p><b>Used By:</b><ul>
1150     * <li><code>Shell</code></li>
1151     * </ul></p>
1152     */

1153    public static final int SHELL_TRIM = CLOSE | TITLE | MIN | MAX | RESIZE;
1154
1155    /**
1156     * Trim style convenience constant for the most common dialog shell appearance
1157     * (value is CLOSE|TITLE|BORDER).
1158     * <p><b>Used By:</b><ul>
1159     * <li><code>Shell</code></li>
1160     * </ul></p>
1161     */

1162    public static final int DIALOG_TRIM = TITLE | CLOSE | BORDER;
1163
1164    /**
1165     * Style constant for modeless behavior (value is 0).
1166     * <br>Note that this is a <em>HINT</em>.
1167     * <p><b>Used By:</b><ul>
1168     * <li><code>Dialog</code></li>
1169     * <li><code>Shell</code></li>
1170     * </ul></p>
1171     */

1172    public static final int MODELESS = 0;
1173
1174    /**
1175     * Style constant for primary modal behavior (value is 1&lt;&lt;15).
1176     * <br>Note that this is a <em>HINT</em>.
1177     * <p><b>Used By:</b><ul>
1178     * <li><code>Dialog</code></li>
1179     * <li><code>Shell</code></li>
1180     * </ul></p>
1181     */

1182    public static final int PRIMARY_MODAL = 1 << 15;
1183
1184    /**
1185     * Style constant for application modal behavior (value is 1&lt;&lt;16).
1186     * <br>Note that this is a <em>HINT</em>.
1187     * <p><b>Used By:</b><ul>
1188     * <li><code>Dialog</code></li>
1189     * <li><code>Shell</code></li>
1190     * </ul></p>
1191     */

1192    public static final int APPLICATION_MODAL = 1 << 16;
1193
1194    /**
1195     * Style constant for system modal behavior (value is 1&lt;&lt;17).
1196     * <br>Note that this is a <em>HINT</em>.
1197     * <p><b>Used By:</b><ul>
1198     * <li><code>Dialog</code></li>
1199     * <li><code>Shell</code></li>
1200     * </ul></p>
1201     */

1202    public static final int SYSTEM_MODAL = 1 << 17;
1203
1204    /**
1205     * Style constant for selection hiding behavior when the widget loses focus (value is 1&lt;&lt;15).
1206     * <br>Note that this is a <em>HINT</em>.
1207     * <p><b>Used By:</b><ul>
1208     * <li><code>Table</code></li>
1209     * </ul></p>
1210     */

1211    public static final int HIDE_SELECTION = 1 << 15;
1212
1213    /**
1214     * Style constant for full row selection behavior and
1215     * selection constant indicating that a full line should be
1216     * drawn. (value is 1&lt;&lt;16).
1217     * <br>Note that for some widgets this is a <em>HINT</em>.
1218     * <p><b>Used By:</b><ul>
1219     * <li><code>Table</code></li>
1220     * <li><code>Tree</code></li>
1221     * <li><code>StyledText</code></li>
1222     * <li><code>TextLayout</code></li>
1223     * </ul></p>
1224     */

1225    public static final int FULL_SELECTION = 1 << 16;
1226
1227    /**
1228     * Style constant for flat appearance. (value is 1&lt;&lt;23).
1229     * <br>Note that this is a <em>HINT</em>.
1230     * <p><b>Used By:</b><ul>
1231     * <li><code>Button</code></li>
1232     * <li><code>ToolBar</code></li>
1233     * </ul></p>
1234     */

1235    public static final int FLAT = 1 << 23;
1236
1237    /**
1238     * Style constant for smooth appearance. (value is 1&lt;&lt;16).
1239     * <br>Note that this is a <em>HINT</em>.
1240     * <p><b>Used By:</b><ul>
1241     * <li><code>ProgressBar</code></li>
1242     * <li><code>Sash</code></li>
1243     * </ul></p>
1244     */

1245    public static final int SMOOTH = 1 << 16;
1246
1247    /**
1248     * Style constant for no background behavior (value is 1&lt;&lt;18).
1249     * <p>
1250     * By default, before a widget paints, the client area is filled with the current background.
1251     * When this style is specified, the background is not filled, and the application is responsible
1252     * for filling every pixel of the client area.
1253     * This style might be used as an alternative to "double-buffering" in order to reduce flicker.
1254     * This style does not mean "transparent" - widgets that are obscured will not draw through.
1255     * </p><p><b>Used By:</b><ul>
1256     * <li><code>Composite</code></li>
1257     * </ul></p>
1258     */

1259    public static final int NO_BACKGROUND = 1 << 18;
1260
1261    /**
1262     * Style constant for no focus from the mouse behavior (value is 1&lt;&lt;19).
1263     * <br>Note that this is a <em>HINT</em>.
1264     * <p><b>Used By:</b><ul>
1265     * <li><code>Composite</code></li>
1266     * </ul></p>
1267     */

1268    public static final int NO_FOCUS = 1 << 19;
1269
1270    /**
1271     * Style constant for no redraw on resize behavior (value is 1&lt;&lt;20).
1272     * <p>
1273     * This style stops the entire client area from being invalidated when the size
1274     * of the Canvas changes. Specifically, when the size of the Canvas gets smaller,
1275     * the SWT.Paint event is not sent. When it gets bigger, an SWT.Paint event is
1276     * sent with a GC clipped to only the new areas to be painted. Without this
1277     * style, the entire client area will be repainted.
1278     * </p><p><b>Used By:</b><ul>
1279     * <li><code>Composite</code></li>
1280     * </ul></p>
1281     */

1282    public static final int NO_REDRAW_RESIZE = 1 << 20;
1283
1284    /**
1285     * Style constant for no paint event merging behavior (value is 1&lt;&lt;21).
1286     * <p><b>Used By:</b><ul>
1287     * <li><code>Composite</code></li>
1288     * </ul></p>
1289     */

1290    public static final int NO_MERGE_PAINTS = 1 << 21;
1291
1292    /**
1293     * Style constant for preventing child radio group behavior (value is 1&lt;&lt;22).
1294     * <p><b>Used By:</b><ul>
1295     * <li><code>Composite</code></li>
1296     * </ul></p>
1297     */

1298    public static final int NO_RADIO_GROUP = 1 << 22;
1299    
1300    /**
1301     * Style constant for left to right orientation (value is 1&lt;&lt;25).
1302     * <p>
1303     * When orientation is not explicitly specified, orientation is
1304     * inherited. This means that children will be assigned the
1305     * orientation of their parent. To override this behavior and
1306     * force an orientation for a child, explicitly set the orientation
1307     * of the child when that child is created.
1308     * <br>Note that this is a <em>HINT</em>.
1309     * </p>
1310     * <p><b>Used By:</b><ul>
1311     * <li><code>Control</code></li>
1312     * <li><code>Menu</code></li>
1313     * <li><code>GC</code></li>
1314     * </ul></p>
1315     *
1316     * @since 2.1.2
1317     */

1318    public static final int LEFT_TO_RIGHT = 1 << 25;
1319    
1320    /**
1321     * Style constant for right to left orientation (value is 1&lt;&lt;26).
1322     * <p>
1323     * When orientation is not explicitly specified, orientation is
1324     * inherited. This means that children will be assigned the
1325     * orientation of their parent. To override this behavior and
1326     * force an orientation for a child, explicitly set the orientation
1327     * of the child when that child is created.
1328     * <br>Note that this is a <em>HINT</em>.
1329     * </p>
1330     * <p><b>Used By:</b><ul>
1331     * <li><code>Control</code></li>
1332     * <li><code>Menu</code></li>
1333     * <li><code>GC</code></li>
1334     * </ul></p>
1335     *
1336     * @since 2.1.2
1337     */

1338    public static final int RIGHT_TO_LEFT = 1 << 26;
1339    
1340    /**
1341     * Style constant to indicate coordinate mirroring (value is 1&lt;&lt;27).
1342     * <p><b>Used By:</b><ul>
1343     * <li><code>Control</code></li>
1344     * <li><code>Menu</code></li>
1345     * </ul></p>
1346     *
1347     * @since 2.1.2
1348     */

1349    public static final int MIRRORED = 1 << 27;
1350    
1351    /**
1352     * Style constant to allow embedding (value is 1&lt;&lt;24).
1353     * <p><b>Used By:</b><ul>
1354     * <li><code>Composite</code></li>
1355     * </ul></p>
1356     *
1357     * @since 3.0
1358     */

1359    public static final int EMBEDDED = 1 << 24;
1360    
1361    /**
1362     * Style constant to allow virtual data (value is 1&lt;&lt;28).
1363     * <p><b>Used By:</b><ul>
1364     * <li><code>Table</code></li>
1365     * <li><code>Tree</code></li>
1366     * </ul></p>
1367     *
1368     * @since 3.0
1369     */

1370    public static final int VIRTUAL = 1 << 28;
1371
1372    /**
1373     * Style constant to indicate double buffering (value is 1&lt;&lt;29).
1374     * <p><b>Used By:</b><ul>
1375     * <li><code>Control</code></li>
1376     * </ul></p>
1377     *
1378     * @since 3.1
1379     */

1380    public static final int DOUBLE_BUFFERED = 1 << 29;
1381    
1382    /**
1383     * Style constant for align up behavior (value is 1&lt;&lt;7,
1384     * since align UP and align TOP are considered the same).
1385     * <p><b>Used By:</b><ul>
1386     * <li><code>Button</code> with <code>ARROW</code> style</li>
1387     * <li><code>Tracker</code></li>
1388     * </ul></p>
1389     */

1390    public static final int UP = 1 << 7;
1391
1392    /**
1393     * Style constant for align top behavior (value is 1&lt;&lt;7,
1394     * since align UP and align TOP are considered the same).
1395     * <p><b>Used By:</b><ul>
1396     * <li><code>FormAttachment</code> in a <code>FormLayout</code></li>
1397     * </ul></p>
1398     */

1399    public static final int TOP = UP;
1400
1401    /**
1402     * Style constant for align down behavior (value is 1&lt;&lt;10,
1403     * since align DOWN and align BOTTOM are considered the same).
1404     * <p><b>Used By:</b><ul>
1405     * <li><code>Button</code> with <code>ARROW</code> style</li>
1406     * <li><code>Tracker</code></li>
1407     * </ul></p>
1408     */

1409    public static final int DOWN = 1 << 10;
1410
1411    /**
1412     * Style constant for align bottom behavior (value is 1&lt;&lt;10,
1413     * since align DOWN and align BOTTOM are considered the same).
1414     * <p><b>Used By:</b><ul>
1415     * <li><code>FormAttachment</code> in a <code>FormLayout</code></li>
1416     * </ul></p>
1417     */

1418    public static final int BOTTOM = DOWN;
1419
1420    /**
1421     * Style constant for leading alignment (value is 1&lt;&lt;14).
1422     * <p><b>Used By:</b><ul>
1423     * <li><code>Button</code></li>
1424     * <li><code>Label</code></li>
1425     * <li><code>TableColumn</code></li>
1426     * <li><code>Tracker</code></li>
1427     * <li><code>FormAttachment</code> in a <code>FormLayout</code></li>
1428     * </ul></p>
1429     *
1430     * @since 2.1.2
1431     */

1432    public static final int LEAD = 1 << 14;
1433    
1434    /**
1435     * Style constant for align left behavior (value is 1&lt;&lt;14).
1436     * This is a synonym for LEAD (value is 1&lt;&lt;14). Newer
1437     * applications should use LEAD instead of LEFT to make code more
1438     * understandable on right-to-left platforms.
1439     */

1440    public static final int LEFT = LEAD;
1441
1442    /**
1443     * Style constant for trailing alignment (value is 1&lt;&lt;17).
1444     * <p><b>Used By:</b><ul>
1445     * <li><code>Button</code></li>
1446     * <li><code>Label</code></li>
1447     * <li><code>TableColumn</code></li>
1448     * <li><code>Tracker</code></li>
1449     * <li><code>FormAttachment</code> in a <code>FormLayout</code></li>
1450     * </ul></p>
1451     *
1452     * @since 2.1.2
1453     */

1454    public static final int TRAIL = 1 << 17;
1455        
1456    /**
1457     * Style constant for align right behavior (value is 1&lt;&lt;17).
1458     * This is a synonym for TRAIL (value is 1&lt;&lt;17). Newer
1459     * applications should use TRAIL instead of RIGHT to make code more
1460     * understandable on right-to-left platforms.
1461     */

1462    public static final int RIGHT = TRAIL;
1463
1464    /**
1465     * Style constant for align center behavior (value is 1&lt;&lt;24).
1466     * <p><b>Used By:</b><ul>
1467     * <li><code>Button</code></li>
1468     * <li><code>Label</code></li>
1469     * <li><code>TableColumn</code></li>
1470     * <li><code>FormAttachment</code> in a <code>FormLayout</code></li>
1471     * </ul></p>
1472     */

1473    public static final int CENTER = 1 << 24;
1474
1475    /**
1476     * Style constant for horizontal alignment or orientation behavior (value is 1&lt;&lt;8).
1477     * <p><b>Used By:</b><ul>
1478     * <li><code>Label</code></li>
1479     * <li><code>ProgressBar</code></li>
1480     * <li><code>Sash</code></li>
1481     * <li><code>Scale</code></li>
1482     * <li><code>ScrollBar</code></li>
1483     * <li><code>Slider</code></li>
1484     * <li><code>ToolBar</code></li>
1485     * <li><code>FillLayout</code> type</li>
1486     * <li><code>RowLayout</code> type</li>
1487     * </ul></p>
1488     */

1489    public static final int HORIZONTAL = 1 << 8;
1490
1491    /**
1492     * Style constant for vertical alignment or orientation behavior (value is 1&lt;&lt;9).
1493     * <p><b>Used By:</b><ul>
1494     * <li><code>Label</code></li>
1495     * <li><code>ProgressBar</code></li>
1496     * <li><code>Sash</code></li>
1497     * <li><code>Scale</code></li>
1498     * <li><code>ScrollBar</code></li>
1499     * <li><code>Slider</code></li>
1500     * <li><code>ToolBar</code></li>
1501     * <li><code>CoolBar</code></li>
1502     * <li><code>FillLayout</code> type</li>
1503     * <li><code>RowLayout</code> type</li>
1504     * </ul></p>
1505     */

1506    public static final int VERTICAL = 1 << 9;
1507
1508    /**
1509     * Style constant for date display (value is 1&lt;&lt;5).
1510     * <p><b>Used By:</b><ul>
1511     * <li><code>DateTime</code></li>
1512     * </ul></p>
1513     *
1514     * @since 3.3
1515     */

1516    public static final int DATE = 1 << 5;
1517
1518    /**
1519     * Style constant for time display (value is 1&lt;&lt;7).
1520     * <p><b>Used By:</b><ul>
1521     * <li><code>DateTime</code></li>
1522     * </ul></p>
1523     *
1524     * @since 3.3
1525     */

1526    public static final int TIME = 1 << 7;
1527    
1528    /**
1529     * Style constant for calendar display (value is 1&lt;&lt;10).
1530     * <p><b>Used By:</b><ul>
1531     * <li><code>DateTime</code></li>
1532     * </ul></p>
1533     *
1534     * @since 3.3
1535     */

1536    public static final int CALENDAR = 1 << 10;
1537
1538    /**
1539     * Style constant for short date/time format (value is 1&lt;&lt;15).
1540     * <p>
1541     * A short date displays the month and year.
1542     * A short time displays hours and minutes.
1543     * <br>Note that this is a <em>HINT</em>.
1544     * </p>
1545     * <p><b>Used By:</b><ul>
1546     * <li><code>DateTime</code></li>
1547     * </ul></p>
1548     *
1549     * @since 3.3
1550     */

1551    public static final int SHORT = 1 << 15;
1552
1553    /**
1554     * Style constant for medium date/time format (value is 1&lt;&lt;16).
1555     * <p>
1556     * A medium date displays the day, month and year.
1557     * A medium time displays hours, minutes, and seconds.
1558     * <br>Note that this is a <em>HINT</em>.
1559     * </p>
1560     * <p><b>Used By:</b><ul>
1561     * <li><code>DateTime</code></li>
1562     * </ul></p>
1563     *
1564     * @since 3.3
1565     */

1566    public static final int MEDIUM = 1 << 16;
1567
1568    /**
1569     * Style constant for long date/time format (value is 1&lt;&lt;28).
1570     * <p>
1571     * A long date displays the day, month and year.
1572     * A long time displays hours, minutes, and seconds.
1573     * The day and month names may be displayed.
1574     * <br>Note that this is a <em>HINT</em>.
1575     * </p>
1576     * <p><b>Used By:</b><ul>
1577     * <li><code>DateTime</code></li>
1578     * </ul></p>
1579     *
1580     * @since 3.3
1581     */

1582    public static final int LONG = 1 << 28;
1583
1584    /**
1585     * Style constant specifying that a Browser should use a Mozilla GRE
1586     * for rendering its content (value is 1&lt;&lt;15).
1587     * <p>
1588     * <p><b>Used By:</b><ul>
1589     * <li><code>Browser</code></li>
1590     * </ul></p>
1591     *
1592     * @since 3.3
1593     */

1594    public static final int MOZILLA = 1 << 15;
1595
1596    /**
1597     * Style constant for balloon behavior (value is 1&lt;&lt;12).
1598     * <p><b>Used By:</b><ul>
1599     * <li><code>ToolTip</code></li>
1600     * </ul></p>
1601     *
1602     * @since 3.2
1603     */

1604    public static final int BALLOON = 1 << 12;
1605    
1606    /**
1607     * Style constant for vertical alignment or orientation behavior (value is 1).
1608     * <p><b>Used By:</b><ul>
1609     * <li><code>GridLayout</code> type</li>
1610     * </ul></p>
1611     */

1612    public static final int BEGINNING = 1;
1613    
1614    /**
1615     * Style constant for vertical alignment or orientation behavior (value is 4).
1616     * <p><b>Used By:</b><ul>
1617     * <li><code>GridLayout</code> type</li>
1618     * </ul></p>
1619     */

1620    public static final int FILL = 4;
1621    
1622    /**
1623     * Input Method Editor style constant for double byte
1624     * input behavior (value is 1&lt;&lt;1).
1625     */

1626    public static final int DBCS = 1 << 1;
1627
1628    /**
1629     * Input Method Editor style constant for alpha
1630     * input behavior (value is 1&lt;&lt;2).
1631     */

1632    public static final int ALPHA = 1 << 2;
1633
1634    /**
1635     * Input Method Editor style constant for native
1636     * input behavior (value is 1&lt;&lt;3).
1637     */

1638    public static final int NATIVE = 1 << 3;
1639
1640    /**
1641     * Input Method Editor style constant for phonetic
1642     * input behavior (value is 1&lt;&lt;4).
1643     */

1644    public static final int PHONETIC = 1 << 4;
1645
1646    /**
1647     * Input Method Editor style constant for romanicized
1648     * input behavior (value is 1&lt;&lt;5).
1649     */

1650    public static final int ROMAN = 1 << 5;
1651
1652    /**
1653     * ASCII character convenience constant for the backspace character
1654     * (value is the <code>char</code> '\b').
1655     */

1656    public static final char BS = '\b';
1657
1658    /**
1659     * ASCII character convenience constant for the carriage return character
1660     * (value is the <code>char</code> '\r').
1661     */

1662    public static final char CR = '\r';
1663
1664    /**
1665     * ASCII character convenience constant for the delete character
1666     * (value is the <code>char</code> with value 127).
1667     */

1668    public static final char DEL = 0x7F;
1669 
1670    /**
1671     * ASCII character convenience constant for the escape character
1672     * (value is the <code>char</code> with value 27).
1673     */

1674    public static final char ESC = 0x1B;
1675
1676    /**
1677     * ASCII character convenience constant for the line feed character
1678     * (value is the <code>char</code> '\n').
1679     */

1680    public static final char LF = '\n';
1681
1682    /**
1683     * ASCII character convenience constant for the tab character
1684     * (value is the <code>char</code> '\t').
1685     *
1686     * @since 2.1
1687     */

1688    public static final char TAB = '\t';
1689                        
1690    /**
1691     * keyboard and/or mouse event mask indicating that the ALT key
1692     * was pushed on the keyboard when the event was generated
1693     * (value is 1&lt;&lt;16).
1694     */

1695    public static final int ALT = 1 << 16;
1696                    
1697    /**
1698     * Keyboard and/or mouse event mask indicating that the SHIFT key
1699     * was pushed on the keyboard when the event was generated
1700     * (value is 1&lt;&lt;17).
1701     */

1702    public static final int SHIFT = 1 << 17;
1703                    
1704    /**
1705     * Keyboard and/or mouse event mask indicating that the CTRL key
1706     * was pushed on the keyboard when the event was generated
1707     * (value is 1&lt;&lt;18).
1708     */

1709    public static final int CTRL = 1 << 18;
1710
1711    /**
1712     * Keyboard and/or mouse event mask indicating that the CTRL key
1713     * was pushed on the keyboard when the event was generated. This
1714     * is a synonym for CTRL (value is 1&lt;&lt;18).
1715     */

1716    public static final int CONTROL = CTRL;
1717
1718    /**
1719     * Keyboard and/or mouse event mask indicating that the COMMAND key
1720     * was pushed on the keyboard when the event was generated
1721     * (value is 1&lt;&lt;22).
1722     *
1723     * @since 2.1
1724     */

1725    public static final int COMMAND = 1 << 22;
1726    
1727    /**
1728     * Keyboard and/or mouse event mask indicating all possible
1729     * keyboard modifiers.
1730     *
1731     * To allow for the future, this mask is intended to be used in
1732     * place of code that references each individual keyboard mask.
1733     * For example, the following expression will determine whether
1734     * any modifier is pressed and will continue to work as new modifier
1735     * masks are added.
1736     *
1737     * <code>(stateMask & SWT.MODIFIER_MASK) != 0</code>.
1738     *
1739     * @since 2.1
1740     */

1741    public static final int MODIFIER_MASK;
1742    
1743    /**
1744     * Keyboard and/or mouse event mask indicating that mouse button one
1745     * was pushed when the event was generated. (value is 1&lt;&lt;19).
1746     */

1747    public static final int BUTTON1 = 1 << 19;
1748
1749    /**
1750     * Keyboard and/or mouse event mask indicating that mouse button two
1751     * was pushed when the event was generated. (value is 1&lt;&lt;20).
1752     */

1753    public static final int BUTTON2 = 1 << 20;
1754
1755    /**
1756     * Keyboard and/or mouse event mask indicating that mouse button three
1757     * was pushed when the event was generated. (value is 1&lt;&lt;21).
1758     */

1759    public static final int BUTTON3 = 1 << 21;
1760
1761    /**
1762     * Keyboard and/or mouse event mask indicating that mouse button four
1763     * was pushed when the event was generated. (value is 1&lt;&lt;23).
1764     *
1765     * @since 3.1
1766     */

1767    public static final int BUTTON4 = 1 << 23;
1768
1769    /**
1770     * Keyboard and/or mouse event mask indicating that mouse button five
1771     * was pushed when the event was generated. (value is 1&lt;&lt;25).
1772     *
1773     * @since 3.1
1774     */

1775    public static final int BUTTON5 = 1 << 25;
1776
1777    /**
1778     * Keyboard and/or mouse event mask indicating all possible
1779     * mouse buttons.
1780     *
1781     * To allow for the future, this mask is intended to be used
1782     * in place of code that references each individual button mask.
1783     * For example, the following expression will determine whether
1784     * any button is pressed and will continue to work as new button
1785     * masks are added.
1786     *
1787     * <code>(stateMask & SWT.BUTTON_MASK) != 0</code>.
1788     *
1789     * @since 2.1
1790     */

1791    public static final int BUTTON_MASK;
1792    
1793    /**
1794     * Keyboard and/or mouse event mask indicating that the MOD1 key
1795     * was pushed on the keyboard when the event was generated.
1796     *
1797     * This is the primary keyboard modifier for the platform.
1798     *
1799     * @since 2.1
1800     */

1801    public static final int MOD1;
1802    
1803    /**
1804     * Keyboard and/or mouse event mask indicating that the MOD2 key
1805     * was pushed on the keyboard when the event was generated.
1806     *
1807     * This is the secondary keyboard modifier for the platform.
1808     *
1809     * @since 2.1
1810     */

1811    public static final int MOD2;
1812
1813    /**
1814     * Keyboard and/or mouse event mask indicating that the MOD3 key
1815     * was pushed on the keyboard when the event was generated.
1816     *
1817     * @since 2.1
1818     */

1819    public static final int MOD3;
1820
1821    /**
1822     * Keyboard and/or mouse event mask indicating that the MOD4 key
1823     * was pushed on the keyboard when the event was generated.
1824     *
1825     * @since 2.1
1826     */

1827    public static final int MOD4;
1828    
1829    /**
1830     * Constants to indicate line scrolling (value is 1).
1831     * <p><b>Used By:</b><ul>
1832     * <li><code>Control</code></li>
1833     * </ul></p>
1834     *
1835     * @since 3.1
1836     */

1837    public static final int SCROLL_LINE = 1;
1838
1839    /**
1840     * Constants to indicate page scrolling (value is 2).
1841     * <p><b>Used By:</b><ul>
1842     * <li><code>Control</code></li>
1843     * </ul></p>
1844     *
1845     * @since 3.1
1846     */

1847    public static final int SCROLL_PAGE = 2;
1848    
1849    /**
1850     * Accelerator constant used to differentiate a key code from a
1851     * unicode character.
1852     *
1853     * If this bit is set, then the key stroke
1854     * portion of an accelerator represents a key code. If this bit
1855     * is not set, then the key stroke portion of an accelerator is
1856     * a unicode character.
1857     *
1858     * The following expression is false:
1859     *
1860     * <code>((SWT.MOD1 | SWT.MOD2 | 'T') & SWT.KEYCODE_BIT) != 0</code>.
1861     *
1862     * The following expression is true:
1863     *
1864     * <code>((SWT.MOD3 | SWT.F2) & SWT.KEYCODE_BIT) != 0</code>.
1865     *
1866     * (value is (1&lt;&lt;24))
1867     *
1868     * @since 2.1
1869     */

1870    public static final int KEYCODE_BIT = (1 << 24);
1871
1872    /**
1873     * Accelerator constant used to extract the key stroke portion of
1874     * an accelerator.
1875     *
1876     * The key stroke may be a key code or a unicode
1877     * value. If the key stroke is a key code <code>KEYCODE_BIT</code>
1878     * will be set.
1879     *
1880     * @since 2.1
1881     */

1882    public static final int KEY_MASK = KEYCODE_BIT + 0xFFFF;
1883    
1884    /**
1885     * Keyboard event constant representing the UP ARROW key
1886     * (value is (1&lt;&lt;24)+1).
1887     */

1888    public static final int ARROW_UP = KEYCODE_BIT + 1;
1889
1890    /**
1891     * Keyboard event constant representing the DOWN ARROW key
1892     * (value is (1&lt;&lt;24)+2).
1893     */

1894    public static final int ARROW_DOWN = KEYCODE_BIT + 2;
1895
1896    /**
1897     * Keyboard event constant representing the LEFT ARROW key
1898     * (value is (1&lt;&lt;24)+3).
1899     */

1900    public static final int ARROW_LEFT = KEYCODE_BIT + 3;
1901
1902    /**
1903     * Keyboard event constant representing the RIGHT ARROW key
1904     * (value is (1&lt;&lt;24)+4).
1905     */

1906    public static final int ARROW_RIGHT = KEYCODE_BIT + 4;
1907
1908    /**
1909     * Keyboard event constant representing the PAGE UP key
1910     * (value is (1&lt;&lt;24)+5).
1911     */

1912    public static final int PAGE_UP = KEYCODE_BIT + 5;
1913
1914    /**
1915     * Keyboard event constant representing the PAGE DOWN key
1916     * (value is (1&lt;&lt;24)+6).
1917     */

1918    public static final int PAGE_DOWN = KEYCODE_BIT + 6;
1919
1920    /**
1921     * Keyboard event constant representing the HOME key
1922     * (value is (1&lt;&lt;24)+7).
1923     */

1924    public static final int HOME = KEYCODE_BIT + 7;
1925
1926    /**
1927     * Keyboard event constant representing the END key
1928     * (value is (1&lt;&lt;24)+8).
1929     */

1930    public static final int END = KEYCODE_BIT + 8;
1931
1932    /**
1933     * Keyboard event constant representing the INSERT key
1934     * (value is (1&lt;&lt;24)+9).
1935     */

1936    public static final int INSERT = KEYCODE_BIT + 9;
1937
1938    /**
1939     * Keyboard event constant representing the F1 key
1940     * (value is (1&lt;&lt;24)+10).
1941     */

1942    public static final int F1 = KEYCODE_BIT + 10;
1943    
1944    /**
1945     * Keyboard event constant representing the F2 key
1946     * (value is (1&lt;&lt;24)+11).
1947     */

1948    public static final int F2 = KEYCODE_BIT + 11;
1949    
1950    /**
1951     * Keyboard event constant representing the F3 key
1952     * (value is (1&lt;&lt;24)+12).
1953     */

1954    public static final int F3 = KEYCODE_BIT + 12;
1955    
1956    /**
1957     * Keyboard event constant representing the F4 key
1958     * (value is (1&lt;&lt;24)+13).
1959     */

1960    public static final int F4 = KEYCODE_BIT + 13;
1961    
1962    /**
1963     * Keyboard event constant representing the F5 key
1964     * (value is (1&lt;&lt;24)+14).
1965     */

1966    public static final int F5 = KEYCODE_BIT + 14;
1967    
1968    /**
1969     * Keyboard event constant representing the F6 key
1970     * (value is (1&lt;&lt;24)+15).
1971     */

1972    public static final int F6 = KEYCODE_BIT + 15;
1973    
1974    /**
1975     * Keyboard event constant representing the F7 key
1976     * (value is (1&lt;&lt;24)+16).
1977     */

1978    public static final int F7 = KEYCODE_BIT + 16;
1979    
1980    /**
1981     * Keyboard event constant representing the F8 key
1982     * (value is (1&lt;&lt;24)+17).
1983     */

1984    public static final int F8 = KEYCODE_BIT + 17;
1985    
1986    /**
1987     * Keyboard event constant representing the F9 key
1988     * (value is (1&lt;&lt;24)+18).
1989     */

1990    public static final int F9 = KEYCODE_BIT + 18;
1991    
1992    /**
1993     * Keyboard event constant representing the F10 key
1994     * (value is (1&lt;&lt;24)+19).
1995     */

1996    public static final int F10 = KEYCODE_BIT + 19;
1997    
1998    /**
1999     * Keyboard event constant representing the F11 key
2000     * (value is (1&lt;&lt;24)+20).
2001     */

2002    public static final int F11 = KEYCODE_BIT + 20;
2003    
2004    /**
2005     * Keyboard event constant representing the F12 key
2006     * (value is (1&lt;&lt;24)+21).
2007     */

2008    public static final int F12 = KEYCODE_BIT + 21;
2009
2010    /**
2011     * Keyboard event constant representing the F13 key
2012     * (value is (1&lt;&lt;24)+22).
2013     *
2014     * @since 3.0
2015     */

2016    public static final int F13 = KEYCODE_BIT + 22;
2017    
2018    /**
2019     * Keyboard event constant representing the F14 key
2020     * (value is (1&lt;&lt;24)+23).
2021     *
2022     * @since 3.0
2023     */

2024    public static final int F14 = KEYCODE_BIT + 23;
2025    
2026    /**
2027     * Keyboard event constant representing the F15 key
2028     * (value is (1&lt;&lt;24)+24).
2029     *
2030     * @since 3.0
2031     */

2032    public static final int F15 = KEYCODE_BIT + 24;
2033    
2034    /**
2035     * Keyboard event constant representing the numeric key
2036     * pad multiply key (value is (1&lt;&lt;24)+42).
2037     *
2038     * @since 3.0
2039     */

2040    public static final int KEYPAD_MULTIPLY = KEYCODE_BIT + 42;
2041    
2042    /**
2043     * Keyboard event constant representing the numeric key
2044     * pad add key (value is (1&lt;&lt;24)+43).
2045     *
2046     * @since 3.0
2047     */

2048    public static final int KEYPAD_ADD = KEYCODE_BIT + 43;
2049    
2050    /**
2051     * Keyboard event constant representing the numeric key
2052     * pad subtract key (value is (1&lt;&lt;24)+45).
2053     *
2054     * @since 3.0
2055     */

2056    public static final int KEYPAD_SUBTRACT = KEYCODE_BIT + 45;
2057
2058    /**
2059     * Keyboard event constant representing the numeric key
2060     * pad decimal key (value is (1&lt;&lt;24)+46).
2061     *
2062     * @since 3.0
2063     */

2064    public static final int KEYPAD_DECIMAL = KEYCODE_BIT + 46;
2065
2066    /**
2067     * Keyboard event constant representing the numeric key
2068     * pad divide key (value is (1&lt;&lt;24)+47).
2069     *
2070     * @since 3.0
2071     */

2072    public static final int KEYPAD_DIVIDE = KEYCODE_BIT + 47;
2073
2074    /**
2075     * Keyboard event constant representing the numeric key
2076     * pad zero key (value is (1&lt;&lt;24)+48).
2077     *
2078     * @since 3.0
2079     */

2080    public static final int KEYPAD_0 = KEYCODE_BIT + 48;
2081
2082    /**
2083     * Keyboard event constant representing the numeric key
2084     * pad one key (value is (1&lt;&lt;24)+49).
2085     *
2086     * @since 3.0
2087     */

2088    public static final int KEYPAD_1 = KEYCODE_BIT + 49;
2089
2090    /**
2091     * Keyboard event constant representing the numeric key
2092     * pad two key (value is (1&lt;&lt;24)+50).
2093     *
2094     * @since 3.0
2095     */

2096    public static final int KEYPAD_2 = KEYCODE_BIT + 50;
2097
2098    /**
2099     * Keyboard event constant representing the numeric key
2100     * pad three key (value is (1&lt;&lt;24)+51).
2101     *
2102     * @since 3.0
2103     */

2104    public static final int KEYPAD_3 = KEYCODE_BIT + 51;
2105
2106    /**
2107     * Keyboard event constant representing the numeric key
2108     * pad four key (value is (1&lt;&lt;24)+52).
2109     *
2110     * @since 3.0
2111     */

2112    public static final int KEYPAD_4 = KEYCODE_BIT + 52;
2113    
2114    /**
2115     * Keyboard event constant representing the numeric key
2116     * pad five key (value is (1&lt;&lt;24)+53).
2117     *
2118     * @since 3.0
2119     */

2120    public static final int KEYPAD_5 = KEYCODE_BIT + 53;
2121    
2122    /**
2123     * Keyboard event constant representing the numeric key
2124     * pad six key (value is (1&lt;&lt;24)+54).
2125     *
2126     * @since 3.0
2127     */

2128    public static final int KEYPAD_6 = KEYCODE_BIT + 54;
2129
2130    /**
2131     * Keyboard event constant representing the numeric key
2132     * pad seven key (value is (1&lt;&lt;24)+55).
2133     *
2134     * @since 3.0
2135     */

2136    public static final int KEYPAD_7 = KEYCODE_BIT + 55;
2137
2138    /**
2139     * Keyboard event constant representing the numeric key
2140     * pad eight key (value is (1&lt;&lt;24)+56).
2141     *
2142     * @since 3.0
2143     */

2144    public static final int KEYPAD_8 = KEYCODE_BIT + 56;
2145    
2146    /**
2147     * Keyboard event constant representing the numeric key
2148     * pad nine key (value is (1&lt;&lt;24)+57).
2149     *
2150     * @since 3.0
2151     */

2152    public static final int KEYPAD_9 = KEYCODE_BIT + 57;
2153
2154    /**
2155     * Keyboard event constant representing the numeric key
2156     * pad equal key (value is (1&lt;&lt;24)+61).
2157     *
2158     * @since 3.0
2159     */

2160    public static final int KEYPAD_EQUAL = KEYCODE_BIT + 61;
2161    
2162    /**
2163     * Keyboard event constant representing the numeric key
2164     * pad enter key (value is (1&lt;&lt;24)+80).
2165     *
2166     * @since 3.0
2167     */

2168    public static final int KEYPAD_CR = KEYCODE_BIT + 80;
2169    
2170    /**
2171     * Keyboard event constant representing the help
2172     * key (value is (1&lt;&lt;24)+81).
2173     *
2174     * NOTE: The HELP key maps to the key labeled "help",
2175     * not "F1". If your keyboard does not have a HELP key,
2176     * you will never see this key press. To listen for
2177     * help on a control, use SWT.Help.
2178     *
2179     * @since 3.0
2180     *
2181     * @see SWT#Help
2182     */

2183    public static final int HELP = KEYCODE_BIT + 81;
2184    
2185    /**
2186     * Keyboard event constant representing the caps
2187     * lock key (value is (1&lt;&lt;24)+82).
2188     *
2189     * @since 3.0
2190     */

2191    public static final int CAPS_LOCK = KEYCODE_BIT + 82;
2192    
2193    /**
2194     * Keyboard event constant representing the num
2195     * lock key (value is (1&lt;&lt;24)+83).
2196     *
2197     * @since 3.0
2198     */

2199    public static final int NUM_LOCK = KEYCODE_BIT + 83;
2200    
2201    /**
2202     * Keyboard event constant representing the scroll
2203     * lock key (value is (1&lt;&lt;24)+84).
2204     *
2205     * @since 3.0
2206     */

2207    public static final int SCROLL_LOCK = KEYCODE_BIT + 84;
2208    
2209    /**
2210     * Keyboard event constant representing the pause
2211     * key (value is (1&lt;&lt;24)+85).
2212     *
2213     * @since 3.0
2214     */

2215    public static final int PAUSE = KEYCODE_BIT + 85;
2216    
2217    /**
2218     * Keyboard event constant representing the break
2219     * key (value is (1&lt;&lt;24)+86).
2220     *
2221     * @since 3.0
2222     */

2223    public static final int BREAK = KEYCODE_BIT + 86;
2224    
2225    /**
2226     * Keyboard event constant representing the print screen
2227     * key (value is (1&lt;&lt;24)+87).
2228     *
2229     * @since 3.0
2230     */

2231    public static final int PRINT_SCREEN = KEYCODE_BIT + 87;
2232    
2233    /**
2234     * The <code>MessageBox</code> style constant for error icon
2235     * behavior (value is 1).
2236     */

2237    public static final int ICON_ERROR = 1;
2238
2239    /**
2240     * The <code>MessageBox</code> style constant for information icon
2241     * behavior (value is 1&lt;&lt;1).
2242     */

2243    public static final int ICON_INFORMATION = 1 << 1;
2244
2245    /**
2246     * The <code>MessageBox</code> style constant for question icon
2247     * behavior (value is 1&lt;&lt;2).
2248     */

2249    public static final int ICON_QUESTION = 1 << 2;
2250
2251    /**
2252     * The <code>MessageBox</code> style constant for warning icon
2253     * behavior (value is 1&lt;&lt;3).
2254     */

2255    public static final int ICON_WARNING = 1 << 3;
2256
2257    /**
2258     * The <code>MessageBox</code> style constant for "working" icon
2259     * behavior (value is 1&lt;&lt;4).
2260     */

2261    public static final int ICON_WORKING = 1 << 4;
2262
2263    /**
2264     * The <code>MessageBox</code> style constant for an OK button;
2265     * valid combinations are OK, OK|CANCEL
2266     * (value is 1&lt;&lt;5).
2267     */

2268    public static final int OK = 1 << 5;
2269
2270    /**
2271     * The <code>MessageBox</code> style constant for YES button;
2272     * valid combinations are YES|NO, YES|NO|CANCEL
2273     * (value is 1&lt;&lt;6).
2274     */

2275    public static final int YES = 1 << 6;
2276
2277    /**
2278     * The <code>MessageBox</code> style constant for NO button;
2279     * valid combinations are YES|NO, YES|NO|CANCEL
2280     * (value is 1&lt;&lt;7).
2281     */

2282    public static final int NO = 1 << 7;
2283
2284    /**
2285     * The <code>MessageBox</code> style constant for a CANCEL button;
2286     * valid combinations are OK|CANCEL, YES|NO|CANCEL, RETRY|CANCEL
2287     * (value is 1&lt;&lt;8). This style constant is also used with
2288     * <code>Text</code> in combination with SEARCH.
2289     *
2290     * <p><b>Used By:</b><ul>
2291     * <li><code>MessageBox</code></li>
2292     * <li><code>Text</code></li>
2293     * </ul></p>
2294     */

2295    public static final int CANCEL = 1 << 8;
2296
2297    /**
2298     * The <code>MessageBox</code> style constant for an ABORT button;
2299     * the only valid combination is ABORT|RETRY|IGNORE
2300     * (value is 1&lt;&lt;9).
2301     */

2302    public static final int ABORT = 1 << 9;
2303
2304    /**
2305     * The <code>MessageBox</code> style constant for a RETRY button;
2306     * valid combinations are ABORT|RETRY|IGNORE, RETRY|CANCEL
2307     * (value is 1&lt;&lt;10).
2308     */

2309    public static final int RETRY = 1 << 10;
2310
2311    /**
2312     * The <code>MessageBox</code> style constant for an IGNORE button;
2313     * the only valid combination is ABORT|RETRY|IGNORE
2314     * (value is 1&lt;&lt;11).
2315     */

2316    public static final int IGNORE = 1 << 11;
2317
2318    /**
2319     * The <code>FileDialog</code> style constant for open file dialog behavior
2320     * (value is 1&lt;&lt;12).
2321     */

2322    public static final int OPEN = 1 << 12;
2323
2324    /**
2325     * The <code>FileDialog</code> style constant for save file dialog behavior
2326     * (value is 1&lt;&lt;13).
2327     */

2328    public static final int SAVE = 1 << 13;
2329
2330    /**
2331     * The <code>Composite</code> constant to indicate that
2332     * an attribute (such as background) is not inherited
2333     * by the children (value is 0).
2334     *
2335     * @since 3.2
2336     */

2337    public static final int INHERIT_NONE = 0;
2338    
2339    /**
2340     * The <code>Composite</code> constant to indicate that
2341     * an attribute (such as background) is inherited by
2342     * children who choose this value as their "default"
2343     * (value is 1). For example, a label child will
2344     * typically choose to inherit the background color
2345     * of a composite while a list or table will not.
2346     *
2347     * @since 3.2
2348     */

2349    public static final int INHERIT_DEFAULT = 1;
2350    
2351    /**
2352     * The <code>Composite</code> constant to indicate that
2353     * an attribute (such as background) is inherited by
2354     * all children.
2355     *
2356     * @since 3.2
2357     */

2358    public static final int INHERIT_FORCE = 2;
2359    
2360    /**
2361     * Default color white (value is 1).
2362     */

2363    public static final int COLOR_WHITE = 1;
2364
2365    /**
2366     * Default color black (value is 2).
2367     */

2368    public static final int COLOR_BLACK = 2;
2369
2370    /**
2371     * Default color red (value is 3).
2372     */

2373    public static final int COLOR_RED = 3;
2374
2375    /**
2376     * Default color dark red (value is 4).
2377     */

2378    public static final int COLOR_DARK_RED = 4;
2379
2380    /**
2381     * Default color green (value is 5).
2382     */

2383    public static final int COLOR_GREEN = 5;
2384
2385    /**
2386     * Default color dark green (value is 6).
2387     */

2388    public static final int COLOR_DARK_GREEN = 6;
2389
2390    /**
2391     * Default color yellow (value is 7).
2392     */

2393    public static final int COLOR_YELLOW = 7;
2394
2395    /**
2396     * Default color dark yellow (value is 8).
2397     */

2398    public static final int COLOR_DARK_YELLOW = 8;
2399
2400    /**
2401     * Default color blue (value is 9).
2402     */

2403    public static final int COLOR_BLUE = 9;
2404
2405    /**
2406     * Default color dark blue (value is 10).
2407     */

2408    public static final int COLOR_DARK_BLUE = 10;
2409
2410    /**
2411     * Default color magenta (value is 11).
2412     */

2413    public static final int COLOR_MAGENTA = 11;
2414
2415    /**
2416     * Default color dark magenta (value is 12).
2417     */

2418    public static final int COLOR_DARK_MAGENTA = 12;
2419
2420    /**
2421     * Default color cyan (value is 13).
2422     */

2423    public static final int COLOR_CYAN = 13;
2424
2425    /**
2426     * Default color dark cyan (value is 14).
2427     */

2428    public static final int COLOR_DARK_CYAN = 14;
2429
2430    /**
2431     * Default color gray (value is 15).
2432     */

2433    public static final int COLOR_GRAY = 15;
2434
2435    /**
2436     * Default color dark gray (value is 16).
2437     */

2438    public static final int COLOR_DARK_GRAY = 16;
2439    
2440    /*
2441     * System Colors
2442     *
2443     * Dealing with system colors is an area where there are
2444     * many platform differences. On some platforms, system
2445     * colors can change dynamically while the program is
2446     * running. On other platforms, system colors can be
2447     * changed for all instances of a particular widget.
2448     * Therefore, the only truly portable method to obtain
2449     * a widget color query is to query the color from an
2450     * instance of the widget.
2451     *
2452     * It is expected that the list of supported colors
2453     * will grow over time.
2454     */

2455    
2456    /**
2457     * System color used to paint dark shadow areas (value is 17).
2458     */

2459    public static final int COLOR_WIDGET_DARK_SHADOW = 17;
2460
2461    /**
2462     * System color used to paint normal shadow areas (value is 18).
2463     */

2464    public static final int COLOR_WIDGET_NORMAL_SHADOW = 18;
2465
2466    /**
2467     * System color used to paint light shadow areas (value is 19).
2468     */

2469    public static final int COLOR_WIDGET_LIGHT_SHADOW = 19;
2470
2471    /**
2472     * System color used to paint highlight shadow areas (value is 20).
2473     */

2474    public static final int COLOR_WIDGET_HIGHLIGHT_SHADOW = 20;
2475
2476    /**
2477     * System color used to paint foreground areas (value is 21).
2478     */

2479    public static final int COLOR_WIDGET_FOREGROUND = 21;
2480
2481    /**
2482     * System color used to paint background areas (value is 22).
2483     */

2484    public static final int COLOR_WIDGET_BACKGROUND = 22;
2485
2486    /**
2487     * System color used to paint border areas (value is 23).
2488     */

2489    public static final int COLOR_WIDGET_BORDER = 23;
2490
2491    /**
2492     * System color used to paint list foreground areas (value is 24).
2493     */

2494    public static final int COLOR_LIST_FOREGROUND = 24;
2495
2496    /**
2497     * System color used to paint list background areas (value is 25).
2498     */

2499    public static final int COLOR_LIST_BACKGROUND = 25;
2500
2501    /**
2502     * System color used to paint list selection background areas (value is 26).
2503     */

2504    public static final int COLOR_LIST_SELECTION = 26;
2505
2506    /**
2507     * System color used to paint list selected text (value is 27).
2508     */

2509    public static final int COLOR_LIST_SELECTION_TEXT = 27;
2510
2511    /**
2512     * System color used to paint tooltip text (value is 28).
2513     */

2514    public static final int COLOR_INFO_FOREGROUND = 28;
2515
2516    /**
2517     * System color used to paint tooltip background areas (value is 29).
2518     */

2519    public static final int COLOR_INFO_BACKGROUND = 29;
2520    
2521    /**
2522     * System color used to paint title text (value is 30).
2523     */

2524    public static final int COLOR_TITLE_FOREGROUND = 30;
2525
2526    /**
2527     * System color used to paint title background areas (value is 31).
2528     */

2529    public static final int COLOR_TITLE_BACKGROUND = 31;
2530
2531    /**
2532     * System color used to paint title background gradient (value is 32).
2533     */

2534    public static final int COLOR_TITLE_BACKGROUND_GRADIENT = 32;
2535    
2536    /**
2537     * System color used to paint inactive title text (value is 33).
2538     */

2539    public static final int COLOR_TITLE_INACTIVE_FOREGROUND = 33;
2540
2541    /**
2542     * System color used to paint inactive title background areas (value is 34).
2543     */

2544    public static final int COLOR_TITLE_INACTIVE_BACKGROUND = 34;
2545
2546    /**
2547     * System color used to paint inactive title background gradient (value is 35).
2548     */

2549    public static final int COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = 35;
2550    
2551    /**
2552     * Draw constant indicating whether the drawing operation
2553     * should fill the background (value is 1&lt;&lt;0).
2554     */

2555    public static final int DRAW_TRANSPARENT = 1 << 0;
2556
2557    /**
2558     * Draw constant indicating whether the string drawing operation
2559     * should handle line-delimiters (value is 1&lt;&lt;1).
2560     */

2561    public static final int DRAW_DELIMITER = 1 << 1;
2562
2563    /**
2564     * Draw constant indicating whether the string drawing operation
2565     * should expand TAB characters (value is 1&lt;&lt;2).
2566     */

2567    public static final int DRAW_TAB = 1 << 2;
2568
2569    /**
2570     * Draw constant indicating whether the string drawing operation
2571     * should handle mnemonics (value is 1&lt;&lt;3).
2572     */

2573    public static final int DRAW_MNEMONIC = 1 << 3;
2574
2575    
2576    /**
2577     * Selection constant indicating that a line delimiter should be
2578     * drawn (value is 1&lt;&lt;17).
2579     *
2580     * <p><b>Used By:</b><ul>
2581     * <li><code>TextLayout</code></li>
2582     * </ul></p>
2583     *
2584     * @see #FULL_SELECTION
2585     * @see #LAST_LINE_SELECTION
2586     *
2587     * @since 3.3
2588     */

2589    public static final int DELIMITER_SELECTION = 1 << 17;
2590    
2591    /**
2592     * Selection constant indicating that the last line is selected
2593     * to the end and should be drawn using either a line delimiter
2594     * or full line selection (value is 1&lt;&lt;20).
2595     *
2596     * <p><b>Used By:</b><ul>
2597     * <li><code>TextLayout</code></li>
2598     * </ul></p>
2599     *
2600     * @see #DELIMITER_SELECTION
2601     * @see #FULL_SELECTION
2602     *
2603     * @since 3.3
2604     */

2605    public static final int LAST_LINE_SELECTION = 1 << 20;
2606    
2607    /**
2608     * SWT error constant indicating that no error number was specified
2609     * (value is 1).
2610     */

2611    public static final int ERROR_UNSPECIFIED = 1;
2612    
2613    /**
2614     * SWT error constant indicating that no more handles for an
2615     * operating system resource are available
2616     * (value is 2).
2617     */

2618    public static final int ERROR_NO_HANDLES = 2;
2619    
2620    /**
2621     * SWT error constant indicating that no more callback resources are available
2622     * (value is 3).
2623     */

2624    public static final int ERROR_NO_MORE_CALLBACKS = 3;
2625    
2626    /**
2627     * SWT error constant indicating that a null argument was passed in
2628     * (value is 4).
2629     */

2630    public static final int ERROR_NULL_ARGUMENT = 4;
2631    
2632    /**
2633     * SWT error constant indicating that an invalid argument was passed in
2634     * (value is 5).
2635     */

2636    public static final int ERROR_INVALID_ARGUMENT = 5;
2637    
2638    /**
2639     * SWT error constant indicating that a value was found to be
2640     * outside the allowable range
2641     * (value is 6).
2642     */

2643    public static final int ERROR_INVALID_RANGE = 6;
2644    
2645    /**
2646     * SWT error constant indicating that a value which can not be
2647     * zero was found to be
2648     * (value is 7).
2649     */

2650    public static final int ERROR_CANNOT_BE_ZERO = 7;
2651    
2652    /**
2653     * SWT error constant indicating that the underlying operating
2654     * system was unable to provide the value of an item
2655     * (value is 8).
2656     */

2657    public static final int ERROR_CANNOT_GET_ITEM = 8;
2658    
2659    /**
2660     * SWT error constant indicating that the underlying operating
2661     * system was unable to provide the selection
2662     * (value is 9).
2663     */

2664    public static final int ERROR_CANNOT_GET_SELECTION = 9;
2665
2666    /**
2667     * SWT error constant indicating that the matrix is not invertible
2668     * (value is 10).
2669     *
2670     * @since 3.1
2671     */

2672    public static final int ERROR_CANNOT_INVERT_MATRIX = 10;
2673
2674    /**
2675     * SWT error constant indicating that the underlying operating
2676     * system was unable to provide the height of an item
2677     * (value is 11).
2678     */

2679    public static final int ERROR_CANNOT_GET_ITEM_HEIGHT = 11;
2680
2681    /**
2682     * SWT error constant indicating that the underlying operating
2683     * system was unable to provide the text of a widget
2684     * (value is 12).
2685     */

2686    public static final int ERROR_CANNOT_GET_TEXT = 12;
2687
2688    /**
2689     * SWT error constant indicating that the underlying operating
2690     * system was unable to set the text of a widget
2691     * (value is 13).
2692     */

2693    public static final int ERROR_CANNOT_SET_TEXT = 13;
2694
2695    /**
2696     * SWT error constant indicating that the underlying operating
2697     * system was unable to add an item
2698     * (value is 14).
2699     */

2700    public static final int ERROR_ITEM_NOT_ADDED = 14;
2701
2702    /**
2703     * SWT error constant indicating that the underlying operating
2704     * system was unable to remove an item
2705     * (value is 15).
2706     */

2707    public static final int ERROR_ITEM_NOT_REMOVED = 15;
2708
2709    /**
2710     * SWT error constant indicating that the graphics library
2711     * is not available
2712     * (value is 16).
2713     */

2714    public static final int ERROR_NO_GRAPHICS_LIBRARY = 16;
2715
2716    /**
2717     * SWT error constant indicating that a particular feature has
2718     * not been implemented on this platform
2719     * (value is 20).
2720     */

2721    public static final int ERROR_NOT_IMPLEMENTED = 20;
2722
2723    /**
2724     * SWT error constant indicating that a menu which needed
2725     * to have the drop down style had some other style instead
2726     * (value is 21).
2727     */

2728    public static final int ERROR_MENU_NOT_DROP_DOWN = 21;
2729
2730    /**
2731     * SWT error constant indicating that an attempt was made to
2732     * invoke an SWT operation which can only be executed by the
2733     * user-interface thread from some other thread
2734     * (value is 22).
2735     */

2736    public static final int ERROR_THREAD_INVALID_ACCESS = 22;
2737
2738    /**
2739     * SWT error constant indicating that an attempt was made to
2740     * invoke an SWT operation using a widget which had already
2741     * been disposed
2742     * (value is 24).
2743     */

2744    public static final int ERROR_WIDGET_DISPOSED = 24;
2745
2746    /**
2747     * SWT error constant indicating that a menu item which needed
2748     * to have the cascade style had some other style instead
2749     * (value is 27).
2750     */

2751    public static final int ERROR_MENUITEM_NOT_CASCADE = 27;
2752
2753    /**
2754     * SWT error constant indicating that the underlying operating
2755     * system was unable to set the selection of a widget
2756     * (value is 28).
2757     */

2758    public static final int ERROR_CANNOT_SET_SELECTION = 28;
2759
2760    /**
2761     * SWT error constant indicating that the underlying operating
2762     * system was unable to set the menu
2763     * (value is 29).
2764     */

2765    public static final int ERROR_CANNOT_SET_MENU = 29;
2766
2767    /**
2768     * SWT error constant indicating that the underlying operating
2769     * system was unable to set the enabled state
2770     * (value is 30).
2771     */

2772    public static final int ERROR_CANNOT_SET_ENABLED = 30;
2773
2774    /**
2775     * SWT error constant indicating that the underlying operating
2776     * system was unable to provide enabled/disabled state information
2777     * (value is 31).
2778     */

2779    public static final int ERROR_CANNOT_GET_ENABLED = 31;
2780
2781    /**
2782     * SWT error constant indicating that a provided widget can
2783     * not be used as a parent in the current operation
2784     * (value is 32).
2785     */

2786    public static final int ERROR_INVALID_PARENT = 32;
2787    
2788    /**
2789     * SWT error constant indicating that a menu which needed
2790     * to have the menu bar style had some other style instead
2791     * (value is 33).
2792     */

2793    public static final int ERROR_MENU_NOT_BAR = 33;
2794
2795    /**
2796     * SWT error constant indicating that the underlying operating
2797     * system was unable to provide count information
2798     * (value is 36).
2799     */

2800    public static final int ERROR_CANNOT_GET_COUNT = 36;
2801
2802    /**
2803     * SWT error constant indicating that a menu which needed
2804     * to have the pop up menu style had some other style instead
2805     * (value is 37).
2806     */

2807    public static final int ERROR_MENU_NOT_POP_UP = 37;
2808
2809    /**
2810     * SWT error constant indicating that a graphics operation
2811     * was attempted with an image of an unsupported depth
2812     * (value is 38).
2813     */

2814    public static final int ERROR_UNSUPPORTED_DEPTH = 38;
2815
2816    /**
2817     * SWT error constant indicating that an input/output operation
2818     * failed during the execution of an SWT operation
2819     * (value is 39).
2820     */

2821    public static final int ERROR_IO = 39;
2822
2823    /**
2824     * SWT error constant indicating that a graphics operation
2825     * was attempted with an image having an invalid format
2826     * (value is 40).
2827     */

2828    public static final int ERROR_INVALID_IMAGE = 40;
2829
2830    /**
2831     * SWT error constant indicating that a graphics operation
2832     * was attempted with an image having a valid but unsupported
2833     * format
2834     * (value is 42).
2835     */

2836    public static final int ERROR_UNSUPPORTED_FORMAT = 42;
2837
2838    /**
2839     * SWT error constant indicating that an attempt was made
2840     * to subclass an SWT widget class without implementing the
2841     * <code>checkSubclass()</code> method
2842     * (value is 43).
2843     *
2844     * For additional information see the comment in
2845     * <code>Widget.checkSubclass()</code>.
2846     *
2847     * @see org.eclipse.swt.widgets.Widget#checkSubclass
2848     */

2849    public static final int ERROR_INVALID_SUBCLASS = 43;
2850
2851    /**
2852     * SWT error constant indicating that an attempt was made to
2853     * invoke an SWT operation using a graphics object which had
2854     * already been disposed
2855     * (value is 44).
2856     */

2857    public static final int ERROR_GRAPHIC_DISPOSED = 44;
2858    
2859    /**
2860     * SWT error constant indicating that an attempt was made to
2861     * invoke an SWT operation using a device which had already
2862     * been disposed
2863     * (value is 45).
2864     */

2865    public static final int ERROR_DEVICE_DISPOSED = 45;
2866    
2867    /**
2868     * SWT error constant indicating that an exception happened
2869     * when executing a runnable
2870     * (value is 46).
2871     */

2872    public static final int ERROR_FAILED_EXEC = 46;
2873    
2874    /**
2875     * SWT error constant indicating that an unsatisfied link
2876     * error occurred while attempting to load a library
2877     * (value is 47).
2878     *
2879     * @since 3.1
2880     */

2881    public static final int ERROR_FAILED_LOAD_LIBRARY = 47;
2882
2883    /**
2884     * SWT error constant indicating that a font is not valid
2885     * (value is 48).
2886     *
2887     * @since 3.1
2888     */

2889    public static final int ERROR_INVALID_FONT = 48;
2890
2891    /**
2892     * Constant indicating that an image or operation is of type bitmap (value is 0).
2893     */

2894    public static final int BITMAP = 0;
2895
2896    /**
2897     * Constant indicating that an image or operation is of type icon (value is 1).
2898     */

2899    public static final int ICON = 1;
2900
2901    /**
2902     * The <code>Image</code> constructor argument indicating that
2903     * the new image should be a copy of the image provided as
2904     * an argument (value is 0).
2905     */

2906    public static final int IMAGE_COPY = 0;
2907
2908    /**
2909     * The <code>Image</code> constructor argument indicating that
2910     * the new image should have the appearance of a "disabled"
2911     * (using the platform's rules for how this should look)
2912     * copy of the image provided as an argument (value is 1).
2913     */

2914    public static final int IMAGE_DISABLE = 1;
2915    
2916    /**
2917     * The <code>Image</code> constructor argument indicating that
2918     * the new image should have the appearance of a "gray scaled"
2919     * copy of the image provided as an argument (value is 2).
2920     */

2921    public static final int IMAGE_GRAY = 2;
2922    
2923    /**
2924     * The font style constant indicating a normal weight, non-italic font
2925     * (value is 0).
2926     */

2927    public static final int NORMAL = 0;
2928    
2929    /**
2930     * The font style constant indicating a bold weight font
2931     * (value is 1&lt;&lt;0).
2932     */

2933    public static final int BOLD = 1 << 0;
2934    
2935    /**
2936     * The font style constant indicating an italic font
2937     * (value is 1&lt;&lt;1).
2938     */

2939    public static final int ITALIC = 1 << 1;
2940        
2941    /**
2942     * System arrow cursor (value is 0).
2943     */

2944    public static final int CURSOR_ARROW = 0;
2945        
2946    /**
2947     * System wait cursor (value is 1).
2948     */

2949    public static final int CURSOR_WAIT = 1;
2950        
2951    /**
2952     * System cross hair cursor (value is 2).
2953     */

2954    public static final int CURSOR_CROSS = 2;
2955        
2956    /**
2957     * System app startup cursor (value is 3).
2958     */

2959    public static final int CURSOR_APPSTARTING = 3;
2960        
2961    /**
2962     * System help cursor (value is 4).
2963     */

2964    public static final int CURSOR_HELP = 4;
2965        
2966    /**
2967     * System resize all directions cursor (value is 5).
2968     */

2969    public static final int CURSOR_SIZEALL = 5;
2970        
2971    /**
2972     * System resize north-east-south-west cursor (value is 6).
2973     */

2974    public static final int CURSOR_SIZENESW = 6;
2975        
2976    /**
2977     * System resize north-south cursor (value is 7).
2978     */

2979    public static final int CURSOR_SIZENS = 7;
2980        
2981    /**
2982     * System resize north-west-south-east cursor (value is 8).
2983     */

2984    public static final int CURSOR_SIZENWSE = 8;
2985        
2986    /**
2987     * System resize west-east cursor (value is 9).
2988     */

2989    public static final int CURSOR_SIZEWE = 9;
2990        
2991    /**
2992     * System resize north cursor (value is 10).
2993     */

2994    public static final int CURSOR_SIZEN = 10;
2995        
2996    /**
2997     * System resize south cursor (value is 11).
2998     */

2999    public static final int CURSOR_SIZES = 11;
3000        
3001    /**
3002     * System resize east cursor (value is 12).
3003     */

3004    public static final int CURSOR_SIZEE = 12;
3005        
3006    /**
3007     * System resize west cursor (value is 13).
3008     */

3009    public static final int CURSOR_SIZEW = 13;
3010        
3011    /**
3012     * System resize north-east cursor (value is 14).
3013     */

3014    public static final int CURSOR_SIZENE = 14;
3015        
3016    /**
3017     * System resize south-east cursor (value is 15).
3018     */

3019    public static final int CURSOR_SIZESE = 15;
3020        
3021    /**
3022     * System resize south-west cursor (value is 16).
3023     */

3024    public static final int CURSOR_SIZESW = 16;
3025        
3026    /**
3027     * System resize north-west cursor (value is 17).
3028     */

3029    public static final int CURSOR_SIZENW = 17;
3030        
3031    /**
3032     * System up arrow cursor (value is 18).
3033     */

3034    public static final int CURSOR_UPARROW = 18;
3035        
3036    /**
3037     * System i-beam cursor (value is 19).
3038     */

3039    public static final int CURSOR_IBEAM = 19;
3040        
3041    /**
3042     * System "not allowed" cursor (value is 20).
3043     */

3044    public static final int CURSOR_NO = 20;
3045        
3046    /**
3047     * System hand cursor (value is 21).
3048     */

3049    public static final int CURSOR_HAND = 21;
3050        
3051    /**
3052     * Line drawing style for flat end caps (value is 1).
3053     *
3054     * @see org.eclipse.swt.graphics.GC#setLineCap(int)
3055     * @see org.eclipse.swt.graphics.GC#getLineCap()
3056     *
3057     * @since 3.1
3058     */

3059    public static final int CAP_FLAT = 1;
3060
3061    /**
3062     * Line drawing style for rounded end caps (value is 2).
3063     *
3064     * @see org.eclipse.swt.graphics.GC#setLineCap(int)
3065     * @see org.eclipse.swt.graphics.GC#getLineCap()
3066     *
3067     * @since 3.1
3068     */

3069    public static final int CAP_ROUND = 2;
3070
3071    /**
3072     * Line drawing style for square end caps (value is 3).
3073     *
3074     * @see org.eclipse.swt.graphics.GC#setLineCap(int)
3075     * @see org.eclipse.swt.graphics.GC#getLineCap()
3076     *
3077     * @since 3.1
3078     */

3079    public static final int CAP_SQUARE = 3;
3080
3081    /**
3082     * Line drawing style for miter joins (value is 1).
3083     *
3084     * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
3085     * @see org.eclipse.swt.graphics.GC#getLineJoin()
3086     *
3087     * @since 3.1
3088     */

3089    public static final int JOIN_MITER = 1;
3090
3091    /**
3092     * Line drawing style for rounded joins (value is 2).
3093     *
3094     * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
3095     * @see org.eclipse.swt.graphics.GC#getLineJoin()
3096     *
3097     * @since 3.1
3098     */

3099    public static final int JOIN_ROUND = 2;
3100
3101    /**
3102     * Line drawing style for bevel joins (value is 3).
3103     *
3104     * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
3105     * @see org.eclipse.swt.graphics.GC#getLineJoin()
3106     *
3107     * @since 3.1
3108     */

3109    public static final int JOIN_BEVEL = 3;
3110
3111    /**
3112     * Line drawing style for solid lines (value is 1).
3113     */

3114    public static final int LINE_SOLID = 1;
3115        
3116    /**
3117     * Line drawing style for dashed lines (value is 2).
3118     */

3119    public static final int LINE_DASH = 2;
3120        
3121    /**
3122     * Line drawing style for dotted lines (value is 3).
3123     */

3124    public static final int LINE_DOT = 3;
3125        
3126    /**
3127     * Line drawing style for alternating dash-dot lines (value is 4).
3128     */

3129    public static final int LINE_DASHDOT = 4;
3130        
3131    /**
3132     * Line drawing style for dash-dot-dot lines (value is 5).
3133     */

3134    public static final int LINE_DASHDOTDOT = 5;
3135
3136    /**
3137     * Line drawing style for custom dashed lines (value is 6).
3138     *
3139     * @see org.eclipse.swt.graphics.GC#setLineDash(int[])
3140     * @see org.eclipse.swt.graphics.GC#getLineDash()
3141     *
3142     * @since 3.1
3143     */

3144    public static final int LINE_CUSTOM = 6;
3145    
3146    /**
3147     * Path constant that represents a "move to" operation (value is 1).
3148     *
3149     * @since 3.1
3150     */

3151    public static final int PATH_MOVE_TO = 1;
3152
3153    /**
3154     * Path constant that represents a "line to" operation (value is 2).
3155     *
3156     * @since 3.1
3157     */

3158    public static final int PATH_LINE_TO = 2;
3159
3160    /**
3161     * Path constant that represents a "quadratic curve to" operation (value is 3).
3162     *
3163     * @since 3.1
3164     */

3165    public static final int PATH_QUAD_TO = 3;
3166
3167    /**
3168     * Path constant that represents a "cubic curve to" operation (value is 4).
3169     *
3170     * @since 3.1
3171     */

3172    public static final int PATH_CUBIC_TO = 4;
3173
3174    /**
3175     * Path constant that represents a "close" operation (value is 5).
3176     *
3177     * @since 3.1
3178     */

3179    public static final int PATH_CLOSE = 5;
3180
3181    /**
3182     * Even odd rule for filling operations (value is 1).
3183     *
3184     * @since 3.1
3185     */

3186    public static final int FILL_EVEN_ODD = 1;
3187
3188    /**
3189     * Winding rule for filling operations (value is 2).
3190     *
3191     * @since 3.1
3192     */

3193    public static final int FILL_WINDING = 2;
3194
3195    /**
3196     * Image format constant indicating an unknown image type (value is -1).
3197     */

3198    public static final int IMAGE_UNDEFINED = -1;
3199
3200    /**
3201     * Image format constant indicating a Windows BMP format image (value is 0).
3202     */

3203    public static final int IMAGE_BMP = 0;
3204
3205    /**
3206     * Image format constant indicating a run-length encoded
3207     * Windows BMP format image (value is 1).
3208     */

3209    public static final int IMAGE_BMP_RLE = 1;
3210
3211    /**
3212     * Image format constant indicating a GIF format image (value is 2).
3213     */

3214    public static final int IMAGE_GIF = 2;
3215
3216    /**
3217     * Image format constant indicating a ICO format image (value is 3).
3218     */

3219    public static final int IMAGE_ICO = 3;
3220
3221    /**
3222     * Image format constant indicating a JPEG format image (value is 4).
3223     */

3224    public static final int IMAGE_JPEG = 4;
3225
3226    /**
3227     * Image format constant indicating a PNG format image (value is 5).
3228     */

3229    public static final int IMAGE_PNG = 5;
3230
3231    /**
3232     * Image format constant indicating a TIFF format image (value is 6).
3233     */

3234    public static final int IMAGE_TIFF = 6;
3235
3236    /**
3237     * Image format constant indicating an OS/2 BMP format image (value is 7).
3238     */

3239    public static final int IMAGE_OS2_BMP = 7;
3240
3241    /**
3242     * GIF image disposal method constants indicating that the
3243     * disposal method is unspecified (value is 0).
3244     */

3245    public static final int DM_UNSPECIFIED = 0x0;
3246
3247    /**
3248     * GIF image disposal method constants indicating that the
3249     * disposal method is to do nothing; that is, to leave the
3250     * previous image in place (value is 1).
3251     */

3252    public static final int DM_FILL_NONE = 0x1;
3253
3254    /**
3255     * GIF image disposal method constants indicating that the
3256     * the previous images should be covered with the background
3257     * color before displaying the next image (value is 2).
3258     */

3259    public static final int DM_FILL_BACKGROUND = 0x2;
3260
3261    /**
3262     * GIF image disposal method constants indicating that the
3263     * disposal method is to restore the previous picture
3264     * (value is 3).
3265     */

3266    public static final int DM_FILL_PREVIOUS = 0x3;
3267    
3268    /**
3269     * Image transparency constant indicating that the image
3270     * contains no transparency information (value is 0).
3271     */

3272    public static final int TRANSPARENCY_NONE = 0x0;
3273    
3274    /**
3275     * Image transparency constant indicating that the image
3276     * contains alpha transparency information (value is 1&lt;&lt;0).
3277     */

3278    public static final int TRANSPARENCY_ALPHA = 1 << 0;
3279    
3280    /**
3281     * Image transparency constant indicating that the image
3282     * contains a transparency mask (value is 1&lt;&lt;1).
3283     */

3284    public static final int TRANSPARENCY_MASK = 1 << 1;
3285    
3286    /**
3287     * Image transparency constant indicating that the image
3288     * contains a transparent pixel (value is 1&lt;&lt;2).
3289     */

3290    public static final int TRANSPARENCY_PIXEL = 1 << 2;
3291
3292    /**
3293     * The character movement type (value is 1&lt;&lt;0).
3294     * This constant is used to move a text offset over a character.
3295     *
3296     * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
3297     * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
3298     *
3299     * @since 3.0
3300     */

3301    public static final int MOVEMENT_CHAR = 1 << 0;
3302
3303    /**
3304     * The cluster movement type (value is 1&lt;&lt;1).
3305     * This constant is used to move a text offset over a cluster.
3306     * A cluster groups one or more characters. A cluster is
3307     * undivisible, this means that a caret offset can not be placed in the
3308     * middle of a cluster.
3309     *
3310     * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
3311     * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
3312     *
3313     * @since 3.0
3314     */

3315    public static final int MOVEMENT_CLUSTER = 1 << 1;
3316
3317    /**
3318     * The word movement type (value is 1&lt;&lt;2).
3319     * This constant is used to move a text offset over a word.
3320     * The behavior of this constant depends on the platform and on the
3321     * direction of the movement. For example, on Windows the stop is
3322     * always at the start of the word. On GTK and Mac the stop is at the end
3323     * of the word if the direction is next and at the start of the word if the
3324     * direction is previous.
3325     *
3326     * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
3327     * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
3328     *
3329     * @since 3.0
3330     */

3331    public static final int MOVEMENT_WORD = 1 << 2;
3332
3333    /**
3334     * The word end movement type (value is 1&lt;&lt;3).
3335     * This constant is used to move a text offset to the next or previous
3336     * word end. The behavior of this constant does not depend on the platform.
3337     *
3338     *
3339     * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
3340     * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
3341     *
3342     * @since 3.3
3343     */

3344    public static final int MOVEMENT_WORD_END = 1 << 3;
3345
3346    /**
3347     * The word start movement type (value is 1&lt;&lt;4).
3348     * This constant is used to move a text offset to the next or previous
3349     * word start. The behavior of this constant does not depend on the platform.
3350     *
3351     * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
3352     * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
3353     *
3354     * @since 3.3
3355     */

3356    public static final int MOVEMENT_WORD_START = 1 << 4;
3357
3358    
3359/**
3360 * Answers a concise, human readable description of the error code.
3361 *
3362 * @param code the SWT error code.
3363 * @return a description of the error code.
3364 *
3365 * @see SWT
3366 */

3367static String JavaDoc findErrorText (int code) {
3368    switch (code) {
3369        case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$
3370
case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$
3371
case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$
3372
case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$
3373
case ERROR_INVALID_ARGUMENT: return "Argument not valid"; //$NON-NLS-1$
3374
case ERROR_INVALID_RANGE: return "Index out of bounds"; //$NON-NLS-1$
3375
case ERROR_CANNOT_BE_ZERO: return "Argument cannot be zero"; //$NON-NLS-1$
3376
case ERROR_CANNOT_GET_ITEM: return "Cannot get item"; //$NON-NLS-1$
3377
case ERROR_CANNOT_GET_SELECTION: return "Cannot get selection"; //$NON-NLS-1$
3378
case ERROR_CANNOT_GET_ITEM_HEIGHT: return "Cannot get item height"; //$NON-NLS-1$
3379
case ERROR_CANNOT_GET_TEXT: return "Cannot get text"; //$NON-NLS-1$
3380
case ERROR_CANNOT_SET_TEXT: return "Cannot set text"; //$NON-NLS-1$
3381
case ERROR_ITEM_NOT_ADDED: return "Item not added"; //$NON-NLS-1$
3382
case ERROR_ITEM_NOT_REMOVED: return "Item not removed"; //$NON-NLS-1$
3383
case ERROR_NOT_IMPLEMENTED: return "Not implemented"; //$NON-NLS-1$
3384
case ERROR_MENU_NOT_DROP_DOWN: return "Menu must be a drop down"; //$NON-NLS-1$
3385
case ERROR_THREAD_INVALID_ACCESS: return "Invalid thread access"; //$NON-NLS-1$
3386
case ERROR_WIDGET_DISPOSED: return "Widget is disposed"; //$NON-NLS-1$
3387
case ERROR_MENUITEM_NOT_CASCADE: return "Menu item is not a CASCADE"; //$NON-NLS-1$
3388
case ERROR_CANNOT_SET_SELECTION: return "Cannot set selection"; //$NON-NLS-1$
3389
case ERROR_CANNOT_SET_MENU: return "Cannot set menu"; //$NON-NLS-1$
3390
case ERROR_CANNOT_SET_ENABLED: return "Cannot set the enabled state"; //$NON-NLS-1$
3391
case ERROR_CANNOT_GET_ENABLED: return "Cannot get the enabled state"; //$NON-NLS-1$
3392
case ERROR_INVALID_PARENT: return "Widget has the wrong parent"; //$NON-NLS-1$
3393
case ERROR_MENU_NOT_BAR: return "Menu is not a BAR"; //$NON-NLS-1$
3394
case ERROR_CANNOT_GET_COUNT: return "Cannot get count"; //$NON-NLS-1$
3395
case ERROR_MENU_NOT_POP_UP: return "Menu is not a POP_UP"; //$NON-NLS-1$
3396
case ERROR_UNSUPPORTED_DEPTH: return "Unsupported color depth"; //$NON-NLS-1$
3397
case ERROR_IO: return "i/o error"; //$NON-NLS-1$
3398
case ERROR_INVALID_IMAGE: return "Invalid image"; //$NON-NLS-1$
3399
case ERROR_UNSUPPORTED_FORMAT: return "Unsupported or unrecognized format"; //$NON-NLS-1$
3400
case ERROR_INVALID_SUBCLASS: return "Subclassing not allowed"; //$NON-NLS-1$
3401
case ERROR_GRAPHIC_DISPOSED: return "Graphic is disposed"; //$NON-NLS-1$
3402
case ERROR_DEVICE_DISPOSED: return "Device is disposed"; //$NON-NLS-1$
3403
case ERROR_FAILED_EXEC: return "Failed to execute runnable"; //$NON-NLS-1$
3404
case ERROR_FAILED_LOAD_LIBRARY: return "Unable to load library"; //$NON-NLS-1$
3405
case ERROR_CANNOT_INVERT_MATRIX: return "Cannot invert matrix"; //$NON-NLS-1$
3406
case ERROR_NO_GRAPHICS_LIBRARY: return "Unable to load graphics library"; //$NON-NLS-1$
3407
case ERROR_INVALID_FONT: return "Font not valid"; //$NON-NLS-1$
3408
}
3409    return "Unknown error"; //$NON-NLS-1$
3410
}
3411
3412/**
3413 * Returns the NLS'ed message for the given argument.
3414 *
3415 * @param key the key to look up
3416 * @return the message for the given key
3417 *
3418 * @exception IllegalArgumentException <ul>
3419 * <li>ERROR_NULL_ARGUMENT - if the key is null</li>
3420 * </ul>
3421 */

3422public static String JavaDoc getMessage(String JavaDoc key) {
3423    return Compatibility.getMessage(key);
3424}
3425    
3426/**
3427 * Returns the SWT platform name.
3428 * Examples: "win32", "motif", "gtk", "photon", "carbon"
3429 *
3430 * @return the SWT platform name
3431 */

3432public static String JavaDoc getPlatform () {
3433    return Platform.PLATFORM;
3434}
3435
3436/**
3437 * Returns the SWT version number as an integer.
3438 * Example: "SWT051" == 51
3439 *
3440 * @return the SWT version number
3441 */

3442public static int getVersion () {
3443    return Library.SWT_VERSION;
3444}
3445
3446/**
3447 * Throws an appropriate exception based on the passed in error code.
3448 *
3449 * @param code the SWT error code
3450 */

3451public static void error (int code) {
3452    error (code, null);
3453}
3454
3455/**
3456 * Throws an appropriate exception based on the passed in error code.
3457 * The <code>throwable</code> argument should be either null, or the
3458 * throwable which caused SWT to throw an exception.
3459 * <p>
3460 * In SWT, errors are reported by throwing one of three exceptions:
3461 * <dl>
3462 * <dd>java.lang.IllegalArgumentException</dd>
3463 * <dt>thrown whenever one of the API methods is invoked with an illegal argument</dt>
3464 * <dd>org.eclipse.swt.SWTException (extends java.lang.RuntimeException)</dd>
3465 * <dt>thrown whenever a recoverable error happens internally in SWT</dt>
3466 * <dd>org.eclipse.swt.SWTError (extends java.lang.Error)</dd>
3467 * <dt>thrown whenever a <b>non-recoverable</b> error happens internally in SWT</dt>
3468 * </dl>
3469 * This method provides the logic which maps between error codes
3470 * and one of the above exceptions.
3471 * </p>
3472 *
3473 * @param code the SWT error code.
3474 * @param throwable the exception which caused the error to occur.
3475 *
3476 * @see SWTError
3477 * @see SWTException
3478 * @see IllegalArgumentException
3479 */

3480public static void error (int code, Throwable JavaDoc throwable) {
3481    error (code, throwable, null);
3482}
3483
3484/**
3485 * Throws an appropriate exception based on the passed in error code.
3486 * The <code>throwable</code> argument should be either null, or the
3487 * throwable which caused SWT to throw an exception.
3488 * <p>
3489 * In SWT, errors are reported by throwing one of three exceptions:
3490 * <dl>
3491 * <dd>java.lang.IllegalArgumentException</dd>
3492 * <dt>thrown whenever one of the API methods is invoked with an illegal argument</dt>
3493 * <dd>org.eclipse.swt.SWTException (extends java.lang.RuntimeException)</dd>
3494 * <dt>thrown whenever a recoverable error happens internally in SWT</dt>
3495 * <dd>org.eclipse.swt.SWTError (extends java.lang.Error)</dd>
3496 * <dt>thrown whenever a <b>non-recoverable</b> error happens internally in SWT</dt>
3497 * </dl>
3498 * This method provides the logic which maps between error codes
3499 * and one of the above exceptions.
3500 * </p>
3501 *
3502 * @param code the SWT error code.
3503 * @param throwable the exception which caused the error to occur.
3504 * @param detail more information about error.
3505 *
3506 * @see SWTError
3507 * @see SWTException
3508 * @see IllegalArgumentException
3509 *
3510 * @since 3.0
3511 */

3512public static void error (int code, Throwable JavaDoc throwable, String JavaDoc detail) {
3513
3514    /*
3515    * This code prevents the creation of "chains" of SWTErrors and
3516    * SWTExceptions which in turn contain other SWTErrors and
3517    * SWTExceptions as their throwable. This can occur when low level
3518    * code throws an exception past a point where a higher layer is
3519    * being "safe" and catching all exceptions. (Note that, this is
3520    * _a_bad_thing_ which we always try to avoid.)
3521    *
3522    * On the theory that the low level code is closest to the
3523    * original problem, we simply re-throw the original exception here.
3524    *
3525    * NOTE: Exceptions thrown in syncExec and asyncExec must be
3526    * wrapped.
3527    */

3528    if (code != SWT.ERROR_FAILED_EXEC) {
3529        if (throwable instanceof SWTError) throw (SWTError) throwable;
3530        if (throwable instanceof SWTException) throw (SWTException) throwable;
3531    }
3532
3533    String JavaDoc message = findErrorText (code);
3534    if (detail != null) message += detail;
3535    switch (code) {
3536        
3537        /* Illegal Arguments (non-fatal) */
3538        case ERROR_NULL_ARGUMENT:
3539        case ERROR_CANNOT_BE_ZERO:
3540        case ERROR_INVALID_ARGUMENT:
3541        case ERROR_MENU_NOT_BAR:
3542        case ERROR_MENU_NOT_DROP_DOWN:
3543        case ERROR_MENU_NOT_POP_UP:
3544        case ERROR_MENUITEM_NOT_CASCADE:
3545        case ERROR_INVALID_PARENT:
3546        case ERROR_INVALID_RANGE: {
3547            throw new IllegalArgumentException JavaDoc (message);
3548        }
3549        
3550        /* SWT Exceptions (non-fatal) */
3551        case ERROR_INVALID_SUBCLASS:
3552        case ERROR_THREAD_INVALID_ACCESS:
3553        case ERROR_WIDGET_DISPOSED:
3554        case ERROR_GRAPHIC_DISPOSED:
3555        case ERROR_DEVICE_DISPOSED:
3556        case ERROR_INVALID_IMAGE:
3557        case ERROR_UNSUPPORTED_DEPTH:
3558        case ERROR_UNSUPPORTED_FORMAT:
3559        case ERROR_FAILED_EXEC:
3560        case ERROR_CANNOT_INVERT_MATRIX:
3561        case ERROR_NO_GRAPHICS_LIBRARY:
3562        case ERROR_IO: {
3563            SWTException exception = new SWTException (code, message);
3564            exception.throwable = throwable;
3565            throw exception;
3566        }
3567        
3568        /* Operation System Errors (fatal, may occur only on some platforms) */
3569        case ERROR_CANNOT_GET_COUNT:
3570        case ERROR_CANNOT_GET_ENABLED:
3571        case ERROR_CANNOT_GET_ITEM:
3572        case ERROR_CANNOT_GET_ITEM_HEIGHT:
3573        case ERROR_CANNOT_GET_SELECTION:
3574        case ERROR_CANNOT_GET_TEXT:
3575        case ERROR_CANNOT_SET_ENABLED:
3576        case ERROR_CANNOT_SET_MENU:
3577        case ERROR_CANNOT_SET_SELECTION:
3578        case ERROR_CANNOT_SET_TEXT:
3579        case ERROR_ITEM_NOT_ADDED:
3580        case ERROR_ITEM_NOT_REMOVED:
3581        case ERROR_NO_HANDLES:
3582        //FALL THROUGH
3583

3584        /* SWT Errors (fatal, may occur only on some platforms) */
3585        case ERROR_FAILED_LOAD_LIBRARY:
3586        case ERROR_NO_MORE_CALLBACKS:
3587        case ERROR_NOT_IMPLEMENTED:
3588        case ERROR_UNSPECIFIED: {
3589            SWTError error = new SWTError (code, message);
3590            error.throwable = throwable;
3591            throw error;
3592        }
3593    }
3594    
3595    /* Unknown/Undefined Error */
3596    SWTError error = new SWTError (code, message);
3597    error.throwable = throwable;
3598    throw error;
3599}
3600
3601static {
3602    /*
3603    * These values represent bit masks that may need to
3604    * expand in the future. Therefore they are not initialized
3605    * in the declaration to stop the compiler from inlining.
3606    */

3607    BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5;
3608    MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND;
3609    
3610    /*
3611    * These values can be different on different platforms.
3612    * Therefore they are not initialized in the declaration
3613    * to stop the compiler from inlining.
3614    */

3615    String JavaDoc platform = getPlatform ();
3616    if ("carbon".equals (platform)) { //$NON-NLS-1$
3617
MOD1 = COMMAND;
3618        MOD2 = SHIFT;
3619        MOD3 = ALT;
3620        MOD4 = CONTROL;
3621    } else {
3622        MOD1 = CONTROL;
3623        MOD2 = SHIFT;
3624        MOD3 = ALT;
3625        MOD4 = 0;
3626    }
3627}
3628}
3629
Popular Tags