# HG changeset patch
# User Frank Benoit
+ * By defining constants like UP and DOWN in a single class, SWT
+ * can share common names and concepts at the same time minimizing
+ * the number of classes, names and constants for the application
+ * programmer.
+ *
+ * Note that some of the constants provided by this class represent
+ * optional, appearance related aspects of widgets which are available
+ * either only on some window systems, or for a differing set of
+ * widgets on each window system. These constants are marked
+ * as HINTs. The set of widgets which support a particular
+ * HINT may change from release to release, although we typically
+ * will not withdraw support for a HINT once it is made available.
+ *
+ * The settings changed event is sent when an operating system
+ * property, such as a system font or color, has been changed.
+ * The event occurs after the property has been changed, but
+ * before any widget is redrawn. Applications that cache operating
+ * system properties can use this event to update their caches.
+ * A specific property change can be detected by querying the
+ * new value of a property and comparing it with the equivalent
+ * cached value. The operating system automatically redraws and
+ * lays out all widgets after this event is sent.
+ * Used By:
+ *
Menu
Used By:
Menu
ToolItem
CoolItem
Combo
Used By:
Menu
Used By:
Label
MenuItem
ToolItem
Used By:
Button
Used By:
Button
Used By:
Button
MenuItem
ToolItem
Used By:
Button
MenuItem
ToolItem
Used By:
Button
MenuItem
ToolItem
Table
Tree
Used By:
MenuItem
Used By:
Text
List
FileDialog
Used By:
Text
List
Table
Tree
Used By:
Combo
Text
Used By:
Label
Text
ToolBar
Spinner
Used By:
Text
Used By:
Combo
Used By:
Text
Used By:
Label
Group
Used By:
Label
Group
ToolBar
Used By:
Group
Used By:
Group
Used By:
Label
Group
Used By:
ProgressBar
+ * A tool window is a window intended to be used as a floating toolbar.
+ * It typically has a title bar that is shorter than a normal title bar,
+ * and the window title is typically drawn using a smaller font.
+ *
Note that this is a HINT.
+ *
Used By:
Decorations
and subclassesUsed By:
Decorations
and subclassesUsed By:
Decorations
and subclassesTracker
Used By:
Decorations
and subclassesUsed By:
Decorations
and subclassesUsed By:
Decorations
and subclassesUsed By:
Decorations
and subclassesUsed By:
Decorations
and subclassesUsed By:
Scrollable
and subclassesUsed By:
Scrollable
and subclassesUsed By:
Control
and subclassesUsed By:
Control
and subclassesUsed By:
Control
and subclassesUsed By:
Shell
and subclassesUsed By:
Shell
Used By:
Shell
Used By:
Dialog
Shell
Used By:
Dialog
Shell
Used By:
Dialog
Shell
Used By:
Dialog
Shell
Used By:
Table
Used By:
Table
Tree
StyledText
TextLayout
Used By:
Button
ToolBar
Used By:
ProgressBar
Sash
+ * By default, before a widget paints, the client area is filled with the current background. + * When this style is specified, the background is not filled, and the application is responsible + * for filling every pixel of the client area. + * This style might be used as an alternative to "double-buffering" in order to reduce flicker. + * This style does not mean "transparent" - widgets that are obscured will not draw through. + *
Used By:
Composite
Used By:
Composite
+ * This style stops the entire client area from being invalidated when the size + * of the Canvas changes. Specifically, when the size of the Canvas gets smaller, + * the SWT.Paint event is not sent. When it gets bigger, an SWT.Paint event is + * sent with a GC clipped to only the new areas to be painted. Without this + * style, the entire client area will be repainted. + *
Used By:
Composite
Used By:
Composite
Used By:
Composite
+ * When orientation is not explicitly specified, orientation is
+ * inherited. This means that children will be assigned the
+ * orientation of their parent. To override this behavior and
+ * force an orientation for a child, explicitly set the orientation
+ * of the child when that child is created.
+ *
Note that this is a HINT.
+ *
Used By:
Control
Menu
GC
+ * When orientation is not explicitly specified, orientation is
+ * inherited. This means that children will be assigned the
+ * orientation of their parent. To override this behavior and
+ * force an orientation for a child, explicitly set the orientation
+ * of the child when that child is created.
+ *
Note that this is a HINT.
+ *
Used By:
Control
Menu
GC
Used By:
Control
Menu
Used By:
Composite
Used By:
Table
Tree
Used By:
Control
Used By:
Button
with ARROW
styleTracker
Used By:
FormAttachment
in a FormLayout
Used By:
Button
with ARROW
styleTracker
Used By:
FormAttachment
in a FormLayout
Used By:
Button
Label
TableColumn
Tracker
FormAttachment
in a FormLayout
Used By:
Button
Label
TableColumn
Tracker
FormAttachment
in a FormLayout
Used By:
Button
Label
TableColumn
FormAttachment
in a FormLayout
Used By:
Label
ProgressBar
Sash
Scale
ScrollBar
Slider
ToolBar
FillLayout
typeRowLayout
typeUsed By:
Label
ProgressBar
Sash
Scale
ScrollBar
Slider
ToolBar
CoolBar
FillLayout
typeRowLayout
typeUsed By:
DateTime
Used By:
DateTime
Used By:
DateTime
+ * A short date displays the month and year.
+ * A short time displays hours and minutes.
+ *
Note that this is a HINT.
+ *
Used By:
DateTime
+ * A medium date displays the day, month and year.
+ * A medium time displays hours, minutes, and seconds.
+ *
Note that this is a HINT.
+ *
Used By:
DateTime
+ * A long date displays the day, month and year.
+ * A long time displays hours, minutes, and seconds.
+ * The day and month names may be displayed.
+ *
Note that this is a HINT.
+ *
Used By:
DateTime
+ *
Used By:
Browser
Used By:
ToolTip
Used By:
GridLayout
typeUsed By:
GridLayout
typechar
'\b').
+ */
+ public static const char BS = '\b';
+
+ /**
+ * ASCII character convenience constant for the carriage return character
+ * (value is the char
'\r').
+ */
+ public static const char CR = '\r';
+
+ /**
+ * ASCII character convenience constant for the delete character
+ * (value is the char
with value 127).
+ */
+ public static const char DEL = 0x7F;
+
+ /**
+ * ASCII character convenience constant for the escape character
+ * (value is the char
with value 27).
+ */
+ public static const char ESC = 0x1B;
+
+ /**
+ * ASCII character convenience constant for the line feed character
+ * (value is the char
'\n').
+ */
+ public static const char LF = '\n';
+
+ /**
+ * ASCII character convenience constant for the tab character
+ * (value is the char
'\t').
+ *
+ * @since 2.1
+ */
+ public static const char TAB = '\t';
+
+ /**
+ * keyboard and/or mouse event mask indicating that the ALT key
+ * was pushed on the keyboard when the event was generated
+ * (value is 1<<16).
+ */
+ public static const int ALT = 1 << 16;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the SHIFT key
+ * was pushed on the keyboard when the event was generated
+ * (value is 1<<17).
+ */
+ public static const int SHIFT = 1 << 17;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the CTRL key
+ * was pushed on the keyboard when the event was generated
+ * (value is 1<<18).
+ */
+ public static const int CTRL = 1 << 18;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the CTRL key
+ * was pushed on the keyboard when the event was generated. This
+ * is a synonym for CTRL (value is 1<<18).
+ */
+ public static const int CONTROL = CTRL;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the COMMAND key
+ * was pushed on the keyboard when the event was generated
+ * (value is 1<<22).
+ *
+ * @since 2.1
+ */
+ public static const int COMMAND = 1 << 22;
+
+ /**
+ * Keyboard and/or mouse event mask indicating all possible
+ * keyboard modifiers.
+ *
+ * To allow for the future, this mask is intended to be used in
+ * place of code that references each individual keyboard mask.
+ * For example, the following expression will determine whether
+ * any modifier is pressed and will continue to work as new modifier
+ * masks are added.
+ *
+ * (stateMask & SWT.MODIFIER_MASK) != 0
.
+ *
+ * @since 2.1
+ */
+ public static const int MODIFIER_MASK;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that mouse button one
+ * was pushed when the event was generated. (value is 1<<19).
+ */
+ public static const int BUTTON1 = 1 << 19;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that mouse button two
+ * was pushed when the event was generated. (value is 1<<20).
+ */
+ public static const int BUTTON2 = 1 << 20;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that mouse button three
+ * was pushed when the event was generated. (value is 1<<21).
+ */
+ public static const int BUTTON3 = 1 << 21;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that mouse button four
+ * was pushed when the event was generated. (value is 1<<23).
+ *
+ * @since 3.1
+ */
+ public static const int BUTTON4 = 1 << 23;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that mouse button five
+ * was pushed when the event was generated. (value is 1<<25).
+ *
+ * @since 3.1
+ */
+ public static const int BUTTON5 = 1 << 25;
+
+ /**
+ * Keyboard and/or mouse event mask indicating all possible
+ * mouse buttons.
+ *
+ * To allow for the future, this mask is intended to be used
+ * in place of code that references each individual button mask.
+ * For example, the following expression will determine whether
+ * any button is pressed and will continue to work as new button
+ * masks are added.
+ *
+ * (stateMask & SWT.BUTTON_MASK) != 0
.
+ *
+ * @since 2.1
+ */
+ public static const int BUTTON_MASK;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the MOD1 key
+ * was pushed on the keyboard when the event was generated.
+ *
+ * This is the primary keyboard modifier for the platform.
+ *
+ * @since 2.1
+ */
+ public static const int MOD1;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the MOD2 key
+ * was pushed on the keyboard when the event was generated.
+ *
+ * This is the secondary keyboard modifier for the platform.
+ *
+ * @since 2.1
+ */
+ public static const int MOD2;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the MOD3 key
+ * was pushed on the keyboard when the event was generated.
+ *
+ * @since 2.1
+ */
+ public static const int MOD3;
+
+ /**
+ * Keyboard and/or mouse event mask indicating that the MOD4 key
+ * was pushed on the keyboard when the event was generated.
+ *
+ * @since 2.1
+ */
+ public static const int MOD4;
+
+ /**
+ * Constants to indicate line scrolling (value is 1).
+ * Used By:
Control
Used By:
Control
((SWT.MOD1 | SWT.MOD2 | 'T') & SWT.KEYCODE_BIT) != 0
.
+ *
+ * The following expression is true:
+ *
+ * ((SWT.MOD3 | SWT.F2) & SWT.KEYCODE_BIT) != 0
.
+ *
+ * (value is (1<<24))
+ *
+ * @since 2.1
+ */
+ public static const int KEYCODE_BIT = (1 << 24);
+
+ /**
+ * Accelerator constant used to extract the key stroke portion of
+ * an accelerator.
+ *
+ * The key stroke may be a key code or a unicode
+ * value. If the key stroke is a key code KEYCODE_BIT
+ * will be set.
+ *
+ * @since 2.1
+ */
+ public static const int KEY_MASK = KEYCODE_BIT + 0xFFFF;
+
+ /**
+ * Keyboard event constant representing the UP ARROW key
+ * (value is (1<<24)+1).
+ */
+ public static const int ARROW_UP = KEYCODE_BIT + 1;
+
+ /**
+ * Keyboard event constant representing the DOWN ARROW key
+ * (value is (1<<24)+2).
+ */
+ public static const int ARROW_DOWN = KEYCODE_BIT + 2;
+
+ /**
+ * Keyboard event constant representing the LEFT ARROW key
+ * (value is (1<<24)+3).
+ */
+ public static const int ARROW_LEFT = KEYCODE_BIT + 3;
+
+ /**
+ * Keyboard event constant representing the RIGHT ARROW key
+ * (value is (1<<24)+4).
+ */
+ public static const int ARROW_RIGHT = KEYCODE_BIT + 4;
+
+ /**
+ * Keyboard event constant representing the PAGE UP key
+ * (value is (1<<24)+5).
+ */
+ public static const int PAGE_UP = KEYCODE_BIT + 5;
+
+ /**
+ * Keyboard event constant representing the PAGE DOWN key
+ * (value is (1<<24)+6).
+ */
+ public static const int PAGE_DOWN = KEYCODE_BIT + 6;
+
+ /**
+ * Keyboard event constant representing the HOME key
+ * (value is (1<<24)+7).
+ */
+ public static const int HOME = KEYCODE_BIT + 7;
+
+ /**
+ * Keyboard event constant representing the END key
+ * (value is (1<<24)+8).
+ */
+ public static const int END = KEYCODE_BIT + 8;
+
+ /**
+ * Keyboard event constant representing the INSERT key
+ * (value is (1<<24)+9).
+ */
+ public static const int INSERT = KEYCODE_BIT + 9;
+
+ /**
+ * Keyboard event constant representing the F1 key
+ * (value is (1<<24)+10).
+ */
+ public static const int F1 = KEYCODE_BIT + 10;
+
+ /**
+ * Keyboard event constant representing the F2 key
+ * (value is (1<<24)+11).
+ */
+ public static const int F2 = KEYCODE_BIT + 11;
+
+ /**
+ * Keyboard event constant representing the F3 key
+ * (value is (1<<24)+12).
+ */
+ public static const int F3 = KEYCODE_BIT + 12;
+
+ /**
+ * Keyboard event constant representing the F4 key
+ * (value is (1<<24)+13).
+ */
+ public static const int F4 = KEYCODE_BIT + 13;
+
+ /**
+ * Keyboard event constant representing the F5 key
+ * (value is (1<<24)+14).
+ */
+ public static const int F5 = KEYCODE_BIT + 14;
+
+ /**
+ * Keyboard event constant representing the F6 key
+ * (value is (1<<24)+15).
+ */
+ public static const int F6 = KEYCODE_BIT + 15;
+
+ /**
+ * Keyboard event constant representing the F7 key
+ * (value is (1<<24)+16).
+ */
+ public static const int F7 = KEYCODE_BIT + 16;
+
+ /**
+ * Keyboard event constant representing the F8 key
+ * (value is (1<<24)+17).
+ */
+ public static const int F8 = KEYCODE_BIT + 17;
+
+ /**
+ * Keyboard event constant representing the F9 key
+ * (value is (1<<24)+18).
+ */
+ public static const int F9 = KEYCODE_BIT + 18;
+
+ /**
+ * Keyboard event constant representing the F10 key
+ * (value is (1<<24)+19).
+ */
+ public static const int F10 = KEYCODE_BIT + 19;
+
+ /**
+ * Keyboard event constant representing the F11 key
+ * (value is (1<<24)+20).
+ */
+ public static const int F11 = KEYCODE_BIT + 20;
+
+ /**
+ * Keyboard event constant representing the F12 key
+ * (value is (1<<24)+21).
+ */
+ public static const int F12 = KEYCODE_BIT + 21;
+
+ /**
+ * Keyboard event constant representing the F13 key
+ * (value is (1<<24)+22).
+ *
+ * @since 3.0
+ */
+ public static const int F13 = KEYCODE_BIT + 22;
+
+ /**
+ * Keyboard event constant representing the F14 key
+ * (value is (1<<24)+23).
+ *
+ * @since 3.0
+ */
+ public static const int F14 = KEYCODE_BIT + 23;
+
+ /**
+ * Keyboard event constant representing the F15 key
+ * (value is (1<<24)+24).
+ *
+ * @since 3.0
+ */
+ public static const int F15 = KEYCODE_BIT + 24;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad multiply key (value is (1<<24)+42).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_MULTIPLY = KEYCODE_BIT + 42;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad add key (value is (1<<24)+43).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_ADD = KEYCODE_BIT + 43;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad subtract key (value is (1<<24)+45).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_SUBTRACT = KEYCODE_BIT + 45;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad decimal key (value is (1<<24)+46).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_DECIMAL = KEYCODE_BIT + 46;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad divide key (value is (1<<24)+47).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_DIVIDE = KEYCODE_BIT + 47;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad zero key (value is (1<<24)+48).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_0 = KEYCODE_BIT + 48;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad one key (value is (1<<24)+49).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_1 = KEYCODE_BIT + 49;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad two key (value is (1<<24)+50).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_2 = KEYCODE_BIT + 50;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad three key (value is (1<<24)+51).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_3 = KEYCODE_BIT + 51;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad four key (value is (1<<24)+52).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_4 = KEYCODE_BIT + 52;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad five key (value is (1<<24)+53).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_5 = KEYCODE_BIT + 53;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad six key (value is (1<<24)+54).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_6 = KEYCODE_BIT + 54;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad seven key (value is (1<<24)+55).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_7 = KEYCODE_BIT + 55;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad eight key (value is (1<<24)+56).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_8 = KEYCODE_BIT + 56;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad nine key (value is (1<<24)+57).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_9 = KEYCODE_BIT + 57;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad equal key (value is (1<<24)+61).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_EQUAL = KEYCODE_BIT + 61;
+
+ /**
+ * Keyboard event constant representing the numeric key
+ * pad enter key (value is (1<<24)+80).
+ *
+ * @since 3.0
+ */
+ public static const int KEYPAD_CR = KEYCODE_BIT + 80;
+
+ /**
+ * Keyboard event constant representing the help
+ * key (value is (1<<24)+81).
+ *
+ * NOTE: The HELP key maps to the key labeled "help",
+ * not "F1". If your keyboard does not have a HELP key,
+ * you will never see this key press. To listen for
+ * help on a control, use SWT.Help.
+ *
+ * @since 3.0
+ *
+ * @see SWT#Help
+ */
+ public static const int HELP = KEYCODE_BIT + 81;
+
+ /**
+ * Keyboard event constant representing the caps
+ * lock key (value is (1<<24)+82).
+ *
+ * @since 3.0
+ */
+ public static const int CAPS_LOCK = KEYCODE_BIT + 82;
+
+ /**
+ * Keyboard event constant representing the num
+ * lock key (value is (1<<24)+83).
+ *
+ * @since 3.0
+ */
+ public static const int NUM_LOCK = KEYCODE_BIT + 83;
+
+ /**
+ * Keyboard event constant representing the scroll
+ * lock key (value is (1<<24)+84).
+ *
+ * @since 3.0
+ */
+ public static const int SCROLL_LOCK = KEYCODE_BIT + 84;
+
+ /**
+ * Keyboard event constant representing the pause
+ * key (value is (1<<24)+85).
+ *
+ * @since 3.0
+ */
+ public static const int PAUSE = KEYCODE_BIT + 85;
+
+ /**
+ * Keyboard event constant representing the break
+ * key (value is (1<<24)+86).
+ *
+ * @since 3.0
+ */
+ public static const int BREAK = KEYCODE_BIT + 86;
+
+ /**
+ * Keyboard event constant representing the print screen
+ * key (value is (1<<24)+87).
+ *
+ * @since 3.0
+ */
+ public static const int PRINT_SCREEN = KEYCODE_BIT + 87;
+
+ /**
+ * The MessageBox
style constant for error icon
+ * behavior (value is 1).
+ */
+ public static const int ICON_ERROR = 1;
+
+ /**
+ * The MessageBox
style constant for information icon
+ * behavior (value is 1<<1).
+ */
+ public static const int ICON_INFORMATION = 1 << 1;
+
+ /**
+ * The MessageBox
style constant for question icon
+ * behavior (value is 1<<2).
+ */
+ public static const int ICON_QUESTION = 1 << 2;
+
+ /**
+ * The MessageBox
style constant for warning icon
+ * behavior (value is 1<<3).
+ */
+ public static const int ICON_WARNING = 1 << 3;
+
+ /**
+ * The MessageBox
style constant for "working" icon
+ * behavior (value is 1<<4).
+ */
+ public static const int ICON_WORKING = 1 << 4;
+
+ /**
+ * The MessageBox
style constant for an OK button;
+ * valid combinations are OK, OK|CANCEL
+ * (value is 1<<5).
+ */
+ public static const int OK = 1 << 5;
+
+ /**
+ * The MessageBox
style constant for YES button;
+ * valid combinations are YES|NO, YES|NO|CANCEL
+ * (value is 1<<6).
+ */
+ public static const int YES = 1 << 6;
+
+ /**
+ * The MessageBox
style constant for NO button;
+ * valid combinations are YES|NO, YES|NO|CANCEL
+ * (value is 1<<7).
+ */
+ public static const int NO = 1 << 7;
+
+ /**
+ * The MessageBox
style constant for a CANCEL button;
+ * valid combinations are OK|CANCEL, YES|NO|CANCEL, RETRY|CANCEL
+ * (value is 1<<8). This style constant is also used with
+ * Text
in combination with SEARCH.
+ *
+ * Used By:
MessageBox
Text
MessageBox
style constant for an ABORT button;
+ * the only valid combination is ABORT|RETRY|IGNORE
+ * (value is 1<<9).
+ */
+ public static const int ABORT = 1 << 9;
+
+ /**
+ * The MessageBox
style constant for a RETRY button;
+ * valid combinations are ABORT|RETRY|IGNORE, RETRY|CANCEL
+ * (value is 1<<10).
+ */
+ public static const int RETRY = 1 << 10;
+
+ /**
+ * The MessageBox
style constant for an IGNORE button;
+ * the only valid combination is ABORT|RETRY|IGNORE
+ * (value is 1<<11).
+ */
+ public static const int IGNORE = 1 << 11;
+
+ /**
+ * The FileDialog
style constant for open file dialog behavior
+ * (value is 1<<12).
+ */
+ public static const int OPEN = 1 << 12;
+
+ /**
+ * The FileDialog
style constant for save file dialog behavior
+ * (value is 1<<13).
+ */
+ public static const int SAVE = 1 << 13;
+
+ /**
+ * The Composite
constant to indicate that
+ * an attribute (such as background) is not inherited
+ * by the children (value is 0).
+ *
+ * @since 3.2
+ */
+ public static const int INHERIT_NONE = 0;
+
+ /**
+ * The Composite
constant to indicate that
+ * an attribute (such as background) is inherited by
+ * children who choose this value as their "default"
+ * (value is 1). For example, a label child will
+ * typically choose to inherit the background color
+ * of a composite while a list or table will not.
+ *
+ * @since 3.2
+ */
+ public static const int INHERIT_DEFAULT = 1;
+
+ /**
+ * The Composite
constant to indicate that
+ * an attribute (such as background) is inherited by
+ * all children.
+ *
+ * @since 3.2
+ */
+ public static const int INHERIT_FORCE = 2;
+
+ /**
+ * Default color white (value is 1).
+ */
+ public static const int COLOR_WHITE = 1;
+
+ /**
+ * Default color black (value is 2).
+ */
+ public static const int COLOR_BLACK = 2;
+
+ /**
+ * Default color red (value is 3).
+ */
+ public static const int COLOR_RED = 3;
+
+ /**
+ * Default color dark red (value is 4).
+ */
+ public static const int COLOR_DARK_RED = 4;
+
+ /**
+ * Default color green (value is 5).
+ */
+ public static const int COLOR_GREEN = 5;
+
+ /**
+ * Default color dark green (value is 6).
+ */
+ public static const int COLOR_DARK_GREEN = 6;
+
+ /**
+ * Default color yellow (value is 7).
+ */
+ public static const int COLOR_YELLOW = 7;
+
+ /**
+ * Default color dark yellow (value is 8).
+ */
+ public static const int COLOR_DARK_YELLOW = 8;
+
+ /**
+ * Default color blue (value is 9).
+ */
+ public static const int COLOR_BLUE = 9;
+
+ /**
+ * Default color dark blue (value is 10).
+ */
+ public static const int COLOR_DARK_BLUE = 10;
+
+ /**
+ * Default color magenta (value is 11).
+ */
+ public static const int COLOR_MAGENTA = 11;
+
+ /**
+ * Default color dark magenta (value is 12).
+ */
+ public static const int COLOR_DARK_MAGENTA = 12;
+
+ /**
+ * Default color cyan (value is 13).
+ */
+ public static const int COLOR_CYAN = 13;
+
+ /**
+ * Default color dark cyan (value is 14).
+ */
+ public static const int COLOR_DARK_CYAN = 14;
+
+ /**
+ * Default color gray (value is 15).
+ */
+ public static const int COLOR_GRAY = 15;
+
+ /**
+ * Default color dark gray (value is 16).
+ */
+ public static const int COLOR_DARK_GRAY = 16;
+
+ /*
+ * System Colors
+ *
+ * Dealing with system colors is an area where there are
+ * many platform differences. On some platforms, system
+ * colors can change dynamically while the program is
+ * running. On other platforms, system colors can be
+ * changed for all instances of a particular widget.
+ * Therefore, the only truly portable method to obtain
+ * a widget color query is to query the color from an
+ * instance of the widget.
+ *
+ * It is expected that the list of supported colors
+ * will grow over time.
+ */
+
+ /**
+ * System color used to paint dark shadow areas (value is 17).
+ */
+ public static const int COLOR_WIDGET_DARK_SHADOW = 17;
+
+ /**
+ * System color used to paint normal shadow areas (value is 18).
+ */
+ public static const int COLOR_WIDGET_NORMAL_SHADOW = 18;
+
+ /**
+ * System color used to paint light shadow areas (value is 19).
+ */
+ public static const int COLOR_WIDGET_LIGHT_SHADOW = 19;
+
+ /**
+ * System color used to paint highlight shadow areas (value is 20).
+ */
+ public static const int COLOR_WIDGET_HIGHLIGHT_SHADOW = 20;
+
+ /**
+ * System color used to paint foreground areas (value is 21).
+ */
+ public static const int COLOR_WIDGET_FOREGROUND = 21;
+
+ /**
+ * System color used to paint background areas (value is 22).
+ */
+ public static const int COLOR_WIDGET_BACKGROUND = 22;
+
+ /**
+ * System color used to paint border areas (value is 23).
+ */
+ public static const int COLOR_WIDGET_BORDER = 23;
+
+ /**
+ * System color used to paint list foreground areas (value is 24).
+ */
+ public static const int COLOR_LIST_FOREGROUND = 24;
+
+ /**
+ * System color used to paint list background areas (value is 25).
+ */
+ public static const int COLOR_LIST_BACKGROUND = 25;
+
+ /**
+ * System color used to paint list selection background areas (value is 26).
+ */
+ public static const int COLOR_LIST_SELECTION = 26;
+
+ /**
+ * System color used to paint list selected text (value is 27).
+ */
+ public static const int COLOR_LIST_SELECTION_TEXT = 27;
+
+ /**
+ * System color used to paint tooltip text (value is 28).
+ */
+ public static const int COLOR_INFO_FOREGROUND = 28;
+
+ /**
+ * System color used to paint tooltip background areas (value is 29).
+ */
+ public static const int COLOR_INFO_BACKGROUND = 29;
+
+ /**
+ * System color used to paint title text (value is 30).
+ */
+ public static const int COLOR_TITLE_FOREGROUND = 30;
+
+ /**
+ * System color used to paint title background areas (value is 31).
+ */
+ public static const int COLOR_TITLE_BACKGROUND = 31;
+
+ /**
+ * System color used to paint title background gradient (value is 32).
+ */
+ public static const int COLOR_TITLE_BACKGROUND_GRADIENT = 32;
+
+ /**
+ * System color used to paint inactive title text (value is 33).
+ */
+ public static const int COLOR_TITLE_INACTIVE_FOREGROUND = 33;
+
+ /**
+ * System color used to paint inactive title background areas (value is 34).
+ */
+ public static const int COLOR_TITLE_INACTIVE_BACKGROUND = 34;
+
+ /**
+ * System color used to paint inactive title background gradient (value is 35).
+ */
+ public static const int COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT = 35;
+
+ /**
+ * Draw constant indicating whether the drawing operation
+ * should fill the background (value is 1<<0).
+ */
+ public static const int DRAW_TRANSPARENT = 1 << 0;
+
+ /**
+ * Draw constant indicating whether the string drawing operation
+ * should handle line-delimiters (value is 1<<1).
+ */
+ public static const int DRAW_DELIMITER = 1 << 1;
+
+ /**
+ * Draw constant indicating whether the string drawing operation
+ * should expand TAB characters (value is 1<<2).
+ */
+ public static const int DRAW_TAB = 1 << 2;
+
+ /**
+ * Draw constant indicating whether the string drawing operation
+ * should handle mnemonics (value is 1<<3).
+ */
+ public static const int DRAW_MNEMONIC = 1 << 3;
+
+
+ /**
+ * Selection constant indicating that a line delimiter should be
+ * drawn (value is 1<<17).
+ *
+ * Used By:
TextLayout
Used By:
TextLayout
checkSubclass()
method
+ * (value is 43).
+ *
+ * For additional information see the comment in
+ * Widget.checkSubclass()
.
+ *
+ * @see org.eclipse.swt.widgets.Widget#checkSubclass
+ */
+ public static const int ERROR_INVALID_SUBCLASS = 43;
+
+ /**
+ * SWT error constant indicating that an attempt was made to
+ * invoke an SWT operation using a graphics object which had
+ * already been disposed
+ * (value is 44).
+ */
+ public static const int ERROR_GRAPHIC_DISPOSED = 44;
+
+ /**
+ * SWT error constant indicating that an attempt was made to
+ * invoke an SWT operation using a device which had already
+ * been disposed
+ * (value is 45).
+ */
+ public static const int ERROR_DEVICE_DISPOSED = 45;
+
+ /**
+ * SWT error constant indicating that an exception happened
+ * when executing a runnable
+ * (value is 46).
+ */
+ public static const int ERROR_FAILED_EXEC = 46;
+
+ /**
+ * SWT error constant indicating that an unsatisfied link
+ * error occurred while attempting to load a library
+ * (value is 47).
+ *
+ * @since 3.1
+ */
+ public static const int ERROR_FAILED_LOAD_LIBRARY = 47;
+
+ /**
+ * SWT error constant indicating that a font is not valid
+ * (value is 48).
+ *
+ * @since 3.1
+ */
+ public static const int ERROR_INVALID_FONT = 48;
+
+ /**
+ * Constant indicating that an image or operation is of type bitmap (value is 0).
+ */
+ public static const int BITMAP = 0;
+
+ /**
+ * Constant indicating that an image or operation is of type icon (value is 1).
+ */
+ public static const int ICON = 1;
+
+ /**
+ * The Image
constructor argument indicating that
+ * the new image should be a copy of the image provided as
+ * an argument (value is 0).
+ */
+ public static const int IMAGE_COPY = 0;
+
+ /**
+ * The Image
constructor argument indicating that
+ * the new image should have the appearance of a "disabled"
+ * (using the platform's rules for how this should look)
+ * copy of the image provided as an argument (value is 1).
+ */
+ public static const int IMAGE_DISABLE = 1;
+
+ /**
+ * The Image
constructor argument indicating that
+ * the new image should have the appearance of a "gray scaled"
+ * copy of the image provided as an argument (value is 2).
+ */
+ public static const int IMAGE_GRAY = 2;
+
+ /**
+ * The font style constant indicating a normal weight, non-italic font
+ * (value is 0).
+ */
+ public static const int NORMAL = 0;
+
+ /**
+ * The font style constant indicating a bold weight font
+ * (value is 1<<0).
+ */
+ public static const int BOLD = 1 << 0;
+
+ /**
+ * The font style constant indicating an italic font
+ * (value is 1<<1).
+ */
+ public static const int ITALIC = 1 << 1;
+
+ /**
+ * System arrow cursor (value is 0).
+ */
+ public static const int CURSOR_ARROW = 0;
+
+ /**
+ * System wait cursor (value is 1).
+ */
+ public static const int CURSOR_WAIT = 1;
+
+ /**
+ * System cross hair cursor (value is 2).
+ */
+ public static const int CURSOR_CROSS = 2;
+
+ /**
+ * System app startup cursor (value is 3).
+ */
+ public static const int CURSOR_APPSTARTING = 3;
+
+ /**
+ * System help cursor (value is 4).
+ */
+ public static const int CURSOR_HELP = 4;
+
+ /**
+ * System resize all directions cursor (value is 5).
+ */
+ public static const int CURSOR_SIZEALL = 5;
+
+ /**
+ * System resize north-east-south-west cursor (value is 6).
+ */
+ public static const int CURSOR_SIZENESW = 6;
+
+ /**
+ * System resize north-south cursor (value is 7).
+ */
+ public static const int CURSOR_SIZENS = 7;
+
+ /**
+ * System resize north-west-south-east cursor (value is 8).
+ */
+ public static const int CURSOR_SIZENWSE = 8;
+
+ /**
+ * System resize west-east cursor (value is 9).
+ */
+ public static const int CURSOR_SIZEWE = 9;
+
+ /**
+ * System resize north cursor (value is 10).
+ */
+ public static const int CURSOR_SIZEN = 10;
+
+ /**
+ * System resize south cursor (value is 11).
+ */
+ public static const int CURSOR_SIZES = 11;
+
+ /**
+ * System resize east cursor (value is 12).
+ */
+ public static const int CURSOR_SIZEE = 12;
+
+ /**
+ * System resize west cursor (value is 13).
+ */
+ public static const int CURSOR_SIZEW = 13;
+
+ /**
+ * System resize north-east cursor (value is 14).
+ */
+ public static const int CURSOR_SIZENE = 14;
+
+ /**
+ * System resize south-east cursor (value is 15).
+ */
+ public static const int CURSOR_SIZESE = 15;
+
+ /**
+ * System resize south-west cursor (value is 16).
+ */
+ public static const int CURSOR_SIZESW = 16;
+
+ /**
+ * System resize north-west cursor (value is 17).
+ */
+ public static const int CURSOR_SIZENW = 17;
+
+ /**
+ * System up arrow cursor (value is 18).
+ */
+ public static const int CURSOR_UPARROW = 18;
+
+ /**
+ * System i-beam cursor (value is 19).
+ */
+ public static const int CURSOR_IBEAM = 19;
+
+ /**
+ * System "not allowed" cursor (value is 20).
+ */
+ public static const int CURSOR_NO = 20;
+
+ /**
+ * System hand cursor (value is 21).
+ */
+ public static const int CURSOR_HAND = 21;
+
+ /**
+ * Line drawing style for flat end caps (value is 1).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineCap(int)
+ * @see org.eclipse.swt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_FLAT = 1;
+
+ /**
+ * Line drawing style for rounded end caps (value is 2).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineCap(int)
+ * @see org.eclipse.swt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_ROUND = 2;
+
+ /**
+ * Line drawing style for square end caps (value is 3).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineCap(int)
+ * @see org.eclipse.swt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_SQUARE = 3;
+
+ /**
+ * Line drawing style for miter joins (value is 1).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
+ * @see org.eclipse.swt.graphics.GC#getLineJoin()
+ *
+ * @since 3.1
+ */
+ public static const int JOIN_MITER = 1;
+
+ /**
+ * Line drawing style for rounded joins (value is 2).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
+ * @see org.eclipse.swt.graphics.GC#getLineJoin()
+ *
+ * @since 3.1
+ */
+ public static const int JOIN_ROUND = 2;
+
+ /**
+ * Line drawing style for bevel joins (value is 3).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineJoin(int)
+ * @see org.eclipse.swt.graphics.GC#getLineJoin()
+ *
+ * @since 3.1
+ */
+ public static const int JOIN_BEVEL = 3;
+
+ /**
+ * Line drawing style for solid lines (value is 1).
+ */
+ public static const int LINE_SOLID = 1;
+
+ /**
+ * Line drawing style for dashed lines (value is 2).
+ */
+ public static const int LINE_DASH = 2;
+
+ /**
+ * Line drawing style for dotted lines (value is 3).
+ */
+ public static const int LINE_DOT = 3;
+
+ /**
+ * Line drawing style for alternating dash-dot lines (value is 4).
+ */
+ public static const int LINE_DASHDOT = 4;
+
+ /**
+ * Line drawing style for dash-dot-dot lines (value is 5).
+ */
+ public static const int LINE_DASHDOTDOT = 5;
+
+ /**
+ * Line drawing style for custom dashed lines (value is 6).
+ *
+ * @see org.eclipse.swt.graphics.GC#setLineDash(int[])
+ * @see org.eclipse.swt.graphics.GC#getLineDash()
+ *
+ * @since 3.1
+ */
+ public static const int LINE_CUSTOM = 6;
+
+ /**
+ * Path constant that represents a "move to" operation (value is 1).
+ *
+ * @since 3.1
+ */
+ public static const int PATH_MOVE_TO = 1;
+
+ /**
+ * Path constant that represents a "line to" operation (value is 2).
+ *
+ * @since 3.1
+ */
+ public static const int PATH_LINE_TO = 2;
+
+ /**
+ * Path constant that represents a "quadratic curve to" operation (value is 3).
+ *
+ * @since 3.1
+ */
+ public static const int PATH_QUAD_TO = 3;
+
+ /**
+ * Path constant that represents a "cubic curve to" operation (value is 4).
+ *
+ * @since 3.1
+ */
+ public static const int PATH_CUBIC_TO = 4;
+
+ /**
+ * Path constant that represents a "close" operation (value is 5).
+ *
+ * @since 3.1
+ */
+ public static const int PATH_CLOSE = 5;
+
+ /**
+ * Even odd rule for filling operations (value is 1).
+ *
+ * @since 3.1
+ */
+ public static const int FILL_EVEN_ODD = 1;
+
+ /**
+ * Winding rule for filling operations (value is 2).
+ *
+ * @since 3.1
+ */
+ public static const int FILL_WINDING = 2;
+
+ /**
+ * Image format constant indicating an unknown image type (value is -1).
+ */
+ public static const int IMAGE_UNDEFINED = -1;
+
+ /**
+ * Image format constant indicating a Windows BMP format image (value is 0).
+ */
+ public static const int IMAGE_BMP = 0;
+
+ /**
+ * Image format constant indicating a run-length encoded
+ * Windows BMP format image (value is 1).
+ */
+ public static const int IMAGE_BMP_RLE = 1;
+
+ /**
+ * Image format constant indicating a GIF format image (value is 2).
+ */
+ public static const int IMAGE_GIF = 2;
+
+ /**
+ * Image format constant indicating a ICO format image (value is 3).
+ */
+ public static const int IMAGE_ICO = 3;
+
+ /**
+ * Image format constant indicating a JPEG format image (value is 4).
+ */
+ public static const int IMAGE_JPEG = 4;
+
+ /**
+ * Image format constant indicating a PNG format image (value is 5).
+ */
+ public static const int IMAGE_PNG = 5;
+
+ /**
+ * Image format constant indicating a TIFF format image (value is 6).
+ */
+ public static const int IMAGE_TIFF = 6;
+
+ /**
+ * Image format constant indicating an OS/2 BMP format image (value is 7).
+ */
+ public static const int IMAGE_OS2_BMP = 7;
+
+ /**
+ * GIF image disposal method constants indicating that the
+ * disposal method is unspecified (value is 0).
+ */
+ public static const int DM_UNSPECIFIED = 0x0;
+
+ /**
+ * GIF image disposal method constants indicating that the
+ * disposal method is to do nothing; that is, to leave the
+ * previous image in place (value is 1).
+ */
+ public static const int DM_FILL_NONE = 0x1;
+
+ /**
+ * GIF image disposal method constants indicating that the
+ * the previous images should be covered with the background
+ * color before displaying the next image (value is 2).
+ */
+ public static const int DM_FILL_BACKGROUND = 0x2;
+
+ /**
+ * GIF image disposal method constants indicating that the
+ * disposal method is to restore the previous picture
+ * (value is 3).
+ */
+ public static const int DM_FILL_PREVIOUS = 0x3;
+
+ /**
+ * Image transparency constant indicating that the image
+ * contains no transparency information (value is 0).
+ */
+ public static const int TRANSPARENCY_NONE = 0x0;
+
+ /**
+ * Image transparency constant indicating that the image
+ * contains alpha transparency information (value is 1<<0).
+ */
+ public static const int TRANSPARENCY_ALPHA = 1 << 0;
+
+ /**
+ * Image transparency constant indicating that the image
+ * contains a transparency mask (value is 1<<1).
+ */
+ public static const int TRANSPARENCY_MASK = 1 << 1;
+
+ /**
+ * Image transparency constant indicating that the image
+ * contains a transparent pixel (value is 1<<2).
+ */
+ public static const int TRANSPARENCY_PIXEL = 1 << 2;
+
+ /**
+ * The character movement type (value is 1<<0).
+ * This constant is used to move a text offset over a character.
+ *
+ * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
+ * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.0
+ */
+ public static const int MOVEMENT_CHAR = 1 << 0;
+
+ /**
+ * The cluster movement type (value is 1<<1).
+ * This constant is used to move a text offset over a cluster.
+ * A cluster groups one or more characters. A cluster is
+ * undivisible, this means that a caret offset can not be placed in the
+ * middle of a cluster.
+ *
+ * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
+ * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.0
+ */
+ public static const int MOVEMENT_CLUSTER = 1 << 1;
+
+ /**
+ * The word movement type (value is 1<<2).
+ * This constant is used to move a text offset over a word.
+ * The behavior of this constant depends on the platform and on the
+ * direction of the movement. For example, on Windows the stop is
+ * always at the start of the word. On GTK and Mac the stop is at the end
+ * of the word if the direction is next and at the start of the word if the
+ * direction is previous.
+ *
+ * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
+ * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.0
+ */
+ public static const int MOVEMENT_WORD = 1 << 2;
+
+ /**
+ * The word end movement type (value is 1<<3).
+ * This constant is used to move a text offset to the next or previous
+ * word end. The behavior of this constant does not depend on the platform.
+ *
+ *
+ * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
+ * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.3
+ */
+ public static const int MOVEMENT_WORD_END = 1 << 3;
+
+ /**
+ * The word start movement type (value is 1<<4).
+ * This constant is used to move a text offset to the next or previous
+ * word start. The behavior of this constant does not depend on the platform.
+ *
+ * @see org.eclipse.swt.graphics.TextLayout#getNextOffset(int, int)
+ * @see org.eclipse.swt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.3
+ */
+ public static const int MOVEMENT_WORD_START = 1 << 4;
+
+
+/**
+ * Answers a concise, human readable description of the error code.
+ *
+ * @param code the SWT error code.
+ * @return a description of the error code.
+ *
+ * @see SWT
+ */
+static char[] findErrorText (int code) {
+ switch (code) {
+ case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$
+ case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$
+ case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$
+ case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$
+ case ERROR_INVALID_ARGUMENT: return "Argument not valid"; //$NON-NLS-1$
+ case ERROR_INVALID_RANGE: return "Index out of bounds"; //$NON-NLS-1$
+ case ERROR_CANNOT_BE_ZERO: return "Argument cannot be zero"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_ITEM: return "Cannot get item"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_SELECTION: return "Cannot get selection"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_ITEM_HEIGHT: return "Cannot get item height"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_TEXT: return "Cannot get text"; //$NON-NLS-1$
+ case ERROR_CANNOT_SET_TEXT: return "Cannot set text"; //$NON-NLS-1$
+ case ERROR_ITEM_NOT_ADDED: return "Item not added"; //$NON-NLS-1$
+ case ERROR_ITEM_NOT_REMOVED: return "Item not removed"; //$NON-NLS-1$
+ case ERROR_NOT_IMPLEMENTED: return "Not implemented"; //$NON-NLS-1$
+ case ERROR_MENU_NOT_DROP_DOWN: return "Menu must be a drop down"; //$NON-NLS-1$
+ case ERROR_THREAD_INVALID_ACCESS: return "Invalid thread access"; //$NON-NLS-1$
+ case ERROR_WIDGET_DISPOSED: return "Widget is disposed"; //$NON-NLS-1$
+ case ERROR_MENUITEM_NOT_CASCADE: return "Menu item is not a CASCADE"; //$NON-NLS-1$
+ case ERROR_CANNOT_SET_SELECTION: return "Cannot set selection"; //$NON-NLS-1$
+ case ERROR_CANNOT_SET_MENU: return "Cannot set menu"; //$NON-NLS-1$
+ case ERROR_CANNOT_SET_ENABLED: return "Cannot set the enabled state"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_ENABLED: return "Cannot get the enabled state"; //$NON-NLS-1$
+ case ERROR_INVALID_PARENT: return "Widget has the wrong parent"; //$NON-NLS-1$
+ case ERROR_MENU_NOT_BAR: return "Menu is not a BAR"; //$NON-NLS-1$
+ case ERROR_CANNOT_GET_COUNT: return "Cannot get count"; //$NON-NLS-1$
+ case ERROR_MENU_NOT_POP_UP: return "Menu is not a POP_UP"; //$NON-NLS-1$
+ case ERROR_UNSUPPORTED_DEPTH: return "Unsupported color depth"; //$NON-NLS-1$
+ case ERROR_IO: return "i/o error"; //$NON-NLS-1$
+ case ERROR_INVALID_IMAGE: return "Invalid image"; //$NON-NLS-1$
+ case ERROR_UNSUPPORTED_FORMAT: return "Unsupported or unrecognized format"; //$NON-NLS-1$
+ case ERROR_INVALID_SUBCLASS: return "Subclassing not allowed"; //$NON-NLS-1$
+ case ERROR_GRAPHIC_DISPOSED: return "Graphic is disposed"; //$NON-NLS-1$
+ case ERROR_DEVICE_DISPOSED: return "Device is disposed"; //$NON-NLS-1$
+ case ERROR_FAILED_EXEC: return "Failed to execute runnable"; //$NON-NLS-1$
+ case ERROR_FAILED_LOAD_LIBRARY: return "Unable to load library"; //$NON-NLS-1$
+ case ERROR_CANNOT_INVERT_MATRIX: return "Cannot invert matrix"; //$NON-NLS-1$
+ case ERROR_NO_GRAPHICS_LIBRARY: return "Unable to load graphics library"; //$NON-NLS-1$
+ case ERROR_INVALID_FONT: return "Font not valid"; //$NON-NLS-1$
+ }
+ return "Unknown error"; //$NON-NLS-1$
+}
+
+/++
+/**
+ * Returns the NLS'ed message for the given argument.
+ *
+ * @param key the key to look up
+ * @return the message for the given key
+ *
+ * @exception IllegalArgumentException throwable
argument should be either null, or the
+ * throwable which caused SWT to throw an exception.
+ * + * In SWT, errors are reported by throwing one of three exceptions: + *
throwable
argument should be either null, or the
+ * throwable which caused SWT to throw an exception.
+ * + * In SWT, errors are reported by throwing one of three exceptions: + *
throwable
field which holds the underlying
+ * throwable that caused the problem (if this information is
+ * available (i.e. it may be null)).
+ * + * SWTErrors are thrown when something fails internally which + * either leaves SWT in an unknown state (eg. the o/s call to + * remove an item from a list returns an error code) or when SWT + * is left in a known-to-be-unrecoverable state (eg. it runs out + * of callback resources). SWTErrors should not occur in typical + * programs, although "high reliability" applications should + * still catch them. + *
+ * This class also provides support methods used by SWT to match + * error codes to the appropriate exception class (SWTError, + * SWTException, or IllegalArgumentException) and to provide + * human readable strings for SWT error codes. + *
+ * + * @see SWTException + * @see SWT#error(int) + */ + +public class SWTError : PlatformException { + /** + * The SWT error code, one of SWT.ERROR_*. + */ + public int code; + + /** + * The underlying throwable that caused the problem, + * or null if this information is not available. + */ + public TracedException throwable; + + //static final long serialVersionUID = 3833467327105808433L; + +/** + * Constructs a new instance of this class with its + * stack trace filled in. The error code is set to an + * unspecified value. + */ +public this () { + this (SWT.ERROR_UNSPECIFIED); +} + +/** + * Constructs a new instance of this class with its + * stack trace and message filled in. The error code is + * set to an unspecified value. Specifyingnull
+ * as the message is equivalent to specifying an empty string.
+ *
+ * @param message the detail message for the exception
+ */
+public this (char[] message) {
+ this (SWT.ERROR_UNSPECIFIED, message);
+}
+
+/**
+ * Constructs a new instance of this class with its
+ * stack trace and error code filled in.
+ *
+ * @param code the SWT error code
+ */
+public this (int code) {
+ this (code, SWT.findErrorText (code));
+}
+
+/**
+ * Constructs a new instance of this class with its
+ * stack trace, error code and message filled in.
+ * Specifying null
as the message is
+ * equivalent to specifying an empty string.
+ *
+ * @param code the SWT error code
+ * @param message the detail message for the exception
+ */
+public this (int code, char[] message) {
+ super (message);
+ this.code = code;
+}
+
+/**
+ * Returns the underlying throwable that caused the problem,
+ * or null if this information is not available.
+ * + * NOTE: This method overrides Throwable.getCause() that was + * added to JDK1.4. It is necessary to override this method + * in order for inherited printStackTrace() methods to work. + *
+ * @return the underlying throwable + * + * @since 3.1 + */ +public Exception getCause() { + return throwable; +} + +/** + * Returns the string describing this SWTError object. + *+ * It is combined with the message string of the Throwable + * which caused this SWTError (if this information is available). + *
+ * @return the error message string of this SWTError object + */ +public char[] getMessage () { + if (throwable is null) + return super.toString(); + return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$ +} + +/** + * Outputs a printable representation of this error's + * stack trace on the standard error stream. + *+ * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter) + * are not provided in order to maintain compatibility with CLDC. + *
+ */ +public void printStackTrace () { + Stderr.formatln( "stacktrace follows (if feature compiled in)" ); + foreach( msg; this ){ + Stderr.formatln( "{}", msg ); + } + if ( throwable !is null) { + Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$ + foreach( msg; throwable ){ + Stderr.formatln( "{}", msg ); + } + } +} + +} diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/SWTException.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/eclipse/swt/SWTException.d Sat Jan 05 00:29:12 2008 +0100 @@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module org.eclipse.swt.SWTException; + +import org.eclipse.swt.SWT; + +import tango.core.Exception; +import tango.io.Stdout; + +/** + * This runtime exception is thrown whenever a recoverable error + * occurs internally in SWT. The message text and error code + * provide a further description of the problem. The exception + * has athrowable
field which holds the underlying
+ * exception that caused the problem (if this information is
+ * available (i.e. it may be null)).
+ * + * SWTExceptions are thrown when something fails internally, + * but SWT is left in a known stable state (eg. a widget call + * was made from a non-u/i thread, or there is failure while + * reading an Image because the source file was corrupt). + *
+ * + * @see SWTError + */ + +public class SWTException : TracedException { + /** + * The SWT error code, one of SWT.ERROR_*. + */ + public int code; + + /** + * The underlying throwable that caused the problem, + * or null if this information is not available. + */ + public TracedException throwable; + + //static final long serialVersionUID = 3257282552304842547L; + +/** + * Constructs a new instance of this class with its + * stack trace filled in. The error code is set to an + * unspecified value. + */ +public this () { + this (SWT.ERROR_UNSPECIFIED); +} + +/** + * Constructs a new instance of this class with its + * stack trace and message filled in. The error code is + * set to an unspecified value. Specifyingnull
+ * as the message is equivalent to specifying an empty string.
+ *
+ * @param message the detail message for the exception
+ */
+public this (char[] message) {
+ this (SWT.ERROR_UNSPECIFIED, message);
+}
+
+/**
+ * Constructs a new instance of this class with its
+ * stack trace and error code filled in.
+ *
+ * @param code the SWT error code
+ */
+public this (int code) {
+ this (code, SWT.findErrorText (code));
+}
+
+/**
+ * Constructs a new instance of this class with its
+ * stack trace, error code and message filled in.
+ * Specifying null
as the message is
+ * equivalent to specifying an empty string.
+ *
+ * @param code the SWT error code
+ * @param message the detail message for the exception
+ */
+public this (int code, char[] message) {
+ super (message);
+ this.code = code;
+}
+
+/**
+ * Returns the underlying throwable that caused the problem,
+ * or null if this information is not available.
+ * + * NOTE: This method overrides Throwable.getCause() that was + * added to JDK1.4. It is necessary to override this method + * in order for inherited printStackTrace() methods to work. + *
+ * @return the underlying throwable + * + * @since 3.1 + */ +public TracedException getCause() { + return throwable; +} + +/** + * Returns the string describing this SWTException object. + *+ * It is combined with the message string of the Throwable + * which caused this SWTException (if this information is available). + *
+ * @return the error message string of this SWTException object + */ +public char[] getMessage () { + if (throwable is null) return super.toString (); + return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$ +} + +/** + * Outputs a printable representation of this exception's + * stack trace on the standard error stream. + *+ * Note: printStackTrace(PrintStream) and printStackTrace(PrintWriter) + * are not provided in order to maintain compatibility with CLDC. + *
+ */ +public void printStackTrace () { + Stderr.formatln( "stacktrace follows (if feature compiled in)" ); + foreach( msg; this ){ + Stderr.formatln( "{}", msg ); + } + if ( throwable !is null) { + Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$ + foreach( msg; throwable ){ + Stderr.formatln( "{}", msg ); + } + } +} + +} + + diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/Compatibility.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/eclipse/swt/internal/Compatibility.d Sat Jan 05 00:29:12 2008 +0100 @@ -0,0 +1,348 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module org.eclipse.swt.internal.Compatibility; + +/+ +import java.io.*; +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.zip.InflaterInputStream; ++/ + +import Math = tango.math.Math; +import Unicode = tango.text.Unicode; +import tango.sys.Process; + +import org.eclipse.swt.SWT; + +/** + * This class is a placeholder for utility methods commonly + * used on J2SE platforms but not supported on some J2ME + * profiles. + *+ * It is part of our effort to provide support for both J2SE + * and J2ME platforms. + *
+ *+ * IMPORTANT: some of the methods have been modified from their + * J2SE parents. Refer to the description of each method for + * specific changes. + *
+ *+ * IMPORTANT: the j2me version has an additional restriction on + * the argument. length must be between -32767 and 32767 (inclusive). + *
+ * + * @param angle the angle in degrees + * @param length the length of the triangle's hypotenuse + * @return the integer conversion of length * cos (angle) + */ +public static int cos(int angle, int length) { + return cast(int)(Math.cos(angle * toRadians) * length); +} + +/** + * Answers the length of the side opposite to the given angle + * of a right triangle. In other words, it returns the integer + * conversion of length * sin (angle). + *+ * IMPORTANT: the j2me version has an additional restriction on + * the argument. length must be between -32767 and 32767 (inclusive). + *
+ * + * @param angle the angle in degrees + * @param length the length of the triangle's hypotenuse + * @return the integer conversion of length * sin (angle) + */ +public static int sin(int angle, int length) { + return cast(int)(Math.sin(angle * toRadians) * length); +} + +/** + * Answers the most negative (i.e. closest to negative infinity) + * integer value which is greater than the number obtained by dividing + * the first argument p by the second argument q. + * + * @param p numerator + * @param q denominator (must be different from zero) + * @return the ceiling of the rational number p / q. + */ +public static int ceil(int p, int q) { + return cast(int)Math.ceil(cast(float)p / q); +} + +/** + * Answers the most positive (i.e. closest to positive infinity) + * integer value which is less than the number obtained by dividing + * the first argument p by the second argument q. + * + * @param p numerator + * @param q denominator (must be different from zero) + * @return the floor of the rational number p / q. + */ +public static int floor(int p, int q) { + return cast(int)Math.floor(cast(double)p / q); +} + +/** + * Answers the result of rounding to the closest integer the number obtained + * by dividing the first argument p by the second argument q. + *+ * IMPORTANT: the j2me version has an additional restriction on + * the arguments. p must be within the range 0 - 32767 (inclusive). + * q must be within the range 1 - 32767 (inclusive). + *
+ * + * @param p numerator + * @param q denominator (must be different from zero) + * @return the closest integer to the rational number p / q + */ +public static int round(int p, int q) { + return cast(int)Math.round(cast(float)p / q); +} + +/** + * Returns 2 raised to the power of the argument. + * + * @param n an int value between 0 and 30 (inclusive) + * @return 2 raised to the power of the argument + * + * @exception IllegalArgumentExceptionnull
+ * @exception IOException
+ *
+ * @since 3.3
+ */
+public static InputStream newInflaterInputStream(InputStream stream) throws IOException {
+ return new InflaterInputStream(stream);
+}
+++/
+/**
+ * Answers whether the character is a letter.
+ *
+ * @param c the character
+ * @return true when the character is a letter
+ */
+public static bool isLetter(dchar c) {
+ return Unicode.isLetter(c);
+}
+
+/**
+ * Answers whether the character is a letter or a digit.
+ *
+ * @param c the character
+ * @return true when the character is a letter or a digit
+ */
+public static bool isLetterOrDigit(dchar c) {
+ return Unicode.isLetterOrDigit(c);
+}
+
+/**
+ * Answers whether the character is a Unicode space character.
+ *
+ * @param c the character
+ * @return true when the character is a Unicode space character
+ */
+public static bool isSpaceChar(dchar c) {
+ return Unicode.isSpace(c);
+}
+
+/**
+ * Answers whether the character is a whitespace character.
+ *
+ * @param c the character to test
+ * @return true if the character is whitespace
+ */
+public static bool isWhitespace(dchar c) {
+ return Unicode.isWhitespace(c);
+}
+
+/**
+ * Execute a program in a separate platform process if the
+ * underlying platform support this.
+ * + * The new process inherits the environment of the caller. + *
+ * + * @param prog the name of the program to execute + * + * @exception ProcessException + * if the program cannot be executed + */ +public static void exec(char[] prog) { + auto proc = new Process( prog ); + proc.execute; +} + +/** + * Execute progArray[0] in a separate platform process if the + * underlying platform support this. + *+ * The new process inherits the environment of the caller. + *
+ * + * @param progArray array containing the program to execute and its arguments + * + * @exception ProcessException + * if the program cannot be executed + */ +public static void exec(char[][] progArray) { + auto proc = new Process( progArray ); + proc.execute; +} +/++ PORTING_LEFT +private static ResourceBundle msgs = null; + +/** + * Returns the NLS'ed message for the given argument. This is only being + * called from SWT. + * + * @param key the key to look up + * @return the message for the given key + * + * @see SWT#getMessage(String) + */ +public static String getMessage(String key) { + String answer = key; + + if (key == null) { + SWT.error (SWT.ERROR_NULL_ARGUMENT); + } + if (msgs == null) { + try { + msgs = ResourceBundle.getBundle("org.eclipse.swt.internal.SWTMessages"); //$NON-NLS-1$ + } catch (MissingResourceException ex) { + answer = key + " (no resource bundle)"; //$NON-NLS-1$ + } + } + if (msgs != null) { + try { + answer = msgs.getString(key); + } catch (MissingResourceException ex2) {} + } + return answer; +} + +public static String getMessage(String key, Object[] args) { + String answer = key; + + if (key == null || args == null) { + SWT.error (SWT.ERROR_NULL_ARGUMENT); + } + if (msgs == null) { + try { + msgs = ResourceBundle.getBundle("org.eclipse.swt.internal.SWTMessages"); //$NON-NLS-1$ + } catch (MissingResourceException ex) { + answer = key + " (no resource bundle)"; //$NON-NLS-1$ + } + } + if (msgs != null) { + try { + MessageFormat formatter = new MessageFormat(""); + formatter.applyPattern(msgs.getString(key)); + answer = formatter.format(args); + } catch (MissingResourceException ex2) {} + } + return answer; +} + +/** + * Interrupt the current thread. + *
+ * Note that this is not available on CLDC. + *
+ */ +public static void interrupt() { + Thread.currentThread().interrupt(); +} +++/ +/** + * Compares two instances of class String ignoring the case of the + * characters and answers if they are equal. + * + * @param s1 string + * @param s2 string + * @return true if the two instances of class String are equal + */ +public static bool equalsIgnoreCase(char[] s1, char[] s2) { + char[] s1b = new char[ s1.length ]; + char[] s2b = new char[ s1.length ]; + scope(exit){ + delete s1b; + delete s2b; + } + char[] s1c = Unicode.toFold( s1, s1b ); + char[] s2c = Unicode.toFold( s2, s2b ); + return s1c == s2c; +} + +} diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/Converter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/eclipse/swt/internal/Converter.d Sat Jan 05 00:29:12 2008 +0100 @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module org.eclipse.swt.internal.Converter; + + +//import org.eclipse.swt.internal.gtk.OS; +import tango.stdc.stringz; + +extern(C) { + struct GError{}; + char* g_utf16_to_utf8 ( wchar *str, + int len, + int *items_read, + int *items_written, + GError **error); + wchar* g_utf8_to_utf16 ( char *str, + int len, + int *items_read, + int *items_written, + GError **error); + void g_free (void* ptr ); +} + +/** + * This class implements the conversions between unicode characters + * and the platform supported representation for characters. + *+ * Note that, unicode characters which can not be found in the platform + * encoding will be converted to an arbitrary platform specific character. + *
+ */ +public final class Converter { + public static const char [] NullByteArray = "\0"; + public static const char [] EmptyByteArray = ""; + public static const wchar [] EmptyCharArray = ""; + +/** + * Returns the default code page for the platform where the + * application is currently running. + * + * @return the default code page + */ +public static char[] defaultCodePage () { + return "UTF8"; +} + +public static wchar [] mbcsToWcs (char[] codePage, char [] buffer) { + int items_written; + wchar* ptr = g_utf8_to_utf16 (toStringz(buffer), buffer.length, null, &items_written, null); + if (!ptr){ + return EmptyCharArray; + } + wchar[] chars = ptr[ 0 .. items_written].dup; + g_free (ptr); + return chars; +} + +/+ +public static char [] wcsToMbcs (char[] codePage, String str, bool terminate) { + int length = str.length (); + wchar [] buffer = new wchar [length]; + string.getChars (0, length, buffer, 0); + return wcsToMbcs (codePage, buffer, terminate); +} ++/ + +public static char [] wcsToMbcs (char[] codePage, wchar [] buffer, bool terminate) { + int items_read, items_written; + /* + * Note that g_utf16_to_utf8() stops converting + * when it finds the first NULL. + */ + char* ptr = g_utf16_to_utf8 (toString16z(buffer), buffer.length, & items_read, & items_written, null); + if (!ptr) { + return terminate ? NullByteArray : EmptyByteArray; + } + char [] bytes = new char [items_written + (terminate ? 1 : 0)]; + bytes[ 0 .. items_written ] = ptr[ 0 .. items_written ]; + if( terminate ){ + bytes[ items_written ] = 0; + } + g_free (ptr); + return bytes; +} + +} diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/LONG.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/eclipse/swt/internal/LONG.d Sat Jan 05 00:29:12 2008 +0100 @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module org.eclipse.swt.internal.LONG; + +public class LONG { + public int /*long*/ value; + + public this (int /*long*/ value) { + this.value = value; + } + + public int opEquals (Object object) { + if (object is this){ + return true; + } + if ( auto obj = cast(LONG)object ) { + return obj.value == this.value; + } + return false; + } + + public int hashCode () { + return /*64*/value; + } +} diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/Library.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org/eclipse/swt/internal/Library.d Sat Jan 05 00:29:12 2008 +0100 @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module org.eclipse.swt.internal.Library; + +import tango.util.Convert; + +public class Library { + + /* SWT Version - Mmmm (M=major, mmm=minor) */ + + /** + * SWT Major version number (must be >= 0) + */ + static const int MAJOR_VERSION = 3; + + /** + * SWT Minor version number (must be in the range 0..999) + */ + static const int MINOR_VERSION = 346; + + /** + * SWT revision number (must be >= 0) + */ + static const int REVISION = 0; + + /** + * The JAVA and SWT versions + */ + //public static const int JAVA_VERSION; + public static const int SWT_VERSION; + + version( linux ){ + static const char[] SEPARATOR = "\n"; + } + else { + static assert( false, "only linux supported for this port" ); + } + + +static this(){ + //SEPARATOR = System.getProperty("file.separator"); + //JAVA_VERSION = parseVersion(System.getProperty("java.version")); + SWT_VERSION = buildSWT_VERSION(MAJOR_VERSION, MINOR_VERSION); +} + +static int parseVersion(char[] aVersion) { + if (aVersion == null) return 0; + int major = 0, minor = 0, micro = 0; + int length = aVersion.length, index = 0, start = 0; + bool isDigit( char c ){ + return c >= '0' && c <= '9'; + } + while (index < length && isDigit(aVersion[index])) index++; + try { + if (start < length) major = to!(int)( aVersion[start .. index] ); + } catch (ConversionException e) {} + start = ++index; + while (index < length && isDigit(aVersion[index])) index++; + try { + if (start < length) minor = to!(int)(aVersion[start .. index]); + } catch (ConversionException e) {} + start = ++index; + while (index < length && isDigit(aVersion[index])) index++; + try { + if (start < length) micro = to!(int)(aVersion[start .. index]); + } catch (ConversionException e) {} + return buildJAVA_VERSION(major, minor, micro); +} + +/** + * Returns the Java version number as an integer. + * + * @param major + * @param minor + * @param micro + * @return the version + */ +public static int buildJAVA_VERSION (int major, int minor, int micro) { + return (major << 16) + (minor << 8) + micro; +} + +/** + * Returns the SWT version number as an integer. + * + * @param major + * @param minor + * @return the version + */ +public static int buildSWT_VERSION (int major, int minor) { + return major * 1000 + minor; +} +/+ PORTING_LEFT +static bool extract (char[] fileName, char[] mappedName) { + FileOutputStream os = null; + InputStream is = null; + File file = new File(fileName); + try { + if (!file.exists ()) { + is = Library.class.getResourceAsStream ("/" + mappedName); //$NON-NLS-1$ + if (is != null) { + int read; + byte [] buffer = new byte [4096]; + os = new FileOutputStream (fileName); + while ((read = is.read (buffer)) != -1) { + os.write(buffer, 0, read); + } + os.close (); + is.close (); + if (!Platform.PLATFORM.equals ("win32")) { //$NON-NLS-1$ + try { + Runtime.getRuntime ().exec (new String []{"chmod", "755", fileName}).waitFor(); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (Throwable e) {} + } + if (load (fileName)) return true; + } + } + } catch (Throwable e) { + try { + if (os != null) os.close (); + } catch (IOException e1) {} + try { + if (is != null) is.close (); + } catch (IOException e1) {} + } + if (file.exists ()) file.delete (); + return false; +} + +static bool load (char[] libName) { + try { + if (libName.indexOf (SEPARATOR) != -1) { + System.load (libName); + } else { + System.loadLibrary (libName); + } + return true; + } catch (UnsatisfiedLinkError e) {} + return false; +} + +/** + * Loads the shared library that matches the version of the + * Java code which is currently running. SWT shared libraries + * follow an encoding scheme where the major, minor and revision + * numbers are embedded in the library name and this along with + *name
is used to load the library. If this fails,
+ * name
is used in another attempt to load the library,
+ * this time ignoring the SWT version encoding scheme.
+ *
+ * @param name the name of the library to load
+ */
+public static void loadLibrary (char[] name) {
+ loadLibrary (name, true);
+}
+
+/**
+ * Loads the shared library that matches the version of the
+ * Java code which is currently running. SWT shared libraries
+ * follow an encoding scheme where the major, minor and revision
+ * numbers are embedded in the library name and this along with
+ * name
is used to load the library. If this fails,
+ * name
is used in another attempt to load the library,
+ * this time ignoring the SWT version encoding scheme.
+ *
+ * @param name the name of the library to load
+ * @param mapName true if the name should be mapped, false otherwise
+ */
+public static void loadLibrary (char[] name, boolean mapName) {
+
+ /* Compute the library name and mapped name */
+ String libName1, libName2, mappedName1, mappedName2;
+ if (mapName) {
+ String version = System.getProperty ("swt.version"); //$NON-NLS-1$
+ if (version == null) {
+ version = "" + MAJOR_VERSION; //$NON-NLS-1$
+ /* Force 3 digits in minor version number */
+ if (MINOR_VERSION < 10) {
+ version += "00"; //$NON-NLS-1$
+ } else {
+ if (MINOR_VERSION < 100) version += "0"; //$NON-NLS-1$
+ }
+ version += MINOR_VERSION;
+ /* No "r" until first revision */
+ if (REVISION > 0) version += "r" + REVISION; //$NON-NLS-1$
+ }
+ libName1 = name + "-" + Platform.PLATFORM + "-" + version; //$NON-NLS-1$ //$NON-NLS-2$
+ libName2 = name + "-" + Platform.PLATFORM; //$NON-NLS-1$
+ mappedName1 = System.mapLibraryName (libName1);
+ mappedName2 = System.mapLibraryName (libName2);
+ } else {
+ libName1 = libName2 = mappedName1 = mappedName2 = name;
+ }
+
+ /* Try loading library from swt library path */
+ String path = System.getProperty ("swt.library.path"); //$NON-NLS-1$
+ if (path != null) {
+ path = new File (path).getAbsolutePath ();
+ if (load (path + SEPARATOR + mappedName1)) return;
+ if (mapName && load (path + SEPARATOR + mappedName2)) return;
+ }
+
+ /* Try loading library from java library path */
+ if (load (libName1)) return;
+ if (mapName && load (libName2)) return;
+
+ /* Try loading library from the tmp directory if swt library path is not specified */
+ if (path == null) {
+ path = System.getProperty ("java.io.tmpdir"); //$NON-NLS-1$
+ path = new File (path).getAbsolutePath ();
+ if (load (path + SEPARATOR + mappedName1)) return;
+ if (mapName && load (path + SEPARATOR + mappedName2)) return;
+ }
+
+ /* Try extracting and loading library from jar */
+ if (path != null) {
+ if (extract (path + SEPARATOR + mappedName1, mappedName1)) return;
+ if (mapName && extract (path + SEPARATOR + mappedName2, mappedName2)) return;
+ }
+
+ /* Failed to find the library */
+ throw new UnsatisfiedLinkError ("no " + libName1 + " or " + libName2 + " in swt.library.path, java.library.path or the jar file"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+}
++/
+}
diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/Lock.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org/eclipse/swt/internal/Lock.d Sat Jan 05 00:29:12 2008 +0100
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module org.eclipse.swt.internal.Lock;
+
+import tango.core.Thread;
+import tango.core.sync.Mutex;
+import tango.core.sync.Condition;
+
+/**
+ * Instance of this represent a recursive monitor.
+ */
+public class Lock {
+ int count, waitCount;
+ Thread owner;
+ Mutex mutex;
+ Condition cond;
+
+ public this(){
+ mutex = new Mutex;
+ cond = new Condition(mutex);
+ }
+/**
+ * Locks the monitor and returns the lock count. If
+ * the lock is owned by another thread, wait until
+ * the lock is released.
+ *
+ * @return the lock count
+ */
+public int lock() {
+ synchronized (mutex) {
+ Thread current = Thread.getThis();
+ if (owner != current) {
+ waitCount++;
+ while (count > 0) {
+ try {
+ cond.wait();
+ } catch (SyncException e) {
+ /* Wait forever, just like synchronized blocks */
+ }
+ }
+ --waitCount;
+ owner = current;
+ }
+ return ++count;
+ }
+}
+
+/**
+ * Unlocks the monitor. If the current thread is not
+ * the monitor owner, do nothing.
+ */
+public void unlock() {
+ synchronized (mutex) {
+ Thread current = Thread.getThis();
+ if (owner == current) {
+ if (--count == 0) {
+ owner = null;
+ if (waitCount > 0) cond.notifyAll();
+ }
+ }
+ }
+}
+}
diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/Platform.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org/eclipse/swt/internal/Platform.d Sat Jan 05 00:29:12 2008 +0100
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+module org.eclipse.swt.internal.Platform;
+
+import org.eclipse.swt.internal.Lock;
+
+public class Platform {
+ public static const char[] PLATFORM = "gtk"; //$NON-NLS-1$
+ public static const Lock lock;
+ static this(){
+ lock = new Lock();
+ }
+}
diff -r 000000000000 -r c8ad75f8819e org/eclipse/swt/internal/SWTMessages.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org/eclipse/swt/internal/SWTMessages.properties Sat Jan 05 00:29:12 2008 +0100
@@ -0,0 +1,73 @@
+###############################################################################
+# Copyright (c) 2000, 2006 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+SWT_Yes=Yes
+SWT_No=No
+SWT_OK=OK
+SWT_Cancel=Cancel
+SWT_Abort=Abort
+SWT_Retry=Retry
+SWT_Ignore=Ignore
+SWT_Sample=Sample
+SWT_A_Sample_Text=A Sample Text
+SWT_Selection=Selection
+SWT_Current_Selection=Current Selection
+SWT_Font=Font
+SWT_Color=Color
+SWT_Extended_style=Extended style
+SWT_Size=Size
+SWT_Style=Style
+SWT_Save=Save
+SWT_Character_set=Character set
+SWT_ColorDialog_Title=Colors
+SWT_FontDialog_Title=Fonts
+SWT_FontSet=Font Set
+SWT_NewFont=New Font
+SWT_Remove=Remove
+SWT_Up=Up
+SWT_Down=Down
+SWT_Selection=Selection
+SWT_Charset_Western=western
+SWT_Charset_EastEuropean=eastern
+SWT_Charset_SouthEuropean=southern
+SWT_Charset_NorthEuropean=northern
+SWT_Charset_Cyrillic=cyrillic
+SWT_Charset_Arabic=arabic
+SWT_Charset_Greek=greek
+SWT_Charset_Hebrew=hebrew
+SWT_Charset_Turkish=turkish
+SWT_Charset_Nordic=nordic
+SWT_Charset_Thai=thai
+SWT_Charset_BalticRim=baltic rim
+SWT_Charset_Celtic=celtic
+SWT_Charset_Euro=euro
+SWT_Charset_Romanian=romanian
+SWT_Charset_SimplifiedChinese=simp. chinese
+SWT_Charset_TraditionalChinese=trad. chinese
+SWT_Charset_Japanese=japanese
+SWT_Charset_Korean=korean
+SWT_Charset_Unicode=unicode
+SWT_Charset_ASCII=ASCII
+SWT_InputMethods=Input Methods
+SWT_Password=Password:
+SWT_Username=User Name:
+SWT_Switch=Switch
+SWT_Press=Press
+SWT_Open=Open
+SWT_Close=Close
+SWT_Minimize=Minimize
+SWT_Maximize=Maximize
+SWT_Restore=Restore
+SWT_ShowList=Show List
+SWT_FileDownload=File Download
+SWT_Download_File=Download: {0}
+SWT_Download_Location=Saving {0} from {1}
+SWT_Download_Started=Downloading...
+SWT_Download_Status=Download: {0,number,integer} KB of {1,number,integer} KB