# 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 a1f832ca7d17 -r ad2b69216039 dwt/SWTException.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/SWTException.d Sat Jan 05 17:39:49 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 a1f832ca7d17 -r ad2b69216039 dwt/events/ArmEvent.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/events/ArmEvent.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.events.ArmEvent; + +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.events.TypedEvent; + +/** + * Instances of this class are sent as a result of + * a widget such as a menu item being armed. + * + * @see ArmListener + */ + +public final class ArmEvent : TypedEvent { + + //static final long serialVersionUID = 3258126964249212217L; + +/** + * Constructs a new instance of this class based on the + * information in the given untyped event. + * + * @param e the untyped event containing the information + */ +public this(Event e) { + super(e); +} + +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ArmListener.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/events/ArmListener.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.events.ArmListener; + +public import org.eclipse.swt.internal.SWTEventListener; +public import org.eclipse.swt.events.ArmEvent; + +/** + * Classes which implement this interface provide a method + * that deals with the event that is generated when a widget, + * such as a menu item, is armed. + *
+ * After creating an instance of a class that :
+ * this interface it can be added to a widget using the
+ * addArmListener
method and removed using
+ * the removeArmListener
method. When the
+ * widget is armed, the widgetArmed method will be invoked.
+ *
ControlListener
interface.
+ *
+ * Classes that wish to deal with ControlEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
Shell
s).
+ * The default behavior is to do nothing.
+ *
+ * @param e an event containing information about the move
+ */
+public void controlMoved(ControlEvent e) {
+}
+
+/**
+ * Sent when the size (width, height) of a control changes.
+ * The default behavior is to do nothing.
+ *
+ * @param e an event containing information about the resize
+ */
+public void controlResized(ControlEvent e) {
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ControlEvent.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/ControlEvent.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.events.ControlEvent;
+
+
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.events.TypedEvent;
+
+/**
+ * Instances of this class are sent as a result of
+ * controls being moved or resized.
+ *
+ * @see ControlListener
+ */
+
+public final class ControlEvent : TypedEvent {
+
+ //static final long serialVersionUID = 3258132436155119161L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+}
+
+}
+
+
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ControlListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/ControlListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.events.ControlListener;
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.ControlEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the events that are generated by moving
+ * and resizing controls.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addControlListener
method and removed using
+ * the removeControlListener
method. When a
+ * control is moved or resized, the appropriate method will
+ * be invoked.
+ *
Shell
s).
+ *
+ * @param e an event containing information about the move
+ */
+public void controlMoved(ControlEvent e);
+
+/**
+ * Sent when the size (width, height) of a control changes.
+ *
+ * @param e an event containing information about the resize
+ */
+public void controlResized(ControlEvent e);
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/DisposeEvent.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/DisposeEvent.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.events.DisposeEvent;
+
+
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.events.TypedEvent;
+
+/**
+ * Instances of this class are sent as a result of
+ * widgets being disposed.
+ *
+ * @see DisposeListener
+ */
+
+public final class DisposeEvent : TypedEvent {
+
+ //static final long serialVersionUID = 3257566187633521206L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+}
+
+}
+
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/DisposeListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/DisposeListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.events.DisposeListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.DisposeEvent;
+
+/**
+ * Classes which implement this interface provide a method
+ * that deals with the event that is generated when a widget
+ * is disposed.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a widget using the
+ * addDisposeListener
method and removed using
+ * the removeDisposeListener
method. When a
+ * widget is disposed, the widgetDisposed method will
+ * be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addDragDetectListener
method and removed using
+ * the removeDragDetectListener
method. When the
+ * drag is detected, the drageDetected method will be invoked.
+ *
ExpandListener
interface.
+ *
+ * Classes that wish to deal with ExpandEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
ExpandItem
s being expanded or collapsed.
+ *
+ * @see ExpandListener
+ *
+ * @since 3.2
+ */
+
+public class ExpandEvent : SelectionEvent {
+
+ //static final long serialVersionUID = 3976735856884987356L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ExpandListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/ExpandListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.events.ExpandListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.ExpandEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the expanding and collapsing of ExpandItem
s.
+ *
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a ExpandBar
+ * control using the addExpandListener
method and
+ * removed using the removeExpandListener
method.
+ * When a item of the ExpandBar
is expanded or
+ * collapsed, the appropriate method will be invoked.
+ *
FocusListener
interface.
+ *
+ * Classes that wish to deal with FocusEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addFocusListener
method and removed using
+ * the removeFocusListener
method. When a
+ * control gains or loses focus, the appropriate method
+ * will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addHelpListener
method and removed using
+ * the removeHelpListener
method. When help
+ * is requested for a control, the helpRequested method
+ * will be invoked.
+ *
KeyListener
interface.
+ *
+ * Classes that wish to deal with KeyEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * When a key listener is added to a control, the control + * will take part in widget traversal. By default, all + * traversal keys (such as the tab key and so on) are + * delivered to the control. In order for a control to take + * part in traversal, it should listen for traversal events. + * Otherwise, the user can traverse into a control but not + * out. Note that native controls such as table and tree + * implement key traversal in the operating system. It is + * not necessary to add traversal listeners for these controls, + * unless you want to override the default traversal. + *
+ * @see KeyListener + * @see TraverseListener + */ + +public class KeyEvent : TypedEvent { + + /** + * the character represented by the key that was typed. + * This is the final character that results after all modifiers have been + * applied. For example, when the user types Ctrl+A, the character value + * is 0x01. It is important that applications do not attempt to modify the + * character value based on a stateMask (such as SWT.CTRL) or the resulting + * character will not be correct. + */ + public char character; + + /** + * the key code of the key that was typed, + * as defined by the key code constants in classSWT
.
+ * When the character field of the event is ambiguous, this field
+ * contains the unicode value of the original character. For example,
+ * typing Ctrl+M or Return both result in the character '\r' but the
+ * keyCode field will also contain '\r' when Return was typed.
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int keyCode;
+
+ /**
+ * the state of the keyboard modifier keys at the time
+ * the event was generated, as defined by the key code
+ * constants in class SWT
.
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int stateMask;
+
+ /**
+ * A flag indicating whether the operation should be allowed.
+ * Setting this field to false
will cancel the operation.
+ */
+ public bool doit;
+
+ static final long serialVersionUID = 3256442491011412789L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+ this.character = e.character;
+ this.keyCode = e.keyCode;
+ this.stateMask = e.stateMask;
+ this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString() {
+ return Format( "{} character={} keyCode={} stateMask={} doit={}}",
+ super.toString[ 0 .. $-2 ],
+ character, keyCode, stateMask, doit );
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/KeyListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/KeyListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.events.KeyListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.KeyEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the events that are generated as keys
+ * are pressed on the system keyboard.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addKeyListener
method and removed using
+ * the removeKeyListener
method. When a
+ * key is pressed or released, the appropriate method will
+ * be invoked.
+ *
MenuListener
interface.
+ *
+ * Classes that wish to deal with MenuEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
false
will cancel the operation.
+ */
+ public bool doit;
+
+ //private static final long serialVersionUID = -3061660596590828941L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+ this.x = e.x;
+ this.y = e.y;
+ this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString() {
+ return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit );
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/MenuDetectListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/MenuDetectListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.events.MenuDetectListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.MenuDetectEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the events that are generated when the
+ * platform-specific trigger for showing a context menu is
+ * detected.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control or TrayItem
+ * using the addMenuDetectListener
method and
+ * removed using the removeMenuDetectListener
method.
+ * When the context menu trigger occurs, the
+ * menuDetected
method will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a menu using the
+ * addMenuListener
method and removed using
+ * the removeMenuListener
method. When the
+ * menu is hidden or shown, the appropriate method will
+ * be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a text widget using the
+ * addModifyListener
method and removed using
+ * the removeModifyListener
method. When the
+ * text is modified, the modifyText method will be invoked.
+ *
MouseListener
interface.
+ *
+ * Classes that wish to deal with MouseEvent
s
+ * which occur as mouse buttons are pressed and released can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * Note: The button
field is an integer that
+ * represents the mouse button number. This is not the same
+ * as the SWT
mask constants BUTTONx
.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addMouseListener
method and removed using
+ * the removeMouseListener
method. When a
+ * mouse button is pressed or released, the appropriate method
+ * will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addMouseMoveListener
method and removed using
+ * the removeMouseMoveListener
method. As the
+ * mouse moves, the mouseMove method will be invoked.
+ *
MouseTrackListener
interface.
+ *
+ * Classes that wish to deal with MouseEvent
s which
+ * occur as the mouse pointer passes (or hovers) over controls can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addMouseTrackListener
method and removed using
+ * the removeMouseTrackListener
method. When the
+ * mouse pointer passes into or out of the area of the screen
+ * covered by a control or pauses while over a control, the
+ * appropriate method will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addMouseWheelListener
method and removed using
+ * the removeMouseWheelListener
method. When the
+ * mouse wheel is scrolled the mouseScrolled
method
+ * will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addPaintListener
method and removed using
+ * the removePaintListener
method. When a
+ * paint event occurs, the paintControl method will be
+ * invoked.
+ *
SelectionListener
interface.
+ *
+ * Classes that wish to deal with SelectionEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * Note: The fields that are filled in depend on the widget. + *
+ * + * @see SelectionListener + */ + +public class SelectionEvent : TypedEvent { + + /** + * The item that was selected. + */ + public Widget item; + + /** + * Extra detail information about the selection, depending on the widget. + * + *Sash
ScrollBar and Slider
Table and Tree
Text
CoolItem and ToolItem
false
will cancel the
+ * operation, depending on the widget.
+ */
+ public bool doit;
+
+ //static final long serialVersionUID = 3976735856884987953L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+ this.item = e.item;
+ this.x = e.x;
+ this.y = e.y;
+ this.width = e.width;
+ this.height = e.height;
+ this.detail = e.detail;
+ this.stateMask = e.stateMask;
+ this.text = e.text;
+ this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString() {
+ return Format( "{} item={} detail={} x={} y={} width={} height={} stateMask={} text={} doit={}}",
+ super.toString[ 0 .. $-2 ],
+ item,
+ detail,
+ x,
+ y,
+ width,
+ height,
+ stateMask,
+ text,
+ doit );
+}
+}
+
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/SelectionListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/SelectionListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.events.SelectionListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.SelectionEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the events that are generated when selection
+ * occurs in a control.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addSelectionListener
method and removed using
+ * the removeSelectionListener
method. When
+ * selection occurs in a control the appropriate method
+ * will be invoked.
+ *
+ * For example, selection occurs in a List when the user selects + * an item or items with the keyboard or mouse. On some platforms, + * the event occurs when a mouse button or key is pressed. On others, + * it happens when the mouse or key is released. The exact key or + * mouse gesture that causes this event is platform specific. + *
+ * + * @param e an event containing information about the selection + */ +public void widgetSelected(SelectionEvent e); + +/** + * Sent when default selection occurs in the control. + *+ * For example, on some platforms default selection occurs in a List + * when the user double-clicks an item or types return in a Text. + * On some platforms, the event occurs when a mouse button or key is + * pressed. On others, it happens when the mouse or key is released. + * The exact key or mouse gesture that causes this event is platform + * specific. + *
+ * + * @param e an event containing information about the default selection + */ +public void widgetDefaultSelected(SelectionEvent e); +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ShellAdapter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/events/ShellAdapter.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.events.ShellAdapter; + +import org.eclipse.swt.events.ShellListener; + +/** + * This adapter class provides default implementations for the + * methods described by theShellListener
interface.
+ *
+ * Classes that wish to deal with ShellEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
false
will cancel the operation.
+ */
+ public bool doit;
+
+ //static final long serialVersionUID = 3257569490479888441L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+ this.doit = e.doit;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString() {
+ return Format( "{} doit={}}", super.toString[ 0 .. $-2 ], doit );
+}
+}
+
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/ShellListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/ShellListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.events.ShellListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.ShellEvent;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with changes in state of Shell
s.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a shell using the
+ * addShellListener
method and removed using
+ * the removeShellListener
method. When the
+ * state of the shell changes, the appropriate method will
+ * be invoked.
+ *
+ * The traversal event allows fine control over keyboard traversal
+ * in a control both to implement traversal and override the default
+ * traversal behavior defined by the system. This is achieved using
+ * two fields, detail
and doit
.
+ *
+ * When a control is traversed, a traverse event is sent. The detail
+ * describes the type of traversal and the doit field indicates the default
+ * behavior of the system. For example, when a right arrow key is pressed
+ * in a text control, the detail field is TRAVERSE_ARROW_NEXT
+ * and the doit field is false
, indicating that the system
+ * will not traverse to the next tab item and the arrow key will be
+ * delivered to the text control. If the same key is pressed in a radio
+ * button, the doit field will be true
, indicating that
+ * traversal is to proceed to the next tab item, possibly another radio
+ * button in the group and that the arrow key is not to be delivered
+ * to the radio button.
+ *
+ * How can the traversal event be used to implement traversal?
+ * When a tab key is pressed in a canvas, the detail field will be
+ * TRAVERSE_TAB_NEXT
and the doit field will be
+ * false
. The default behavior of the system is to
+ * provide no traversal for canvas controls. This means that by
+ * default in a canvas, a key listener will see every key that the
+ * user types, including traversal keys. To understand why this
+ * is so, it is important to understand that only the widget implementor
+ * can decide which traversal is appropriate for the widget. Returning
+ * to the TRAVERSE_TAB_NEXT
example, a text widget implemented
+ * by a canvas would typically want to use the tab key to insert a
+ * tab character into the widget. A list widget implementation, on the
+ * other hand, would like the system default traversal behavior. Using
+ * only the doit flag, both implementations are possible. The text widget
+ * implementor sets doit to false
, ensuring that the system
+ * will not traverse and that the tab key will be delivered to key listeners.
+ * The list widget implementor sets doit to true
, indicating
+ * that the system should perform tab traversal and that the key should not
+ * be delivered to the list widget.
+ *
+ * How can the traversal event be used to override system traversal?
+ * When the return key is pressed in a single line text control, the
+ * detail field is TRAVERSE_RETURN
and the doit field
+ * is true
. This means that the return key will be processed
+ * by the default button, not the text widget. If the text widget has
+ * a default selection listener, it will not run because the return key
+ * will be processed by the default button. Imagine that the text control
+ * is being used as an in-place editor and return is used to dispose the
+ * widget. Setting doit to false
will stop the system from
+ * activating the default button but the key will be delivered to the text
+ * control, running the key and selection listeners for the text. How
+ * can TRAVERSE_RETURN
be implemented so that the default button
+ * will not be activated and the text widget will not see the return key?
+ * This is achieved by setting doit to true
, and the detail
+ * to TRAVERSE_NONE
.
+ *
+ * Note: A widget implementor will typically implement traversal using + * only the doit flag to either enable or disable system traversal. + *
+ * + * @see TraverseListener + */ + +public final class TraverseEvent : KeyEvent { + + /** + * The traversal type. + *TRAVERSE_NONE
+ * causes no traversal action to be taken.
+ *
+ * When used in conjunction with the doit
field, the
+ * traversal detail field can be useful when overriding the default
+ * traversal mechanism for a control. For example, setting the doit
+ * field to false
will cancel the operation and allow
+ * the traversal key stroke to be delivered to the control. Setting
+ * the doit field to true
indicates that the traversal
+ * described by the detail field is to be performed.
+ */
+ public int detail;
+
+ //static final long serialVersionUID = 3257565105301239349L;
+
+/**
+ * Constructs a new instance of this class based on the
+ * information in the given untyped event.
+ *
+ * @param e the untyped event containing the information
+ */
+public this(Event e) {
+ super(e);
+ this.detail = e.detail;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString() {
+ return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail );
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/events/TraverseListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/events/TraverseListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.events.TraverseListener;
+
+
+public import org.eclipse.swt.internal.SWTEventListener;
+public import org.eclipse.swt.events.TraverseEvent;
+
+/**
+ * Classes which implement this interface provide a method
+ * that deals with the events that are generated when a
+ * traverse event occurs in a control.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a control using the
+ * addTraverseListener
method and removed using
+ * the removeTraverseListener
method. When a
+ * traverse event occurs in a control, the keyTraversed method
+ * will be invoked.
+ *
+ * A traverse event occurs when the user presses a traversal
+ * key. Traversal keys are typically tab and arrow keys, along
+ * with certain other keys on some platforms. Traversal key
+ * constants beginning with TRAVERSE_
are defined
+ * in the SWT
class.
+ *
TreeListener
interface.
+ *
+ * Classes that wish to deal with TreeEvent
s can
+ * extend this class and override only the methods which they are
+ * interested in.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a tree control using the
+ * addTreeListener
method and removed using
+ * the removeTreeListener
method. When a branch
+ * of the tree is expanded or collapsed, the appropriate method
+ * will be invoked.
+ *
+ * After creating an instance of a class that :
+ * this interface it can be added to a text control using the
+ * addVerifyListener
method and removed using
+ * the removeVerifyListener
method. When the
+ * text is about to be modified, the verifyText method
+ * will be invoked.
+ *
+ * A verify event occurs after the user has done something + * to modify the text (typically typed a key), but before + * the text is modified. The doit field in the verify event + * indicates whether or not to modify the text. + *
+ * + * @param e an event containing information about the verify + */ +public void verifyText(VerifyEvent e); +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/DeviceData.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/DeviceData.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.graphics.DeviceData; + +import tango.core.Exception; + +public class DeviceData { + /* + * The following fields are platform dependent. + *+ * IMPORTANT: These fields are not part of the SWT + * public API. They are marked public only so that they can be shared + * within the packages provided by SWT. They are not available on all + * platforms and should never be accessed from application code. + *
+ */ + public char[] display_name; + public char[] application_name; + public char[] application_class; + + /* + * Debug fields - may not be honoured + * on some SWT platforms. + */ + public bool debugging; + public bool tracking; + public TracedException [] errors; + public Object [] objects; +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/FontData.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/FontData.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,439 @@ +/******************************************************************************* + * 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.graphics.FontData; + + +import org.eclipse.swt.SWT; + +import tango.text.convert.Format; +import tango.text.Util : locate; +import tango.util.Convert; + +/** + * Instances of this class describe operating system fonts. + *+ * For platform-independent behaviour, use the get and set methods + * corresponding to the following properties: + *
FontData
+ * corresponds to a Windows LOGFONT
structure whose fields
+ * may be retrieved and modified.FontData
correspond
+ * to the entries in the font's XLFD name and may be retrieved and modified.
+ * dispose()
method is provided.
+ *
+ * @see Font
+ */
+public final class FontData {
+ /**
+ * the font name
+ * (Warning: This field is platform dependent)
+ * + * IMPORTANT: This field is not part of the SWT + * public API. It is marked public only so that it can be shared + * within the packages provided by SWT. It is not available on all + * platforms and should never be accessed from application code. + *
+ */ + public char[] name; + + /** + * The height of the font data in points + * (Warning: This field is platform dependent) + *+ * IMPORTANT: This field is not part of the SWT + * public API. It is marked public only so that it can be shared + * within the packages provided by SWT. It is not available on all + * platforms and should never be accessed from application code. + *
+ */ + public float height; + + /** + * the font style + * (Warning: This field is platform dependent) + *+ * IMPORTANT: This field is not part of the SWT + * public API. It is marked public only so that it can be shared + * within the packages provided by SWT. It is not available on all + * platforms and should never be accessed from application code. + *
+ */ + public int style; + + /** + * the Pango string + * (Warning: This field is platform dependent) + *+ * IMPORTANT: This field is not part of the SWT + * public API. It is marked public only so that it can be shared + * within the packages provided by SWT. It is not available on all + * platforms and should never be accessed from application code. + *
+ */ + public byte[] str; + + /** + * The locales of the font + */ + char[] lang, country, variant; + +/** + * Constructs a new uninitialized font data. + */ +public this () { + this("", 12, SWT.NORMAL); +} + +/** + * Constructs a new FontData given a string representation + * in the form generated by theFontData.toString
+ * method.
+ * + * Note that the representation varies between platforms, + * and a FontData can only be created from a string that was + * generated on the same platform. + *
+ * + * @param string the string representation of aFontData
(must not be null)
+ *
+ * @exception IllegalArgumentException true
if the object is the same as this object and false
otherwise
+ *
+ * @see #hashCode
+ */
+public override int opEquals (Object object) {
+ if (object is this) return true;
+ if( auto data = cast(FontData)object ){
+ return name == data.name && height == data.height && style == data.style;
+ }
+ return false;
+}
+
+/**
+ * Returns the height of the receiver in points.
+ *
+ * @return the height of this FontData
+ *
+ * @see #setHeight(int)
+ */
+public int getHeight() {
+ return cast(int)(0.5f + height);
+}
+
+/*public*/ float getHeightF() {
+ return height;
+}
+
+/**
+ * Returns the locale of the receiver.
+ * + * The locale determines which platform character set this + * font is going to use. Widgets and graphics operations that + * use this font will convert UNICODE strings to the platform + * character set of the specified locale. + *
+ *+ * On platforms where there are multiple character sets for a + * given language/country locale, the variant portion of the + * locale will determine the character set. + *
+ * + * @return theString
representing a Locale object
+ * @since 3.0
+ */
+public char[] getLocale () {
+ char[] result;
+ const char sep = '_';
+ if (lang != null) {
+ result ~= lang;
+ result ~= sep;
+ }
+ if (country != null) {
+ result ~= country;
+ result ~= sep;
+ }
+ if (variant != null) {
+ result ~= variant;
+ }
+
+ if (result) {
+ if (result[$-1] == sep) {
+ result = result[0 .. $ - 1];
+ }
+ }
+ return result;
+}
+
+/**
+ * Returns the name of the receiver.
+ * On platforms that support font foundries, the return value will
+ * be the foundry followed by a dash ("-") followed by the face name.
+ *
+ * @return the name of this FontData
+ *
+ * @see #setName
+ */
+public char[] getName() {
+ return name;
+}
+
+/**
+ * Returns the style of the receiver which is a bitwise OR of
+ * one or more of the SWT
constants NORMAL, BOLD
+ * and ITALIC.
+ *
+ * @return the style of this FontData
+ *
+ * @see #setStyle
+ */
+public int getStyle() {
+ return style;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
+ * equals
must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public hash_t toHash () {
+ return typeid(char[]).getHash(&name) ^ getHeight() ^ style;
+}
+
+/**
+ * Sets the height of the receiver. The parameter is
+ * specified in terms of points, where a point is one
+ * seventy-second of an inch.
+ *
+ * @param height the height of the FontData
+ *
+ * @exception IllegalArgumentException + * The locale determines which platform character set this + * font is going to use. Widgets and graphics operations that + * use this font will convert UNICODE strings to the platform + * character set of the specified locale. + *
+ *+ * On platforms where there are multiple character sets for a + * given language/country locale, the variant portion of the + * locale will determine the character set. + *
+ * + * @param locale theString
representing a Locale object
+ * @see java.util.Locale#toString
+ */
+public void setLocale(char[] locale) {
+ lang = country = variant = null;
+ if (locale !is null) {
+ char sep = '_';
+ int length = locale.length;
+ int firstSep, secondSep;
+
+ firstSep = locate( locale, sep );
+ if (firstSep == locale.length) {
+ firstSep = secondSep = length;
+ } else {
+ secondSep = locate( locale, sep, firstSep + 1);
+ if (secondSep == locale.length) secondSep = length;
+ }
+ if (firstSep > 0) lang = locale[0 .. firstSep];
+ if (secondSep > firstSep + 1) country = locale[firstSep + 1 .. secondSep ];
+ if (length > secondSep + 1) variant = locale[secondSep + 1 .. $ ];
+ }
+}
+
+/**
+ * Sets the name of the receiver.
+ * + * Some platforms support font foundries. On these platforms, the name + * of the font specified in setName() may have one of the following forms: + *
+ * On platforms that do not support font foundries, only the face name
+ * (for example, "courier") is used in setName()
and
+ * getName()
.
+ *
SWT
+ * constants NORMAL, BOLD and ITALIC. All other style bits are
+ * ignored.
+ *
+ * @param style the new style for this FontData
+ *
+ * @see #getStyle
+ */
+public void setStyle(int style) {
+ this.style = style;
+ this.str = null;
+}
+
+/**
+ * Returns a string representation of the receiver which is suitable
+ * for constructing an equivalent instance using the
+ * FontData(String)
constructor.
+ *
+ * @return a string representation of the FontData
+ *
+ * @see FontData
+ */
+public char[] toString() {
+ return Format( "1|{}|{}|{}|GTK|1|", getName, getHeightF, getStyle );
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/FontMetrics.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/FontMetrics.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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.graphics.FontMetrics;
+
+
+/**
+ * Instances of this class provide measurement information
+ * about fonts including ascent, descent, height, leading
+ * space between rows, and average character width.
+ * FontMetrics
are obtained from GC
s
+ * using the getFontMetrics()
method.
+ *
+ * @see GC#getFontMetrics
+ */
+public final class FontMetrics {
+ int ascent, descent, averageCharWidth, leading, height;
+
+package this() {
+}
+
+/**
+ * Compares the argument to the receiver, and returns true
+ * if they represent the same object using a class
+ * specific comparison.
+ *
+ * @param object the object to compare with this object
+ * @return true
if the object is the same as this object and false
otherwise
+ *
+ * @see #hashCode
+ */
+public int opEquals (Object object) {
+ if (object is this) return true;
+ if( auto metrics = cast(FontMetrics)object ){
+ return ascent == metrics.ascent && descent == metrics.descent &&
+ averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
+ height == metrics.height;
+ }
+ return false;
+}
+
+/**
+ * Returns the ascent of the font described by the receiver. A
+ * font's ascent is the distance from the baseline to the
+ * top of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the ascent of the font
+ */
+public int getAscent() {
+ return ascent;
+}
+
+/**
+ * Returns the average character width, measured in pixels,
+ * of the font described by the receiver.
+ *
+ * @return the average character width of the font
+ */
+public int getAverageCharWidth() {
+ return averageCharWidth;
+}
+
+/**
+ * Returns the descent of the font described by the receiver. A
+ * font's descent is the distance from the baseline to the
+ * bottom of actual characters, not including any of the leading area,
+ * measured in pixels.
+ *
+ * @return the descent of the font
+ */
+public int getDescent() {
+ return descent;
+}
+
+/**
+ * Returns the height of the font described by the receiver,
+ * measured in pixels. A font's height is the sum of
+ * its ascent, descent and leading area.
+ *
+ * @return the height of the font
+ *
+ * @see #getAscent
+ * @see #getDescent
+ * @see #getLeading
+ */
+public int getHeight() {
+ return height;
+}
+
+/**
+ * Returns the leading area of the font described by the
+ * receiver. A font's leading area is the space
+ * above its ascent which may include accents or other marks.
+ *
+ * @return the leading space of the font
+ */
+public int getLeading() {
+ return leading;
+}
+
+public static FontMetrics gtk_new(int ascent, int descent, int averageCharWidth, int leading, int height) {
+ FontMetrics fontMetrics = new FontMetrics();
+ fontMetrics.ascent = ascent;
+ fontMetrics.descent = descent;
+ fontMetrics.averageCharWidth = averageCharWidth;
+ fontMetrics.leading = leading;
+ fontMetrics.height = height;
+ return fontMetrics;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
+ * equals
must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals
+ */
+public hash_t toHash() {
+ return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/ImageData.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/ImageData.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,3610 @@
+/*******************************************************************************
+ * 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.graphics.ImageData;
+
+
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.ImageDataLoader;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.CloneableCompatibility;
+
+import tango.io.model.IConduit;
+
+// PORTING_TYPE
+class GC{
+ void drawImage(Image, int, int, int, int, int, int, int, int );
+}
+class Device{}
+class Image{
+ this( Device, ImageData ){}
+ void dispose(){}
+}
+
+/**
+ * Instances of this class are device-independent descriptions
+ * of images. They are typically used as an intermediate format
+ * between loading from or writing to streams and creating an
+ * Image
.
+ *
+ * Note that the public fields x
, y
,
+ * disposalMethod
and delayTime
are
+ * typically only used when the image is in a set of images used
+ * for animation.
+ *
+ * Note that a depth of 8 or less does not necessarily + * mean that the image is palette indexed, or + * conversely that a depth greater than 8 means that + * the image is direct color. Check the associated + * PaletteData's isDirect field for such determinations. + */ + public int depth; + + /** + * The scanline padding. + *
+ * If one scanline of the image is not a multiple of + * this number, it will be padded with zeros until it is. + *
+ */ + public int scanlinePad; + + /** + * The number of bytes per scanline. + *+ * This is a multiple of the scanline padding. + *
+ */ + public int bytesPerLine; + + /** + * The pixel data of the image. + *+ * Note that for 16 bit depth images the pixel data is stored + * in least significant byte order; however, for 24bit and + * 32bit depth images the pixel data is stored in most + * significant byte order. + *
+ */ + public byte[] data; + + /** + * The color table for the image. + */ + public PaletteData palette; + + /** + * The transparent pixel. + *+ * Pixels with this value are transparent. + *
+ * The default is -1 which means 'no transparent pixel'. + *
+ */ + public int transparentPixel; + + /** + * An icon-specific field containing the data from the icon mask. + *+ * This is a 1 bit bitmap stored with the most significant + * bit first. The number of bytes per scanline is + * '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'. + *
+ * The default is null which means 'no transparency mask'. + *
+ */ + public byte[] maskData; + + /** + * An icon-specific field containing the scanline pad of the mask. + *+ * If one scanline of the transparency mask is not a + * multiple of this number, it will be padded with zeros until + * it is. + *
+ */ + public int maskPad; + + /** + * The alpha data of the image. + *+ * Every pixel can have an alpha blending value that + * varies from 0, meaning fully transparent, to 255 meaning + * fully opaque. The number of bytes per scanline is + * 'width'. + *
+ */ + public byte[] alphaData; + + /** + * The global alpha value to be used for every pixel. + *
+ * If this value is set, the alphaData
field
+ * is ignored and when the image is rendered each pixel
+ * will be blended with the background an amount
+ * proportional to this value.
+ *
+ * The default is -1 which means 'no global alpha value' + *
+ */ + public int alpha; + + /** + * The type of file from which the image was read. + * + * It is expressed as one of the following values: + *IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
DM_UNSPECIFIED
DM_FILL_NONE
DM_FILL_BACKGROUND
DM_FILL_PREVIOUS
ImageData
loaded from the specified
+ * input stream. Throws an error if an error occurs while loading
+ * the image, or if the image has an unsupported type. Application
+ * code is still responsible for closing the input stream.
+ *
+ * This constructor is provided for convenience when loading a single
+ * image only. If the stream contains multiple images, only the first
+ * one will be loaded. To load multiple images, use
+ * ImageLoader.load()
.
+ *
+ * This constructor may be used to load a resource as follows: + *
+ *+ * static ImageData loadImageData (Class clazz, String string) { + * InputStream stream = clazz.getResourceAsStream (string); + * if (stream == null) return null; + * ImageData imageData = null; + * try { + * imageData = new ImageData (stream); + * } catch (SWTException ex) { + * } finally { + * try { + * stream.close (); + * } catch (IOException ex) {} + * } + * return imageData; + * } + *+ * + * @param stream the input stream to load the image from (must not be null) + * + * @exception IllegalArgumentException
ImageData
loaded from a file with the
+ * specified name. Throws an error if an error occurs loading the
+ * image, or if the image has an unsupported type.
+ *
+ * This constructor is provided for convenience when loading a single
+ * image only. If the file contains multiple images, only the first
+ * one will be loaded. To load multiple images, use
+ * ImageLoader.load()
.
+ *
+ * This method is for internal use, and is not described further. + *
+ */ +this( + int width, int height, int depth, PaletteData palette, + int scanlinePad, byte[] data, int maskPad, byte[] maskData, + byte[] alphaData, int alpha, int transparentPixel, int type, + int x, int y, int disposalMethod, int delayTime) +{ + + if (palette == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8 + || depth == 16 || depth == 24 || depth == 32)) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + if (width <= 0 || height <= 0) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + if (scanlinePad == 0) SWT.error (SWT.ERROR_CANNOT_BE_ZERO); + + int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) + / scanlinePad * scanlinePad; + setAllFields( + width, + height, + depth, + scanlinePad, + bytesPerLine, + data != null ? data : new byte[bytesPerLine * height], + palette, + transparentPixel, + maskData, + maskPad, + alphaData, + alpha, + type, + x, + y, + disposalMethod, + delayTime); +} + +/** + * Initializes all fields in the receiver. This method must be called + * by all public constructors to ensure that all fields are initialized + * for a new ImageData object. If a new field is added to the class, + * then it must be added to this method. + *+ * This method is for internal use, and is not described further. + *
+ */ +void setAllFields(int width, int height, int depth, int scanlinePad, + int bytesPerLine, byte[] data, PaletteData palette, int transparentPixel, + byte[] maskData, int maskPad, byte[] alphaData, int alpha, + int type, int x, int y, int disposalMethod, int delayTime) { + + this.width = width; + this.height = height; + this.depth = depth; + this.scanlinePad = scanlinePad; + this.bytesPerLine = bytesPerLine; + this.data = data; + this.palette = palette; + this.transparentPixel = transparentPixel; + this.maskData = maskData; + this.maskPad = maskPad; + this.alphaData = alphaData; + this.alpha = alpha; + this.type = type; + this.x = x; + this.y = y; + this.disposalMethod = disposalMethod; + this.delayTime = delayTime; +} + +/** + * Invokes internal SWT functionality to create a new instance of + * this class. + *
+ * IMPORTANT: This method is not part of the public
+ * API for ImageData
. It is marked public only so that it
+ * can be shared within the packages provided by SWT. It is subject
+ * to change without notice, and should never be called from
+ * application code.
+ *
+ * This method is for internal use, and is not described further. + *
+ */ +public static ImageData internal_new( + int width, int height, int depth, PaletteData palette, + int scanlinePad, byte[] data, int maskPad, byte[] maskData, + byte[] alphaData, int alpha, int transparentPixel, int type, + int x, int y, int disposalMethod, int delayTime) +{ + return new ImageData( + width, height, depth, palette, scanlinePad, data, maskPad, maskData, + alphaData, alpha, transparentPixel, type, x, y, disposalMethod, delayTime); +} + +ImageData colorMaskImage(int pixel) { + ImageData mask = new ImageData(width, height, 1, bwPalette(), + 2, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, + 0, 0, 0, 0); + int[] row = new int[width]; + for (int y = 0; y < height; y++) { + getPixels(0, y, width, row, 0); + for (int i = 0; i < width; i++) { + if (pixel != -1 && row[i] == pixel) { + row[i] = 0; + } else { + row[i] = 1; + } + } + mask.setPixels(0, y, width, row, 0); + } + return mask; +} + +static byte[] checkData(byte [] data) { + if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + return data; +} + +/** + * Returns a new instance of the same class as the receiver, + * whose slots have been filled in with copies of + * the values in the slots of the receiver. That is, the + * returned object is a deep copy of the receiver. + * + * @return a copy of the receiver. + */ +public Object clone() { + byte[] cloneData = data.dup; + byte[] cloneMaskData = null; + if (maskData != null) { + cloneMaskData = maskData.dup; + } + byte[] cloneAlphaData = null; + if (alphaData != null) { + cloneAlphaData = alphaData.dup; + } + return new ImageData( + width, + height, + depth, + palette, + scanlinePad, + cloneData, + maskPad, + cloneMaskData, + cloneAlphaData, + alpha, + transparentPixel, + type, + x, + y, + disposalMethod, + delayTime); +} + +/** + * Returns the alpha value at offsetx
in
+ * scanline y
in the receiver's alpha data.
+ *
+ * @param x the x coordinate of the pixel to get the alpha value of
+ * @param y the y coordinate of the pixel to get the alpha value of
+ * @return the alpha value at the given coordinates
+ *
+ * @exception IllegalArgumentException getWidth
alpha values starting at offset
+ * x
in scanline y
in the receiver's alpha
+ * data starting at startIndex
.
+ *
+ * @param x the x position of the pixel to begin getting alpha values
+ * @param y the y position of the pixel to begin getting alpha values
+ * @param getWidth the width of the data to get
+ * @param alphas the buffer in which to put the alpha values
+ * @param startIndex the offset into the image to begin getting alpha values
+ *
+ * @exception IndexOutOfBoundsException if getWidth is too large
+ * @exception IllegalArgumentException x
in
+ * scanline y
in the receiver's data.
+ *
+ * @param x the x position of the pixel to get
+ * @param y the y position of the pixel to get
+ * @return the pixel at the given coordinates
+ *
+ * @exception IllegalArgumentException getWidth
pixel values starting at offset
+ * x
in scanline y
in the receiver's
+ * data starting at startIndex
.
+ *
+ * @param x the x position of the first pixel to get
+ * @param y the y position of the first pixel to get
+ * @param getWidth the width of the data to get
+ * @param pixels the buffer in which to put the pixels
+ * @param startIndex the offset into the byte array to begin storing pixels
+ *
+ * @exception IndexOutOfBoundsException if getWidth is too large
+ * @exception IllegalArgumentException getWidth
pixel values starting at offset
+ * x
in scanline y
in the receiver's
+ * data starting at startIndex
.
+ *
+ * @param x the x position of the first pixel to get
+ * @param y the y position of the first pixel to get
+ * @param getWidth the width of the data to get
+ * @param pixels the buffer in which to put the pixels
+ * @param startIndex the offset into the buffer to begin storing pixels
+ *
+ * @exception IndexOutOfBoundsException if getWidth is too large
+ * @exception IllegalArgumentException RGB
s which comprise the
+ * indexed color table of the receiver, or null if the receiver
+ * has a direct color model.
+ *
+ * @return the RGB values for the image or null if direct color
+ *
+ * @see PaletteData#getRGBs()
+ */
+public RGB[] getRGBs() {
+ return palette.getRGBs();
+}
+
+/**
+ * Returns an ImageData
which specifies the
+ * transparency mask information for the receiver. If the
+ * receiver has no transparency or is not an icon, returns
+ * an opaque mask.
+ *
+ * @return the transparency mask
+ */
+public ImageData getTransparencyMask() {
+ if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
+ return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
+ } else {
+ return colorMaskImage(transparentPixel);
+ }
+}
+
+/**
+ * Returns the image transparency type, which will be one of
+ * SWT.TRANSPARENCY_NONE
, SWT.TRANSPARENCY_MASK
,
+ * SWT.TRANSPARENCY_PIXEL
or SWT.TRANSPARENCY_ALPHA
.
+ *
+ * @return the receiver's transparency type
+ */
+public int getTransparencyType() {
+ if (maskData != null) return SWT.TRANSPARENCY_MASK;
+ if (transparentPixel != -1) return SWT.TRANSPARENCY_PIXEL;
+ if (alphaData != null) return SWT.TRANSPARENCY_ALPHA;
+ return SWT.TRANSPARENCY_NONE;
+}
+
+/**
+ * Returns the byte order of the receiver.
+ *
+ * @return MSB_FIRST or LSB_FIRST
+ */
+int getByteOrder() {
+ return depth != 16 ? MSB_FIRST : LSB_FIRST;
+}
+
+/**
+ * Returns a copy of the receiver which has been stretched or
+ * shrunk to the specified size. If either the width or height
+ * is negative, the resulting image will be inverted in the
+ * associated axis.
+ *
+ * @param width the width of the new ImageData
+ * @param height the height of the new ImageData
+ * @return a scaled copy of the image
+ */
+public ImageData scaledTo(int width, int height) {
+ /* Create a destination image with no data */
+ bool flipX = (width < 0);
+ if (flipX) width = - width;
+ bool flipY = (height < 0);
+ if (flipY) height = - height;
+
+ ImageData dest = new ImageData(
+ width, height, depth, palette,
+ scanlinePad, null, 0, null,
+ null, -1, transparentPixel, type,
+ x, y, disposalMethod, delayTime);
+
+ /* Scale the image contents */
+ if (palette.isDirect) blit(BLIT_SRC,
+ this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, 0, 0, 0,
+ ALPHA_OPAQUE, null, 0, 0, 0,
+ dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, 0, 0, 0,
+ flipX, flipY);
+ else blit(BLIT_SRC,
+ this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, null, null, null,
+ ALPHA_OPAQUE, null, 0, 0, 0,
+ dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, null, null, null,
+ flipX, flipY);
+
+ /* Scale the image mask or alpha */
+ if (maskData != null) {
+ dest.maskPad = this.maskPad;
+ int destBpl = (dest.width + 7) / 8;
+ destBpl = (destBpl + (dest.maskPad - 1)) / dest.maskPad * dest.maskPad;
+ dest.maskData = new byte[destBpl * dest.height];
+ int srcBpl = (this.width + 7) / 8;
+ srcBpl = (srcBpl + (this.maskPad - 1)) / this.maskPad * this.maskPad;
+ blit(BLIT_SRC,
+ this.maskData, 1, srcBpl, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
+ ALPHA_OPAQUE, null, 0, 0, 0,
+ dest.maskData, 1, destBpl, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
+ flipX, flipY);
+ } else if (alpha != -1) {
+ dest.alpha = this.alpha;
+ } else if (alphaData != null) {
+ dest.alphaData = new byte[dest.width * dest.height];
+ blit(BLIT_SRC,
+ this.alphaData, 8, this.width, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
+ ALPHA_OPAQUE, null, 0, 0, 0,
+ dest.alphaData, 8, dest.width, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
+ flipX, flipY);
+ }
+ return dest;
+}
+
+/**
+ * Sets the alpha value at offset x
in
+ * scanline y
in the receiver's alpha data.
+ *
+ * @param x the x coordinate of the alpha value to set
+ * @param y the y coordinate of the alpha value to set
+ * @param alpha the value to set the alpha to
+ *
+ * @exception IllegalArgumentException x
in
+ * scanline y
in the receiver's alpha data to the
+ * values from the array alphas
starting at
+ * startIndex
.
+ *
+ * @param x the x coordinate of the pixel to being setting the alpha values
+ * @param y the y coordinate of the pixel to being setting the alpha values
+ * @param putWidth the width of the alpha values to set
+ * @param alphas the alpha values to set
+ * @param startIndex the index at which to begin setting
+ *
+ * @exception IndexOutOfBoundsException if putWidth is too large
+ * @exception IllegalArgumentException x
in
+ * scanline y
in the receiver's data.
+ *
+ * @param x the x coordinate of the pixel to set
+ * @param y the y coordinate of the pixel to set
+ * @param pixelValue the value to set the pixel to
+ *
+ * @exception IllegalArgumentException x
in
+ * scanline y
in the receiver's data to the
+ * values from the array pixels
starting at
+ * startIndex
.
+ *
+ * @param x the x position of the pixel to set
+ * @param y the y position of the pixel to set
+ * @param putWidth the width of the pixels to set
+ * @param pixels the pixels to set
+ * @param startIndex the index at which to begin setting
+ *
+ * @exception IndexOutOfBoundsException if putWidth is too large
+ * @exception IllegalArgumentException x
in
+ * scanline y
in the receiver's data to the
+ * values from the array pixels
starting at
+ * startIndex
.
+ *
+ * @param x the x position of the pixel to set
+ * @param y the y position of the pixel to set
+ * @param putWidth the width of the pixels to set
+ * @param pixels the pixels to set
+ * @param startIndex the index at which to begin setting
+ *
+ * @exception IndexOutOfBoundsException if putWidth is too large
+ * @exception IllegalArgumentException + * Note: When the source and destination depth, order and masks + * are pairwise equal and the blitter operation is BLIT_SRC, + * the masks are ignored. Hence when not changing the image + * data format, 0 may be specified for the masks. + *
+ * + * @param op the blitter operation: a combination of BLIT_xxx flags + * (see BLIT_xxx constants) + * @param srcData the source byte array containing image data + * @param srcDepth the source depth: one of 8, 16, 24, 32 + * @param srcStride the source number of bytes per line + * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if srcDepth is not 16 or 32 + * @param srcX the top-left x-coord of the source blit region + * @param srcY the top-left y-coord of the source blit region + * @param srcWidth the width of the source blit region + * @param srcHeight the height of the source blit region + * @param srcRedMask the source red channel mask + * @param srcGreenMask the source green channel mask + * @param srcBlueMask the source blue channel mask + * @param alphaMode the alpha blending or mask mode, may be + * an integer 0-255 for global alpha; ignored if BLIT_ALPHA + * not specified in the blitter operations + * (see ALPHA_MODE_xxx constants) + * @param alphaData the alpha blending or mask data, varies depending + * on the value of alphaMode and sometimes ignored + * @param alphaStride the alpha data number of bytes per line + * @param alphaX the top-left x-coord of the alpha blit region + * @param alphaY the top-left y-coord of the alpha blit region + * @param destData the destination byte array containing image data + * @param destDepth the destination depth: one of 8, 16, 24, 32 + * @param destStride the destination number of bytes per line + * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if destDepth is not 16 or 32 + * @param destX the top-left x-coord of the destination blit region + * @param destY the top-left y-coord of the destination blit region + * @param destWidth the width of the destination blit region + * @param destHeight the height of the destination blit region + * @param destRedMask the destination red channel mask + * @param destGreenMask the destination green channel mask + * @param destBlueMask the destination blue channel mask + * @param flipX if true the resulting image is flipped along the vertical axis + * @param flipY if true the resulting image is flipped along the horizontal axis + */ +static void blit(int op, + byte[] srcData, int srcDepth, int srcStride, int srcOrder, + int srcX, int srcY, int srcWidth, int srcHeight, + int srcRedMask, int srcGreenMask, int srcBlueMask, + int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, + byte[] destData, int destDepth, int destStride, int destOrder, + int destX, int destY, int destWidth, int destHeight, + int destRedMask, int destGreenMask, int destBlueMask, + bool flipX, bool flipY) { + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + + // these should be supplied as params later + const int srcAlphaMask = 0, destAlphaMask = 0; + + /*** Prepare scaling data ***/ + int dwm1 = destWidth - 1; + int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int dhm1 = destHeight - 1; + int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + + /*** Prepare source-related data ***/ + int sbpp, stype; + switch (srcDepth) { + case 8: + sbpp = 1; + stype = TYPE_GENERIC_8; + break; + case 16: + sbpp = 2; + stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + break; + case 24: + sbpp = 3; + stype = TYPE_GENERIC_24; + break; + case 32: + sbpp = 4; + stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int spr = srcY * srcStride + srcX * sbpp; + + /*** Prepare destination-related data ***/ + int dbpp, dtype; + switch (destDepth) { + case 8: + dbpp = 1; + dtype = TYPE_GENERIC_8; + break; + case 16: + dbpp = 2; + dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + break; + case 24: + dbpp = 3; + dtype = TYPE_GENERIC_24; + break; + case 32: + dbpp = 4; + dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid destination type"); + return; + } + int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; + int dprxi = (flipX) ? -dbpp : dbpp; + int dpryi = (flipY) ? -destStride : destStride; + + /*** Prepare special processing data ***/ + int apr; + if ((op & BLIT_ALPHA) != 0) { + switch (alphaMode) { + case ALPHA_MASK_UNPACKED: + case ALPHA_CHANNEL_SEPARATE: + if (alphaData == null) alphaMode = 0x10000; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_PACKED: + if (alphaData == null) alphaMode = 0x10000; + alphaStride <<= 3; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_INDEX: + //throw new IllegalArgumentException("Invalid alpha type"); + return; + case ALPHA_MASK_RGB: + if (alphaData == null) alphaMode = 0x10000; + apr = 0; + break; + default: + alphaMode = (alphaMode << 16) / 255; // prescale + case ALPHA_CHANNEL_SOURCE: + apr = 0; + break; + } + } else { + alphaMode = 0x10000; + apr = 0; + } + + /*** Blit ***/ + int dp = dpr; + int sp = spr; + if ((alphaMode == 0x10000) && (stype == dtype) && + (srcRedMask == destRedMask) && (srcGreenMask == destGreenMask) && + (srcBlueMask == destBlueMask) && (srcAlphaMask == destAlphaMask)) { + /*** Fast blit (straight copy) ***/ + switch (sbpp) { + case 1: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + destData[dp] = srcData[sp]; + sp += (sfx >>> 16); + } + } + break; + case 2: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + destData[dp] = srcData[sp]; + destData[dp + 1] = srcData[sp + 1]; + sp += (sfx >>> 16) * 2; + } + } + break; + case 3: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + destData[dp] = srcData[sp]; + destData[dp + 1] = srcData[sp + 1]; + destData[dp + 2] = srcData[sp + 2]; + sp += (sfx >>> 16) * 3; + } + } + break; + case 4: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + destData[dp] = srcData[sp]; + destData[dp + 1] = srcData[sp + 1]; + destData[dp + 2] = srcData[sp + 2]; + destData[dp + 3] = srcData[sp + 3]; + sp += (sfx >>> 16) * 4; + } + } + break; + } + return; + } + /*** Comprehensive blit (apply transformations) ***/ + int srcRedShift = getChannelShift(srcRedMask); + byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)]; + int srcGreenShift = getChannelShift(srcGreenMask); + byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)]; + int srcBlueShift = getChannelShift(srcBlueMask); + byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)]; + int srcAlphaShift = getChannelShift(srcAlphaMask); + byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)]; + + int destRedShift = getChannelShift(destRedMask); + int destRedWidth = getChannelWidth(destRedMask, destRedShift); + byte[] destReds = ANY_TO_EIGHT[destRedWidth]; + int destRedPreShift = 8 - destRedWidth; + int destGreenShift = getChannelShift(destGreenMask); + int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift); + byte[] destGreens = ANY_TO_EIGHT[destGreenWidth]; + int destGreenPreShift = 8 - destGreenWidth; + int destBlueShift = getChannelShift(destBlueMask); + int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift); + byte[] destBlues = ANY_TO_EIGHT[destBlueWidth]; + int destBluePreShift = 8 - destBlueWidth; + int destAlphaShift = getChannelShift(destAlphaMask); + int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift); + byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth]; + int destAlphaPreShift = 8 - destAlphaWidth; + + int ap = apr, alpha = alphaMode; + int r = 0, g = 0, b = 0, a = 0; + int rq = 0, gq = 0, bq = 0, aq = 0; + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, + sp = spr += (sfy >>> 16) * srcStride, + ap = apr += (sfy >>> 16) * alphaStride, + sfy = (sfy & 0xffff) + sfyi, + dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, + dp += dprxi, + sfx = (sfx & 0xffff) + sfxi) { + /*** READ NEXT PIXEL ***/ + switch (stype) { + case TYPE_GENERIC_8: { + int data = srcData[sp] & 0xff; + sp += (sfx >>> 16); + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_MSB: { + int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff); + sp += (sfx >>> 16) * 2; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_LSB: { + int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff); + sp += (sfx >>> 16) * 2; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_24: { + int data = (( ((srcData[sp] & 0xff) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp + 2] & 0xff); + sp += (sfx >>> 16) * 3; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_MSB: { + int data = (( (( ((srcData[sp] & 0xff) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp + 2] & 0xff)) << 8) | + (srcData[sp + 3] & 0xff); + sp += (sfx >>> 16) * 4; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_LSB: { + int data = (( (( ((srcData[sp + 3] & 0xff) << 8) | + (srcData[sp + 2] & 0xff)) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp] & 0xff); + sp += (sfx >>> 16) * 4; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + } + + /*** DO SPECIAL PROCESSING IF REQUIRED ***/ + switch (alphaMode) { + case ALPHA_CHANNEL_SEPARATE: + alpha = ((alphaData[ap] & 0xff) << 16) / 255; + ap += (sfx >> 16); + break; + case ALPHA_CHANNEL_SOURCE: + alpha = (a << 16) / 255; + break; + case ALPHA_MASK_UNPACKED: + alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + ap += (sfx >> 16); + break; + case ALPHA_MASK_PACKED: + alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; + ap += (sfx >> 16); + break; + case ALPHA_MASK_RGB: + alpha = 0x10000; + for (int i = 0; i < alphaData.length; i += 3) { + if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { + alpha = 0x0000; + break; + } + } + break; + } + if (alpha != 0x10000) { + if (alpha == 0x0000) continue; + switch (dtype) { + case TYPE_GENERIC_8: { + int data = destData[dp] & 0xff; + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_MSB: { + int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_LSB: { + int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_24: { + int data = (( ((destData[dp] & 0xff) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp + 2] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_MSB: { + int data = (( (( ((destData[dp] & 0xff) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp + 2] & 0xff)) << 8) | + (destData[dp + 3] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_LSB: { + int data = (( (( ((destData[dp + 3] & 0xff) << 8) | + (destData[dp + 2] & 0xff)) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + } + // Perform alpha blending + a = aq + ((a - aq) * alpha >> 16); + r = rq + ((r - rq) * alpha >> 16); + g = gq + ((g - gq) * alpha >> 16); + b = bq + ((b - bq) * alpha >> 16); + } + + /*** WRITE NEXT PIXEL ***/ + int data = + (r >>> destRedPreShift << destRedShift) | + (g >>> destGreenPreShift << destGreenShift) | + (b >>> destBluePreShift << destBlueShift) | + (a >>> destAlphaPreShift << destAlphaShift); + switch (dtype) { + case TYPE_GENERIC_8: { + destData[dp] = cast(byte) data; + } break; + case TYPE_GENERIC_16_MSB: { + destData[dp] = cast(byte) (data >>> 8); + destData[dp + 1] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_16_LSB: { + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + } break; + case TYPE_GENERIC_24: { + destData[dp] = cast(byte) (data >>> 16); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_32_MSB: { + destData[dp] = cast(byte) (data >>> 24); + destData[dp + 1] = cast(byte) (data >>> 16); + destData[dp + 2] = cast(byte) (data >>> 8); + destData[dp + 3] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_32_LSB: { + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data >>> 16); + destData[dp + 3] = cast(byte) (data >>> 24); + } break; + } + } + } +} + +/** + * Blits an index palette image into an index palette image. + *+ * Note: The source and destination red, green, and blue + * arrays may be null if no alpha blending or dither is to be + * performed. + *
+ * + * @param op the blitter operation: a combination of BLIT_xxx flags + * (see BLIT_xxx constants) + * @param srcData the source byte array containing image data + * @param srcDepth the source depth: one of 1, 2, 4, 8 + * @param srcStride the source number of bytes per line + * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if srcDepth is not 1 + * @param srcX the top-left x-coord of the source blit region + * @param srcY the top-left y-coord of the source blit region + * @param srcWidth the width of the source blit region + * @param srcHeight the height of the source blit region + * @param srcReds the source palette red component intensities + * @param srcGreens the source palette green component intensities + * @param srcBlues the source palette blue component intensities + * @param alphaMode the alpha blending or mask mode, may be + * an integer 0-255 for global alpha; ignored if BLIT_ALPHA + * not specified in the blitter operations + * (see ALPHA_MODE_xxx constants) + * @param alphaData the alpha blending or mask data, varies depending + * on the value of alphaMode and sometimes ignored + * @param alphaStride the alpha data number of bytes per line + * @param alphaX the top-left x-coord of the alpha blit region + * @param alphaY the top-left y-coord of the alpha blit region + * @param destData the destination byte array containing image data + * @param destDepth the destination depth: one of 1, 2, 4, 8 + * @param destStride the destination number of bytes per line + * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if destDepth is not 1 + * @param destX the top-left x-coord of the destination blit region + * @param destY the top-left y-coord of the destination blit region + * @param destWidth the width of the destination blit region + * @param destHeight the height of the destination blit region + * @param destReds the destination palette red component intensities + * @param destGreens the destination palette green component intensities + * @param destBlues the destination palette blue component intensities + * @param flipX if true the resulting image is flipped along the vertical axis + * @param flipY if true the resulting image is flipped along the horizontal axis + */ +static void blit(int op, + byte[] srcData, int srcDepth, int srcStride, int srcOrder, + int srcX, int srcY, int srcWidth, int srcHeight, + byte[] srcReds, byte[] srcGreens, byte[] srcBlues, + int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, + byte[] destData, int destDepth, int destStride, int destOrder, + int destX, int destY, int destWidth, int destHeight, + byte[] destReds, byte[] destGreens, byte[] destBlues, + bool flipX, bool flipY) { + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + + /*** Prepare scaling data ***/ + int dwm1 = destWidth - 1; + int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int dhm1 = destHeight - 1; + int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + + /*** Prepare source-related data ***/ + int stype; + switch (srcDepth) { + case 8: + stype = TYPE_INDEX_8; + break; + case 4: + srcStride <<= 1; + stype = TYPE_INDEX_4; + break; + case 2: + srcStride <<= 2; + stype = TYPE_INDEX_2; + break; + case 1: + srcStride <<= 3; + stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int spr = srcY * srcStride + srcX; + + /*** Prepare destination-related data ***/ + int dtype; + switch (destDepth) { + case 8: + dtype = TYPE_INDEX_8; + break; + case 4: + destStride <<= 1; + dtype = TYPE_INDEX_4; + break; + case 2: + destStride <<= 2; + dtype = TYPE_INDEX_2; + break; + case 1: + destStride <<= 3; + dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); + int dprxi = (flipX) ? -1 : 1; + int dpryi = (flipY) ? -destStride : destStride; + + /*** Prepare special processing data ***/ + int apr; + if ((op & BLIT_ALPHA) != 0) { + switch (alphaMode) { + case ALPHA_MASK_UNPACKED: + case ALPHA_CHANNEL_SEPARATE: + if (alphaData == null) alphaMode = 0x10000; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_PACKED: + if (alphaData == null) alphaMode = 0x10000; + alphaStride <<= 3; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_INDEX: + case ALPHA_MASK_RGB: + if (alphaData == null) alphaMode = 0x10000; + apr = 0; + break; + default: + alphaMode = (alphaMode << 16) / 255; // prescale + case ALPHA_CHANNEL_SOURCE: + apr = 0; + break; + } + } else { + alphaMode = 0x10000; + apr = 0; + } + bool ditherEnabled = (op & BLIT_DITHER) != 0; + + /*** Blit ***/ + int dp = dpr; + int sp = spr; + int ap = apr; + int destPaletteSize = 1 << destDepth; + if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; + byte[] paletteMapping = null; + bool isExactPaletteMapping = true; + switch (alphaMode) { + case 0x10000: + /*** If the palettes and formats are equivalent use a one-to-one mapping ***/ + if ((stype == dtype) && + (srcReds == destReds) && (srcGreens == destGreens) && (srcBlues == destBlues)) { + paletteMapping = ONE_TO_ONE_MAPPING; + break; + /*** If palettes have not been supplied, supply a suitable mapping ***/ + } else if ((srcReds == null) || (destReds == null)) { + if (srcDepth <= destDepth) { + paletteMapping = ONE_TO_ONE_MAPPING; + } else { + paletteMapping = new byte[1 << srcDepth]; + int mask = (0xff << destDepth) >>> 8; + for (int i = 0; i < paletteMapping.length; ++i) paletteMapping[i] = cast(byte)(i & mask); + } + break; + } + case ALPHA_MASK_UNPACKED: + case ALPHA_MASK_PACKED: + case ALPHA_MASK_INDEX: + case ALPHA_MASK_RGB: + /*** Generate a palette mapping ***/ + int srcPaletteSize = 1 << srcDepth; + paletteMapping = new byte[srcPaletteSize]; + if ((srcReds != null) && (srcReds.length < srcPaletteSize)) srcPaletteSize = srcReds.length; + for (int i = 0, r, g, b, index; i < srcPaletteSize; ++i) { + r = srcReds[i] & 0xff; + g = srcGreens[i] & 0xff; + b = srcBlues[i] & 0xff; + index = 0; + int minDistance = 0x7fffffff; + for (int j = 0, dr, dg, db, distance; j < destPaletteSize; ++j) { + dr = (destReds[j] & 0xff) - r; + dg = (destGreens[j] & 0xff) - g; + db = (destBlues[j] & 0xff) - b; + distance = dr * dr + dg * dg + db * db; + if (distance < minDistance) { + index = j; + if (distance == 0) break; + minDistance = distance; + } + } + paletteMapping[i] = cast(byte)index; + if (minDistance != 0) isExactPaletteMapping = false; + } + break; + } + if ((paletteMapping != null) && (isExactPaletteMapping || ! ditherEnabled)) { + if ((stype == dtype) && (alphaMode == 0x10000)) { + /*** Fast blit (copy w/ mapping) ***/ + switch (stype) { + case TYPE_INDEX_8: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + destData[dp] = paletteMapping[srcData[sp] & 0xff]; + sp += (sfx >>> 16); + } + } + break; + case TYPE_INDEX_4: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + int v; + if ((sp & 1) != 0) v = paletteMapping[srcData[sp >> 1] & 0x0f]; + else v = (srcData[sp >> 1] >>> 4) & 0x0f; + sp += (sfx >>> 16); + if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | v); + else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (v << 4)); + } + } + break; + case TYPE_INDEX_2: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + int index = paletteMapping[(srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03]; + sp += (sfx >>> 16); + int shift = 6 - (dp & 3) * 2; + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); + } + } + break; + case TYPE_INDEX_1_MSB: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + int index = paletteMapping[(srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01]; + sp += (sfx >>> 16); + int shift = 7 - (dp & 7); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + } + } + break; + case TYPE_INDEX_1_LSB: + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { + int index = paletteMapping[(srcData[sp >> 3] >>> (sp & 7)) & 0x01]; + sp += (sfx >>> 16); + int shift = dp & 7; + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + } + } + break; + } + } else { + /*** Convert between indexed modes using mapping and mask ***/ + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, + sp = spr += (sfy >>> 16) * srcStride, + sfy = (sfy & 0xffff) + sfyi, + dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, + dp += dprxi, + sfx = (sfx & 0xffff) + sfxi) { + int index; + /*** READ NEXT PIXEL ***/ + switch (stype) { + case TYPE_INDEX_8: + index = srcData[sp] & 0xff; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_4: + if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + else index = (srcData[sp >> 1] >>> 4) & 0x0f; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_2: + index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_MSB: + index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_LSB: + index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; + sp += (sfx >>> 16); + break; + default: + return; + } + /*** APPLY MASK ***/ + switch (alphaMode) { + case ALPHA_MASK_UNPACKED: { + byte mask = alphaData[ap]; + ap += (sfx >> 16); + if (mask == 0) continue; + } break; + case ALPHA_MASK_PACKED: { + int mask = alphaData[ap >> 3] & (1 << (ap & 7)); + ap += (sfx >> 16); + if (mask == 0) continue; + } break; + case ALPHA_MASK_INDEX: { + int i = 0; + while (i < alphaData.length) { + if (index == (alphaData[i] & 0xff)) break; + } + if (i < alphaData.length) continue; + } break; + case ALPHA_MASK_RGB: { + byte r = srcReds[index], g = srcGreens[index], b = srcBlues[index]; + int i = 0; + while (i < alphaData.length) { + if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) break; + i += 3; + } + if (i < alphaData.length) continue; + } break; + } + index = paletteMapping[index] & 0xff; + + /*** WRITE NEXT PIXEL ***/ + switch (dtype) { + case TYPE_INDEX_8: + destData[dp] = cast(byte) index; + break; + case TYPE_INDEX_4: + if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | index); + else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (index << 4)); + break; + case TYPE_INDEX_2: { + int shift = 6 - (dp & 3) * 2; + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); + } break; + case TYPE_INDEX_1_MSB: { + int shift = 7 - (dp & 7); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + } break; + case TYPE_INDEX_1_LSB: { + int shift = dp & 7; + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); + } break; + } + } + } + } + return; + } + + /*** Comprehensive blit (apply transformations) ***/ + int alpha = alphaMode; + int index = 0; + int indexq = 0; + int lastindex = 0, lastr = -1, lastg = -1, lastb = -1; + int[] rerr, gerr, berr; + if (ditherEnabled) { + rerr = new int[destWidth + 2]; + gerr = new int[destWidth + 2]; + berr = new int[destWidth + 2]; + } else { + rerr = null; gerr = null; berr = null; + } + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, + sp = spr += (sfy >>> 16) * srcStride, + ap = apr += (sfy >>> 16) * alphaStride, + sfy = (sfy & 0xffff) + sfyi, + dp = dpr += dpryi) { + int lrerr = 0, lgerr = 0, lberr = 0; + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, + dp += dprxi, + sfx = (sfx & 0xffff) + sfxi) { + /*** READ NEXT PIXEL ***/ + switch (stype) { + case TYPE_INDEX_8: + index = srcData[sp] & 0xff; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_4: + if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + else index = (srcData[sp >> 1] >>> 4) & 0x0f; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_2: + index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_MSB: + index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_LSB: + index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; + sp += (sfx >>> 16); + break; + } + + /*** DO SPECIAL PROCESSING IF REQUIRED ***/ + int r = srcReds[index] & 0xff, g = srcGreens[index] & 0xff, b = srcBlues[index] & 0xff; + switch (alphaMode) { + case ALPHA_CHANNEL_SEPARATE: + alpha = ((alphaData[ap] & 0xff) << 16) / 255; + ap += (sfx >> 16); + break; + case ALPHA_MASK_UNPACKED: + alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + ap += (sfx >> 16); + break; + case ALPHA_MASK_PACKED: + alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; + ap += (sfx >> 16); + break; + case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices + int i = 0; + while (i < alphaData.length) { + if (index == (alphaData[i] & 0xff)) break; + } + if (i < alphaData.length) continue; + } break; + case ALPHA_MASK_RGB: { + int i = 0; + while (i < alphaData.length) { + if ((r == (alphaData[i] & 0xff)) && + (g == (alphaData[i + 1] & 0xff)) && + (b == (alphaData[i + 2] & 0xff))) break; + i += 3; + } + if (i < alphaData.length) continue; + } break; + } + if (alpha != 0x10000) { + if (alpha == 0x0000) continue; + switch (dtype) { + case TYPE_INDEX_8: + indexq = destData[dp] & 0xff; + break; + case TYPE_INDEX_4: + if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; + else indexq = (destData[dp >> 1] >>> 4) & 0x0f; + break; + case TYPE_INDEX_2: + indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03; + break; + case TYPE_INDEX_1_MSB: + indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01; + break; + case TYPE_INDEX_1_LSB: + indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01; + break; + } + // Perform alpha blending + int rq = destReds[indexq] & 0xff; + int gq = destGreens[indexq] & 0xff; + int bq = destBlues[indexq] & 0xff; + r = rq + ((r - rq) * alpha >> 16); + g = gq + ((g - gq) * alpha >> 16); + b = bq + ((b - bq) * alpha >> 16); + } + + /*** MAP COLOR TO THE PALETTE ***/ + if (ditherEnabled) { + // Floyd-Steinberg error diffusion + r += rerr[dx] >> 4; + if (r < 0) r = 0; else if (r > 255) r = 255; + g += gerr[dx] >> 4; + if (g < 0) g = 0; else if (g > 255) g = 255; + b += berr[dx] >> 4; + if (b < 0) b = 0; else if (b > 255) b = 255; + rerr[dx] = lrerr; + gerr[dx] = lgerr; + berr[dx] = lberr; + } + if (r != lastr || g != lastg || b != lastb) { + // moving the variable declarations out seems to make the JDK JIT happier... + for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { + dr = (destReds[j] & 0xff) - r; + dg = (destGreens[j] & 0xff) - g; + db = (destBlues[j] & 0xff) - b; + distance = dr * dr + dg * dg + db * db; + if (distance < minDistance) { + lastindex = j; + if (distance == 0) break; + minDistance = distance; + } + } + lastr = r; lastg = g; lastb = b; + } + if (ditherEnabled) { + // Floyd-Steinberg error diffusion, cont'd... + int dxm1 = dx - 1, dxp1 = dx + 1; + int acc; + rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr; + rerr[dx] += acc += lrerr + lrerr; + rerr[dxm1] += acc + lrerr + lrerr; + gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr; + gerr[dx] += acc += lgerr + lgerr; + gerr[dxm1] += acc + lgerr + lgerr; + berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr; + berr[dx] += acc += lberr + lberr; + berr[dxm1] += acc + lberr + lberr; + } + + /*** WRITE NEXT PIXEL ***/ + switch (dtype) { + case TYPE_INDEX_8: + destData[dp] = cast(byte) lastindex; + break; + case TYPE_INDEX_4: + if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); + else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); + break; + case TYPE_INDEX_2: { + int shift = 6 - (dp & 3) * 2; + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); + } break; + case TYPE_INDEX_1_MSB: { + int shift = 7 - (dp & 7); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + } break; + case TYPE_INDEX_1_LSB: { + int shift = dp & 7; + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + } break; + } + } + } +} + +/** + * Blits an index palette image into a direct palette image. + *+ * Note: The source and destination masks and palettes must + * always be fully specified. + *
+ * + * @param op the blitter operation: a combination of BLIT_xxx flags + * (see BLIT_xxx constants) + * @param srcData the source byte array containing image data + * @param srcDepth the source depth: one of 1, 2, 4, 8 + * @param srcStride the source number of bytes per line + * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if srcDepth is not 1 + * @param srcX the top-left x-coord of the source blit region + * @param srcY the top-left y-coord of the source blit region + * @param srcWidth the width of the source blit region + * @param srcHeight the height of the source blit region + * @param srcReds the source palette red component intensities + * @param srcGreens the source palette green component intensities + * @param srcBlues the source palette blue component intensities + * @param alphaMode the alpha blending or mask mode, may be + * an integer 0-255 for global alpha; ignored if BLIT_ALPHA + * not specified in the blitter operations + * (see ALPHA_MODE_xxx constants) + * @param alphaData the alpha blending or mask data, varies depending + * on the value of alphaMode and sometimes ignored + * @param alphaStride the alpha data number of bytes per line + * @param alphaX the top-left x-coord of the alpha blit region + * @param alphaY the top-left y-coord of the alpha blit region + * @param destData the destination byte array containing image data + * @param destDepth the destination depth: one of 8, 16, 24, 32 + * @param destStride the destination number of bytes per line + * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if destDepth is not 16 or 32 + * @param destX the top-left x-coord of the destination blit region + * @param destY the top-left y-coord of the destination blit region + * @param destWidth the width of the destination blit region + * @param destHeight the height of the destination blit region + * @param destRedMask the destination red channel mask + * @param destGreenMask the destination green channel mask + * @param destBlueMask the destination blue channel mask + * @param flipX if true the resulting image is flipped along the vertical axis + * @param flipY if true the resulting image is flipped along the horizontal axis + */ +static void blit(int op, + byte[] srcData, int srcDepth, int srcStride, int srcOrder, + int srcX, int srcY, int srcWidth, int srcHeight, + byte[] srcReds, byte[] srcGreens, byte[] srcBlues, + int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, + byte[] destData, int destDepth, int destStride, int destOrder, + int destX, int destY, int destWidth, int destHeight, + int destRedMask, int destGreenMask, int destBlueMask, + bool flipX, bool flipY) { + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + + // these should be supplied as params later + int destAlphaMask = 0; + + /*** Prepare scaling data ***/ + int dwm1 = destWidth - 1; + int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int dhm1 = destHeight - 1; + int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + + /*** Prepare source-related data ***/ + int stype; + switch (srcDepth) { + case 8: + stype = TYPE_INDEX_8; + break; + case 4: + srcStride <<= 1; + stype = TYPE_INDEX_4; + break; + case 2: + srcStride <<= 2; + stype = TYPE_INDEX_2; + break; + case 1: + srcStride <<= 3; + stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int spr = srcY * srcStride + srcX; + + /*** Prepare destination-related data ***/ + int dbpp, dtype; + switch (destDepth) { + case 8: + dbpp = 1; + dtype = TYPE_GENERIC_8; + break; + case 16: + dbpp = 2; + dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + break; + case 24: + dbpp = 3; + dtype = TYPE_GENERIC_24; + break; + case 32: + dbpp = 4; + dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid destination type"); + return; + } + int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; + int dprxi = (flipX) ? -dbpp : dbpp; + int dpryi = (flipY) ? -destStride : destStride; + + /*** Prepare special processing data ***/ + int apr; + if ((op & BLIT_ALPHA) != 0) { + switch (alphaMode) { + case ALPHA_MASK_UNPACKED: + case ALPHA_CHANNEL_SEPARATE: + if (alphaData == null) alphaMode = 0x10000; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_PACKED: + if (alphaData == null) alphaMode = 0x10000; + alphaStride <<= 3; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_INDEX: + case ALPHA_MASK_RGB: + if (alphaData == null) alphaMode = 0x10000; + apr = 0; + break; + default: + alphaMode = (alphaMode << 16) / 255; // prescale + case ALPHA_CHANNEL_SOURCE: + apr = 0; + break; + } + } else { + alphaMode = 0x10000; + apr = 0; + } + + /*** Comprehensive blit (apply transformations) ***/ + int destRedShift = getChannelShift(destRedMask); + int destRedWidth = getChannelWidth(destRedMask, destRedShift); + byte[] destReds = ANY_TO_EIGHT[destRedWidth]; + int destRedPreShift = 8 - destRedWidth; + int destGreenShift = getChannelShift(destGreenMask); + int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift); + byte[] destGreens = ANY_TO_EIGHT[destGreenWidth]; + int destGreenPreShift = 8 - destGreenWidth; + int destBlueShift = getChannelShift(destBlueMask); + int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift); + byte[] destBlues = ANY_TO_EIGHT[destBlueWidth]; + int destBluePreShift = 8 - destBlueWidth; + int destAlphaShift = getChannelShift(destAlphaMask); + int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift); + byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth]; + int destAlphaPreShift = 8 - destAlphaWidth; + + int dp = dpr; + int sp = spr; + int ap = apr, alpha = alphaMode; + int r = 0, g = 0, b = 0, a = 0, index = 0; + int rq = 0, gq = 0, bq = 0, aq = 0; + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, + sp = spr += (sfy >>> 16) * srcStride, + ap = apr += (sfy >>> 16) * alphaStride, + sfy = (sfy & 0xffff) + sfyi, + dp = dpr += dpryi) { + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, + dp += dprxi, + sfx = (sfx & 0xffff) + sfxi) { + /*** READ NEXT PIXEL ***/ + switch (stype) { + case TYPE_INDEX_8: + index = srcData[sp] & 0xff; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_4: + if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; + else index = (srcData[sp >> 1] >>> 4) & 0x0f; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_2: + index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_MSB: + index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; + sp += (sfx >>> 16); + break; + case TYPE_INDEX_1_LSB: + index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; + sp += (sfx >>> 16); + break; + } + + /*** DO SPECIAL PROCESSING IF REQUIRED ***/ + r = srcReds[index] & 0xff; + g = srcGreens[index] & 0xff; + b = srcBlues[index] & 0xff; + switch (alphaMode) { + case ALPHA_CHANNEL_SEPARATE: + alpha = ((alphaData[ap] & 0xff) << 16) / 255; + ap += (sfx >> 16); + break; + case ALPHA_MASK_UNPACKED: + alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + ap += (sfx >> 16); + break; + case ALPHA_MASK_PACKED: + alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; + ap += (sfx >> 16); + break; + case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices + int i = 0; + while (i < alphaData.length) { + if (index == (alphaData[i] & 0xff)) break; + } + if (i < alphaData.length) continue; + } break; + case ALPHA_MASK_RGB: { + int i = 0; + while (i < alphaData.length) { + if ((r == (alphaData[i] & 0xff)) && + (g == (alphaData[i + 1] & 0xff)) && + (b == (alphaData[i + 2] & 0xff))) break; + i += 3; + } + if (i < alphaData.length) continue; + } break; + } + if (alpha != 0x10000) { + if (alpha == 0x0000) continue; + switch (dtype) { + case TYPE_GENERIC_8: { + int data = destData[dp] & 0xff; + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_MSB: { + int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_LSB: { + int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_24: { + int data = (( ((destData[dp] & 0xff) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp + 2] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_MSB: { + int data = (( (( ((destData[dp] & 0xff) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp + 2] & 0xff)) << 8) | + (destData[dp + 3] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_LSB: { + int data = (( (( ((destData[dp + 3] & 0xff) << 8) | + (destData[dp + 2] & 0xff)) << 8) | + (destData[dp + 1] & 0xff)) << 8) | + (destData[dp] & 0xff); + rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; + gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; + bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; + aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; + } break; + } + // Perform alpha blending + a = aq + ((a - aq) * alpha >> 16); + r = rq + ((r - rq) * alpha >> 16); + g = gq + ((g - gq) * alpha >> 16); + b = bq + ((b - bq) * alpha >> 16); + } + + /*** WRITE NEXT PIXEL ***/ + int data = + (r >>> destRedPreShift << destRedShift) | + (g >>> destGreenPreShift << destGreenShift) | + (b >>> destBluePreShift << destBlueShift) | + (a >>> destAlphaPreShift << destAlphaShift); + switch (dtype) { + case TYPE_GENERIC_8: { + destData[dp] = cast(byte) data; + } break; + case TYPE_GENERIC_16_MSB: { + destData[dp] = cast(byte) (data >>> 8); + destData[dp + 1] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_16_LSB: { + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + } break; + case TYPE_GENERIC_24: { + destData[dp] = cast(byte) (data >>> 16); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_32_MSB: { + destData[dp] = cast(byte) (data >>> 24); + destData[dp + 1] = cast(byte) (data >>> 16); + destData[dp + 2] = cast(byte) (data >>> 8); + destData[dp + 3] = cast(byte) (data & 0xff); + } break; + case TYPE_GENERIC_32_LSB: { + destData[dp] = cast(byte) (data & 0xff); + destData[dp + 1] = cast(byte) (data >>> 8); + destData[dp + 2] = cast(byte) (data >>> 16); + destData[dp + 3] = cast(byte) (data >>> 24); + } break; + } + } + } +} + +/** + * Blits a direct palette image into an index palette image. + *+ * Note: The source and destination masks and palettes must + * always be fully specified. + *
+ * + * @param op the blitter operation: a combination of BLIT_xxx flags + * (see BLIT_xxx constants) + * @param srcData the source byte array containing image data + * @param srcDepth the source depth: one of 8, 16, 24, 32 + * @param srcStride the source number of bytes per line + * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if srcDepth is not 16 or 32 + * @param srcX the top-left x-coord of the source blit region + * @param srcY the top-left y-coord of the source blit region + * @param srcWidth the width of the source blit region + * @param srcHeight the height of the source blit region + * @param srcRedMask the source red channel mask + * @param srcGreenMask the source green channel mask + * @param srcBlueMask the source blue channel mask + * @param alphaMode the alpha blending or mask mode, may be + * an integer 0-255 for global alpha; ignored if BLIT_ALPHA + * not specified in the blitter operations + * (see ALPHA_MODE_xxx constants) + * @param alphaData the alpha blending or mask data, varies depending + * on the value of alphaMode and sometimes ignored + * @param alphaStride the alpha data number of bytes per line + * @param alphaX the top-left x-coord of the alpha blit region + * @param alphaY the top-left y-coord of the alpha blit region + * @param destData the destination byte array containing image data + * @param destDepth the destination depth: one of 1, 2, 4, 8 + * @param destStride the destination number of bytes per line + * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; + * ignored if destDepth is not 1 + * @param destX the top-left x-coord of the destination blit region + * @param destY the top-left y-coord of the destination blit region + * @param destWidth the width of the destination blit region + * @param destHeight the height of the destination blit region + * @param destReds the destination palette red component intensities + * @param destGreens the destination palette green component intensities + * @param destBlues the destination palette blue component intensities + * @param flipX if true the resulting image is flipped along the vertical axis + * @param flipY if true the resulting image is flipped along the horizontal axis + */ +static void blit(int op, + byte[] srcData, int srcDepth, int srcStride, int srcOrder, + int srcX, int srcY, int srcWidth, int srcHeight, + int srcRedMask, int srcGreenMask, int srcBlueMask, + int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, + byte[] destData, int destDepth, int destStride, int destOrder, + int destX, int destY, int destWidth, int destHeight, + byte[] destReds, byte[] destGreens, byte[] destBlues, + bool flipX, bool flipY) { + if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; + + // these should be supplied as params later + int srcAlphaMask = 0; + + /*** Prepare scaling data ***/ + int dwm1 = destWidth - 1; + int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; + int dhm1 = destHeight - 1; + int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; + + /*** Prepare source-related data ***/ + int sbpp, stype; + switch (srcDepth) { + case 8: + sbpp = 1; + stype = TYPE_GENERIC_8; + break; + case 16: + sbpp = 2; + stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; + break; + case 24: + sbpp = 3; + stype = TYPE_GENERIC_24; + break; + case 32: + sbpp = 4; + stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int spr = srcY * srcStride + srcX * sbpp; + + /*** Prepare destination-related data ***/ + int dtype; + switch (destDepth) { + case 8: + dtype = TYPE_INDEX_8; + break; + case 4: + destStride <<= 1; + dtype = TYPE_INDEX_4; + break; + case 2: + destStride <<= 2; + dtype = TYPE_INDEX_2; + break; + case 1: + destStride <<= 3; + dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; + break; + default: + //throw new IllegalArgumentException("Invalid source type"); + return; + } + int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); + int dprxi = (flipX) ? -1 : 1; + int dpryi = (flipY) ? -destStride : destStride; + + /*** Prepare special processing data ***/ + int apr; + if ((op & BLIT_ALPHA) != 0) { + switch (alphaMode) { + case ALPHA_MASK_UNPACKED: + case ALPHA_CHANNEL_SEPARATE: + if (alphaData == null) alphaMode = 0x10000; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_PACKED: + if (alphaData == null) alphaMode = 0x10000; + alphaStride <<= 3; + apr = alphaY * alphaStride + alphaX; + break; + case ALPHA_MASK_INDEX: + //throw new IllegalArgumentException("Invalid alpha type"); + return; + case ALPHA_MASK_RGB: + if (alphaData == null) alphaMode = 0x10000; + apr = 0; + break; + default: + alphaMode = (alphaMode << 16) / 255; // prescale + case ALPHA_CHANNEL_SOURCE: + apr = 0; + break; + } + } else { + alphaMode = 0x10000; + apr = 0; + } + bool ditherEnabled = (op & BLIT_DITHER) != 0; + + /*** Comprehensive blit (apply transformations) ***/ + int srcRedShift = getChannelShift(srcRedMask); + byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)]; + int srcGreenShift = getChannelShift(srcGreenMask); + byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)]; + int srcBlueShift = getChannelShift(srcBlueMask); + byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)]; + int srcAlphaShift = getChannelShift(srcAlphaMask); + byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)]; + + int dp = dpr; + int sp = spr; + int ap = apr, alpha = alphaMode; + int r = 0, g = 0, b = 0, a = 0; + int indexq = 0; + int lastindex = 0, lastr = -1, lastg = -1, lastb = -1; + int[] rerr, gerr, berr; + int destPaletteSize = 1 << destDepth; + if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; + if (ditherEnabled) { + rerr = new int[destWidth + 2]; + gerr = new int[destWidth + 2]; + berr = new int[destWidth + 2]; + } else { + rerr = null; gerr = null; berr = null; + } + for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, + sp = spr += (sfy >>> 16) * srcStride, + ap = apr += (sfy >>> 16) * alphaStride, + sfy = (sfy & 0xffff) + sfyi, + dp = dpr += dpryi) { + int lrerr = 0, lgerr = 0, lberr = 0; + for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, + dp += dprxi, + sfx = (sfx & 0xffff) + sfxi) { + /*** READ NEXT PIXEL ***/ + switch (stype) { + case TYPE_GENERIC_8: { + int data = srcData[sp] & 0xff; + sp += (sfx >>> 16); + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_MSB: { + int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff); + sp += (sfx >>> 16) * 2; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_16_LSB: { + int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff); + sp += (sfx >>> 16) * 2; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_24: { + int data = (( ((srcData[sp] & 0xff) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp + 2] & 0xff); + sp += (sfx >>> 16) * 3; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_MSB: { + int data = (( (( ((srcData[sp] & 0xff) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp + 2] & 0xff)) << 8) | + (srcData[sp + 3] & 0xff); + sp += (sfx >>> 16) * 4; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + case TYPE_GENERIC_32_LSB: { + int data = (( (( ((srcData[sp + 3] & 0xff) << 8) | + (srcData[sp + 2] & 0xff)) << 8) | + (srcData[sp + 1] & 0xff)) << 8) | + (srcData[sp] & 0xff); + sp += (sfx >>> 16) * 4; + r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; + g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; + b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; + a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; + } break; + } + + /*** DO SPECIAL PROCESSING IF REQUIRED ***/ + switch (alphaMode) { + case ALPHA_CHANNEL_SEPARATE: + alpha = ((alphaData[ap] & 0xff) << 16) / 255; + ap += (sfx >> 16); + break; + case ALPHA_CHANNEL_SOURCE: + alpha = (a << 16) / 255; + break; + case ALPHA_MASK_UNPACKED: + alpha = (alphaData[ap] != 0) ? 0x10000 : 0; + ap += (sfx >> 16); + break; + case ALPHA_MASK_PACKED: + alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; + ap += (sfx >> 16); + break; + case ALPHA_MASK_RGB: + alpha = 0x10000; + for (int i = 0; i < alphaData.length; i += 3) { + if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { + alpha = 0x0000; + break; + } + } + break; + } + if (alpha != 0x10000) { + if (alpha == 0x0000) continue; + switch (dtype) { + case TYPE_INDEX_8: + indexq = destData[dp] & 0xff; + break; + case TYPE_INDEX_4: + if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; + else indexq = (destData[dp >> 1] >>> 4) & 0x0f; + break; + case TYPE_INDEX_2: + indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03; + break; + case TYPE_INDEX_1_MSB: + indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01; + break; + case TYPE_INDEX_1_LSB: + indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01; + break; + } + // Perform alpha blending + int rq = destReds[indexq] & 0xff; + int gq = destGreens[indexq] & 0xff; + int bq = destBlues[indexq] & 0xff; + r = rq + ((r - rq) * alpha >> 16); + g = gq + ((g - gq) * alpha >> 16); + b = bq + ((b - bq) * alpha >> 16); + } + + /*** MAP COLOR TO THE PALETTE ***/ + if (ditherEnabled) { + // Floyd-Steinberg error diffusion + r += rerr[dx] >> 4; + if (r < 0) r = 0; else if (r > 255) r = 255; + g += gerr[dx] >> 4; + if (g < 0) g = 0; else if (g > 255) g = 255; + b += berr[dx] >> 4; + if (b < 0) b = 0; else if (b > 255) b = 255; + rerr[dx] = lrerr; + gerr[dx] = lgerr; + berr[dx] = lberr; + } + if (r != lastr || g != lastg || b != lastb) { + // moving the variable declarations out seems to make the JDK JIT happier... + for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { + dr = (destReds[j] & 0xff) - r; + dg = (destGreens[j] & 0xff) - g; + db = (destBlues[j] & 0xff) - b; + distance = dr * dr + dg * dg + db * db; + if (distance < minDistance) { + lastindex = j; + if (distance == 0) break; + minDistance = distance; + } + } + lastr = r; lastg = g; lastb = b; + } + if (ditherEnabled) { + // Floyd-Steinberg error diffusion, cont'd... + int dxm1 = dx - 1, dxp1 = dx + 1; + int acc; + rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr; + rerr[dx] += acc += lrerr + lrerr; + rerr[dxm1] += acc + lrerr + lrerr; + gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr; + gerr[dx] += acc += lgerr + lgerr; + gerr[dxm1] += acc + lgerr + lgerr; + berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr; + berr[dx] += acc += lberr + lberr; + berr[dxm1] += acc + lberr + lberr; + } + + /*** WRITE NEXT PIXEL ***/ + switch (dtype) { + case TYPE_INDEX_8: + destData[dp] = cast(byte) lastindex; + break; + case TYPE_INDEX_4: + if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); + else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); + break; + case TYPE_INDEX_2: { + int shift = 6 - (dp & 3) * 2; + destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); + } break; + case TYPE_INDEX_1_MSB: { + int shift = 7 - (dp & 7); + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + } break; + case TYPE_INDEX_1_LSB: { + int shift = dp & 7; + destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); + } break; + } + } + } +} + +/** + * Computes the required channel shift from a mask. + */ +static int getChannelShift(int mask) { + if (mask == 0) return 0; + int i; + for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) { + mask >>>= 1; + } + return i; +} + +/** + * Computes the required channel width (depth) from a mask. + */ +static int getChannelWidth(int mask, int shift) { + if (mask == 0) return 0; + int i; + mask >>>= shift; + for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) { + mask >>>= 1; + } + return i - shift; +} + +/** + * Extracts a field from packed RGB data given a mask for that field. + */ +static byte getChannelField(int data, int mask) { + int shift = getChannelShift(mask); + return ANY_TO_EIGHT[getChannelWidth(mask, shift)][(data & mask) >>> shift]; +} + +/** + * Creates an ImageData containing one band's worth of a gradient filled + * block. Ifvertical
is true, the band must be tiled
+ * horizontally to fill a region, otherwise it must be tiled vertically.
+ *
+ * @param width the width of the region to be filled
+ * @param height the height of the region to be filled
+ * @param vertical if true sweeps from top to bottom, else
+ * sweeps from left to right
+ * @param fromRGB the color to start with
+ * @param toRGB the color to end with
+ * @param redBits the number of significant red bits, 0 for palette modes
+ * @param greenBits the number of significant green bits, 0 for palette modes
+ * @param blueBits the number of significant blue bits, 0 for palette modes
+ * @return the new ImageData
+ */
+static ImageData createGradientBand(
+ int width, int height, bool vertical,
+ RGB fromRGB, RGB toRGB,
+ int redBits, int greenBits, int blueBits) {
+ /* Gradients are drawn as tiled bands */
+ int bandWidth, bandHeight, bitmapDepth;
+ byte[] bitmapData;
+ PaletteData paletteData;
+ /* Select an algorithm depending on the depth of the screen */
+ if (redBits != 0 && greenBits != 0 && blueBits != 0) {
+ paletteData = new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000);
+ bitmapDepth = 32;
+ if (redBits >= 8 && greenBits >= 8 && blueBits >= 8) {
+ /* Precise color */
+ int steps;
+ if (vertical) {
+ bandWidth = 1;
+ bandHeight = height;
+ steps = bandHeight > 1 ? bandHeight - 1 : 1;
+ } else {
+ bandWidth = width;
+ bandHeight = 1;
+ steps = bandWidth > 1 ? bandWidth - 1 : 1;
+ }
+ int bytesPerLine = bandWidth * 4;
+ bitmapData = new byte[bandHeight * bytesPerLine];
+ buildPreciseGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine);
+ buildPreciseGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine);
+ buildPreciseGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine);
+ } else {
+ /* Dithered color */
+ int steps;
+ if (vertical) {
+ bandWidth = (width < 8) ? width : 8;
+ bandHeight = height;
+ steps = bandHeight > 1 ? bandHeight - 1 : 1;
+ } else {
+ bandWidth = width;
+ bandHeight = (height < 8) ? height : 8;
+ steps = bandWidth > 1 ? bandWidth - 1 : 1;
+ }
+ int bytesPerLine = bandWidth * 4;
+ bitmapData = new byte[bandHeight * bytesPerLine];
+ buildDitheredGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine, blueBits);
+ buildDitheredGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine, greenBits);
+ buildDitheredGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine, redBits);
+ }
+ } else {
+ /* Dithered two tone */
+ paletteData = new PaletteData([ fromRGB, toRGB ]);
+ bitmapDepth = 8;
+ int blendi;
+ if (vertical) {
+ bandWidth = (width < 8) ? width : 8;
+ bandHeight = height;
+ blendi = (bandHeight > 1) ? 0x1040000 / (bandHeight - 1) + 1 : 1;
+ } else {
+ bandWidth = width;
+ bandHeight = (height < 8) ? height : 8;
+ blendi = (bandWidth > 1) ? 0x1040000 / (bandWidth - 1) + 1 : 1;
+ }
+ int bytesPerLine = (bandWidth + 3) & -4;
+ bitmapData = new byte[bandHeight * bytesPerLine];
+ if (vertical) {
+ for (int dy = 0, blend = 0, dp = 0; dy < bandHeight;
+ ++dy, blend += blendi, dp += bytesPerLine) {
+ for (int dx = 0; dx < bandWidth; ++dx) {
+ bitmapData[dp + dx] = (blend + DITHER_MATRIX[dy & 7][dx]) <
+ 0x1000000 ? cast(byte)0 : cast(byte)1;
+ }
+ }
+ } else {
+ for (int dx = 0, blend = 0; dx < bandWidth; ++dx, blend += blendi) {
+ for (int dy = 0, dptr = dx; dy < bandHeight; ++dy, dptr += bytesPerLine) {
+ bitmapData[dptr] = (blend + DITHER_MATRIX[dy][dx & 7]) <
+ 0x1000000 ? cast(byte)0 : cast(byte)1;
+ }
+ }
+ }
+ }
+ return new ImageData(bandWidth, bandHeight, bitmapDepth, paletteData, 4, bitmapData);
+}
+
+/*
+ * Fill in gradated values for a color channel
+ */
+static final void buildPreciseGradientChannel(int from, int to, int steps,
+ int bandWidth, int bandHeight, bool vertical,
+ byte[] bitmapData, int dp, int bytesPerLine) {
+ int val = from << 16;
+ int inc = ((to << 16) - val) / steps + 1;
+ if (vertical) {
+ for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
+ bitmapData[dp] = cast(byte)(val >>> 16);
+ val += inc;
+ }
+ } else {
+ for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
+ bitmapData[dp] = cast(byte)(val >>> 16);
+ val += inc;
+ }
+ }
+}
+
+/*
+ * Fill in dithered gradated values for a color channel
+ */
+static final void buildDitheredGradientChannel(int from, int to, int steps,
+ int bandWidth, int bandHeight, bool vertical,
+ byte[] bitmapData, int dp, int bytesPerLine, int bits) {
+ int mask = 0xff00 >>> bits;
+ int val = from << 16;
+ int inc = ((to << 16) - val) / steps + 1;
+ if (vertical) {
+ for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
+ for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
+ int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
+ int temp = val + thresh;
+ if (temp > 0xffffff) bitmapData[dptr] = -1;
+ else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask);
+ }
+ val += inc;
+ }
+ } else {
+ for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
+ for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
+ int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
+ int temp = val + thresh;
+ if (temp > 0xffffff) bitmapData[dptr] = -1;
+ else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask);
+ }
+ val += inc;
+ }
+ }
+}
+
+/**
+ * Renders a gradient onto a GC.
+ * + * This is a GC helper. + *
+ * + * @param gc the GC to render the gradient onto + * @param device the device the GC belongs to + * @param x the top-left x coordinate of the region to be filled + * @param y the top-left y coordinate of the region to be filled + * @param width the width of the region to be filled + * @param height the height of the region to be filled + * @param vertical if true sweeps from top to bottom, else + * sweeps from left to right + * @param fromRGB the color to start with + * @param toRGB the color to end with + * @param redBits the number of significant red bits, 0 for palette modes + * @param greenBits the number of significant green bits, 0 for palette modes + * @param blueBits the number of significant blue bits, 0 for palette modes + */ +static void fillGradientRectangle(GC gc, Device device, + int x, int y, int width, int height, bool vertical, + RGB fromRGB, RGB toRGB, + int redBits, int greenBits, int blueBits) { + /* Create the bitmap and tile it */ + ImageData band = createGradientBand(width, height, vertical, + fromRGB, toRGB, redBits, greenBits, blueBits); + Image image = new Image(device, band); + if ((band.width == 1) || (band.height == 1)) { + gc.drawImage(image, 0, 0, band.width, band.height, x, y, width, height); + } else { + if (vertical) { + for (int dx = 0; dx < width; dx += band.width) { + int blitWidth = width - dx; + if (blitWidth > band.width) blitWidth = band.width; + gc.drawImage(image, 0, 0, blitWidth, band.height, dx + x, y, blitWidth, band.height); + } + } else { + for (int dy = 0; dy < height; dy += band.height) { + int blitHeight = height - dy; + if (blitHeight > band.height) blitHeight = band.height; + gc.drawImage(image, 0, 0, band.width, blitHeight, x, dy + y, band.width, blitHeight); + } + } + } + image.dispose(); +} + +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/ImageDataLoader.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/ImageDataLoader.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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.graphics.ImageDataLoader; + +public import org.eclipse.swt.graphics.ImageData; + +import org.eclipse.swt.graphics.ImageLoader; +import tango.io.model.IConduit; + +/** + * Internal class that separates ImageData from ImageLoader + * to allow removal of ImageLoader from the toolkit. + */ +class ImageDataLoader { + + public static ImageData[] load(InputStream stream) { + return (new ImageLoader()).load(stream); + } + + public static ImageData[] load(char[] filename) { + return (new ImageLoader()).load(filename); + } + +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/ImageLoader.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/ImageLoader.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,329 @@ +/******************************************************************************* + * 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.graphics.ImageLoader; + + +public import org.eclipse.swt.graphics.ImageLoaderListener; +public import org.eclipse.swt.graphics.ImageLoaderEvent; +public import org.eclipse.swt.graphics.ImageData; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.internal.Compatibility; +//import org.eclipse.swt.internal.image.*; + +import tango.core.Exception; +import tango.core.Array; +import tango.io.model.IConduit; + +class FileFormat{ + static ImageData[] load( InputStream, ImageLoader ){ return null; } + static void save( OutputStream, int, ImageLoader ){} +} + +/** + * Instances of this class are used to load images from, + * and save images to, a file or stream. + *+ * Currently supported image formats are: + *
ImageLoaders
can be used to:
+ * imageLoaderListeners
field.
+ */
+void reset() {
+ data = null;
+ logicalScreenWidth = 0;
+ logicalScreenHeight = 0;
+ backgroundPixel = -1;
+ repeatCount = 1;
+}
+
+/**
+ * Loads an array of ImageData
objects from the
+ * specified input stream. Throws an error if either an error
+ * occurs while loading the images, or if the images are not
+ * of a supported type. Returns the loaded image data array.
+ *
+ * @param stream the input stream to load the images from
+ * @return an array of ImageData
objects loaded from the specified input stream
+ *
+ * @exception IllegalArgumentException ImageData
objects from the
+ * file with the specified name. Throws an error if either
+ * an error occurs while loading the images, or if the images are
+ * not of a supported type. Returns the loaded image data array.
+ *
+ * @param filename the name of the file to load the images from
+ * @return an array of ImageData
objects loaded from the specified file
+ *
+ * @exception IllegalArgumentException IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
+ * An ImageLoaderListener should be added before invoking
+ * one of the receiver's load methods. The listener's
+ * imageDataLoaded
method is called when image
+ * data has been partially loaded, as is supported by interlaced
+ * GIF/PNG or progressive JPEG images.
+ *
+ * @param listener the listener which should be notified
+ *
+ * @exception IllegalArgumentException
true
if the receiver has image loader
+ * listeners, and false
otherwise.
+ *
+ * @return true
if there are ImageLoaderListener
s, and false
otherwise
+ *
+ * @see #addImageLoaderListener(ImageLoaderListener)
+ * @see #removeImageLoaderListener(ImageLoaderListener)
+ */
+public bool hasListeners() {
+ return imageLoaderListeners.length > 0;
+}
+
+/**
+ * Notifies all image loader listeners that an image loader event
+ * has occurred. Pass the specified event object to each listener.
+ *
+ * @param event the ImageLoaderEvent
to send to each ImageLoaderListener
+ */
+public void notifyListeners(ImageLoaderEvent event) {
+ if (!hasListeners()) return;
+ foreach( listener; imageLoaderListeners ){
+ listener.imageDataLoaded(event);
+ }
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/ImageLoaderEvent.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/ImageLoaderEvent.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.graphics.ImageLoaderEvent;
+
+
+public import org.eclipse.swt.internal.SWTEventObject;
+public import org.eclipse.swt.graphics.ImageLoader;
+public import org.eclipse.swt.graphics.ImageData;
+
+import tango.text.convert.Format;
+
+/**
+ * Instances of this class are sent as a result of the incremental
+ * loading of image data.
+ * + * Notes: + *
endOfImage
flag in the event will be set to true
+ * after each individual image is loaded.endOfImage
flag is false, then this is a
+ * partially complete copy of the current ImageData
,
+ * otherwise this is a completely loaded ImageData
+ */
+ public ImageData imageData;
+
+ /**
+ * the zero-based count of image data increments -- this is
+ * equivalent to the number of events that have been generated
+ * while loading a particular image
+ */
+ public int incrementCount;
+
+ /**
+ * If this flag is true, then the current image data has been
+ * completely loaded, otherwise the image data is only partially
+ * loaded, and further ImageLoader events will occur unless an
+ * exception is thrown
+ */
+ public bool endOfImage;
+
+ //static final long serialVersionUID = 3257284738325558065L;
+
+/**
+ * Constructs a new instance of this class given the event source and
+ * the values to store in its fields.
+ *
+ * @param source the ImageLoader that was loading when the event occurred
+ * @param imageData the image data for the event
+ * @param incrementCount the image data increment for the event
+ * @param endOfImage the end of image flag for the event
+ */
+public this(ImageLoader source, ImageData imageData, int incrementCount, bool endOfImage) {
+ super(source);
+ this.imageData = imageData;
+ this.incrementCount = incrementCount;
+ this.endOfImage = endOfImage;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString () {
+ return Format( "ImageLoaderEvent {source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/ImageLoaderListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/ImageLoaderListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.graphics.ImageLoaderListener;
+
+
+public import org.eclipse.swt.graphics.ImageLoaderEvent;
+public import org.eclipse.swt.internal.SWTEventListener;
+
+/**
+ * Classes which implement this interface provide methods
+ * that deal with the incremental loading of image data.
+ *
+ * After creating an instance of a class that implements
+ * this interface it can be added to an image loader using the
+ * addImageLoaderListener
method and removed using
+ * the removeImageLoaderListener
method. When
+ * image data is either partially or completely loaded, this
+ * method will be invoked.
+ *
+ * The timing of when this method is called varies depending on + * the format of the image being loaded. + *
+ * + * @param e an event containing information about the image loading operation + */ +public void imageDataLoaded(ImageLoaderEvent e); + +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/LineAttributes.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/graphics/LineAttributes.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,121 @@ +/******************************************************************************* + * 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.graphics.LineAttributes; + +import org.eclipse.swt.SWT; + +/** + *LineAttributes
defines a set of line attributes that
+ * can be modified in a GC.
+ *
+ * Application code does not need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no dispose()
method is provided.
+ *
+ * Depending on the depth of the image, the PaletteData can take one + * of two forms, indicated by the isDirect field: + *
+ *false
, this palette is an indexed
+ * palette which maps pixel values to RGBs. The actual RGB values
+ * may be retrieved by using the getRGBs() method.
+ * true
, this palette is a direct color
+ * palette. Instead of containing RGB values, it contains red,
+ * green and blue mask and shift information which indicates how
+ * the color components may be extracted from a given pixel.
+ * This means that the RGB value is actually encoded in the pixel value.
+ * + * In this case, the shift data is the number of bits required to shift + * the RGB value to the left in order to align the high bit of the + * corresponding mask with the high bit of the first byte. This number + * may be negative, so care must be taken when shifting. For example, + * with a red mask of 0xFF0000, the red shift would be -16. With a red + * mask of 0x1F, the red shift would be 3. + *
+ *RGB
s for the palette
+ *
+ * @exception IllegalArgumentException RGB
.
+ *
+ * @param rgb the RGB to get the pixel value for
+ * @return the pixel value for the given RGB
+ *
+ * @exception IllegalArgumentException RGB
corresponding to the given pixel value.
+ *
+ * @param pixel the pixel to get the RGB value for
+ * @return the RGB value for the given pixel
+ *
+ * @exception IllegalArgumentException RGB
s for the receiver or null
+ */
+public RGB[] getRGBs() {
+ return colors;
+}
+
+/**
+ * Computes the shift value for a given mask.
+ *
+ * @param mask the mask to compute the shift for
+ * @return the shift amount
+ *
+ * @see PaletteData
+ */
+int shiftForMask(int mask) {
+ for (int i = 31; i >= 0; i--) {
+ if (((mask >> i) & 0x1) != 0) return 7 - i;
+ }
+ return 32;
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/PathData.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/PathData.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.graphics.PathData;
+
+
+/**
+ * Instances of this class describe device-independent paths.
+ *
+ * @see Path
+ *
+ * @since 3.1
+ */
+public final class PathData {
+
+ /**
+ * The type of each point.
+ */
+ public byte[] types;
+
+ /**
+ * The points of a path.
+ */
+ public float[] points;
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/Point.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/Point.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.graphics.Point;
+
+
+public import org.eclipse.swt.internal.SerializableCompatibility;
+
+import tango.text.convert.Format;
+
+/**
+ * Instances of this class represent places on the (x, y)
+ * coordinate plane.
+ * + * The coordinate space for rectangles and points is considered + * to have increasing values downward and to the right from its + * origin making this the normal, computer graphics oriented notion + * of (x, y) coordinates rather than the strict mathematical one. + *
+ *+ * The hashCode() method in this class uses the values of the public + * fields to compute the hash value. When storing instances of the + * class in hashed collections, do not modify these fields after the + * object has been inserted. + *
+ *
+ * Application code does not need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no dispose()
method is provided.
+ *
true
if the object is the same as this object and false
otherwise
+ *
+ * @see #hashCode()
+ */
+public override int opEquals (Object object) {
+ if (object is this) return true;
+ if ( auto p = cast(Point)object ){
+ return (p.x == this.x) && (p.y == this.y);
+ }
+ return false;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
+ * equals
must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+public hash_t toHash () {
+ return x ^ y;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the point
+ */
+public char[] toString () {
+ return Format( "Point {}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+}
+
+}
+
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/RGB.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/RGB.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * 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.graphics.RGB;
+
+public import org.eclipse.swt.internal.SerializableCompatibility;
+
+import org.eclipse.swt.SWT;
+import Math = tango.math.Math : min, max;
+import tango.text.convert.Format;
+
+/**
+ * Instances of this class are descriptions of colors in
+ * terms of the primary additive color model (red, green and
+ * blue). A color may be described in terms of the relative
+ * intensities of these three primary colors. The brightness
+ * of each color is specified by a value in the range 0 to 255,
+ * where 0 indicates no color (blackness) and 255 indicates
+ * maximum intensity.
+ * + * The hashCode() method in this class uses the values of the public + * fields to compute the hash value. When storing instances of the + * class in hashed collections, do not modify these fields after the + * object has been inserted. + *
+ *
+ * Application code does not need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no dispose()
method is provided.
+ *
true
if the object is the same as this object and false
otherwise
+ *
+ * @see #hashCode()
+ */
+public override int opEquals(Object object) {
+ if (object is this) return true;
+ if( auto rgb = cast(RGB) object ){
+ return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
+ }
+ return false;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
+ * equals
must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+public hash_t toHash() {
+ return (blue << 16) | (green << 8) | red;
+}
+
+/**
+ * Returns a String containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a String representation of the RGB
+ */
+public override char[] toString() {
+ return Format( "RGB {}, {}, {}}", red, green, blue ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+}
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/graphics/Rectangle.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/graphics/Rectangle.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,349 @@
+/*******************************************************************************
+ * 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.graphics.Rectangle;
+
+public import org.eclipse.swt.graphics.Point;
+public import org.eclipse.swt.internal.SerializableCompatibility;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import tango.text.convert.Format;
+
+/**
+ * Instances of this class represent rectangular areas in an
+ * (x, y) coordinate system. The top left corner of the rectangle
+ * is specified by its x and y values, and the extent of the
+ * rectangle is specified by its width and height.
+ * + * The coordinate space for rectangles and points is considered + * to have increasing values downward and to the right from its + * origin making this the normal, computer graphics oriented notion + * of (x, y) coordinates rather than the strict mathematical one. + *
+ *+ * The hashCode() method in this class uses the values of the public + * fields to compute the hash value. When storing instances of the + * class in hashed collections, do not modify these fields after the + * object has been inserted. + *
+ *
+ * Application code does not need to explicitly release the
+ * resources managed by each instance when those instances are no longer
+ * required, and thus no dispose()
method is provided.
+ *
+ * The union of two rectangles is the smallest single rectangle + * that completely covers both of the areas covered by the two + * given rectangles. + *
+ * + * @param rect the rectangle to merge with the receiver + * + * @exception IllegalArgumentExceptiontrue
if the point specified by the
+ * arguments is inside the area specified by the receiver,
+ * and false
otherwise.
+ *
+ * @param x the x coordinate of the point to test for containment
+ * @param y the y coordinate of the point to test for containment
+ * @return true
if the rectangle contains the point and false
otherwise
+ */
+public bool contains (int x, int y) {
+ return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height);
+}
+
+/**
+ * Returns true
if the given point is inside the
+ * area specified by the receiver, and false
+ * otherwise.
+ *
+ * @param pt the point to test for containment
+ * @return true
if the rectangle contains the point and false
otherwise
+ *
+ * @exception IllegalArgumentException true
if the object is the same as this object and false
otherwise
+ *
+ * @see #hashCode()
+ */
+public override int opEquals (Object object) {
+ if (object is this) return true;
+ if( auto r = cast(Rectangle) object ){
+ return (r.x == this.x) && (r.y == this.y) && (r.width == this.width) && (r.height == this.height);
+ }
+ return false;
+}
+
+/**
+ * Returns an integer hash code for the receiver. Any two
+ * objects that return true
when passed to
+ * equals
must return the same value for this
+ * method.
+ *
+ * @return the receiver's hash
+ *
+ * @see #equals(Object)
+ */
+public override hash_t toHash () {
+ return x ^ y ^ width ^ height;
+}
+
+/**
+ * Destructively replaces the x, y, width and height values
+ * in the receiver with ones which represent the intersection of the
+ * rectangles specified by the receiver and the given rectangle.
+ *
+ * @param rect the rectangle to intersect with the receiver
+ *
+ * @exception IllegalArgumentException + * The intersection of two rectangles is the rectangle that + * covers the area which is contained within both rectangles. + *
+ * + * @param rect the rectangle to intersect with the receiver + * @return the intersection of the receiver and the argument + * + * @exception IllegalArgumentExceptiontrue
if the rectangle described by the
+ * arguments intersects with the receiver and false
+ * otherwise.
+ * + * Two rectangles intersect if the area of the rectangle + * representing their intersection is not empty. + *
+ * + * @param x the x coordinate of the origin of the rectangle + * @param y the y coordinate of the origin of the rectangle + * @param width the width of the rectangle + * @param height the height of the rectangle + * @returntrue
if the rectangle intersects with the receiver, and false
otherwise
+ *
+ * @exception IllegalArgumentException true
if the given rectangle intersects
+ * with the receiver and false
otherwise.
+ * + * Two rectangles intersect if the area of the rectangle + * representing their intersection is not empty. + *
+ * + * @param rect the rectangle to test for intersection + * @returntrue
if the rectangle intersects with the receiver, and false
otherwise
+ *
+ * @exception IllegalArgumentException true
if the receiver does not cover any
+ * area in the (x, y) coordinate plane, and false
if
+ * the receiver does cover some area in the plane.
+ * + * A rectangle is considered to cover area in the + * (x, y) coordinate plane if both its width and height are + * non-zero. + *
+ * + * @returntrue
if the receiver is empty, and false
otherwise
+ */
+public bool isEmpty () {
+ return (width <= 0) || (height <= 0);
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the rectangle
+ */
+public override char[] toString () {
+ return Format( "Rectangle {}, {}, {}, {}}", x, y, width, height ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+}
+
+/**
+ * Returns a new rectangle which represents the union of
+ * the receiver and the given rectangle.
+ * + * The union of two rectangles is the smallest single rectangle + * that completely covers both of the areas covered by the two + * given rectangles. + *
+ * + * @param rect the rectangle to perform union with + * @return the union of the receiver and the argument + * + * @exception IllegalArgumentException+ * IMPORTANT: This class is intended to be subclassed only + * within the SWT implementation. However, it has not been marked + * final to allow those outside of the SWT development team to implement + * patched versions of the class in order to get around specific + * limitations in advance of when those limitations can be addressed + * by the team. Any class built using subclassing to access the internals + * of this class will likely fail to compile or run between releases and + * may be strongly platform specific. Subclassing should not be attempted + * without an intimate and detailed understanding of the workings of the + * hierarchy. No support is provided for user-written classes which are + * implemented as subclasses of this class. + *
+ * + * @see #dispose + * @see #isDisposed + * + * @since 3.1 + */ +public abstract class Resource { + + /** + * the device where this resource was created + */ + Device device; + +/** + * Disposes of the operating system resources associated with + * this resource. Applications must dispose of all resources + * which they allocate. + */ +public abstract void dispose(); + +/** + * Returns theDevice
where this resource was
+ * created.
+ *
+ * @return Device
the device of the receiver
+ *
+ * @since 3.2
+ */
+public Device getDevice() {
+ Device device = this.device;
+ if (device is null || isDisposed ()) SWT.error (SWT.ERROR_GRAPHIC_DISPOSED);
+ return device;
+}
+
+/**
+ * Returns true
if the resource has been disposed,
+ * and false
otherwise.
+ *
+ * This method gets the dispose state for the resource.
+ * When a resource has been disposed, it is an error to
+ * invoke any other method using the resource.
+ *
+ * @return true
when the resource is disposed and false
otherwise
+ */
+public abstract bool isDisposed();
+
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/BidiUtil.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/BidiUtil.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.BidiUtil;
+
+//import org.eclipse.swt.graphics.GC;
+
+// PORTING_TYPE
+class GC{}
+class Runnable{}
+
+/*
+ * This class is supplied so that the StyledText code that supports bidi text (supported
+ * for win platforms) is not platform dependent. Bidi text is not implemented on
+ * emulated platforms.
+ */
+public class BidiUtil {
+ // Keyboard language types
+ public static const int KEYBOARD_NON_BIDI = 0;
+ public static const int KEYBOARD_BIDI = 1;
+
+ // bidi rendering input flag constants, not used
+ // on emulated platforms
+ public static const int CLASSIN = 1;
+ public static const int LINKBEFORE = 2;
+ public static const int LINKAFTER = 4;
+
+ // bidi rendering/ordering constants, not used on
+ // emulated platforms
+ public static const int CLASS_HEBREW = 2;
+ public static const int CLASS_ARABIC = 2;
+ public static const int CLASS_LOCALNUMBER = 4;
+ public static const int CLASS_LATINNUMBER = 5;
+ public static const int REORDER = 0;
+ public static const int LIGATE = 0;
+ public static const int GLYPHSHAPE = 0;
+
+/*
+ * Not implemented.
+ */
+public static void addLanguageListener(int /*long*/ hwnd, Runnable runnable) {
+}
+/*
+ * Not implemented.
+ *
+ */
+public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) {
+}
+/*
+ * Bidi not supported on emulated platforms.
+ *
+ */
+public static bool isBidiPlatform() {
+ return false;
+}
+/*
+ * Not implemented.
+ */
+public static bool isKeyboardBidi() {
+ return false;
+}
+/*
+ * Not implemented.
+ */
+public static int getFontBidiAttributes(GC gc) {
+ return 0;
+}
+/*
+ * Not implemented.
+ *
+ */
+public static void getOrderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int flags, int [] offsets) {
+}
+/*
+ * Not implemented. Returns null.
+ *
+ */
+public static char[] getRenderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) {
+ return null;
+}
+/*
+ * Not implemented. Returns 0.
+ */
+public static int getKeyboardLanguage() {
+ return 0;
+}
+/*
+ * Not implemented.
+ */
+public static void removeLanguageListener(int /*long*/ hwnd) {
+}
+/*
+ * Not implemented.
+ */
+public static void setKeyboardLanguage(int language) {
+}
+/*
+ * Not implemented.
+ */
+public static bool setOrientation(int /*long*/ hwnd, int orientation) {
+ return false;
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/CloneableCompatibility.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/CloneableCompatibility.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.CloneableCompatibility;
+
+//PORTING_TYPE
+interface Cloneable{}
+
+/**
+ * This interface is the cross-platform version of the
+ * java.lang.Cloneable interface.
+ *
+ * It is part of our effort to provide support for both J2SE + * and J2ME platforms. Under this scheme, classes need to + * implement CloneableCompatibility instead of java.lang.Cloneable. + *
+ *+ * Note: java.lang.Cloneable is not part of CLDC. + *
+ */ +public interface CloneableCompatibility : Cloneable { +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/Compatibility.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/Compatibility.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,350 @@ +/******************************************************************************* + * 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 org.eclipse.swt.SWT; + +import Math = tango.math.Math; +import Unicode = tango.text.Unicode; +import tango.sys.Process; +import tango.io.stream.FileStream; +import tango.io.compress.ZlibStream; + +/** + * 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) {
+ return new ZlibInput(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 a1f832ca7d17 -r ad2b69216039 dwt/internal/Converter.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/Converter.d Sat Jan 05 17:39:49 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; +} + +/+ // only difference with String vs. char[] arg, so no diff in dwt +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 a1f832ca7d17 -r ad2b69216039 dwt/internal/LONG.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/LONG.d Sat Jan 05 17:39:49 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 a1f832ca7d17 -r ad2b69216039 dwt/internal/Library.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/Library.d Sat Jan 05 17:39:49 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 a1f832ca7d17 -r ad2b69216039 dwt/internal/Lock.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/Lock.d Sat Jan 05 17:39:49 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 a1f832ca7d17 -r ad2b69216039 dwt/internal/Platform.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/Platform.d Sat Jan 05 17:39:49 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 a1f832ca7d17 -r ad2b69216039 dwt/internal/SWTEventListener.d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/SWTEventListener.d Sat Jan 05 17:39:49 2008 +0100
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.SWTEventListener;
+
+
+//import java.util.EventListener;
+
+///PORTING_TYPE
+interface EventListener{
+}
+
+/**
+ * This interface is the cross-platform version of the
+ * java.util.EventListener interface.
+ * + * It is part of our effort to provide support for both J2SE + * and J2ME platforms. Under this scheme, classes need to + * implement SWTEventListener instead of java.util.EventListener. + *
+ *+ * Note: java.util.EventListener is not part of CDC and CLDC. + *
+ */ +public interface SWTEventListener : EventListener { +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/SWTEventObject.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/SWTEventObject.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,63 @@ +/******************************************************************************* + * 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.SWTEventObject; + + +//import java.util.EventObject; +import tango.core.Exception; + +///PORTING_TYPE +class EventObject { + protected Object source; + + public this(Object source) { + if (source is null) + throw new IllegalArgumentException( "null arg" ); + this.source = source; + } + + public Object getSource() { + return source; + } + + public override char[] toString() { + return this.classinfo.name ~ "[source=" ~ source.toString() ~ "]"; + } +} + + + + +/** + * This class is the cross-platform version of the + * java.util.EventObject class. + *+ * It is part of our effort to provide support for both J2SE + * and J2ME platforms. Under this scheme, classes need to + * extend SWTEventObject instead of java.util.EventObject. + *
+ *+ * Note: java.util.EventObject is not part of CDC and CLDC. + *
+ */ +public class SWTEventObject : EventObject { + + //static final long serialVersionUID = 3258125873411470903L; + +/** + * Constructs a new instance of this class. + * + * @param source the object which fired the event + */ +public this(Object source) { + super(source); +} +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/SWTMessages.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/SWTMessages.properties Sat Jan 05 17:39:49 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 diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/SerializableCompatibility.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/SerializableCompatibility.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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.SerializableCompatibility; + + +//import java.io.Serializable; +///PORTING_TYPE +interface Serializable{} + +/** + * This interface is the cross-platform version of the + * java.io.Serializable interface. + *+ * It is part of our effort to provide support for both J2SE + * and J2ME platforms. Under this scheme, classes need to + * implement SerializableCompatibility instead of + * java.io.Serializable. + *
+ *+ * Note: java.io.Serializable is not part of CLDC. + *
+ */ +public interface SerializableCompatibility : Serializable { +} diff -r a1f832ca7d17 -r ad2b69216039 dwt/internal/gtk/OS.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/gtk/OS.d Sat Jan 05 17:39:49 2008 +0100 @@ -0,0 +1,2851 @@ +/******************************************************************************* + * 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.gtk.OS; + +import org.eclipse.swt.internal.Platform; +import tango.core.Traits; + +template NameOfFunc(alias f) { + // Note: highly dependent on the .stringof formatting + // the value begins with "& " which is why the first two chars are cut off + const char[] NameOfFunc = (&f).stringof[2 .. $]; +} + +template ForwardGtkOsCFunc( alias cFunc ) { + alias ParameterTupleOf!(cFunc) P; + alias ReturnTypeOf!(cFunc) R; + mixin("public static R " ~ NameOfFunc!(cFunc) ~ "( P p ){ + lock.lock(); + scope(exit) lock.unlock(); + return cFunc(p); + }"); +} + +//import org.eclipse.swt.internal.*; + +// opaque structs used in the parameters +// they do not have a separated module +public { + struct GtkEntry{} + struct GtkWidget{} + struct PangoLayout{} +} + +private extern(C){ +// int /*long*/ localeconv_decimal_point(); +// int /*long*/ realpath(byte[] path, byte[] realPath); +// int GTK_WIDGET_HEIGHT(int /*long*/ widget); +// int GTK_WIDGET_WIDTH(int /*long*/ widget); +// int /*long*/ GTK_WIDGET_WINDOW(int /*long*/ widget); +// int GTK_WIDGET_X(int /*long*/ widget); +// int GTK_WIDGET_Y(int /*long*/ widget); +// int /*long*/ GTK_SCROLLED_WINDOW_HSCROLLBAR(int /*long*/ widget); +// int /*long*/ GTK_SCROLLED_WINDOW_VSCROLLBAR(int /*long*/ widget); +// int GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(int /*long*/ widget); +// void GTK_ACCEL_LABEL_SET_ACCEL_STRING(int /*long*/ acce_label, int /*long*/ string); +// int /*long*/ GTK_ACCEL_LABEL_GET_ACCEL_STRING(int /*long*/ acce_label); +// int /*long*/ GTK_ENTRY_IM_CONTEXT(int /*long*/ widget); +// int /*long*/ GTK_TEXTVIEW_IM_CONTEXT(int /*long*/ widget); +// int /*long*/ GTK_TOOLTIPS_TIP_WINDOW(int /*long*/ widget); +// void GTK_TOOLTIPS_SET_ACTIVE(int /*long*/ widget, int /*long*/ data); +// void GTK_WIDGET_SET_HEIGHT(int /*long*/ widget, int height); +// void GTK_WIDGET_SET_WIDTH(int /*long*/ widget, int width); +// void GTK_WIDGET_SET_X(int /*long*/ widget, int x); +// void GTK_WIDGET_SET_Y(int /*long*/ widget, int y); +// int GTK_WIDGET_REQUISITION_WIDTH(int /*long*/ widget); +// int GTK_WIDGET_REQUISITION_HEIGHT(int /*long*/ widget); +// int GDK_EVENT_TYPE(int /*long*/ event); +// int /*long*/ GDK_EVENT_WINDOW(int /*long*/ event); +// int X_EVENT_TYPE(int /*long*/ xevent); +// int /*long*/ X_EVENT_WINDOW(int /*long*/ xevent); +// int _Call(int /*long*/ proc, int /*long*/ arg1, int /*long*/ arg2); +// int /*long*/ _call (int /*long*/ function, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4, int /*long*/ arg5, int /*long*/ arg6); +// bool GDK_WINDOWING_X11(); +// int /*long*/ _GDK_PIXMAP_XID(int /*long*/ pixmap); +// bool _XCheckMaskEvent(int /*long*/ display, int /*long*/ event_mask, int /*long*/ event_return); +// bool _XCheckWindowEvent(int /*long*/ display, int /*long*/ window, int /*long*/ event_mask, int /*long*/ event_return); +// bool _XCheckIfEvent(int /*long*/ display, int /*long*/ event_return, int /*long*/ predicate, int /*long*/ arg); +// int _XDefaultScreen(int /*long*/ display); +// int /*long*/ _XDefaultRootWindow(int /*long*/ display); +// void _XFlush(int /*long*/ display); +// void _XFree(int /*long*/ address); +// int /*long*/ _XGetSelectionOwner(int /*long*/ display, int /*long*/ selection); +// int /*long*/ _XInternAtom(int /*long*/ display, byte[] name, bool ifExists); +// int _XQueryTree(int /*long*/ display, int /*long*/ w, int /*long*/[] root_return, int /*long*/[] parent_return, int /*long*/[] children_return, int[] nchildren_return); +// int _XKeysymToKeycode(int /*long*/ display, int /*long*/ keysym); +// int /*long*/ _XListProperties(int /*long*/ display, int /*long*/ window, int[] num_prop_return); +// int _XReconfigureWMWindow(int /*long*/ display, int /*long*/ window, int screen, int valueMask, XWindowChanges values); +// int _XSendEvent(int /*long*/ display, int /*long*/ w, bool propogate, int /*long*/ event_mask, int /*long*/ event_send); +// int /*long*/ _XSetIOErrorHandler(int /*long*/ handler); +// int /*long*/ _XSetErrorHandler(int /*long*/ handler); +// int _XSetInputFocus(int /*long*/ display, int /*long*/ window, int revert, int time); +// int /*long*/ _XSynchronize(int /*long*/ display, bool onoff); +// void _XTestFakeButtonEvent(int /*long*/ display, int button, bool is_press, int /*long*/ delay); +// void _XTestFakeKeyEvent(int /*long*/ display, int keycode, bool is_press, int /*long*/ delay); +// void _XTestFakeMotionEvent(int /*long*/ display, int screen_number, int x, int y, int /*long*/ delay); +// int _XWarpPointer(int /*long*/ display, int /*long*/ sourceWindow, int /*long*/ destWindow, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY); +// int /*long*/ _gdk_x11_atom_to_xatom(int /*long*/ atom); +// int /*long*/ _gdk_x11_colormap_get_xcolormap(int /*long*/ colormap); +// int /*long*/ _gdk_x11_drawable_get_xdisplay(int /*long*/ drawable); +// int /*long*/ _gdk_x11_drawable_get_xid(int /*long*/ drawable); +// int /*long*/ _gdk_x11_screen_lookup_visual(int /*long*/ screen, int xvisualid); +// int /*long*/ _gdk_x11_screen_get_window_manager_name(int /*long*/ screen); +// int /*long*/ _gdk_x11_visual_get_xvisual(int /*long*/ visual); +// int /*long*/ _gdk_pixmap_foreign_new(int /*long*/ anid); +// int /*long*/ _gdk_window_lookup(int /*long*/ xid); +// void _gdk_window_add_filter(int /*long*/ window, int /*long*/ function, int /*long*/ data); +// void _gdk_window_remove_filter(int /*long*/ window, int /*long*/ function, int /*long*/ data); +// /** X render natives and constants */ +// int XRenderPictureAttributes_sizeof(); +// bool _XRenderQueryExtension(int /*long*/ display, int[] event_basep, int[] error_basep); +// int _XRenderQueryVersion(int /*long*/ display, int[] major_versionp, int[] minor_versionp); +// int /*long*/ _XRenderCreatePicture(int /*long*/ display, int /*long*/ drawable, int /*long*/ format, int /*long*/ valuemask, XRenderPictureAttributes attributes); +// void _XRenderSetPictureClipRectangles(int /*long*/ display, int /*long*/ picture, int xOrigin, int yOrigin, short[] rects, int count); +// void _XRenderSetPictureTransform(int /*long*/ display, int /*long*/ picture, int[] transform); +// void _XRenderFreePicture(int /*long*/ display, int /*long*/ picture); +// void _XRenderComposite(int /*long*/ display, int op, int /*long*/ src, int /*long*/ mask, int /*long*/ dst, int src_x, int src_y, int mask_x, int mask_y, int dst_x, int dst_y, int width, int height); +// int /*long*/ _XRenderFindStandardFormat(int /*long*/ display, int format); +// int /*long*/ _XRenderFindVisualFormat(int /*long*/ display, int /*long*/ visual); +// int Call (int /*long*/ func, int /*long*/ arg0, int arg1, int arg2); +// int /*long*/ _GDK_DISPLAY(); +// int /*long*/ _GDK_ROOT_PARENT(); +// int /*long*/ _GDK_TYPE_COLOR(); +// int /*long*/ _GDK_TYPE_PIXBUF(); +// bool _GTK_IS_BUTTON(int /*long*/ obj); +// bool _GTK_IS_WINDOW(int /*long*/ obj); +// bool _GTK_IS_CELL_RENDERER_PIXBUF(int /*long*/ obj); +// bool _GTK_IS_CELL_RENDERER_TEXT(int /*long*/ obj); +// bool _GTK_IS_CELL_RENDERER_TOGGLE(int /*long*/ obj); +// bool _GTK_IS_CONTAINER(int /*long*/ obj); +// bool _GTK_IS_IMAGE_MENU_ITEM(int /*long*/ obj); +// bool _GTK_IS_PLUG(int /*long*/ obj); +// int /*long*/ _GTK_STOCK_CANCEL(); +// int /*long*/ _GTK_STOCK_OK(); +// int /*long*/ _GTK_TYPE_CELL_RENDERER_TEXT(); +// int /*long*/ _GTK_TYPE_CELL_RENDERER_PIXBUF(); +// int /*long*/ _GTK_TYPE_CELL_RENDERER_TOGGLE(); +// int /*long*/ _GTK_TYPE_FIXED(); +// int /*long*/ _GTK_TYPE_MENU(); +// int /*long*/ _GTK_TYPE_WIDGET(); +// int _GTK_WIDGET_FLAGS(int /*long*/ wid); +// int _GTK_WIDGET_STATE(int /*long*/ wid); +// bool _GTK_WIDGET_HAS_DEFAULT(int /*long*/ wid); +// bool _GTK_WIDGET_HAS_FOCUS(int /*long*/ wid); +// bool _GTK_WIDGET_IS_SENSITIVE(int /*long*/ wid); +// bool _GTK_WIDGET_MAPPED(int /*long*/ wid); +// bool _GTK_WIDGET_SENSITIVE(int /*long*/ wid); +// void _GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag); +// void _GTK_WIDGET_UNSET_FLAGS(int /*long*/ wid, int flag); +// bool _GTK_WIDGET_VISIBLE(int /*long*/ wid); +// int /*long*/ _G_OBJECT_CLASS (int /*long*/ klass); +// int /*long*/ _G_OBJECT_GET_CLASS (int /*long*/ object); +// int /*long*/ _G_OBJECT_TYPE_NAME (int /*long*/ object); +// int /*long*/ _G_TYPE_BOOLEAN(); +// int /*long*/ _G_TYPE_INT(); +// int /*long*/ _G_OBJECT_TYPE (int /*long*/ instance); +// int /*long*/ _G_TYPE_STRING(); +// int _PANGO_PIXELS(int dimension); +// int /*long*/ _PANGO_TYPE_FONT_DESCRIPTION(); +// int /*long*/ _g_cclosure_new(int /*long*/ callback_func, int /*long*/ user_data, int /*long*/ destroy_data); +// int /*long*/ _g_closure_ref(int /*long*/ closure); +// void _g_closure_unref(int /*long*/ closure); +// bool _g_main_context_acquire(int /*long*/ context); +// int _g_main_context_check(int /*long*/ context, int max_priority, int /*long*/ fds, int n_fds); +// int /*long*/ _g_main_context_default(); +// bool _g_main_context_iteration(int /*long*/ context, bool may_block); +// bool _g_main_context_pending(int /*long*/ context); +// int /*long*/ _g_main_context_get_poll_func(int /*long*/ context); +// bool _g_main_context_prepare(int /*long*/ context, int[] priority); +// int _g_main_context_query(int /*long*/ context, int max_priority, int[] timeout_, int /*long*/ fds, int n_fds); +// void _g_main_context_release(int /*long*/ context); +// void g_main_context_wakeup(int /*long*/ context); +// int /*long*/ _g_filename_to_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); +// int /*long*/ _g_filename_to_uri(int /*long*/ filename, int /*long*/ hostname, int /*long*/[] error); +// int /*long*/ _g_filename_from_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); +// int /*long*/ _g_filename_from_uri(int /*long*/ uri, int /*long*/[] hostname, int /*long*/[] error); +// void _g_free(int /*long*/ mem); +// int _g_idle_add(int /*long*/ function, int /*long*/ data); +// int /*long*/ _g_list_append(int /*long*/ list, int /*long*/ data); +// int /*long*/ _g_list_data(int /*long*/ list); +// void _g_list_free(int /*long*/ list); +// void _g_list_free_1(int /*long*/ list); +// int _g_list_length(int /*long*/ list); +// void _g_list_set_next(int /*long*/ list, int /*long*/ llist); +// int /*long*/ _g_list_next(int /*long*/ list); +// int /*long*/ _g_list_nth(int /*long*/ list, int n); +// int /*long*/ _g_list_nth_data(int /*long*/ list, int n); +// int /*long*/ _g_list_prepend(int /*long*/ list, int /*long*/ data); +// void _g_list_set_previous(int /*long*/ list, int /*long*/ llist); +// int /*long*/ _g_list_previous(int /*long*/ list); +// int /*long*/ _g_list_remove_link(int /*long*/ list, int /*long*/ link); +// int /*long*/ _g_list_reverse(int /*long*/ list); +// int /*long*/ _g_locale_from_utf8(int /*long*/ utf8string, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); +// int /*long*/ _g_locale_to_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); +// void _g_log_default_handler(int /*long*/ log_domain, int log_levels, int /*long*/ message, int /*long*/ unused_data); +// void _g_log_remove_handler(byte[] log_domain, int handler_id); +// int _g_log_set_handler(byte[] log_domain, int log_levels, int /*long*/ log_func, int /*long*/ user_data); +// int /*long*/ _g_malloc(int /*long*/ size); +// void _g_object_get(int /*long*/ object, byte[] first_property_name, int[] value, int /*long*/ terminator); +// int /*long*/ _g_object_get_qdata(int /*long*/ object, int quark); +// int /*long*/ _g_object_new (int /*long*/ type, int /*long*/ first_property_name); +// int /*long*/ _g_object_ref(int /*long*/ object); +// void _g_object_set(int /*long*/ object, byte[] first_property_name, bool data, int /*long*/ terminator); +// void _g_object_set(int /*long*/ object, byte[] first_property_name, GdkColor data, int /*long*/ terminator); +// void _g_object_set(int /*long*/ object, byte[] first_property_name, int data, int /*long*/ terminator); +// void _g_object_set(int /*long*/ object, byte[] first_property_name, float data, int /*long*/ terminator); +// void _g_object_set(int /*long*/ object, byte[] first_property_name, long data, int /*long*/ terminator); +// void _g_object_set_qdata(int /*long*/ object, int quark, int /*long*/ data); +// void _g_object_unref(int /*long*/ object); +// int _g_quark_from_string(byte[] string); +// void _g_set_prgname(byte[] prgname); +// int _g_signal_connect(int /*long*/ instance, byte[] detailed_signal, int /*long*/ proc, int /*long*/ data); +// int _g_signal_connect_closure(int /*long*/ instance, byte[] detailed_signal, int /*long*/ closure, bool after); +// int _g_signal_connect_closure_by_id(int /*long*/ instance, int signal_id, int detail, int /*long*/ closure, bool after); +// int _g_signal_connect_after(int /*long*/ instance, byte[] detailed_signal, int /*long*/ proc, int /*long*/ data); +// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal); +// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, int /*long*/ data); +// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, int /*long*/ data1, int /*long*/ data2); +// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, byte [] data); +// void _g_signal_handler_disconnect(int /*long*/ instance, int handler_id); +// int _g_signal_handlers_block_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); +// int _g_signal_handlers_disconnect_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); +// int _g_signal_handlers_unblock_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); +// int _g_signal_lookup (byte[] name, int /*long*/ itype); +// void _g_signal_stop_emission_by_name(int /*long*/ instance, byte[] detailed_signal); +// bool /*long*/ _g_source_remove (int /*long*/ tag); +// int /*long*/ _g_slist_data (int /*long*/ list); +// void _g_slist_free (int /*long*/ list); +// int /*long*/ _g_slist_next (int /*long*/ list); +// int _g_slist_length (int /*long*/ list); +// void _g_strfreev(int /*long*/ string_array); +// double _g_strtod(int /*long*/ str, int /*long*/[] endptr); +// void _g_type_add_interface_static (int /*long*/ instance_type, int /*long*/ interface_type, int /*long*/ info); +// int /*long*/ _g_type_class_peek (int /*long*/ g_class); +// int /*long*/ _g_type_class_peek_parent (int /*long*/ g_class); +// int /*long*/ _g_type_from_name (byte[] name); +// int /*long*/ _g_type_interface_peek_parent (int /*long*/ iface); +// bool _g_type_is_a (int /*long*/ type, int /*long*/ is_a_type); +// int /*long*/ _g_type_name (int /*long*/ handle); +// int /*long*/ _g_type_parent (int /*long*/ type); +// void _g_type_query (int /*long*/ type, int /*long*/ query); +// int /*long*/ _g_type_register_static (int /*long*/ parent_type, byte[] type_name, int /*long*/ info, int flags); +// void _g_thread_init(int /*long*/ vtable); +// bool _g_thread_supported(); +// int /*long*/ _g_utf16_to_utf8(char[] str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); +// int /*long*/ _g_utf8_offset_to_pointer(int /*long*/ str, int /*long*/ offset); +// int /*long*/ _g_utf8_pointer_to_offset(int /*long*/ str, int /*long*/ pos); +// int /*long*/ _g_utf8_strlen(int /*long*/ str, int /*long*/ max); +// int /*long*/ _g_utf8_to_utf16(byte[] str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); +// int /*long*/ _g_utf8_to_utf16(int /*long*/ str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); +// int /*long*/ _gdk_atom_intern(byte[] atom_name, bool only_if_exists); +// int /*long*/ _gdk_atom_name(int /*long*/ atom); +// void _gdk_beep(); +// int /*long*/ _gdk_bitmap_create_from_data(int /*long*/ window, byte[] data, int width, int height); +// void _gdk_cairo_region(int /*long*/ cairo, int /*long*/ region); +// void _gdk_cairo_set_source_color(int /*long*/ cairo, GdkColor color); +// bool _gdk_color_white(int /*long*/ colormap, GdkColor color); +// bool _gdk_colormap_alloc_color(int /*long*/ colormap, GdkColor color, bool writeable, bool best_match); +// void _gdk_colormap_free_colors(int /*long*/ colormap, GdkColor colors, int ncolors); +// int /*long*/ _gdk_colormap_get_system(); +// void _gdk_colormap_query_color(int /*long*/ colormap, int /*long*/ pixel, GdkColor result); +// void _gdk_cursor_destroy(int /*long*/ cursor); +// int /*long*/ _gdk_cursor_new(int /*long*/ cursor_type); +// int /*long*/ _gdk_cursor_new_from_pixmap(int /*long*/ source, int /*long*/ mask, GdkColor fg, GdkColor bg, int x, int y); +// int /*long*/ _gdk_cursor_new_from_pixbuf(int /*long*/ display, int /*long*/ pixbuf, int x, int y); +// int /*long*/ _gdk_display_get_default(); +// bool _gdk_display_supports_cursor_color(int /*long*/ display); +// void _gdk_drag_status(int /*long*/ context, int action, int time); +// void _gdk_draw_arc(int /*long*/ drawable, int /*long*/ gc, int filled, int x, int y, int width, int height, int angle1, int angle2); +// void _gdk_draw_drawable(int /*long*/ drawable, int /*long*/ gc, int /*long*/ src, int xsrc, int ysrc, int xdest, int ydest, int width, int height); +// void _gdk_draw_image(int /*long*/ drawable, int /*long*/ gc, int /*long*/ image, int xsrc, int ysrc, int xdest, int ydest, int width, int height); +// void _gdk_draw_layout(int /*long*/ drawable, int /*long*/ gc, int x, int y, int /*long*/ layout); +// void _gdk_draw_layout_with_colors(int /*long*/ drawable, int /*long*/ gc, int x, int y, int /*long*/ layout, GdkColor foreground, GdkColor background); +// void _gdk_draw_line(int /*long*/ drawable, int /*long*/ gc, int x1, int y1, int x2, int y2); +// void _gdk_draw_lines(int /*long*/ drawable, int /*long*/ gc, int[] points, int npoints); +// void _gdk_draw_pixbuf(int /*long*/ drawable, int /*long*/ gc, int /*long*/ pixbuf, int xsrc, int ysrc, int xdest, int ydest, int width, int height, int dither, int x_dither, int y_dither); +// void _gdk_draw_point(int /*long*/ drawable, int /*long*/ gc, int x, int y); +// void _gdk_draw_polygon(int /*long*/ drawable, int /*long*/ gc, int filled, int[] points, int npoints); +// void _gdk_draw_rectangle(int /*long*/ drawable, int /*long*/ gc, int filled, int x, int y, int width, int height); +// int _gdk_drawable_get_depth(int /*long*/ drawable); +// int /*long*/ _gdk_drawable_get_image(int /*long*/ drawable, int x, int y, int width, int height); +// void _gdk_drawable_get_size(int /*long*/ drawable, int[] width, int[] height); +// int /*long*/ _gdk_drawable_get_visible_region(int /*long*/ drawable); +// int /*long*/ _gdk_event_copy(int /*long*/ event); +// void _gdk_event_free(int /*long*/ event); +// int /*long*/ _gdk_event_get(); +// bool _gdk_event_get_root_coords(int /*long*/ event, double[] px, double[] py); +// bool _gdk_event_get_coords(int /*long*/ event, double[] px, double[] py); +// int /*long*/ _gdk_event_get_graphics_expose(int /*long*/ window); +// bool _gdk_event_get_state(int /*long*/ event, int[] pmod); +// int _gdk_event_get_time(int /*long*/ event); +// void _gdk_event_handler_set(int /*long*/ func, int /*long*/ data, int /*long*/ notify); +// int /*long*/ _gdk_event_peek(); +// void _gdk_event_put(int /*long*/ event); +// void _gdk_error_trap_push(); +// int _gdk_error_trap_pop(); +// void _gdk_flush(); +// void _gdk_free_text_list(int /*long*/ list); +// void _gdk_gc_get_values(int /*long*/ gc, GdkGCValues values); +// int /*long*/ _gdk_gc_new(int /*long*/ window); +// void _gdk_gc_set_background(int /*long*/ gc, GdkColor color); +// void _gdk_gc_set_clip_mask(int /*long*/ gc, int /*long*/ mask); +// void _gdk_gc_set_clip_origin(int /*long*/ gc, int x, int y); +// void _gdk_gc_set_clip_rectangle(int /*long*/ gc, GdkRectangle rectangle); +// void _gdk_gc_set_clip_region(int /*long*/ gc, int /*long*/ region); +// void _gdk_gc_set_dashes(int /*long*/ gc, int dash_offset, byte[] dash_list, int n); +// void _gdk_gc_set_exposures(int /*long*/ gc, bool exposures); +// void _gdk_gc_set_fill(int /*long*/ gc, int fill); +// void _gdk_gc_set_foreground(int /*long*/ gc, GdkColor color); +// void _gdk_gc_set_function(int /*long*/ gc, int /*long*/ function); +// void _gdk_gc_set_line_attributes(int /*long*/ gc, int line_width, int line_style, int cap_style, int join_style); +// void _gdk_gc_set_stipple(int /*long*/ gc, int /*long*/ stipple); +// void _gdk_gc_set_subwindow(int /*long*/ gc, int /*long*/ mode); +// void _gdk_gc_set_tile(int /*long*/ gc, int /*long*/ tile); +// void _gdk_gc_set_ts_origin(int /*long*/ gc, int x, int y); +// void _gdk_gc_set_values(int /*long*/ gc, GdkGCValues values, int values_mask); +// void _gdk_keyboard_ungrab(int time); +// int /*long*/ _gdk_keymap_get_default(); +// bool _gdk_keymap_translate_keyboard_state (int /*long*/ keymap, int hardware_keycode, int state, int group, int[] keyval, int[] effective_group, int[] level, int[] consumed_modifiers); +// int _gdk_keyval_to_lower(int keyval); +// int _gdk_keyval_to_unicode(int keyval); +// int /*long*/ _gdk_pango_context_get(); +// void _gdk_pango_context_set_colormap(int /*long*/ context, int /*long*/ colormap); +// int /*long*/ _gdk_pango_layout_get_clip_region(int /*long*/ layout, int x_origin, int y_origin, int[] index_ranges, int n_ranges); +// void _gdk_pixbuf_copy_area(int /*long*/ src_pixbuf, int src_x, int src_y, int width, int height, int /*long*/ dest_pixbuf, int dest_x, int dest_y); +// int /*long*/ _gdk_pixbuf_get_from_drawable(int /*long*/ dest, int /*long*/ src, int /*long*/ cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); +// bool _gdk_pixbuf_get_has_alpha(int /*long*/ pixbuf); +// int _gdk_pixbuf_get_height(int /*long*/ pixbuf); +// int /*long*/ _gdk_pixbuf_get_pixels(int /*long*/ pixbuf); +// int _gdk_pixbuf_get_rowstride(int /*long*/ pixbuf); +// int _gdk_pixbuf_get_width(int /*long*/ pixbuf); +// int /*long*/ _gdk_pixbuf_new(int colorspace, bool has_alpha, int bits_per_sample, int width, int height); +// int /*long*/ _gdk_pixbuf_new_from_file(byte[] filename, int /*long*/ [] error); +// void _gdk_pixbuf_render_to_drawable(int /*long*/ pixbuf, int /*long*/ drawable, int /*long*/ gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int dither, int x_dither, int y_dither); +// void _gdk_pixbuf_render_to_drawable_alpha(int /*long*/ pixbuf, int /*long*/ drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_mode, int alpha_threshold, int dither, int x_dither, int y_dither); +// void _gdk_pixbuf_render_pixmap_and_mask(int /*long*/ pixbuf, int /*long*/[] pixmap_return, int /*long*/[] mask_return, int alpha_threshold); +// void _gdk_pixbuf_scale(int /*long*/ src, int /*long*/ dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, int interp_type); +// int /*long*/ _gdk_pixbuf_scale_simple(int /*long*/ src, int dest_width, int dest_height, int interp_type); +// int /*long*/ _gdk_pixmap_new(int /*long*/ window, int width, int height, int depth); +// int _gdk_pointer_grab(int /*long*/ window, bool owner_events, int event_mask, int /*long*/ confine_to, int /*long*/ cursor, int time); +// bool _gdk_pointer_is_grabbed(); +// void _gdk_pointer_ungrab(int time); +// bool _gdk_property_get(int /*long*/ window, int /*long*/ property, int /*long*/ type, int /*long*/ offset, int /*long*/ length, int pdelete, int /*long*/[] actual_property_type, int[] actual_format, int[] actual_length, int /*long*/[] data); +// void _gdk_region_destroy(int /*long*/ region); +// bool _gdk_region_empty(int /*long*/ region); +// void _gdk_region_get_clipbox(int /*long*/ region, GdkRectangle rectangle); +// void _gdk_region_get_rectangles(int /*long*/ region, int /*long*/[] rectangles, int[] n_rectangles); +// void _gdk_region_intersect(int /*long*/ source1, int /*long*/ source2); +// int /*long*/ _gdk_region_new(); +// void _gdk_region_offset(int /*long*/ region, int dx, int dy); +// bool _gdk_region_point_in(int /*long*/ region, int x, int y); +// int /*long*/ _gdk_region_polygon(int[] points, int npoints, int fill_rule); +// int /*long*/ _gdk_region_rectangle(GdkRectangle rectangle); +// int /*long*/ _gdk_region_rect_in(int /*long*/ region, GdkRectangle rect); +// void _gdk_region_subtract(int /*long*/ source1, int /*long*/ source2); +// void _gdk_region_union(int /*long*/ source1, int /*long*/ source2); +// void _gdk_region_union_with_rect(int /*long*/ region, GdkRectangle rect); +// void _gdk_rgb_init(); +// int /*long*/ _gdk_screen_get_default(); +// int _gdk_screen_get_monitor_at_point (int /*long*/ screen, int x, int y); +// int _gdk_screen_get_monitor_at_window(int /*long*/ screen, int /*long*/ window); +// void _gdk_screen_get_monitor_geometry (int /*long*/ screen, int monitor_num, GdkRectangle dest); +// int _gdk_screen_get_n_monitors(int /*long*/ screen); +// int _gdk_screen_get_number(int /*long*/ screen); +// int _gdk_screen_height(); +// int _gdk_screen_width(); +// int _gdk_screen_width_mm(); +// void _gdk_set_program_class(byte[] program_class); +// bool _gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length); +// int /*long*/ _gdk_utf8_to_string_target(byte[] str); +// int _gdk_text_property_to_utf8_list (int /*long*/ encoding, int format, int /*long*/ text, int length, int /*long*/[] list); +// int _gdk_unicode_to_keyval(int wc); +// int /*long*/ _gdk_visual_get_system(); +// int /*long*/ _gdk_window_at_pointer(int[] win_x, int[] win_y); +// void _gdk_window_begin_paint_rect(int /*long*/ window, GdkRectangle rectangle); +// void _gdk_window_clear_area(int /*long*/ window, int x, int y, int width, int height); +// void _gdk_window_destroy(int /*long*/ window); +// void _gdk_window_end_paint(int /*long*/ window); +// int /*long*/ _gdk_window_get_children(int /*long*/ window); +// int _gdk_window_get_events(int /*long*/ window); +// void _gdk_window_focus(int /*long*/ window, int timestamp); +// void _gdk_window_freeze_updates(int /*long*/ window); +// void _gdk_window_get_frame_extents(int /*long*/ window, GdkRectangle rect); +// void _gdk_window_get_internal_paint_info(int /*long*/ window, int /*long*/ [] real_drawable, int[] x_offset, int[] y_offset); +// int _gdk_window_get_origin(int /*long*/ window, int[] x, int[] y); +// int /*long*/ _gdk_window_get_parent(int /*long*/ window); +// int /*long*/ _gdk_window_get_pointer(int /*long*/ window, int[] x, int[] y, int[] mask); +// void _gdk_window_get_position(int /*long*/ window, int[] x, int[] y); +// void _gdk_window_get_user_data(int /*long*/ window, int /*long*/[] data); +// void _gdk_window_hide(int /*long*/ window); +// void _gdk_window_invalidate_rect(int /*long*/ window, GdkRectangle rectangle, bool invalidate_children); +// void _gdk_window_invalidate_region(int /*long*/ window, int /*long*/ region, bool invalidate_children); +// void _gdk_window_move(int /*long*/ window, int x, int y); +// int /*long*/ _gdk_window_new(int /*long*/ parent, GdkWindowAttr attributes, int attributes_mask); +// void _gdk_window_lower(int /*long*/ window); +// void _gdk_window_process_all_updates(); +// void _gdk_window_process_updates(int /*long*/ window, bool update_children); +// void _gdk_window_raise(int /*long*/ window); +// void _gdk_window_resize(int /*long*/ window, int width, int height); +// void _gdk_window_scroll(int /*long*/ window, int dx, int dy); +// void _gdk_window_set_accept_focus(int /*long*/ window, bool accept_focus); +// void _gdk_window_set_back_pixmap(int /*long*/ window, int /*long*/ pixmap, bool parent_relative); +// void _gdk_window_set_cursor(int /*long*/ window, int /*long*/ cursor); +// void _gdk_window_set_debug_updates(bool setting); +// void _gdk_window_set_decorations(int /*long*/ window, int decorations); +// void _gdk_window_set_events(int /*long*/ window, int event_mask); +// void _gdk_window_set_icon(int /*long*/ window, int /*long*/ icon_window, int /*long*/ pixmap, int /*long*/ mask); +// void _gdk_window_set_icon_list(int /*long*/ window, int /*long*/ pixbufs); +// void _gdk_window_set_keep_above(int /*long*/ window, bool setting); +// void _gdk_window_set_override_redirect(int /*long*/ window, bool override_redirect); +// void _gdk_window_set_user_data(int /*long*/ window, int /*long*/ user_data); +// void _gdk_window_shape_combine_region (int /*long*/ window, int /*long*/ shape_region, int offset_x, int offset_y); +// void _gdk_window_show(int /*long*/ window); +// void _gdk_window_show_unraised(int /*long*/ window); +// void _gdk_window_thaw_updates(int /*long*/ window); +// int /*long*/ _gtk_accel_group_new(); +// bool _gtk_accel_groups_activate(int /*long*/ accelGroup, int accelKey, int accelMods); +// void _gtk_accel_label_set_accel_widget(int /*long*/ accel_label, int /*long*/ accel_widget); +// void _gtk_adjustment_changed(int /*long*/ adjustment); +// int /*long*/ _gtk_adjustment_new(double value, double lower, double upper, double step_increment, double page_increment, double page_size); +// void _gtk_adjustment_set_value(int /*long*/ adjustment, double value); +// void _gtk_adjustment_value_changed(int /*long*/ adjustment); +// int /*long*/ _gtk_arrow_new(int arrow_type, int shadow_type); +// void _gtk_arrow_set(int /*long*/ arrow, int arrow_type, int shadow_type); +// int /*long*/ _gtk_bin_get_child(int /*long*/ bin); +// void _gtk_box_set_spacing(int /*long*/ box, int spacing); +// void _gtk_box_set_child_packing(int /*long*/ box, int /*long*/ child, bool expand, bool fill, int padding, int pack_type); +// void _gtk_button_clicked(int /*long*/ button); +// int _gtk_button_get_relief(int /*long*/ button); +// int /*long*/ _gtk_button_new(); +// void _gtk_button_set_relief(int /*long*/ button, int newstyle); +// int /*long*/ _gtk_calendar_new(); +// bool /*long*/ _gtk_calendar_select_month(int /*long*/ calendar, int month, int year); +// void _gtk_calendar_select_day(int /*long*/ calendar, int day); +// void _gtk_calendar_set_display_options(int /*long*/ calendar, int flags); +// void _gtk_calendar_display_options(int /*long*/ calendar, int flags); +// void _gtk_calendar_get_date(int /*long*/ calendar, int[] year, int[] month, int[] day); +// void _gtk_cell_layout_clear(int /*long*/ cell_layout); +// void _gtk_cell_layout_set_attributes(int /*long*/ cell_layout, int /*long*/ cell, byte[] attribute, int column, int /*long*/ sentinel); +// void _gtk_cell_layout_pack_start(int /*long*/ cell_layout, int /*long*/ cell, bool expand); +// void _gtk_cell_renderer_get_size(int /*long*/ cell, int /*long*/ widget, GdkRectangle area, int[] x_offset, int[] y_offset, int[] width, int[] height); +// int /*long*/ _gtk_cell_renderer_pixbuf_new(); +// int /*long*/ _gtk_cell_renderer_text_new(); +// int /*long*/ _gtk_cell_renderer_toggle_new(); +// int /*long*/ _gtk_check_button_new(); +// bool _gtk_check_menu_item_get_active(int /*long*/ check_menu_item); +// int /*long*/ _gtk_check_menu_item_new_with_label(byte[] label); +// void _gtk_check_menu_item_set_active(int /*long*/ wid, bool active); +// int /*long*/ _gtk_check_version(int required_major, int required_minor, int required_micro); +// void _gtk_clipboard_clear(int /*long*/ clipboard); +// int /*long*/ _gtk_clipboard_get(int /*long*/ selection); +// bool _gtk_clipboard_set_with_data(int /*long*/ clipboard, int /*long*/ target, int n_targets, int /*long*/ get_func, int /*long*/ clear_func, int /*long*/ user_data); +// int /*long*/ _gtk_clipboard_wait_for_contents(int /*long*/ clipboard, int /*long*/ target); +// int /*long*/ _gtk_color_selection_dialog_new(byte[] title); +// void _gtk_color_selection_get_current_color(int /*long*/ colorsel, GdkColor color); +// void _gtk_color_selection_set_current_color(int /*long*/ colorsel, GdkColor color); +// void _gtk_color_selection_set_has_palette(int /*long*/ colorsel, bool has_palette); +// void _gtk_combo_disable_activate(int /*long*/ combo); +// int /*long*/ _gtk_combo_new(); +// void _gtk_combo_set_case_sensitive(int /*long*/ combo, bool val); +// void _gtk_combo_set_popdown_strings(int /*long*/ combo, int /*long*/ strings); +// int /*long*/ _gtk_combo_box_entry_new_text(); +// int /*long*/ _gtk_combo_box_new_text(); +// void _gtk_combo_box_insert_text(int /*long*/ combo_box, int position, byte[] text); +// void _gtk_combo_box_remove_text(int /*long*/ combo_box, int position); +// int _gtk_combo_box_get_active(int /*long*/ combo_box); +// int /*long*/ _gtk_combo_box_get_model(int /*long*/ combo_box); +// void _gtk_combo_box_set_active(int /*long*/ combo_box, int index); +// void _gtk_combo_box_popup(int /*long*/ combo_box); +// void _gtk_combo_box_popdown(int /*long*/ combo_box); +// void _gtk_container_add(int /*long*/ container, int /*long*/ widget); +// void _gtk_container_forall(int /*long*/ container, int /*long*/ callback, int /*long*/ callback_data); +// int _gtk_container_get_border_width(int /*long*/ container); +// int /*long*/ _gtk_container_get_children(int /*long*/ container); +// void _gtk_container_remove(int /*long*/ container, int /*long*/ widget); +// void _gtk_container_resize_children(int /*long*/ container); +// void _gtk_container_set_border_width(int /*long*/ container, int border_width); +// int /*long*/ _gtk_dialog_add_button(int /*long*/ dialog, byte[] button_text, int response_id); +// int _gtk_dialog_run(int /*long*/ dialog); +// int /*long*/ _gtk_drag_begin(int /*long*/ widget, int /*long*/ targets, int actions, int button, int /*long*/ event); +// bool _gtk_drag_check_threshold(int /*long*/ widget, int start_x, int start_y, int current_x, int current_y); +// int /*long*/ _gtk_drag_dest_find_target(int /*long*/ widget, int /*long*/ context, int /*long*/ target_list); +// void _gtk_drag_dest_set(int /*long*/ widget, int flags, int /*long*/ targets, int n_targets, int actions); +// void _gtk_drag_dest_unset(int /*long*/ widget); +// void _gtk_drag_finish(int /*long*/ context, bool success, bool delete, int time); +// void _gtk_drag_get_data(int /*long*/ widget, int /*long*/ context, int /*long*/ target, int time); +// void _gtk_drag_set_icon_pixbuf(int /*long*/ context, int /*long*/ pixbuf, int hot_x, int hot_y); +// int /*long*/ _gtk_drawing_area_new(); +// void _gtk_editable_copy_clipboard(int /*long*/ editable); +// void _gtk_editable_cut_clipboard(int /*long*/ editable); +// void _gtk_editable_delete_selection(int /*long*/ editable); +// void _gtk_editable_delete_text(int /*long*/ editable, int start_pos, int end_pos); +// int /*long*/ _gtk_editable_get_chars(int /*long*/ editable, int start_pos, int end_pos); +// bool _gtk_editable_get_editable(int /*long*/ editable); +// int _gtk_editable_get_position(int /*long*/ editable); +// bool _gtk_editable_get_selection_bounds(int /*long*/ editable, int[] start, int[] end); +// void _gtk_editable_insert_text(int /*long*/ editable, byte[] new_text, int new_text_length, int[] position); +// void _gtk_editable_paste_clipboard(int /*long*/ editable); +// void _gtk_editable_select_region(int /*long*/ editable, int start, int end); +// void _gtk_editable_set_editable(int /*long*/ entry, bool editable); +// void _gtk_editable_set_position(int /*long*/ editable, int position); + char gtk_entry_get_invisible_char(GtkEntry* entry); + PangoLayout* gtk_entry_get_layout (GtkEntry* entry); + void gtk_entry_get_layout_offsets (GtkEntry* layout, int* x, int* y); + int gtk_entry_text_index_to_layout_index (GtkEntry* entry, int index); + int gtk_entry_get_max_length(GtkEntry* entry); + char* gtk_entry_get_text(GtkEntry* entry); +// bool _FcConfigAppFontAddFile(int /*long*/ config, byte[] file); + bool gtk_entry_get_visibility(GtkEntry* entry); + GtkWidget* gtk_entry_new(); + void gtk_entry_set_activates_default(GtkEntry* entry, bool setting); + void gtk_entry_set_alignment(GtkEntry* entry, float xalign); + void gtk_entry_set_has_frame(GtkEntry* entry, bool setting); + void gtk_entry_set_invisible_char(GtkEntry* entry, char ch); + void gtk_entry_set_max_length(GtkEntry* entry, int max); + void gtk_entry_set_text(GtkEntry* entry, char* text); + void gtk_entry_set_visibility(GtkEntry* entry, bool visible); +// int _gtk_events_pending(); +// bool _gtk_expander_get_expanded(int /*long*/ expander); +// int /*long*/ _gtk_expander_get_label_widget(int /*long*/ expander); +// int /*long*/ _gtk_expander_new(byte[] label); +// void _gtk_expander_set_expanded(int /*long*/ expander, bool expanded); +// void _gtk_expander_set_label(int /*long*/ expander, byte[] label); +// void _gtk_expander_set_label_widget(int /*long*/ expander, int /*long*/ label_widget); +// void _gtk_file_chooser_add_filter(int /*long*/ chooser, int /*long*/ filter); +// int /*long*/ _gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, int /*long*/ first_button_text, int first_button_id, int /*long*/ second_button_text, int second_button_id, int /*long*/ terminator); +// int /*long*/ _gtk_file_chooser_get_current_folder(int /*long*/ chooser); +// int /*long*/ _gtk_file_chooser_get_filename(int /*long*/ chooser); +// int /*long*/ _gtk_file_chooser_get_filenames(int /*long*/ chooser); +// void _gtk_file_chooser_set_current_folder(int /*long*/ chooser, byte[] filename); +// void _gtk_file_chooser_set_current_name(int /*long*/ chooser, byte[] name); +// void _gtk_file_chooser_set_extra_widget(int /*long*/ chooser, int /*long*/ extra_widget); +// void _gtk_file_chooser_set_filename(int /*long*/ chooser, int /*long*/ name); +// void _gtk_file_chooser_set_select_multiple(int /*long*/ chooser, bool select_multiple); +// void _gtk_file_filter_add_pattern(int /*long*/ filter, byte[] pattern); +// int /*long*/ _gtk_file_filter_new(); +// void _gtk_file_filter_set_name(int /*long*/ filter, byte[] name); +// int /*long*/ _gtk_file_selection_get_filename(int /*long*/ filesel); +// int /*long*/ _gtk_file_selection_get_selections(int /*long*/ filesel); +// void _gtk_file_selection_hide_fileop_buttons(int /*long*/ filesel); +// int /*long*/ _gtk_file_selection_new(byte[] title); +// void _gtk_file_selection_set_filename(int /*long*/ filesel, int /*long*/ filename); +// void _gtk_file_selection_set_select_multiple(int /*long*/ filesel, bool select_multiple); +// void _gtk_fixed_move(int /*long*/ fixed, int /*long*/ widget, int x, int y); +// int /*long*/ _gtk_fixed_new(); +// void _gtk_fixed_set_has_window(int /*long*/ fixed, bool has_window); +// int /*long*/ _gtk_font_selection_dialog_get_font_name(int /*long*/ fsd); +// int /*long*/ _gtk_font_selection_dialog_new(byte[] title); +// bool _gtk_font_selection_dialog_set_font_name(int /*long*/ fsd, byte[] fontname); +// int /*long*/ _gtk_frame_new(byte[] label); +// int /*long*/ _gtk_frame_get_label_widget(int /*long*/ frame); +// void _gtk_frame_set_label(int /*long*/ frame, byte[] label); +// void _gtk_frame_set_label_widget(int /*long*/ frame, int /*long*/ label_widget); +// void _gtk_frame_set_shadow_type(int /*long*/ frame, int type); +// int /*long*/ _gtk_get_current_event(); +// bool _gtk_get_current_event_state (int[] state); +// int _gtk_get_current_event_time(); +// int /*long*/ _gtk_get_default_language(); +// int /*long*/ _gtk_get_event_widget(int /*long*/ event); +// void _gtk_grab_add(int /*long*/ widget); +// int /*long*/ _gtk_grab_get_current(); +// void _gtk_grab_remove(int /*long*/ widget); +// int /*long*/ _gtk_hbox_new(bool homogeneous, int spacing); +// int /*long*/ _gtk_hscale_new(int /*long*/ adjustment); +// int /*long*/ _gtk_hscrollbar_new(int /*long*/ adjustment); +// int /*long*/ _gtk_hseparator_new(); +// int /*long*/ _gtk_icon_factory_lookup_default(byte[] stock_id); +// void _gtk_icon_source_free(int /*long*/ source); +// int /*long*/ _gtk_icon_source_new(); +// void _gtk_icon_source_set_pixbuf(int /*long*/ source, int /*long*/ pixbuf); +// int /*long*/ _gtk_icon_set_render_icon(int /*long*/ icon_set, int /*long*/ style, int direction, int state, int size, int /*long*/ widget, int /*long*/ detail); +// bool _gtk_im_context_filter_keypress(int /*long*/ context, int /*long*/ event); +// void _gtk_im_context_focus_in(int /*long*/ context); +// void _gtk_im_context_focus_out(int /*long*/ context); +// void _gtk_im_context_get_preedit_string(int /*long*/ context, int /*long*/[] str, int /*long*/[] attrs, int[] cursor_pos); +// int /*long*/ _gtk_im_context_get_type(); +// void _gtk_im_context_reset(int /*long*/ context); +// void _gtk_im_context_set_client_window(int /*long*/ context, int /*long*/ window); +// void _gtk_im_context_set_cursor_location(int /*long*/ context, GdkRectangle area); +// void _gtk_im_multicontext_append_menuitems (int /*long*/ context, int /*long*/ menushell); +// int /*long*/ _gtk_im_multicontext_new(); +// int /*long*/ _gtk_image_menu_item_new_with_label(byte[] label); +// void _gtk_image_menu_item_set_image(int /*long*/ menu_item, int /*long*/ image); +// int /*long*/ _gtk_image_new(); +// int /*long*/ _gtk_image_new_from_pixbuf(int /*long*/ pixbuf); +// int /*long*/ _gtk_image_new_from_pixmap(int /*long*/ pixmap, int /*long*/ mask); +// void _gtk_image_set_from_pixbuf(int /*long*/ image, int /*long*/ pixbuf); +// void _gtk_image_set_from_pixmap(int /*long*/ image, int /*long*/ pixmap, int /*long*/ mask); +// bool _gtk_init_check(int /*long*/[] argc, int /*long*/[] argv); +// int /*long*/ _gtk_label_get_layout(int /*long*/ label); +// int _gtk_label_get_mnemonic_keyval(int /*long*/ label); +// int /*long*/ _gtk_label_new(byte[] label); +// int /*long*/ _gtk_label_new_with_mnemonic(byte[] str); +// void _gtk_label_set_attributes(int /*long*/ label, int /*long*/ attrs); +// void _gtk_label_set_justify(int /*long*/ label, int jtype); +// void _gtk_label_set_line_wrap(int /*long*/ label, bool wrap); +// void _gtk_label_set_text(int /*long*/ label, int /*long*/ str); +// void _gtk_label_set_text(int /*long*/ label, byte[] str); +// void _gtk_label_set_text_with_mnemonic(int /*long*/ label, byte[] str); +// void _gtk_list_append_items(int /*long*/ list, int /*long*/ items); +// void _gtk_list_clear_items(int /*long*/ list, int start, int end); +// void _gtk_list_insert_items(int /*long*/ list, int /*long*/ items, int position); +// int /*long*/ _gtk_list_item_new_with_label(byte[] label); +// void _gtk_list_remove_items(int /*long*/ list, int /*long*/ items); +// void _gtk_list_select_item(int /*long*/ list, int item); +// void _gtk_list_unselect_all(int /*long*/ list); +// void _gtk_list_unselect_item(int /*long*/ list, int item); +// void _gtk_list_store_append(int /*long*/ list_store, int /*long*/ iter); +// void _gtk_list_store_clear(int /*long*/ store); +// void _gtk_list_store_insert(int /*long*/ list_store, int /*long*/ iter, int position); +// int /*long*/ _gtk_list_store_newv(int numColumns, int /*long*/[] types); +// void _gtk_list_store_remove(int /*long*/ list_store, int /*long*/ iter); +// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, byte[] value, int /*long*/ terminator); +// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, int value, int /*long*/ terminator); +// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, long value, int /*long*/ terminator); +// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, GdkColor value, int /*long*/ terminator); +// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, bool value, int /*long*/ terminator); +// int _gtk_major_version(); +// int _gtk_minor_version(); +// int _gtk_micro_version(); +// void _gtk_main(); +// int _gtk_main_iteration(); +// void _gtk_main_do_event(int /*long*/ event); +// int /*long*/ _gtk_menu_bar_new(); +// void _gtk_menu_item_remove_submenu(int /*long*/ menu_item); +// void _gtk_menu_item_set_submenu(int /*long*/ menu_item, int /*long*/ submenu); +// int /*long*/ _gtk_menu_new(); +// void _gtk_menu_popdown(int /*long*/ menu); +// void _gtk_menu_popup(int /*long*/ menu, int /*long*/ parent_menu_shell, int /*long*/ parent_menu_item, int /*long*/ func, int /*long*/ data, int button, int activate_time); +// void _gtk_menu_shell_deactivate(int /*long*/ menu_shell); +// void _gtk_menu_shell_insert(int /*long*/ menu_shell, int /*long*/ child, int position); +// void _gtk_menu_shell_select_item(int /*long*/ menu_shell, int /*long*/ menu_item); +// void _gtk_menu_shell_set_take_focus(int /*long*/ menu_shell, bool take_focus); +// int /*long*/ _gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format); +// void _gtk_misc_set_alignment(int /*long*/ misc, float xalign, float yalign); +// int _gtk_notebook_get_current_page(int /*long*/ notebook); +// bool _gtk_notebook_get_scrollable(int /*long*/ notebook); +// void _gtk_notebook_insert_page(int /*long*/ notebook, int /*long*/ child, int /*long*/ tab_label, int position); +// int /*long*/ _gtk_notebook_new(); +// void _gtk_notebook_next_page(int /*long*/ notebook); +// void _gtk_notebook_prev_page(int /*long*/ notebook); +// void _gtk_notebook_remove_page(int /*long*/ notebook, int page_num); +// void _gtk_notebook_set_current_page(int /*long*/ notebook, int page_num); +// void _gtk_notebook_set_scrollable(int /*long*/ notebook, bool scrollable); +// void _gtk_notebook_set_show_tabs(int /*long*/ notebook, bool show_tabs); +// void _gtk_notebook_set_tab_pos(int /*long*/ notebook, int pos); +// void _gtk_object_sink(int /*long*/ object); +// int /*long*/ _gtk_page_setup_new (); +// int _gtk_page_setup_get_orientation(int /*long*/ setup); +// void _gtk_page_setup_set_orientation(int /*long*/ setup, int orientation); +// int /*long*/ _gtk_page_setup_get_paper_size(int /*long*/ setup); +// void _gtk_page_setup_set_paper_size(int /*long*/ setup, int /*long*/ size); +// double _gtk_page_setup_get_top_margin(int /*long*/ setup, int unit); +// void _gtk_page_setup_set_top_margin(int /*long*/ setup, double margin, int unit); +// double _gtk_page_setup_get_bottom_margin(int /*long*/ setup, int unit); +// void _gtk_page_setup_set_bottom_margin(int /*long*/ setup, double margin, int unit); +// double _gtk_page_setup_get_left_margin(int /*long*/ setup, int unit); +// void _gtk_page_setup_set_left_margin(int /*long*/ setup, double margin, int unit); +// double _gtk_page_setup_get_right_margin(int /*long*/ setup, int unit); +// void _gtk_page_setup_set_right_margin(int /*long*/ setup, double margin, int unit); +// double _gtk_page_setup_get_paper_width(int /*long*/ setup, int unit); +// double _gtk_page_setup_get_paper_height(int /*long*/ setup, int unit); +// double _gtk_page_setup_get_page_width(int /*long*/ setup, int unit); +// double _gtk_page_setup_get_page_height(int /*long*/ setup, int unit); +// void _gtk_paint_handle(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int orientation); +// void _gtk_paint_flat_box(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_focus(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_option(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_slider(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int orientation); +// void _gtk_paint_tab(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_arrow(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int arrow_type, bool fill, int x, int y, int width, int height); +// void _gtk_paint_box(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_box_gap(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width); +// void _gtk_paint_check(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_expander(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int expander_style); +// void _gtk_paint_extension(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side); +// void _gtk_paint_hline(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x1 , int x2, int y); +// void _gtk_paint_layout(int /*long*/ style, int /*long*/ window, int state_type, bool use_text, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int /*long*/ layout); +// void _gtk_paint_shadow_gap(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width); +// void _gtk_paint_shadow(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); +// void _gtk_paint_vline(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int y1 , int y2, int x); +// int /*long*/ _gtk_paper_size_new(byte [] name); +// int /*long*/ _gtk_paper_size_new_from_ppd(byte [] ppd_name, byte [] ppd_display_name, double width, double height); +// int /*long*/ _gtk_paper_size_new_custom(byte [] name, byte [] display_name, double width, double height, int unit); +// int /*long*/ _gtk_paper_size_get_name(int /*long*/ size); +// int /*long*/ _gtk_paper_size_get_display_name(int /*long*/ size); +// int /*long*/ _gtk_paper_size_get_ppd_name(int /*long*/ size); +// double _gtk_paper_size_get_width(int /*long*/ size, int unit); +// double _gtk_paper_size_get_height(int /*long*/ size, int unit); +// bool _gtk_paper_size_is_custom(int /*long*/ size); +// int /*long*/ _gtk_plug_get_id(int /*long*/ plug); +// int /*long*/ _gtk_plug_new(int /*long*/ socket_id); +// int /*long*/ _gtk_printer_get_backend(int /*long*/ printer); +// int /*long*/ _gtk_printer_get_name(int /*long*/ printer); +// bool _gtk_printer_is_default(int /*long*/ printer); +// void _gtk_enumerate_printers(int /*long*/ func, int /*long*/data, int /*long*/ destroy, bool wait); +// int /*long*/ _gtk_print_job_new(byte[] title, int /*long*/ printer, int /*long*/ settings, int /*long*/ page_setup); +// int /*long*/ _gtk_print_job_get_settings(int /*long*/ job); +// int /*long*/ _gtk_print_job_get_printer(int /*long*/ job); +// int /*long*/ _gtk_print_job_get_title(int /*long*/ job); +// int _gtk_print_job_get_status(int /*long*/ job); +// bool _gtk_print_job_set_source_file(int /*long*/ job, byte[] filename, int /*long*/ error[]); +// int /*long*/ _gtk_print_job_get_surface(int /*long*/ job, int /*long*/ error[]); +// void _gtk_print_job_send(int /*long*/ job, int /*long*/ callback, int /*long*/ user_data, int /*long*/ dnotify); +// int /*long*/ _gtk_print_settings_new(); +// void _gtk_print_settings_foreach(int /*long*/ settings, int /*long*/ func, int /*long*/ data); +// int /*long*/ _gtk_print_settings_get(int /*long*/ settings, byte [] key); +// void _gtk_print_settings_set(int /*long*/ settings, byte [] key, byte [] value); +// int /*long*/ _gtk_print_settings_get_printer(int /*long*/ settings); +// void _gtk_print_settings_set_printer(int /*long*/ settings, byte[] printer); +// int _gtk_print_settings_get_orientation(int /*long*/ settings); +// void _gtk_print_settings_set_orientation(int /*long*/ settings, int orientation); +// bool _gtk_print_settings_get_collate(int /*long*/ settings); +// void _gtk_print_settings_set_collate(int /*long*/ settings, bool collate); +// int _gtk_print_settings_get_n_copies(int /*long*/ settings); +// void _gtk_print_settings_set_n_copies(int /*long*/ settings, int num_copies); +// int _gtk_print_settings_get_print_pages(int /*long*/ settings); +// void _gtk_print_settings_set_print_pages(int /*long*/ settings, int pages); +// int /*long*/ _gtk_print_settings_get_page_ranges(int /*long*/ settings, int[] num_ranges); +// void _gtk_print_settings_set_page_ranges(int /*long*/ settings, int[] page_ranges, int num_ranges); +// double _gtk_print_settings_get_paper_width(int /*long*/ settings, int unit); +// double _gtk_print_settings_get_paper_height(int /*long*/ settings, int unit); +// int _gtk_print_settings_get_resolution(int /*long*/ settings); +// int /*long*/ _gtk_print_unix_dialog_new(byte[] title, int /*long*/ parent); +// void _gtk_print_unix_dialog_set_page_setup(int /*long*/ dialog, int /*long*/ page_setup); +// int /*long*/ _gtk_print_unix_dialog_get_page_setup(int /*long*/ dialog); +// void _gtk_print_unix_dialog_set_current_page(int /*long*/ dialog, int current_page); +// int _gtk_print_unix_dialog_get_current_page(int /*long*/ dialog); +// void _gtk_print_unix_dialog_set_settings(int /*long*/ dialog, int /*long*/ settings); +// int /*long*/ _gtk_print_unix_dialog_get_settings(int /*long*/ dialog); +// int /*long*/ _gtk_print_unix_dialog_get_selected_printer(int /*long*/ dialog); +// void _gtk_print_unix_dialog_set_manual_capabilities(int /*long*/ dialog, int /*long*/ capabilities); +// int /*long*/ _gtk_progress_bar_new(); +// void _gtk_progress_bar_pulse(int /*long*/ pbar); +// void _gtk_progress_bar_set_fraction(int /*long*/ pbar, double fraction); +// void _gtk_progress_bar_set_orientation(int /*long*/ pbar, int orientation); +// int /*long*/ _gtk_radio_button_get_group(int /*long*/ radio_button); +// int /*long*/ _gtk_radio_button_new(int /*long*/ group); +// int /*long*/ _gtk_radio_menu_item_get_group(int /*long*/ radio_menu_item); +// int /*long*/ _gtk_radio_menu_item_new(int /*long*/ group); +// int /*long*/ _gtk_radio_menu_item_new_with_label(int /*long*/ group, byte[] label); +// int /*long*/ _gtk_range_get_adjustment(int /*long*/ range); +// void _gtk_range_set_increments(int /*long*/ range, double step, double page); +// void _gtk_range_set_inverted(int /*long*/ range, bool setting); +// void _gtk_range_set_range(int /*long*/ range, double min, double max); +// void _gtk_range_set_value(int /*long*/ range, double value); +// void _gtk_rc_parse_string(byte[] rc_string); +// int /*long*/ _gtk_rc_style_get_bg_pixmap_name(int /*long*/ style, int index); +// int _gtk_rc_style_get_color_flags(int /*long*/ style, int index); +// void _gtk_rc_style_set_bg(int /*long*/ style, int index, GdkColor color); +// void _gtk_rc_style_set_bg_pixmap_name(int /*long*/ style, int index, int /*long*/ name); +// void _gtk_rc_style_set_color_flags(int /*long*/ style, int index, int flag); +// void _gtk_scale_set_digits(int /*long*/ scale, int digits); +// void _gtk_scale_set_draw_value(int /*long*/ scale, bool draw_value); +// void _gtk_rc_style_set_fg(int /*long*/ style, int index, GdkColor color); +// void _gtk_rc_style_set_text(int /*long*/ style, int index, GdkColor color); +// void _gtk_scrolled_window_add_with_viewport(int /*long*/ scrolled_window, int /*long*/ child); +// int /*long*/ _gtk_scrolled_window_get_hadjustment(int /*long*/ scrolled_window); +// void _gtk_scrolled_window_get_policy(int /*long*/ scrolled_window, int[] hscrollbar_policy, int[] vscrollbar_policy); +// int _gtk_scrolled_window_get_shadow_type(int /*long*/ scrolled_window); +// int /*long*/ _gtk_scrolled_window_get_vadjustment(int /*long*/ scrolled_window); +// int /*long*/ _gtk_scrolled_window_new(int /*long*/ hadjustment, int /*long*/ vadjustment); +// void _gtk_scrolled_window_set_placement(int /*long*/ scrolled_window, int placement); +// void _gtk_scrolled_window_set_policy(int /*long*/ scrolled_window, int hscrollbar_policy, int vscrollbar_policy); +// void _gtk_scrolled_window_set_shadow_type(int /*long*/ scrolled_window, int type); +// int /*long*/ _gtk_settings_get_default(); +// void _gtk_selection_data_free(int /*long*/ selection_data); +// void _gtk_selection_data_set(int /*long*/ selection_data, int /*long*/ type, int format, int /*long*/ data, int length); +// int /*long*/ _gtk_separator_menu_item_new(); +// int /*long*/ _gtk_set_locale(); +// int /*long*/ _gtk_socket_get_id(int /*long*/ socket); +// int /*long*/ _gtk_socket_new(); +// int /*long*/ _gtk_spin_button_new(int /*long*/ adjustment, double climb_rate, int digits); +// int /*long*/ _gtk_spin_button_get_adjustment(int /*long*/ spin_button); +// int _gtk_spin_button_get_digits(int /*long*/ spin_button); +// void _gtk_spin_button_set_digits(int /*long*/ spin_button, int digits); +// void _gtk_spin_button_set_increments(int /*long*/ spin_button, double step, double page); +// void _gtk_spin_button_set_range(int /*long*/ spin_button, double max, double min); +// void _gtk_spin_button_set_value(int /*long*/ spin_button, double value); +// void _gtk_spin_button_set_wrap(int /*long*/ spin_button, bool wrap); +// void _gtk_spin_button_update(int /*long*/ spin_button); +// void _gtk_style_get_base(int /*long*/ style, int index, GdkColor color); +// void _gtk_style_get_black(int /*long*/ style, GdkColor color); +// void _gtk_style_get_bg(int /*long*/ style, int index, GdkColor color); +// void _gtk_style_get_dark(int /*long*/ style, int index, GdkColor color); +// void _gtk_style_get_fg(int /*long*/ style, int index, GdkColor color); +// void _gtk_style_get_fg_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_bg_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_light_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_dark_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_mid_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_text_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_text_aa_gc(int /*long*/ style, int index, int /*long*/[] gc); +// void _gtk_style_get_black_gc(int /*long*/ style, int /*long*/[] gc); +// void _gtk_style_get_white_gc(int /*long*/ style, int /*long*/[] gc); +// int /*long*/ _gtk_style_get_font_desc(int /*long*/ style); +// void _gtk_style_get_light(int /*long*/ style, int index, GdkColor color); +// void _gtk_style_get_text(int /*long*/ style, int index, GdkColor color); +// int _gtk_style_get_xthickness(int /*long*/ style); +// int _gtk_style_get_ythickness(int /*long*/ style); +// int /*long*/ _gtk_style_render_icon(int /*long*/ style, int /*long*/ source, int direction, int state, int size, int /*long*/ widget, byte[] detail); +// int /*long*/ _gtk_target_list_new(int /*long*/ targets, int ntargets); +// void _gtk_target_list_unref(int /*long*/ list); +// void _gtk_text_buffer_copy_clipboard(int /*long*/ buffer, int /*long*/ clipboard); +// void _gtk_text_buffer_cut_clipboard(int /*long*/ buffer, int /*long*/ clipboard, bool default_editable); +// void _gtk_text_buffer_delete(int /*long*/ buffer, byte[] start, byte[] end); +// void _gtk_text_buffer_get_bounds(int /*long*/ buffer, byte[] start, byte[] end); +// int _gtk_text_buffer_get_char_count(int /*long*/ buffer); +// void _gtk_text_buffer_get_end_iter(int /*long*/ buffer, byte[] iter); +// int /*long*/ _gtk_text_buffer_get_insert(int /*long*/ buffer); +// void _gtk_text_buffer_get_iter_at_line(int /*long*/ buffer, byte[] iter, int line_number); +// void _gtk_text_buffer_get_iter_at_mark(int /*long*/ buffer, byte[] iter, int /*long*/ mark); +// void _gtk_text_buffer_get_iter_at_offset(int /*long*/ buffer, byte[] iter, int char_offset); +// int _gtk_text_buffer_get_line_count(int /*long*/ buffer); +// int /*long*/ _gtk_text_buffer_get_selection_bound(int /*long*/ buffer); +// bool _gtk_text_buffer_get_selection_bounds(int /*long*/ buffer, byte[] start, byte[] end); +// int /*long*/ _gtk_text_buffer_get_text(int /*long*/ buffer, byte[] start, byte[] end, bool include_hidden_chars); +// void _gtk_text_buffer_insert(int /*long*/ buffer, byte[] iter, byte[] text, int len); +// void _gtk_text_buffer_insert(int /*long*/ buffer, int /*long*/ iter, byte[] text, int len); +// void _gtk_text_buffer_move_mark(int /*long*/ buffer, int /*long*/ mark, byte[] where); +// void _gtk_text_buffer_paste_clipboard(int /*long*/ buffer, int /*long*/ clipboard, byte[] override_location, bool default_editable); +// void _gtk_text_buffer_place_cursor(int /*long*/ buffer, byte[] where); +// void _gtk_text_buffer_set_text(int /*long*/ buffer, byte[] text, int len); +// int _gtk_text_iter_get_line(byte[] iter); +// int _gtk_text_iter_get_offset(byte[] iter); +// void _gtk_text_view_buffer_to_window_coords(int /*long*/ text_view, int win, int buffer_x, int buffer_y, int[] window_x, int[] window_y); +// int /*long*/ _gtk_text_view_get_buffer(int /*long*/ text_view); +// bool _gtk_text_view_get_editable(int /*long*/ text_view); +// void _gtk_text_view_get_iter_at_location(int /*long*/ text_view, byte[] iter, int x, int y); +// void _gtk_text_view_get_iter_location(int /*long*/ text_view, byte[] iter, GdkRectangle location); +// void _gtk_text_view_get_line_at_y(int /*long*/ text_view, byte[] target_iter, int y, int[] line_top); +// void _gtk_text_view_get_visible_rect(int /*long*/ text_view, GdkRectangle visible_rect); +// int /*long*/ _gtk_text_view_get_window(int /*long*/ text_view, int win); +// int /*long*/ _gtk_text_view_new(); +// void _gtk_text_view_scroll_mark_onscreen(int /*long*/ text_view, int /*long*/ mark); +// bool _gtk_text_view_scroll_to_iter(int /*long*/ text_view, byte[] iter, double within_margin, bool use_align, double xalign, double yalign); +// void _gtk_text_view_set_editable(int /*long*/ text_view, bool setting); +// void _gtk_text_view_set_justification(int /*long*/ text_view, int justification); +// void _gtk_text_view_set_tabs(int /*long*/ text_view, int /*long*/ tabs); +// void _gtk_text_view_set_wrap_mode(int /*long*/ text_view, int wrap_mode); +// void _gtk_text_view_window_to_buffer_coords(int /*long*/ text_view, int win, int window_x, int window_y, int[] buffer_x, int[] buffer_y); +// int _gtk_timeout_add(int interval, int /*long*/ function, int /*long*/ data); +// void _gtk_timeout_remove(int timeout_handler_id); +// bool _gtk_toggle_button_get_active(int /*long*/ toggle_button); +// int /*long*/ _gtk_toggle_button_new(); +// void _gtk_toggle_button_set_active(int /*long*/ toggle_button, bool is_active); +// void _gtk_toggle_button_set_mode(int /*long*/ toggle_button, bool draw_indicator); +// void _gtk_toolbar_insert_widget(int /*long*/ toolbar, int /*long*/ widget, byte[] tooltip_text, byte[] tooltip_private_text, int position); +// int /*long*/ _gtk_toolbar_new(); +// void _gtk_toolbar_set_orientation(int /*long*/ toolbar, int orientation); +// int /*long*/ _gtk_tooltips_data_get(int /*long*/ widget); +// void _gtk_tooltips_disable(int /*long*/ tooltips); +// void _gtk_tooltips_enable(int /*long*/ tooltips); +// int /*long*/ _gtk_tooltips_new(); +// void _gtk_tooltips_force_window(int /*long*/ tooltips); +// void _gtk_tooltips_set_tip(int /*long*/ tooltips, int /*long*/ widget, byte[] tip_text, byte[] tip_private); +// void _gtk_tree_model_get(int /*long*/ tree_model, int /*long*/ iter, int column, int[] value, int /*long*/ terminator); +// void _gtk_tree_model_get(int /*long*/ tree_model, int /*long*/ iter, int column, long[] value, int /*long*/ terminator); +// bool _gtk_tree_model_get_iter(int /*long*/ tree_model, int /*long*/ iter, int /*long*/ path); +// bool _gtk_tree_model_get_iter_first(int /*long*/ tree_model, int /*long*/ iter); +// int _gtk_tree_model_get_n_columns(int /*long*/ tree_model); +// int /*long*/ _gtk_tree_model_get_path(int /*long*/ tree_model, int /*long*/ iter); +// int /*long*/ _gtk_tree_model_get_type(); +// bool _gtk_tree_model_iter_children(int /*long*/ model, int /*long*/ iter, int /*long*/ parent); +// int _gtk_tree_model_iter_n_children(int /*long*/ model, int /*long*/ iter); +// bool _gtk_tree_model_iter_next(int /*long*/ model, int /*long*/ iter); +// bool _gtk_tree_model_iter_nth_child(int /*long*/ tree_model, int /*long*/ iter, int /*long*/ parent, int n); +// void _gtk_tree_path_append_index(int /*long*/ path, int index); +// int /*long*/ _gtk_tree_path_compare(int /*long*/ a, int /*long*/ b); +// void _gtk_tree_path_down(int /*long*/ path); +// void _gtk_tree_path_free(int /*long*/ path); +// int _gtk_tree_path_get_depth(int /*long*/ path); +// int /*long*/ _gtk_tree_path_get_indices(int /*long*/ path); +// int /*long*/ _gtk_tree_path_new(); +// int /*long*/ _gtk_tree_path_new_first(); +// int /*long*/ _gtk_tree_path_new_from_string(byte[] path); +// int /*long*/ _gtk_tree_path_new_from_string(int /*long*/ path); +// void _gtk_tree_path_next(int /*long*/ path); +// bool _gtk_tree_path_prev(int /*long*/ path); +// bool _gtk_tree_path_up(int /*long*/ path); +// int _gtk_tree_selection_count_selected_rows(int /*long*/ selection); +// bool _gtk_tree_selection_get_selected(int /*long*/ selection, int /*long*/[] model, int /*long*/ iter); +// int /*long*/ _gtk_tree_selection_get_selected_rows(int /*long*/ selection, int /*long*/[] model); +// bool _gtk_tree_selection_path_is_selected(int /*long*/ selection, int /*long*/ path); +// void _gtk_tree_selection_select_all(int /*long*/ selection); +// void _gtk_tree_selection_select_iter(int /*long*/ selection, int /*long*/ iter); +// void _gtk_tree_selection_selected_foreach(int /*long*/ selection, int /*long*/ func, int /*long*/ data); +// void _gtk_tree_selection_set_mode(int /*long*/ selection, int mode); +// void _gtk_tree_selection_unselect_all(int /*long*/ selection); +// void _gtk_tree_selection_unselect_iter(int /*long*/ selection, int /*long*/ iter); +// void _gtk_tree_store_append(int /*long*/ store, int /*long*/ iter, int /*long*/ parent); +// void _gtk_tree_store_clear(int /*long*/ store); +// void _gtk_tree_store_insert(int /*long*/ store, int /*long*/ iter, int /*long*/ parent, int position); +// int /*long*/ _gtk_tree_store_newv(int numColumns, int /*long*/[] types); +// void _gtk_tree_store_remove(int /*long*/ store, int /*long*/ iter); +// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, byte[] value, int /*long*/ terminator); +// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, int value, int /*long*/ terminator); +// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, long value, int /*long*/ terminator); +// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, GdkColor value, int /*long*/ terminator); +// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, bool value, int /*long*/ terminator); +// int /*long*/ _gtk_tree_view_create_row_drag_icon(int /*long*/ view, int /*long*/ path); +// bool _gtk_tree_view_collapse_row(int /*long*/ view, int /*long*/ path); +// void _gtk_tree_view_column_add_attribute(int /*long*/ treeColumn, int /*long*/ cellRenderer, byte[] attribute, int column); +// bool _gtk_tree_view_column_cell_get_position(int /*long*/ tree_column, int /*long*/ cell_renderer, int[] start_pos, int[] width); +// void _gtk_tree_view_column_cell_get_size(int /*long*/ tree_column, GdkRectangle cell_area, int[] x_offset, int[] y_offset, int[] width, int[] height); +// void _gtk_tree_view_column_cell_set_cell_data(int /*long*/ tree_column, int /*long*/ tree_model, int /*long*/ iter, bool is_expander, bool is_expanded); +// void _gtk_tree_view_column_clear(int /*long*/ tree_column); +// int /*long*/ _gtk_tree_view_column_get_cell_renderers(int /*long*/ tree_column); +// int _gtk_tree_view_column_get_fixed_width(int /*long*/ column); +// bool _gtk_tree_view_column_get_reorderable(int /*long*/ column); +// bool _gtk_tree_view_column_get_resizable(int /*long*/ column); +// int _gtk_tree_view_column_get_sizing(int /*long*/ tree_column); +// int _gtk_tree_view_column_get_spacing(int /*long*/ tree_column); +// bool _gtk_tree_view_column_get_visible(int /*long*/ column); +// bool _gtk_tree_view_column_get_sort_indicator(int /*long*/ tree_column); +// int _gtk_tree_view_column_get_sort_order(int /*long*/ tree_column); +// int _gtk_tree_view_column_get_width(int /*long*/ column); +// int /*long*/ _gtk_tree_view_column_new(); +// void _gtk_tree_view_column_pack_start(int /*long*/ tree_column, int /*long*/ cell_renderer, bool expand); +// void _gtk_tree_view_column_pack_end(int /*long*/ tree_column, int /*long*/ cell_renderer, bool expand); +// void _gtk_tree_view_column_set_alignment(int /*long*/ tree_column, float xalign); +// void _gtk_tree_view_column_set_cell_data_func(int /*long*/ tree_column, int /*long*/ cell_renderer, int /*long*/ func, int /*long*/ func_data, int /*long*/ destroy); +// void _gtk_tree_view_column_set_clickable(int /*long*/ column, bool clickable); +// void _gtk_tree_view_column_set_fixed_width(int /*long*/ column, int fixed_width); +// void _gtk_tree_view_column_set_min_width(int /*long*/ tree_column, int min_width); +// void _gtk_tree_view_column_set_reorderable(int /*long*/ column, bool reorderable); +// void _gtk_tree_view_column_set_resizable(int /*long*/ column, bool resizable); +// void _gtk_tree_view_column_set_sizing(int /*long*/ column, int type); +// void _gtk_tree_view_column_set_sort_indicator(int /*long*/ tree_column, bool setting); +// void _gtk_tree_view_column_set_sort_order(int /*long*/ tree_column, int order); +// void _gtk_tree_view_column_set_title(int /*long*/ tree_column, byte[] title); +// void _gtk_tree_view_column_set_visible (int /*long*/ tree_column, bool visible); +// void _gtk_tree_view_column_set_widget(int /*long*/ tree_column, int /*long*/ widget); +// void _gtk_tree_view_set_drag_dest_row(int /*long*/ view, int /*long*/ path, int pos); +// void _gtk_tree_view_set_enable_search (int /*long*/ view, bool enable_search); +// bool _gtk_tree_view_expand_row(int /*long*/ view, int /*long*/ path, bool open_all); +// void _gtk_tree_view_get_background_area(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, GdkRectangle rect); +// int /*long*/ _gtk_tree_view_get_bin_window(int /*long*/ tree_view); +// void _gtk_tree_view_get_cell_area(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, GdkRectangle rect); +// int /*long*/_gtk_tree_view_get_expander_column(int /*long*/ tree_view); +// int /*long*/ _gtk_tree_view_get_column(int /*long*/ tree_view, int n); +// int /*long*/ _gtk_tree_view_get_columns(int /*long*/ tree_view); +// void _gtk_tree_view_get_cursor(int /*long*/ tree_view, int /*long*/[] path, int /*long*/[] focus_column); +// bool _gtk_tree_view_get_headers_visible(int /*long*/ tree_view); +// bool _gtk_tree_view_get_path_at_pos(int /*long*/ tree_view, int x, int y, int /*long*/[] path, int /*long*/[] column, int[] cell_x, int[] cell_y); +// bool _gtk_tree_view_get_rules_hint(int /*long*/ tree_view); +// int /*long*/ _gtk_tree_view_get_selection(int /*long*/ tree_view); +// void _gtk_tree_view_get_visible_rect(int /*long*/ tree_view, GdkRectangle visible_rect); +// int _gtk_tree_view_insert_column(int /*long*/ tree_view, int /*long*/ column, int position); +// void _gtk_tree_view_move_column_after(int /*long*/ tree_view, int /*long*/ column, int /*long*/ base_column); +// int /*long*/ _gtk_tree_view_new_with_model(int /*long*/ model); +// void _gtk_tree_view_remove_column(int /*long*/ tree_view, int /*long*/ column); +// bool _gtk_tree_view_row_expanded(int /*long*/ view, int /*long*/ path); +// void _gtk_tree_view_scroll_to_cell(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, bool use_align, float row_aligh, float column_align); +// void _gtk_tree_view_scroll_to_point (int /*long*/ tree_view, int tree_x, int tree_y); +// void _gtk_tree_view_set_cursor(int /*long*/ tree_view, int /*long*/ path, int /*long*/ focus_column, bool start_editing); +// void _gtk_tree_view_set_headers_visible(int /*long*/ tree_view, bool visible); +// void _gtk_tree_view_set_model(int /*long*/ tree_view, int /*long*/ model); +// void _gtk_tree_view_set_rules_hint(int /*long*/ tree_view, bool setting); +// void _gtk_tree_view_set_search_column(int /*long*/ tree_view, int column); +// void _gtk_tree_view_tree_to_widget_coords(int /*long*/ tree_view, int tx, int ty, int[] wx, int[] wy); +// void _gtk_tree_view_unset_rows_drag_dest(int /*long*/ tree_view); +// void _gtk_tree_view_widget_to_tree_coords(int /*long*/ tree_view, int wx, int wy, int[] tx, int[] ty); +// int /*long*/ _gtk_vbox_new(bool homogeneous, int spacing); +// int /*long*/ _gtk_vscale_new(int /*long*/ adjustment); +// int /*long*/ _gtk_vscrollbar_new(int /*long*/ adjustment); +// int /*long*/ _gtk_vseparator_new(); +// void _gtk_widget_add_accelerator(int /*long*/ widget, byte[] accel_signal, int /*long*/ accel_group, int accel_key, int accel_mods, int accel_flags); +// void _gtk_widget_add_events(int /*long*/ widget, int events); +// bool _gtk_widget_child_focus(int /*long*/ widget, int direction); +// int /*long*/ _gtk_widget_create_pango_layout(int /*long*/ widget, byte[] text); +// int /*long*/ _gtk_widget_create_pango_layout(int /*long*/ widget, int /*long*/ text); +// void _gtk_widget_destroy(int /*long*/ widget); +// bool _gtk_widget_event(int /*long*/ widget, int /*long*/ event); +// int /*long*/ _gtk_widget_get_accessible (int /*long*/ widget); +// bool _gtk_widget_get_child_visible (int /*long*/ widget); +// int _gtk_widget_get_default_direction(); +// int /*long*/ _gtk_widget_get_default_style(); +// int _gtk_widget_get_direction(int /*long*/ widget); +// int _gtk_widget_get_events(int /*long*/ widget); +// int /*long*/ _gtk_widget_get_modifier_style(int /*long*/ widget); +// int /*long*/ _gtk_widget_get_pango_context(int /*long*/ widget); +// int /*long*/ _gtk_widget_get_parent(int /*long*/ widget); +// int /*long*/ _gtk_widget_get_style(int /*long*/ widget); +// void _gtk_widget_get_size_request(int /*long*/ widget, int [] width, int [] height); +// int /*long*/ _gtk_widget_get_toplevel (int /*long*/ widget); +// void _gtk_widget_grab_focus(int /*long*/ widget); +// void _gtk_widget_hide(int /*long*/ widget); +// bool _gtk_widget_is_focus(int /*long*/ widget); +// void _gtk_widget_map(int /*long*/ widget); +// bool _gtk_widget_mnemonic_activate(int /*long*/ widget, bool group_cycling); +// void _gtk_widget_modify_base(int /*long*/ widget, int state, GdkColor color); +// void _gtk_widget_modify_bg(int /*long*/ widget, int state, GdkColor color); +// void _gtk_widget_modify_fg(int /*long*/ widget, int state, GdkColor color); +// void _gtk_widget_modify_font(int /*long*/ widget, int /*long*/ pango_font_descr); +// void _gtk_widget_modify_style(int /*long*/ widget, int /*long*/ style); +// void _gtk_widget_modify_text(int /*long*/ widget, int state, GdkColor color); +// void _gtk_widget_queue_resize(int /*long*/ widget); +// void _gtk_widget_realize(int /*long*/ widget); +// void _gtk_widget_remove_accelerator(int /*long*/ widget, int /*long*/ accel_group, int accel_key, int accel_mods); +// void _gtk_widget_reparent(int /*long*/ widget, int /*long*/ new_parent); +// void _gtk_widget_set_app_paintable(int /*long*/ widget, bool app_paintable); +// void _gtk_widget_set_default_direction(int dir); +// void _gtk_widget_set_direction(int /*long*/ widget, int dir); +// void _gtk_widget_set_double_buffered(int /*long*/ widget, bool double_buffered); +// void _gtk_widget_set_name(int /*long*/ widget, byte[] name); +// void _gtk_widget_set_redraw_on_allocate(int /*long*/ widget, bool redraw); +// void _gtk_widget_set_sensitive(int /*long*/ widget, bool sensitive); +// void _gtk_widget_set_size_request(int /*long*/ widget, int width, int height); +// void _gtk_widget_set_state(int /*long*/ widget, int state); +// void _gtk_widget_set_style(int /*long*/ widget, int /*long*/ style); +// void _gtk_widget_shape_combine_mask(int /*long*/ widget, int /*long*/ shape_mask, int offset_x, int offset_y); +// void _gtk_widget_show(int /*long*/ widget); +// void _gtk_widget_show_now(int /*long*/ widget); +// void _gtk_widget_size_allocate(int /*long*/ widget, GtkAllocation allocation); +// void _gtk_widget_size_request(int /*long*/ widget, GtkRequisition requisition); +// void _gtk_widget_style_get(int /*long*/ widget, byte[] property_name, int[] value, int /*long*/ terminator); +// void _gtk_widget_style_get(int /*long*/ widget, byte[] property_name, long[] value, int /*long*/ terminator); +// bool _gtk_widget_translate_coordinates(int /*long*/ src_widget, int /*long*/ dest_widget, int src_x, int src_y, int[] dest_x, int[] dest_y); +// void _gtk_widget_unrealize(int /*long*/ widget); +// bool _gtk_window_activate_default(int /*long*/ window); +// void _gtk_window_add_accel_group(int /*long*/ window, int /*long*/ accel_group); +// void _gtk_window_deiconify(int /*long*/ handle); +// int /*long*/ _gtk_window_get_focus(int /*long*/ window); +// int /*long*/ _gtk_window_get_icon_list(int /*long*/ window); +// bool _gtk_window_get_modal(int /*long*/ window); +// int _gtk_window_get_mnemonic_modifier(int /*long*/ window); +// void _gtk_window_get_position(int /*long*/ handle, int[] x, int[] y); +// void _gtk_window_get_size(int /*long*/ handle, int[] x, int[] y); +// void _gtk_window_iconify(int /*long*/ handle); +// void _gtk_window_maximize(int /*long*/ handle); +// void _gtk_window_move(int /*long*/ handle, int x, int y); +// int /*long*/ _gtk_window_new(int type); +// void _gtk_window_present(int /*long*/ window); +// void _gtk_window_remove_accel_group(int /*long*/ window, int /*long*/ accel_group); +// void _gtk_window_resize(int /*long*/ handle, int x, int y); +// void _gtk_window_set_default(int /*long*/ window, int /*long*/ widget); +// void _gtk_window_set_destroy_with_parent(int /*long*/ window, bool setting); +// void _gtk_window_set_geometry_hints(int /*long*/ window, int /*long*/ geometry_widget, GdkGeometry geometry, int geom_mask); +// void _gtk_window_set_icon_list(int /*long*/ window, int /*long*/ list); +// void _gtk_window_set_modal(int /*long*/ window, bool modal); +// void _gtk_widget_set_parent_window(int /*long*/ widget, int /*long*/ parent_window); +// void _gtk_window_set_resizable(int /*long*/ window, bool resizable); +// void _gtk_window_set_title(int /*long*/ window, byte[] title); +// void _gtk_window_set_skip_taskbar_hint(int /*long*/ window, bool skips_taskbar); +// void _gtk_window_set_type_hint(int /*long*/ window, int hint); +// void _gtk_window_set_transient_for(int /*long*/ window, int /*long*/ parent); +// void _gtk_window_unmaximize(int /*long*/ handle); +// +// int /*long*/ _pango_attr_background_new (short red, short green, short blue); +// int /*long*/ _pango_attr_font_desc_new(int /*long*/ desc); +// int /*long*/ _pango_attr_foreground_new (short red, short green, short blue); +// int /*long*/ _pango_attr_rise_new(int rise); +// int /*long*/ _pango_attr_shape_new(PangoRectangle ink_rect, PangoRectangle logical_rect); +// void _pango_attr_list_insert(int /*long*/ list, int /*long*/ attr); +// void _pango_attr_list_change(int /*long*/ list, int /*long*/ attr); +// int /*long*/ _pango_attr_list_new(); +// void _pango_attr_list_unref(int /*long*/ list); +// int /*long*/ _pango_attr_strikethrough_new(bool strikethrough); +// int /*long*/ _pango_attr_underline_new(int underline); +// int /*long*/ _pango_attr_weight_new(int weight); +// int /*long*/ _pango_cairo_font_map_get_default(); +// int /*long*/ _pango_cairo_font_map_new(); +// int /*long*/ _pango_cairo_font_map_create_context(int /*long*/ fontmap); +// int /*long*/ _pango_cairo_create_layout(int /*long*/ cairo); +// int /*long*/ _pango_cairo_context_get_font_options(int /*long*/ context); +// void _pango_cairo_context_set_font_options(int /*long*/ context, int /*long*/ options); +// void _pango_cairo_font_map_set_resolution(int /*long*/ fontmap, double dpi); +// void _pango_cairo_layout_path(int /*long*/ cairo, int /*long*/ layout); +// void _pango_cairo_show_layout(int /*long*/ cairo, int /*long*/ layout); +// int _pango_context_get_base_dir(int /*long*/ context); +// int /*long*/ _pango_context_get_language(int /*long*/ context); +// int /*long*/ _pango_context_get_metrics(int /*long*/ context, int /*long*/ desc, int /*long*/ language); +// void _pango_context_list_families(int /*long*/ context, int /*long*/[] families, int[] n_families); +// void _pango_context_set_base_dir(int /*long*/ context, int direction); +// void _pango_context_set_language(int /*long*/ context, int /*long*/ language); +// int /*long*/ _pango_font_description_copy(int /*long*/ desc); +// void _pango_font_description_free(int /*long*/ desc); +// int /*long*/ _pango_font_description_from_string(byte[] str); +// int /*long*/ _pango_font_description_get_family(int /*long*/ desc); +// int _pango_font_description_get_size(int /*long*/ desc); +// int _pango_font_description_get_style(int /*long*/ desc); +// int _pango_font_description_get_weight(int /*long*/ desc); +// int /*long*/ _pango_font_description_new(); +// void _pango_font_description_set_family(int /*long*/ desc, byte[] family); +// void _pango_font_description_set_size(int /*long*/ desc, int size); +// void _pango_font_description_set_stretch(int /*long*/ desc, int stretch); +// void _pango_font_description_set_style(int /*long*/ desc, int weight); +// void _pango_font_description_set_weight(int /*long*/ desc, int weight); +// int /*long*/ _pango_font_description_to_string(int /*long*/ desc); +// int /*long*/ _pango_font_face_describe(int /*long*/ face); +// int /*long*/ _pango_font_family_get_name(int /*long*/ family); +// void _pango_font_family_list_faces(int /*long*/ family, int /*long*/[] faces, int[] n_faces); +// int /*long*/ _pango_font_get_metrics(int /*long*/ font, int /*long*/ language); +// int _pango_font_metrics_get_approximate_char_width(int /*long*/ metrics); +// int _pango_font_metrics_get_ascent(int /*long*/ metrics); +// int _pango_font_metrics_get_descent(int /*long*/ metrics); +// void _pango_font_metrics_unref(int /*long*/ metrics); +// int /*long*/ _pango_language_from_string(byte[] language); +// void _pango_layout_context_changed(int /*long*/ layout); +// int _pango_layout_get_alignment(int /*long*/ layout); +// int /*long*/ _pango_layout_get_context(int /*long*/ layout); +// int /*long*/ _pango_layout_get_attributes(int /*long*/ layout); +// int _pango_layout_get_indent(int /*long*/ layout); +// int /*long*/ _pango_layout_get_iter(int /*long*/ layout); +// bool _pango_layout_get_justify(int /*long*/ layout); +// int /*long*/ _pango_layout_get_line(int /*long*/ layout, int line); +// int _pango_layout_get_line_count(int /*long*/ layout); +// void _pango_layout_get_log_attrs(int /*long*/ layout, int /*long*/[] attrs, int[] n_attrs); +// void _pango_layout_get_size(int /*long*/ layout, int[] width, int[] height); +// int _pango_layout_get_spacing(int /*long*/ layout); +// int /*long*/ _pango_layout_get_tabs(int /*long*/ layout); +// int /*long*/ _pango_layout_get_text(int /*long*/ layout); +// int _pango_layout_get_width(int /*long*/ layout); +// void _pango_layout_index_to_pos(int /*long*/ layout, int index, PangoRectangle pos); +// void _pango_layout_iter_free(int /*long*/ iter); +// void _pango_layout_iter_get_line_extents(int /*long*/ iter, PangoRectangle ink_rect, PangoRectangle logical_rect); +// int _pango_layout_iter_get_index(int /*long*/ iter); +// int /*long*/ _pango_layout_iter_get_run(int /*long*/ iter); +// bool _pango_layout_iter_next_line(int /*long*/ iter); +// bool _pango_layout_iter_next_run(int /*long*/ iter); +// void _pango_layout_line_get_extents(int /*long*/ line, PangoRectangle ink_rect, PangoRectangle logical_rect); +// bool _pango_layout_line_x_to_index(int /*long*/ line, int x_pos, int[] index_, int[] trailing); +// int /*long*/ _pango_layout_new(int /*long*/ context); +// void _pango_layout_set_alignment (int /*long*/ layout, int alignment); +// void _pango_layout_set_attributes(int /*long*/ layout, int /*long*/ attrs); +// void _pango_layout_set_auto_dir(int /*long*/ layout, bool auto_dir); +// void _pango_layout_set_font_description(int /*long*/ context, int /*long*/ descr); +// void _pango_layout_set_indent(int /*long*/ layout, int indent); +// void _pango_layout_set_justify(int /*long*/ layout, bool justify); +// void _pango_layout_set_single_paragraph_mode(int /*long*/ context, bool setting); +// void _pango_layout_set_spacing(int /*long*/ layout, int spacing); +// void _pango_layout_set_tabs(int /*long*/ layout, int /*long*/ tabs); +// void _pango_layout_set_text(int /*long*/ layout, byte[] text, int length); +// void _pango_layout_set_width(int /*long*/ layout, int width); +// void _pango_layout_set_wrap (int /*long*/ layout, int wrap); +// bool _pango_layout_xy_to_index(int /*long*/ layout, int x, int y, int[] index, int[] trailing); +// int _pango_tab_array_get_size(int /*long*/ tab_array); +// void _pango_tab_array_get_tabs(int /*long*/ tab_array, int /*long*/[] alignments, int /*long*/[] locations); +// void _pango_tab_array_free(int /*long*/ tab_array); +// int /*long*/ _pango_tab_array_new(int initial_size, bool positions_in_pixels); +// void _pango_tab_array_set_tab(int /*long*/ tab_array, int tab_index, int /*long*/ alignment, int location); +// bool atk_object_add_relationship (int /*long*/ object, int relationship, int /*long*/ target); +} + +public class OS : Platform { + + /** OS Constants */ + public static const bool IsAIX, IsSunOS, IsLinux, IsHPUX; + static this() { + /* Initialize the OS flags and locale constants */ + char[] osName = "Linux";//System.getProperty ("os.name"); + bool isAIX = false, isSunOS = false, isLinux = false, isHPUX = false; + if (osName == "Linux") isLinux = true; + if (osName == "AIX") isAIX = true; + if (osName == "Solaris") isSunOS = true; + if (osName == "SunOS") isSunOS = true; + if (osName == "HP-UX") isHPUX = true; + IsAIX = isAIX; IsSunOS = isSunOS; IsLinux = isLinux; IsHPUX = isHPUX; + //PORTING_LEFT + GTK_VERSION = 0; //buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + } + + /** Constants */ + public static const int ATK_RELATION_LABELLED_BY = 4; + public static const int G_SIGNAL_MATCH_DATA = 1 << 4; + public static const int G_SIGNAL_MATCH_ID = 1 << 0; + public static const int GDK_2BUTTON_PRESS = 0x5; + public static const int GDK_3BUTTON_PRESS = 0x6; + public static const int GDK_ACTION_COPY = 1 << 1; + public static const int GDK_ACTION_MOVE = 1 << 2; + public static const int GDK_ACTION_LINK = 1 << 3; + public static const int GDK_Alt_L = 0xffe9; + public static const int GDK_Alt_R = 0xffea; + public static const int GDK_AND = 4; + public static const int GDK_BackSpace = 0xff08; + public static const int GDK_BOTTOM_LEFT_CORNER = 0xc; + public static const int GDK_BOTTOM_RIGHT_CORNER = 0xe; + public static const int GDK_BOTTOM_SIDE = 0x10; + public static const int GDK_BUTTON1_MASK = 0x100; + public static const int GDK_BUTTON2_MASK = 0x200; + public static const int GDK_BUTTON3_MASK = 0x400; + public static const int GDK_BUTTON_MOTION_MASK = 1 << 4; + public static const int GDK_BUTTON1_MOTION_MASK = 1 << 5; + public static const int GDK_BUTTON2_MOTION_MASK = 1 << 6; + public static const int GDK_BUTTON3_MOTION_MASK = 1 << 7; + public static const int GDK_BUTTON_PRESS = 0x4; + public static const int GDK_BUTTON_PRESS_MASK = 0x100; + public static const int GDK_BUTTON_RELEASE = 0x7; + public static const int GDK_BUTTON_RELEASE_MASK = 0x200; + public static const int GDK_CAP_BUTT = 0x1; + public static const int GDK_CAP_PROJECTING = 3; + public static const int GDK_CAP_ROUND = 0x2; + public static const int GDK_COLORSPACE_RGB = 0; + public static const int GDK_CONFIGURE = 13; + public static const int GDK_CONTROL_MASK = 0x4; + public static const int GDK_COPY = 0x0; + public static const int GDK_CROSS = 0x1e; + public static const int GDK_CROSSING_NORMAL = 0; + public static const int GDK_CROSSING_GRAB = 1; + public static const int GDK_CROSSING_UNGRAB = 2; + public static const int GDK_Break = 0xff6b; + public static const int GDK_Cancel = 0xff69; + public static const int GDK_Caps_Lock = 0xffE5; + public static const int GDK_Clear = 0xff0B; + public static const int GDK_Control_L = 0xffe3; + public static const int GDK_Control_R = 0xffe4; + public static const int GDK_CURRENT_TIME = 0x0; + public static const int GDK_DECOR_BORDER = 0x2; + public static const int GDK_DECOR_MAXIMIZE = 0x40; + public static const int GDK_DECOR_MENU = 0x10; + public static const int GDK_DECOR_MINIMIZE = 0x20; + public static const int GDK_DECOR_RESIZEH = 0x4; + public static const int GDK_DECOR_TITLE = 0x8; + public static const int GDK_DOUBLE_ARROW = 0x2a; + public static const int GDK_Delete = 0xffff; + public static const int GDK_Down = 0xff54; + public static const int GDK_ENTER_NOTIFY_MASK = 0x1000; + public static const int GDK_ENTER_NOTIFY = 10; + public static const int GDK_EVEN_ODD_RULE = 0; + public static const int GTK_EXPANDER_COLAPSED = 0; + public static const int GTK_EXPANDER_SEMI_COLLAPSED = 1; + public static const int GTK_EXPANDER_SEMI_EXPANDED = 2; + public static const int GTK_EXPANDER_EXPANDED = 3; + public static const int GDK_EXPOSE = 2; + public static const int GDK_EXPOSURE_MASK = 0x2; + public static const int GDK_End = 0xff57; + public static const int GDK_Escape = 0xff1b; + public static const int GDK_F1 = 0xffbe; + public static const int GDK_F10 = 0xffc7; + public static const int GDK_F11 = 0xffc8; + public static const int GDK_F12 = 0xffc9; + public static const int GDK_F13 = 0xffca; + public static const int GDK_F14 = 0xffcb; + public static const int GDK_F15 = 0xffcc; + public static const int GDK_F2 = 0xffbf; + public static const int GDK_F3 = 0xffc0; + public static const int GDK_F4 = 0xffc1; + public static const int GDK_F5 = 0xffc2; + public static const int GDK_F6 = 0xffc3; + public static const int GDK_F7 = 0xffc4; + public static const int GDK_F8 = 0xffc5; + public static const int GDK_F9 = 0xffc6; + public static const int GDK_FLEUR = 0x34; + public static const int GDK_FOCUS_CHANGE = 0xc; + public static const int GDK_FOCUS_CHANGE_MASK = 0x4000; + public static const int GDK_GC_CLIP_MASK = 0x80; + public static const int GDK_GC_CLIP_X_ORIGIN = 0x800; + public static const int GDK_GC_CLIP_Y_ORIGIN = 0x1000; + public static const int GDK_GRAB_SUCCESS = 0x0; + public static const int GDK_HAND2 = 0x3c; + public static const int GDK_Help = 0xFF6A; + public static const int GDK_HINT_MIN_SIZE = 1 << 1; + public static const int GDK_Home = 0xff50; + public static const int GDK_INCLUDE_INFERIORS = 0x1; + public static const int GDK_INPUT_ONLY = 1; + public static const int GDK_INTERP_BILINEAR = 0x2; + public static const int GDK_Insert = 0xff63; + public static const int GDK_ISO_Left_Tab = 0xfe20; + public static const int GDK_JOIN_MITER = 0x0; + public static const int GDK_JOIN_ROUND = 0x1; + public static const int GDK_JOIN_BEVEL = 0x2; + public static const int GDK_KEY_PRESS = 0x8; + public static const int GDK_KEY_PRESS_MASK = 0x400; + public static const int GDK_KEY_RELEASE = 0x9; + public static const int GDK_KEY_RELEASE_MASK = 0x800; + public static const int GDK_KP_0 = 0xffb0; + public static const int GDK_KP_1 = 0xffb1; + public static const int GDK_KP_2 = 0xffb2; + public static const int GDK_KP_3 = 0xffb3; + public static const int GDK_KP_4 = 0xffb4; + public static const int GDK_KP_5 = 0xffb5; + public static const int GDK_KP_6 = 0xffb6; + public static const int GDK_KP_7 = 0xffb7; + public static const int GDK_KP_8 = 0xffb8; + public static const int GDK_KP_9 = 0xffb9; + public static const int GDK_KP_Add = 0xffab; + public static const int GDK_KP_Decimal = 0xffae; + public static const int GDK_KP_Delete = 0xFF9F; + public static const int GDK_KP_Divide = 0xffaf; + public static const int GDK_KP_Down = 0xFF99; + public static const int GDK_KP_End = 0xFF9C; + public static const int GDK_KP_Enter = 0xff8d; + public static const int GDK_KP_Equal = 0xffbd; + public static const int GDK_KP_Home = 0xFF95; + public static const int GDK_KP_Insert = 0xFF9E; + public static const int GDK_KP_Left = 0xFF96; + public static const int GDK_KP_Multiply = 0xffaa; + public static const int GDK_KP_Page_Down = 0xFF9B; + public static const int GDK_KP_Page_Up = 0xFF9A; + public static const int GDK_KP_Right = 0xFF98; + public static const int GDK_KP_Subtract = 0xffad; + public static const int GDK_KP_Up = 0xFF97; + public static const int GDK_LEAVE_NOTIFY = 11; + public static const int GDK_LEAVE_NOTIFY_MASK = 0x2000; + public static const int GDK_LEFT_PTR = 0x44; + public static const int GDK_LEFT_SIDE = 0x46; + public static const int GDK_LINE_ON_OFF_DASH = 0x1; + public static const int GDK_LINE_SOLID = 0x0; + public static const int GDK_Linefeed = 0xff0A; + public static const int GDK_LSB_FIRST = 0x0; + public static const int GDK_Left = 0xff51; + public static const int GDK_Meta_L = 0xFFE7; + public static const int GDK_Meta_R = 0xFFE8; + public static const int GDK_MAP = 14; + public static const int GDK_MOD1_MASK = 0x8; + public static const int GDK_MOTION_NOTIFY = 0x3; + public static const int GDK_NO_EXPOSE = 30; + public static const int GDK_NONE = 0; + public static const int GDK_NOTIFY_INFERIOR = 2; + public static const int GDK_Num_Lock = 0xFF7F; + public static const int GDK_OVERLAP_RECTANGLE_OUT = 0x1; + public static const int GDK_PIXBUF_ALPHA_BILEVEL = 0x0; + public static const int GDK_POINTER_MOTION_HINT_MASK = 0x8; + public static const int GDK_POINTER_MOTION_MASK = 0x4; + public static const int GDK_PROPERTY_NOTIFY = 16; + public static const int GDK_Page_Down = 0xff56; + public static const int GDK_Page_Up = 0xff55; + public static const int GDK_Pause = 0xff13; + public static const int GDK_Print = 0xff61; + public static const int GDK_QUESTION_ARROW = 0x5c; + public static const int GDK_RGB_DITHER_NORMAL = 0x1; + public static const int GDK_RIGHT_SIDE = 0x60; + public static const int GDK_Return = 0xff0d; + public static const int GDK_Right = 0xff53; + public static const int GDK_space = 0x20; + public static const int GDK_SB_H_DOUBLE_ARROW = 0x6c; + public static const int GDK_SB_UP_ARROW = 0x72; + public static const int GDK_SB_V_DOUBLE_ARROW = 0x74; + public static const int GDK_SCROLL_UP = 0; + public static const int GDK_SCROLL_DOWN = 1; + public static const int GDK_SCROLL_LEFT = 2; + public static const int GDK_SCROLL_RIGHT = 3; + public static const int GDK_SELECTION_CLEAR = 17; + public static const int GDK_SELECTION_NOTIFY = 19; + public static const int GDK_SELECTION_REQUEST = 18; + public static const int GDK_SHIFT_MASK = 0x1; + public static const int GDK_SIZING = 0x78; + public static const int GDK_STIPPLED = 0x2; + public static const int GDK_TILED = 0x1; + public static const int GDK_Shift_L = 0xffe1; + public static const int GDK_Shift_R = 0xffe2; + public static const int GDK_SCROLL = 31; + public static const int GDK_Scroll_Lock = 0xff14; + public static const int GDK_TOP_LEFT_CORNER = 0x86; + public static const int GDK_TOP_RIGHT_CORNER = 0x88; + public static const int GDK_TOP_SIDE = 0x8a; + public static const int GDK_Tab = 0xff09; + public static const int GDK_Up = 0xff52; + public static const int GDK_WATCH = 0x96; + public static const int GDK_XOR = 0x2; + public static const int GDK_XTERM = 0x98; + public static const int GDK_X_CURSOR = 0x0; + public static const int GDK_VISIBILITY_FULLY_OBSCURED = 2; + public static const int GDK_VISIBILITY_NOTIFY_MASK = 1 << 17; + public static const int GDK_WINDOW_CHILD = 2; + public static const int GDK_WINDOW_STATE_ICONIFIED = 1 << 1; + public static const int GDK_WINDOW_STATE_MAXIMIZED = 1 << 2; + public static const int GTK_ACCEL_VISIBLE = 0x1; + public static const int GTK_ARROW_DOWN = 0x1; + public static const int GTK_ARROW_LEFT = 0x2; + public static const int GTK_ARROW_RIGHT = 0x3; + public static const int GTK_ARROW_UP = 0x0; + public static const int GTK_CALENDAR_SHOW_HEADING = 1 << 0; + public static const int GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1; + public static const int GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2; + public static const int GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3; + public static const int GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4; + public static const int GTK_CAN_DEFAULT = 0x2000; + public static const int GTK_CAN_FOCUS = 0x800; + public static const int GTK_CELL_RENDERER_MODE_ACTIVATABLE = 1; + public static const int GTK_CELL_RENDERER_SELECTED = 1 << 0; + public static const int GTK_CELL_RENDERER_FOCUSED = 1 << 4; + public static const int GTK_CLIST_SHOW_TITLES = 0x4; + public static const int GTK_CORNER_TOP_LEFT = 0x0; + public static const int GTK_CORNER_TOP_RIGHT = 0x2; + public static const int GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1; + public static const int GTK_DIALOG_MODAL = 1 << 0; + public static const int GTK_DIR_TAB_FORWARD = 0; + public static const int GTK_DIR_TAB_BACKWARD = 1; + public static const int GTK_FILE_CHOOSER_ACTION_OPEN = 0; + public static const int GTK_FILE_CHOOSER_ACTION_SAVE = 1; + public static const int GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER = 2; + public static const int GTK_HAS_FOCUS = 1 << 12; + public static const int GTK_ICON_SIZE_MENU = 1; + public static const int GTK_ICON_SIZE_SMALL_TOOLBAR = 2; + public static const int GTK_ICON_SIZE_LARGE_TOOLBAR = 3; + public static const int GTK_ICON_SIZE_DIALOG = 6; + public static const int GTK_JUSTIFY_CENTER = 0x2; + public static const int GTK_JUSTIFY_LEFT = 0x0; + public static const int GTK_JUSTIFY_RIGHT = 0x1; + public static const int GTK_MAPPED = 1 << 7; + public static const int GTK_MESSAGE_INFO = 0; + public static const int GTK_MESSAGE_WARNING = 1; + public static const int GTK_MESSAGE_QUESTION = 2; + public static const int GTK_MESSAGE_ERROR = 3; + public static const int GTK_NO_WINDOW = 1 << 5; + public static const int GTK_ORIENTATION_HORIZONTAL = 0x0; + public static const int GTK_ORIENTATION_VERTICAL = 0x1; + public static const int GTK_PACK_END = 1; + public static const int GTK_PACK_START = 0; + public static const int GTK_POLICY_ALWAYS = 0x0; + public static const int GTK_POLICY_AUTOMATIC = 0x1; + public static const int GTK_POLICY_NEVER = 0x2; + public static const int GTK_POS_TOP = 0x2; + public static const int GTK_POS_BOTTOM = 0x3; + public static const int GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0; + public static const int GTK_PRINT_CAPABILITY_COPIES = 1 << 1; + public static const int GTK_PRINT_CAPABILITY_COLLATE = 1 << 2; + public static const int GTK_PRINT_CAPABILITY_REVERSE = 1 << 3; + public static const int GTK_PRINT_CAPABILITY_SCALE = 1 << 4; + public static const int GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5; + public static const int GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6; + public static const int GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7; + public static const int GTK_PRINT_PAGES_ALL = 0; + public static const int GTK_PRINT_PAGES_CURRENT = 1; + public static const int GTK_PRINT_PAGES_RANGES = 2; + public static const int GTK_PROGRESS_CONTINUOUS = 0x0; + public static const int GTK_PROGRESS_DISCRETE = 0x1; + public static const int GTK_PROGRESS_LEFT_TO_RIGHT = 0x0; + public static const int GTK_PROGRESS_BOTTOM_TO_TOP = 0x2; + public static const int GTK_REALIZED = 1 << 6; + public static const int GTK_RELIEF_NONE = 0x2; + public static const int GTK_RELIEF_NORMAL = 0; + public static const int GTK_RC_BG = 1 << 1; + public static const int GTK_RC_FG = 1 << 0; + public static const int GTK_RC_TEXT = 1 << 2; + public static const int GTK_RC_BASE = 1 << 3; + public static const int GTK_RESPONSE_APPLY = 0xfffffff6; + public static const int GTK_RESPONSE_CANCEL = 0xfffffffa; + public static const int GTK_RESPONSE_OK = 0xfffffffb; + public static const int GTK_SCROLL_NONE = 0; + public static const int GTK_SCROLL_JUMP = 1; + public static const int GTK_SCROLL_STEP_BACKWARD = 2; + public static const int GTK_SCROLL_STEP_FORWARD = 3; + public static const int GTK_SCROLL_PAGE_BACKWARD = 4; + public static const int GTK_SCROLL_PAGE_FORWARD = 5; + public static const int GTK_SCROLL_STEP_UP = 6; + public static const int GTK_SCROLL_STEP_DOWN = 7; + public static const int GTK_SCROLL_PAGE_UP = 8; + public static const int GTK_SCROLL_PAGE_DOWN = 9; + public static const int GTK_SCROLL_STEP_LEFT = 10; + public static const int GTK_SCROLL_STEP_RIGHT = 11; + public static const int GTK_SCROLL_PAGE_LEFT = 12; + public static const int GTK_SCROLL_PAGE_RIGHT = 13; + public static const int GTK_SCROLL_START = 14; + public static const int GTK_SCROLL_END = 15; + public static const int GTK_SELECTION_BROWSE = 0x2; + public static const int GTK_SELECTION_MULTIPLE = 0x3; + public static const int GTK_SENSITIVE = 0x200; + public static const int GTK_SHADOW_ETCHED_IN = 0x3; + public static const int GTK_SHADOW_ETCHED_OUT = 0x4; + public static const int GTK_SHADOW_IN = 0x1; + public static const int GTK_SHADOW_NONE = 0x0; + public static const int GTK_SHADOW_OUT = 0x2; + public static const int GTK_STATE_ACTIVE = 0x1; + public static const int GTK_STATE_INSENSITIVE = 0x4; + public static const int GTK_STATE_NORMAL = 0x0; + public static const int GTK_STATE_PRELIGHT = 0x2; + public static const int GTK_STATE_SELECTED = 0x3; + public static const int GTK_TEXT_DIR_LTR = 1; + public static const int GTK_TEXT_DIR_NONE = 0 ; + public static const int GTK_TEXT_DIR_RTL = 2; + public static const int GTK_TEXT_WINDOW_TEXT = 2; + public static const int GTK_TOOLBAR_CHILD_BUTTON = 0x1; + public static const int GTK_TOOLBAR_CHILD_RADIOBUTTON = 0x3; + public static const int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 0x2; + public static const int GTK_TREE_VIEW_COLUMN_GROW_ONLY = 0; + public static const int GTK_TREE_VIEW_COLUMN_AUTOSIZE = 1; + public static const int GTK_TREE_VIEW_COLUMN_FIXED = 2; + public static const int GTK_TREE_VIEW_DROP_BEFORE = 0; + public static const int GTK_TREE_VIEW_DROP_AFTER = 1; + public static const int GTK_TREE_VIEW_DROP_INTO_OR_BEFORE = 2; + public static const int GTK_TREE_VIEW_DROP_INTO_OR_AFTER = 3; + public static const int GDK_UNMAP = 15; + public static const int GTK_UNIT_PIXEL = 0; + public static const int GTK_UNIT_POINTS = 1; + public static const int GTK_UNIT_INCH = 2; + public static const int GTK_UNIT_MM = 3; + public static const int GTK_VISIBILITY_FULL = 0x2; + public static const int GTK_VISIBILITY_NONE = 0x0; + public static const int GTK_VISIBLE = 0x100; + public static const int GDK_WA_X = 1 << 2; + public static const int GDK_WA_Y = 1 << 3; + public static const int GDK_WA_VISUAL = 1 << 6; + public static const int GTK_WINDOW_POPUP = 0x1; + public static const int GTK_WINDOW_TOPLEVEL = 0x0; + public static const int GDK_WINDOW_TYPE_HINT_DIALOG = 1; + public static const int GTK_WRAP_NONE = 0; + public static const int GTK_WRAP_WORD = 2; + public static const int G_LOG_FLAG_FATAL = 0x2; + public static const int G_LOG_FLAG_RECURSION = 0x1; + public static const int G_LOG_LEVEL_MASK = 0xfffffffc; + public static const int None = 0; + public static const int PANGO_ALIGN_LEFT = 0; + public static const int PANGO_ALIGN_CENTER = 1; + public static const int PANGO_ALIGN_RIGHT = 2; + public static const int PANGO_DIRECTION_LTR = 0; + public static const int PANGO_DIRECTION_RTL = 1; + public static const int PANGO_SCALE = 1024; + public static const int PANGO_STRETCH_NORMAL = 0x4; + public static const int PANGO_STYLE_ITALIC = 0x2; + public static const int PANGO_STYLE_NORMAL = 0x0; + public static const int PANGO_STYLE_OBLIQUE = 0x1; + public static const int PANGO_TAB_LEFT = 0; + public static const int PANGO_UNDERLINE_LOW = 3; + public static const int PANGO_UNDERLINE_SINGLE = 1; + public static const int PANGO_WEIGHT_BOLD = 0x2bc; + public static const int PANGO_WEIGHT_NORMAL = 0x190; + public static const int PANGO_WRAP_WORD = 0; + public static const int PANGO_WRAP_WORD_CHAR = 2; + public static const int RTLD_LAZY = 1; + public static const int XA_CARDINAL = 6; + public static const int XA_WINDOW = 33; + + /** Signals */ + public static const char[] activate = "activate"; + public static const char[] button_press_event = "button-press-event"; + public static const char[] button_release_event = "button-release-event"; + public static const char[] changed = "changed"; + public static const char[] change_current_page = "change-current-page"; + public static const char[] change_value = "change-value"; + public static const char[] clicked = "clicked"; + public static const char[] commit = "commit"; + public static const char[] configure_event = "configure-event"; + public static const char[] delete_event = "delete-event"; + public static const char[] day_selected = "day-selected"; + public static const char[] delete_range = "delete-range"; + public static const char[] delete_text = "delete-text"; + public static const char[] drag_data_delete = "drag_data_delete"; + public static const char[] drag_data_get = "drag_data_get"; + public static const char[] drag_data_received = "drag_data_received"; + public static const char[] drag_drop = "drag_drop"; + public static const char[] drag_end = "drag_end"; + public static const char[] drag_leave = "drag_leave"; + public static const char[] drag_motion = "drag_motion"; + public static const char[] enter_notify_event = "enter-notify-event"; + public static const char[] event = "event"; + public static const char[] event_after = "event-after"; + public static const char[] expand_collapse_cursor_row = "expand-collapse-cursor-row"; + public static const char[] expose_event = "expose-event"; + public static const char[] focus = "focus"; + public static const char[] focus_in_event = "focus-in-event"; + public static const char[] focus_out_event = "focus-out-event"; + public static const char[] grab_focus = "grab-focus"; + public static const char[] hide = "hide"; + public static const char[] input = "input"; + public static const char[] insert_text = "insert-text"; + public static const char[] key_press_event = "key-press-event"; + public static const char[] key_release_event = "key-release-event"; + public static const char[] leave_notify_event = "leave-notify-event"; + public static const char[] map = "map"; + public static const char[] map_event = "map-event"; + public static const char[] mnemonic_activate = "mnemonic-activate"; + public static const char[] month_changed = "month-changed"; + public static const char[] motion_notify_event = "motion-notify-event"; + public static const char[] move_focus = "move-focus"; + public static const char[] output = "output"; + public static const char[] popup_menu = "popup-menu"; + public static const char[] preedit_changed = "preedit-changed"; + public static const char[] realize = "realize"; + public static const char[] row_activated = "row-activated"; + public static const char[] row_changed = "row-changed"; + public static const char[] scroll_child = "scroll-child"; + public static const char[] scroll_event = "scroll-event"; + public static const char[] select = "select"; + public static const char[] show = "show"; + public static const char[] show_help = "show-help"; + public static const char[] size_allocate = "size-allocate"; + public static const char[] size_request = "size-request"; + public static const char[] style_set = "style-set"; + public static const char[] switch_page = "switch-page"; + public static const char[] test_collapse_row = "test-collapse-row"; + public static const char[] test_expand_row = "test-expand-row"; + public static const char[] toggled = "toggled"; + public static const char[] unmap = "unmap"; + public static const char[] unmap_event = "unmap-event"; + public static const char[] unrealize = "unrealize"; + public static const char[] value_changed = "value-changed"; + public static const char[] visibility_notify_event = "visibility-notify-event"; + public static const char[] window_state_event = "window-state-event"; + + /** Properties */ + public static const char[] active = "active"; + public static const char[] background_gdk = "background-gdk"; + public static const char[] button_relief = "button-relief"; + public static const char[] cell_background_gdk = "cell-background-gdk"; + public static const char[] default_border = "default-border"; + public static const char[] expander_size = "expander-size"; + public static const char[] fixed_height_mode = "fixed-height-mode"; + public static const char[] focus_line_width = "focus-line-width"; + public static const char[] font_desc = "font-desc"; + public static const char[] foreground_gdk = "foreground-gdk"; + public static const char[] gtk_cursor_blink = "gtk-cursor-blink"; + public static const char[] gtk_cursor_blink_time = "gtk-cursor-blink-time"; + public static const char[] gtk_double_click_time = "gtk-double-click-time"; + public static const char[] gtk_entry_select_on_focus = "gtk-entry-select-on-focus"; + public static const char[] horizontal_separator = "horizontal-separator"; + public static const char[] inconsistent = "inconsistent"; + public static const char[] interior_focus = "interior-focus"; + public static const char[] mode = "mode"; + public static const char[] pixbuf = "pixbuf"; + public static const char[] text = "text"; + public static const char[] xalign = "xalign"; + public static const char[] ypad = "ypad"; + public static const char[] GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri"; + + public static const int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + +/+ +protected static byte [] ascii (String name) { + int length = name.length (); + char [] chars = new char [length]; + name.getChars (0, length, chars, 0); + byte [] buffer = new byte [length + 1]; + for (int i=0; i+ * Note: For a given event, only the fields which are appropriate + * will be filled in. The contents of the fields which are not used + * by the event are unspecified. + *
+ * + * @see Listener + * @see org.eclipse.swt.events.TypedEvent + */ + +public class Event { + + /** + * the display where the event occurred + * + * @since 2.0 + */ + public Display display; + + /** + * the widget that issued the event + */ + public Widget widget; + + /** + * the type of event, as defined by the event type constants + * in classSWT
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int type;
+
+ /**
+ * the event specific detail field, as defined by the detail constants
+ * in class SWT
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int detail;
+
+ /**
+ * the item that the event occurred in (can be null)
+ */
+ public Widget item;
+
+ /**
+ * the index of the item where the event occurred
+ *
+ * @since 3.2
+ */
+ public int index;
+
+ /**
+ * the graphics context to use when painting
+ * that is configured to use the colors, font and
+ * damaged region of the control. It is valid
+ * only during the paint and must not be disposed
+ */
+ public GC gc;
+
+ /**
+ * depending on the event type, the x offset of the bounding
+ * rectangle of the region that requires painting or the
+ * widget-relative, x coordinate of the pointer at the
+ * time the mouse button was pressed or released
+ */
+ public int x;
+
+ /**
+ * depending on the event type, the y offset of the bounding
+ * rectangle of the region that requires painting or the
+ * widget-relative, y coordinate of the pointer at the
+ * time the mouse button was pressed or released
+ */
+ public int y;
+
+ /**
+ * the width of the bounding rectangle of the
+ * region that requires painting
+ */
+ public int width;
+
+ /**
+ * the height of the bounding rectangle of the
+ * region that requires painting
+ */
+ public int height;
+
+ /**
+ * depending on the event type, the number of following
+ * paint events which are pending which may always be zero
+ * on some platforms or the number of lines or pages to
+ * scroll using the mouse wheel
+ */
+ public int count;
+
+ /**
+ * the time that the event occurred.
+ *
+ * NOTE: This field is an unsigned integer and should
+ * be AND'ed with 0xFFFFFFFFL so that it can be treated
+ * as a signed long.
+ */
+ public int time;
+
+ /**
+ * the button that was pressed or released; 1 for the
+ * first button, 2 for the second button, and 3 for the
+ * third button, etc.
+ */
+ public int button;
+
+ /**
+ * depending on the event, the character represented by the key
+ * that was typed. This is the final character that results
+ * after all modifiers have been applied. For example, when the
+ * user types Ctrl+A, the character value is 0x01 (ASCII SOH).
+ * It is important that applications do not attempt to modify the
+ * character value based on a stateMask (such as SWT.CTRL) or the
+ * resulting character will not be correct.
+ */
+ public char character;
+
+ /**
+ * depending on the event, the key code of the key that was typed,
+ * as defined by the key code constants in class SWT
.
+ * When the character field of the event is ambiguous, this field
+ * contains the unaffected value of the original character. For
+ * example, typing Ctrl+M or Enter both result in the character '\r'
+ * but the keyCode field will also contain '\r' when Enter was typed
+ * and 'm' when Ctrl+M was typed.
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int keyCode;
+
+ /**
+ * depending on the event, the state of the keyboard modifier
+ * keys and mouse masks at the time the event was generated.
+ *
+ * @see org.eclipse.swt.SWT
+ */
+ public int stateMask;
+
+ /**
+ * depending on the event, the range of text being modified.
+ * Setting these fields has no effect.
+ */
+ public int start, end;
+
+ /**
+ * depending on the event, the new text that will be inserted.
+ * Setting this field will change the text that is about to
+ * be inserted or deleted.
+ */
+ public char[] text;
+
+ /**
+ * depending on the event, a flag indicating whether the operation
+ * should be allowed. Setting this field to false will cancel the
+ * operation.
+ */
+ public bool doit = true;
+
+ /**
+ * a field for application use
+ */
+ public Object data;
+
+/**
+ * Gets the bounds.
+ *
+ * @return a rectangle that is the bounds.
+ */
+public Rectangle getBounds () {
+ return new Rectangle (x, y, width, height);
+}
+
+/**
+ * Sets the bounds.
+ *
+ * @param rect the new rectangle
+ */
+public void setBounds (Rectangle rect) {
+ this.x = rect.x;
+ this.y = rect.y;
+ this.width = rect.width;
+ this.height = rect.height;
+}
+
+/**
+ * Returns a string containing a concise, human-readable
+ * description of the receiver.
+ *
+ * @return a string representation of the event
+ */
+public char[] toString () {
+ return Format( "Event {type={} {} time={} data={} x={} y={} width={} height={} detail={}}",
+ type, widget, time, data, x, y, width, height, detail ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+}
+}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/SWT.d
--- a/org/eclipse/swt/SWT.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3636 +0,0 @@
-/*******************************************************************************
- * 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.SWT;
-
-
-import org.eclipse.swt.internal.Compatibility;
-import org.eclipse.swt.internal.Library;
-import org.eclipse.swt.internal.Platform;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
-
-import tango.core.Exception;
-
-/**
- * This class provides access to a small number of SWT system-wide
- * methods, and in addition defines the public constants provided
- * by SWT.
- * - * 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. - *
- */ - -/* NOTE: - * Good javadoc coding style is to put the values of static const - * constants in the comments. This reinforces the fact that - * consumers are allowed to rely on the value (and they must - * since the values are compiled inline in their code). We - * can not change the values of these constants between - * releases. - */ -public class SWT { - - /* Widget Event Constants */ - - /** - * The null event type (value is 0). - * - * @since 3.0 - */ - public static const int None = 0; - - /** - * The key down event type (value is 1). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addKeyListener - * @see org.eclipse.swt.widgets.Tracker#addKeyListener - * @see org.eclipse.swt.events.KeyListener#keyPressed - * @see org.eclipse.swt.events.KeyEvent - */ - public static const int KeyDown = 1; - - /** - * The key up event type (value is 2). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addKeyListener - * @see org.eclipse.swt.widgets.Tracker#addKeyListener - * @see org.eclipse.swt.events.KeyListener#keyReleased - * @see org.eclipse.swt.events.KeyEvent - */ - public static const int KeyUp = 2; - - /** - * The mouse down event type (value is 3). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseListener - * @see org.eclipse.swt.events.MouseListener#mouseDown - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseDown = 3; - - /** - * The mouse up event type (value is 4). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseListener - * @see org.eclipse.swt.events.MouseListener#mouseUp - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseUp = 4; - - /** - * The mouse move event type (value is 5). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseMoveListener - * @see org.eclipse.swt.events.MouseMoveListener#mouseMove - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseMove = 5; - - /** - * The mouse enter event type (value is 6). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseTrackListener - * @see org.eclipse.swt.events.MouseTrackListener#mouseEnter - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseEnter = 6; - - /** - * The mouse exit event type (value is 7). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseTrackListener - * @see org.eclipse.swt.events.MouseTrackListener#mouseExit - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseExit = 7; - - /** - * The mouse double click event type (value is 8). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseListener - * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseDoubleClick = 8; - - /** - * The paint event type (value is 9). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addPaintListener - * @see org.eclipse.swt.events.PaintListener#paintControl - * @see org.eclipse.swt.events.PaintEvent - */ - public static const int Paint = 9; - - /** - * The move event type (value is 10). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addControlListener - * @see org.eclipse.swt.widgets.TableColumn#addControlListener - * @see org.eclipse.swt.widgets.Tracker#addControlListener - * @see org.eclipse.swt.widgets.TreeColumn#addControlListener - * @see org.eclipse.swt.events.ControlListener#controlMoved - * @see org.eclipse.swt.events.ControlEvent - */ - public static const int Move = 10; - - /** - * The resize event type (value is 11). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addControlListener - * @see org.eclipse.swt.widgets.TableColumn#addControlListener - * @see org.eclipse.swt.widgets.Tracker#addControlListener - * @see org.eclipse.swt.widgets.TreeColumn#addControlListener - * @see org.eclipse.swt.events.ControlListener#controlResized - * @see org.eclipse.swt.events.ControlEvent - */ - public static const int Resize = 11; - - /** - * The dispose event type (value is 12). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Widget#addDisposeListener - * @see org.eclipse.swt.events.DisposeListener#widgetDisposed - * @see org.eclipse.swt.events.DisposeEvent - */ - public static const int Dispose = 12; - - /** - * The selection event type (value is 13). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Button#addSelectionListener - * @see org.eclipse.swt.widgets.Combo#addSelectionListener - * @see org.eclipse.swt.widgets.CoolItem#addSelectionListener - * @see org.eclipse.swt.widgets.Link#addSelectionListener - * @see org.eclipse.swt.widgets.List#addSelectionListener - * @see org.eclipse.swt.widgets.MenuItem#addSelectionListener - * @see org.eclipse.swt.widgets.Sash#addSelectionListener - * @see org.eclipse.swt.widgets.Scale#addSelectionListener - * @see org.eclipse.swt.widgets.ScrollBar#addSelectionListener - * @see org.eclipse.swt.widgets.Slider#addSelectionListener - * @see org.eclipse.swt.widgets.TabFolder#addSelectionListener - * @see org.eclipse.swt.widgets.Table#addSelectionListener - * @see org.eclipse.swt.widgets.TableColumn#addSelectionListener - * @see org.eclipse.swt.widgets.ToolItem#addSelectionListener - * @see org.eclipse.swt.widgets.TrayItem#addSelectionListener - * @see org.eclipse.swt.widgets.Tree#addSelectionListener - * @see org.eclipse.swt.widgets.TreeColumn#addSelectionListener - * @see org.eclipse.swt.events.SelectionListener#widgetSelected - * @see org.eclipse.swt.events.SelectionEvent - */ - public static const int Selection = 13; - - /** - * The default selection event type (value is 14). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Combo#addSelectionListener - * @see org.eclipse.swt.widgets.List#addSelectionListener - * @see org.eclipse.swt.widgets.Spinner#addSelectionListener - * @see org.eclipse.swt.widgets.Table#addSelectionListener - * @see org.eclipse.swt.widgets.Text#addSelectionListener - * @see org.eclipse.swt.widgets.TrayItem#addSelectionListener - * @see org.eclipse.swt.widgets.Tree#addSelectionListener - * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected - * @see org.eclipse.swt.events.SelectionEvent - */ - public static const int DefaultSelection = 14; - - /** - * The focus in event type (value is 15). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addFocusListener - * @see org.eclipse.swt.events.FocusListener#focusGained - * @see org.eclipse.swt.events.FocusEvent - */ - public static const int FocusIn = 15; - - /** - * The focus out event type (value is 16). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addFocusListener - * @see org.eclipse.swt.events.FocusListener#focusLost - * @see org.eclipse.swt.events.FocusEvent - */ - public static const int FocusOut = 16; - - /** - * The expand event type (value is 17). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Tree#addTreeListener - * @see org.eclipse.swt.events.TreeListener#treeExpanded - * @see org.eclipse.swt.events.TreeEvent - */ - public static const int Expand = 17; - - /** - * The collapse event type (value is 18). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Tree#addTreeListener - * @see org.eclipse.swt.events.TreeListener#treeCollapsed - * @see org.eclipse.swt.events.TreeEvent - */ - public static const int Collapse = 18; - - /** - * The iconify event type (value is 19). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Shell#addShellListener - * @see org.eclipse.swt.events.ShellListener#shellIconified - * @see org.eclipse.swt.events.ShellEvent - */ - public static const int Iconify = 19; - - /** - * The de-iconify event type (value is 20). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Shell#addShellListener - * @see org.eclipse.swt.events.ShellListener#shellDeiconified - * @see org.eclipse.swt.events.ShellEvent - */ - public static const int Deiconify = 20; - - /** - * The close event type (value is 21). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Shell#addShellListener - * @see org.eclipse.swt.events.ShellListener#shellClosed - * @see org.eclipse.swt.events.ShellEvent - */ - public static const int Close = 21; - - /** - * The show event type (value is 22). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Menu#addMenuListener - * @see org.eclipse.swt.events.MenuListener#menuShown - * @see org.eclipse.swt.events.MenuEvent - */ - public static const int Show = 22; - - /** - * The hide event type (value is 23). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Menu#addMenuListener - * @see org.eclipse.swt.events.MenuListener#menuHidden - * @see org.eclipse.swt.events.MenuEvent - */ - public static const int Hide = 23; - - /** - * The modify event type (value is 24). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Combo#addModifyListener - * @see org.eclipse.swt.widgets.Spinner#addModifyListener - * @see org.eclipse.swt.widgets.Text#addModifyListener - * @see org.eclipse.swt.events.ModifyListener#modifyText - * @see org.eclipse.swt.events.ModifyEvent - */ - public static const int Modify = 24; - - /** - * The verify event type (value is 25). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Combo#addVerifyListener - * @see org.eclipse.swt.widgets.Text#addVerifyListener - * @see org.eclipse.swt.events.VerifyListener#verifyText - * @see org.eclipse.swt.events.VerifyEvent - */ - public static const int Verify = 25; - - /** - * The activate event type (value is 26). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Shell#addShellListener - * @see org.eclipse.swt.events.ShellListener#shellActivated - * @see org.eclipse.swt.events.ShellEvent - */ - public static const int Activate = 26; - - /** - * The deactivate event type (value is 27). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Shell#addShellListener - * @see org.eclipse.swt.events.ShellListener#shellDeactivated - * @see org.eclipse.swt.events.ShellEvent - */ - public static const int Deactivate = 27; - - /** - * The help event type (value is 28). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addHelpListener - * @see org.eclipse.swt.widgets.Menu#addHelpListener - * @see org.eclipse.swt.widgets.MenuItem#addHelpListener - * @see org.eclipse.swt.events.HelpListener#helpRequested - * @see org.eclipse.swt.events.HelpEvent - */ - public static const int Help = 28; - - /** - * The drag detect event type (value is 29). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.dnd.DragSource - */ - public static const int DragDetect = 29; - - /** - * The arm event type (value is 30). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.MenuItem#addArmListener - * @see org.eclipse.swt.events.ArmListener#widgetArmed - * @see org.eclipse.swt.events.ArmEvent - */ - public static const int Arm = 30; - - /** - * The traverse event type (value is 31). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addTraverseListener - * @see org.eclipse.swt.events.TraverseListener#keyTraversed - * @see org.eclipse.swt.events.TraverseEvent - */ - public static const int Traverse = 31; - - /** - * The mouse hover event type (value is 32). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Control#addMouseTrackListener - * @see org.eclipse.swt.events.MouseTrackListener#mouseHover - * @see org.eclipse.swt.events.MouseEvent - */ - public static const int MouseHover = 32; - - /** - * The hardware key down event type (value is 33). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - */ - public static const int HardKeyDown = 33; - - /** - * The hardware key up event type (value is 34). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - */ - public static const int HardKeyUp = 34; - - /** - * The menu detect event type (value is 35). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @since 3.0 - */ - public static const int MenuDetect = 35; - - /** - * The set data event type (value is 36). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Table - * @see org.eclipse.swt.widgets.Tree - * - * @since 3.0 - */ - public static const int SetData = 36; - - /** - * The mouse wheel event type (value is 37). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @since 3.1 - */ - public static const int MouseWheel = 37; - - /** - * The settings changed event type (value is 39). - *- * 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. - *
- * - * @see org.eclipse.swt.widgets.Display#addListener - * @see org.eclipse.swt.widgets.Event - * - * @since 3.2 - */ - public static const int Settings = 39; - - /** - * The erase item event type (value is 40). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @since 3.2 - */ - public static const int EraseItem = 40; - - /** - * The measure item event type (value is 41). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @since 3.2 - */ - public static const int MeasureItem = 41; - - /** - * The paint item event type (value is 42). - * - * @see org.eclipse.swt.widgets.Widget#addListener - * @see org.eclipse.swt.widgets.Display#addFilter - * @see org.eclipse.swt.widgets.Event - * - * @since 3.2 - */ - public static const int PaintItem = 42; - - /* Event Details */ - - /** - * Indicates that a user-interface component is being dragged, - * for example dragging the thumb of a scroll bar (value is 1). - */ - public static const int DRAG = 1; - - /** - * Event detail field that indicates a user-interface component - * state is selected (value is 1<<1). - * - * @since 3.2 - */ - public static const int SELECTED = 1 << 1; - - /** - * Event detail field that indicates a user-interface component - * state is focused (value is 1<<2). - * - * @since 3.2 - */ - public static const int FOCUSED = 1 << 2; - - /** - * Event detail field that indicates a user-interface component - * draws the background (value is 1<<3). - * - * @since 3.2 - */ - public static const int BACKGROUND = 1 << 3; - - /** - * Event detail field that indicates a user-interface component - * draws the foreground (value is 1<<4). - * - * @since 3.2 - */ - public static const int FOREGROUND = 1 << 4; - - /** - * Event detail field that indicates a user-interface component - * state is hot (value is 1<<5). - * - * @since 3.3 - */ - public static const int HOT = 1 << 5; - - /* This code is intentionally commented */ - //public static const int PRESSED = 1 << 3; - //public static const int ACTIVE = 1 << 4; - //public static const int DISABLED = 1 << 5; - //public static const int HOT = 1 << 6; - //public static const int DEFAULTED = 1 << 7; - - /** - * Traversal event detail field value indicating that no - * traversal action should be taken - * (value is 0). - */ - public static const int TRAVERSE_NONE = 0; - - /** - * Traversal event detail field value indicating that the - * key which designates that a dialog should be cancelled was - * pressed; typically, this is the ESC key - * (value is 1<<1). - */ - public static const int TRAVERSE_ESCAPE = 1 << 1; - - /** - * Traversal event detail field value indicating that the - * key which activates the default button in a dialog was - * pressed; typically, this is the ENTER key - * (value is 1<<2). - */ - public static const int TRAVERSE_RETURN = 1 << 2; - - /** - * Traversal event detail field value indicating that the - * key which designates that focus should be given to the - * previous tab group was pressed; typically, this is the - * SHIFT-TAB key sequence - * (value is 1<<3). - */ - public static const int TRAVERSE_TAB_PREVIOUS = 1 << 3; - - /** - * Traversal event detail field value indicating that the - * key which designates that focus should be given to the - * next tab group was pressed; typically, this is the - * TAB key - * (value is 1<<4). - */ - public static const int TRAVERSE_TAB_NEXT = 1 << 4; - - /** - * Traversal event detail field value indicating that the - * key which designates that focus should be given to the - * previous tab item was pressed; typically, this is either - * the LEFT-ARROW or UP-ARROW keys - * (value is 1<<5). - */ - public static const int TRAVERSE_ARROW_PREVIOUS = 1 << 5; - - /** - * Traversal event detail field value indicating that the - * key which designates that focus should be given to the - * previous tab item was pressed; typically, this is either - * the RIGHT-ARROW or DOWN-ARROW keys - * (value is 1<<6). - */ - public static const int TRAVERSE_ARROW_NEXT = 1 << 6; - - /** - * Traversal event detail field value indicating that a - * mnemonic key sequence was pressed - * (value is 1<<7). - */ - public static const int TRAVERSE_MNEMONIC = 1 << 7; - - /** - * Traversal event detail field value indicating that the - * key which designates that the previous page of a multi-page - * window should be shown was pressed; typically, this - * is the CTRL-PAGEUP key sequence - * (value is 1<<8). - */ - public static const int TRAVERSE_PAGE_PREVIOUS = 1 << 8; - - /** - * Traversal event detail field value indicating that the - * key which designates that the next page of a multi-page - * window should be shown was pressed; typically, this - * is the CTRL-PAGEDOWN key sequence - * (value is 1<<9). - */ - public static const int TRAVERSE_PAGE_NEXT = 1 << 9; - - /** - * A constant known to be zero (0), typically used in operations - * which take bit flags to indicate that "no bits are set". - */ - public static const int NONE = 0; - - /** - * A constant known to be zero (0), used in operations which - * take pointers to indicate a null argument. - */ - public static const int NULL = 0; - - /** - * Indicates that a default should be used (value is -1). - */ - public static const int DEFAULT = -1; - - /** - * Indicates that a property is off (value is 0). - * - * @since 3.1 - */ - public static const int OFF = 0; - - /** - * Indicates that a property is on (value is 1). - * - * @since 3.1 - */ - public static const int ON = 1; - - /** - * Indicates low quality (value is 1). - * - * @since 3.1 - */ - public static const int LOW = 1; - - /** - * Indicates high quality (value is 2). - * - * @since 3.1 - */ - public static const int HIGH = 2; - - /** - * Style constant for menu bar behavior (value is 1<<1). - *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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/SWTException.d --- a/org/eclipse/swt/SWTException.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/******************************************************************************* - * 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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ArmEvent.d --- a/org/eclipse/swt/events/ArmEvent.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/******************************************************************************* - * 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.events.ArmEvent; - -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.events.TypedEvent; - -/** - * Instances of this class are sent as a result of - * a widget such as a menu item being armed. - * - * @see ArmListener - */ - -public final class ArmEvent : TypedEvent { - - //static final long serialVersionUID = 3258126964249212217L; - -/** - * Constructs a new instance of this class based on the - * information in the given untyped event. - * - * @param e the untyped event containing the information - */ -public this(Event e) { - super(e); -} - -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ArmListener.d --- a/org/eclipse/swt/events/ArmListener.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.events.ArmListener; - -public import org.eclipse.swt.internal.SWTEventListener; -public import org.eclipse.swt.events.ArmEvent; - -/** - * Classes which implement this interface provide a method - * that deals with the event that is generated when a widget, - * such as a menu item, is armed. - *
- * After creating an instance of a class that :
- * this interface it can be added to a widget using the
- * addArmListener
method and removed using
- * the removeArmListener
method. When the
- * widget is armed, the widgetArmed method will be invoked.
- *
ControlListener
interface.
- *
- * Classes that wish to deal with ControlEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
Shell
s).
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the move
- */
-public void controlMoved(ControlEvent e) {
-}
-
-/**
- * Sent when the size (width, height) of a control changes.
- * The default behavior is to do nothing.
- *
- * @param e an event containing information about the resize
- */
-public void controlResized(ControlEvent e) {
-}
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ControlEvent.d
--- a/org/eclipse/swt/events/ControlEvent.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.events.ControlEvent;
-
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.events.TypedEvent;
-
-/**
- * Instances of this class are sent as a result of
- * controls being moved or resized.
- *
- * @see ControlListener
- */
-
-public final class ControlEvent : TypedEvent {
-
- //static final long serialVersionUID = 3258132436155119161L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
-}
-
-}
-
-
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ControlListener.d
--- a/org/eclipse/swt/events/ControlListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.events.ControlListener;
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.ControlEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated by moving
- * and resizing controls.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addControlListener
method and removed using
- * the removeControlListener
method. When a
- * control is moved or resized, the appropriate method will
- * be invoked.
- *
Shell
s).
- *
- * @param e an event containing information about the move
- */
-public void controlMoved(ControlEvent e);
-
-/**
- * Sent when the size (width, height) of a control changes.
- *
- * @param e an event containing information about the resize
- */
-public void controlResized(ControlEvent e);
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/DisposeEvent.d
--- a/org/eclipse/swt/events/DisposeEvent.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.events.DisposeEvent;
-
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.events.TypedEvent;
-
-/**
- * Instances of this class are sent as a result of
- * widgets being disposed.
- *
- * @see DisposeListener
- */
-
-public final class DisposeEvent : TypedEvent {
-
- //static final long serialVersionUID = 3257566187633521206L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
-}
-
-}
-
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/DisposeListener.d
--- a/org/eclipse/swt/events/DisposeListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.events.DisposeListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.DisposeEvent;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the event that is generated when a widget
- * is disposed.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a widget using the
- * addDisposeListener
method and removed using
- * the removeDisposeListener
method. When a
- * widget is disposed, the widgetDisposed method will
- * be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addDragDetectListener
method and removed using
- * the removeDragDetectListener
method. When the
- * drag is detected, the drageDetected method will be invoked.
- *
ExpandListener
interface.
- *
- * Classes that wish to deal with ExpandEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
ExpandItem
s being expanded or collapsed.
- *
- * @see ExpandListener
- *
- * @since 3.2
- */
-
-public class ExpandEvent : SelectionEvent {
-
- //static final long serialVersionUID = 3976735856884987356L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ExpandListener.d
--- a/org/eclipse/swt/events/ExpandListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.events.ExpandListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.ExpandEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the expanding and collapsing of ExpandItem
s.
- *
- *
- * After creating an instance of a class that :
- * this interface it can be added to a ExpandBar
- * control using the addExpandListener
method and
- * removed using the removeExpandListener
method.
- * When a item of the ExpandBar
is expanded or
- * collapsed, the appropriate method will be invoked.
- *
FocusListener
interface.
- *
- * Classes that wish to deal with FocusEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addFocusListener
method and removed using
- * the removeFocusListener
method. When a
- * control gains or loses focus, the appropriate method
- * will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addHelpListener
method and removed using
- * the removeHelpListener
method. When help
- * is requested for a control, the helpRequested method
- * will be invoked.
- *
KeyListener
interface.
- *
- * Classes that wish to deal with KeyEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * When a key listener is added to a control, the control - * will take part in widget traversal. By default, all - * traversal keys (such as the tab key and so on) are - * delivered to the control. In order for a control to take - * part in traversal, it should listen for traversal events. - * Otherwise, the user can traverse into a control but not - * out. Note that native controls such as table and tree - * implement key traversal in the operating system. It is - * not necessary to add traversal listeners for these controls, - * unless you want to override the default traversal. - *
- * @see KeyListener - * @see TraverseListener - */ - -public class KeyEvent : TypedEvent { - - /** - * the character represented by the key that was typed. - * This is the final character that results after all modifiers have been - * applied. For example, when the user types Ctrl+A, the character value - * is 0x01. It is important that applications do not attempt to modify the - * character value based on a stateMask (such as SWT.CTRL) or the resulting - * character will not be correct. - */ - public char character; - - /** - * the key code of the key that was typed, - * as defined by the key code constants in classSWT
.
- * When the character field of the event is ambiguous, this field
- * contains the unicode value of the original character. For example,
- * typing Ctrl+M or Return both result in the character '\r' but the
- * keyCode field will also contain '\r' when Return was typed.
- *
- * @see org.eclipse.swt.SWT
- */
- public int keyCode;
-
- /**
- * the state of the keyboard modifier keys at the time
- * the event was generated, as defined by the key code
- * constants in class SWT
.
- *
- * @see org.eclipse.swt.SWT
- */
- public int stateMask;
-
- /**
- * A flag indicating whether the operation should be allowed.
- * Setting this field to false
will cancel the operation.
- */
- public bool doit;
-
- static final long serialVersionUID = 3256442491011412789L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
- this.character = e.character;
- this.keyCode = e.keyCode;
- this.stateMask = e.stateMask;
- this.doit = e.doit;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString() {
- return Format( "{} character={} keyCode={} stateMask={} doit={}}",
- super.toString[ 0 .. $-2 ],
- character, keyCode, stateMask, doit );
-}
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/KeyListener.d
--- a/org/eclipse/swt/events/KeyListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.events.KeyListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.KeyEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated as keys
- * are pressed on the system keyboard.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addKeyListener
method and removed using
- * the removeKeyListener
method. When a
- * key is pressed or released, the appropriate method will
- * be invoked.
- *
MenuListener
interface.
- *
- * Classes that wish to deal with MenuEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
false
will cancel the operation.
- */
- public bool doit;
-
- //private static final long serialVersionUID = -3061660596590828941L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
- this.x = e.x;
- this.y = e.y;
- this.doit = e.doit;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString() {
- return Format( "{} x={} y={} doit={}}", super.toString[ 0 .. $-2 ], x, y, doit );
-}
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/MenuDetectListener.d
--- a/org/eclipse/swt/events/MenuDetectListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.events.MenuDetectListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.MenuDetectEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated when the
- * platform-specific trigger for showing a context menu is
- * detected.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control or TrayItem
- * using the addMenuDetectListener
method and
- * removed using the removeMenuDetectListener
method.
- * When the context menu trigger occurs, the
- * menuDetected
method will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a menu using the
- * addMenuListener
method and removed using
- * the removeMenuListener
method. When the
- * menu is hidden or shown, the appropriate method will
- * be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a text widget using the
- * addModifyListener
method and removed using
- * the removeModifyListener
method. When the
- * text is modified, the modifyText method will be invoked.
- *
MouseListener
interface.
- *
- * Classes that wish to deal with MouseEvent
s
- * which occur as mouse buttons are pressed and released can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * Note: The button
field is an integer that
- * represents the mouse button number. This is not the same
- * as the SWT
mask constants BUTTONx
.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addMouseListener
method and removed using
- * the removeMouseListener
method. When a
- * mouse button is pressed or released, the appropriate method
- * will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addMouseMoveListener
method and removed using
- * the removeMouseMoveListener
method. As the
- * mouse moves, the mouseMove method will be invoked.
- *
MouseTrackListener
interface.
- *
- * Classes that wish to deal with MouseEvent
s which
- * occur as the mouse pointer passes (or hovers) over controls can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addMouseTrackListener
method and removed using
- * the removeMouseTrackListener
method. When the
- * mouse pointer passes into or out of the area of the screen
- * covered by a control or pauses while over a control, the
- * appropriate method will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addMouseWheelListener
method and removed using
- * the removeMouseWheelListener
method. When the
- * mouse wheel is scrolled the mouseScrolled
method
- * will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addPaintListener
method and removed using
- * the removePaintListener
method. When a
- * paint event occurs, the paintControl method will be
- * invoked.
- *
SelectionListener
interface.
- *
- * Classes that wish to deal with SelectionEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * Note: The fields that are filled in depend on the widget. - *
- * - * @see SelectionListener - */ - -public class SelectionEvent : TypedEvent { - - /** - * The item that was selected. - */ - public Widget item; - - /** - * Extra detail information about the selection, depending on the widget. - * - *Sash
ScrollBar and Slider
Table and Tree
Text
CoolItem and ToolItem
false
will cancel the
- * operation, depending on the widget.
- */
- public bool doit;
-
- //static final long serialVersionUID = 3976735856884987953L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
- this.item = e.item;
- this.x = e.x;
- this.y = e.y;
- this.width = e.width;
- this.height = e.height;
- this.detail = e.detail;
- this.stateMask = e.stateMask;
- this.text = e.text;
- this.doit = e.doit;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString() {
- return Format( "{} item={} detail={} x={} y={} width={} height={} stateMask={} text={} doit={}}",
- super.toString[ 0 .. $-2 ],
- item,
- detail,
- x,
- y,
- width,
- height,
- stateMask,
- text,
- doit );
-}
-}
-
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/SelectionListener.d
--- a/org/eclipse/swt/events/SelectionListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.events.SelectionListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.SelectionEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the events that are generated when selection
- * occurs in a control.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addSelectionListener
method and removed using
- * the removeSelectionListener
method. When
- * selection occurs in a control the appropriate method
- * will be invoked.
- *
- * For example, selection occurs in a List when the user selects - * an item or items with the keyboard or mouse. On some platforms, - * the event occurs when a mouse button or key is pressed. On others, - * it happens when the mouse or key is released. The exact key or - * mouse gesture that causes this event is platform specific. - *
- * - * @param e an event containing information about the selection - */ -public void widgetSelected(SelectionEvent e); - -/** - * Sent when default selection occurs in the control. - *- * For example, on some platforms default selection occurs in a List - * when the user double-clicks an item or types return in a Text. - * On some platforms, the event occurs when a mouse button or key is - * pressed. On others, it happens when the mouse or key is released. - * The exact key or mouse gesture that causes this event is platform - * specific. - *
- * - * @param e an event containing information about the default selection - */ -public void widgetDefaultSelected(SelectionEvent e); -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ShellAdapter.d --- a/org/eclipse/swt/events/ShellAdapter.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.events.ShellAdapter; - -import org.eclipse.swt.events.ShellListener; - -/** - * This adapter class provides default implementations for the - * methods described by theShellListener
interface.
- *
- * Classes that wish to deal with ShellEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
false
will cancel the operation.
- */
- public bool doit;
-
- //static final long serialVersionUID = 3257569490479888441L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
- this.doit = e.doit;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString() {
- return Format( "{} doit={}}", super.toString[ 0 .. $-2 ], doit );
-}
-}
-
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/ShellListener.d
--- a/org/eclipse/swt/events/ShellListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.events.ShellListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.ShellEvent;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with changes in state of Shell
s.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a shell using the
- * addShellListener
method and removed using
- * the removeShellListener
method. When the
- * state of the shell changes, the appropriate method will
- * be invoked.
- *
- * The traversal event allows fine control over keyboard traversal
- * in a control both to implement traversal and override the default
- * traversal behavior defined by the system. This is achieved using
- * two fields, detail
and doit
.
- *
- * When a control is traversed, a traverse event is sent. The detail
- * describes the type of traversal and the doit field indicates the default
- * behavior of the system. For example, when a right arrow key is pressed
- * in a text control, the detail field is TRAVERSE_ARROW_NEXT
- * and the doit field is false
, indicating that the system
- * will not traverse to the next tab item and the arrow key will be
- * delivered to the text control. If the same key is pressed in a radio
- * button, the doit field will be true
, indicating that
- * traversal is to proceed to the next tab item, possibly another radio
- * button in the group and that the arrow key is not to be delivered
- * to the radio button.
- *
- * How can the traversal event be used to implement traversal?
- * When a tab key is pressed in a canvas, the detail field will be
- * TRAVERSE_TAB_NEXT
and the doit field will be
- * false
. The default behavior of the system is to
- * provide no traversal for canvas controls. This means that by
- * default in a canvas, a key listener will see every key that the
- * user types, including traversal keys. To understand why this
- * is so, it is important to understand that only the widget implementor
- * can decide which traversal is appropriate for the widget. Returning
- * to the TRAVERSE_TAB_NEXT
example, a text widget implemented
- * by a canvas would typically want to use the tab key to insert a
- * tab character into the widget. A list widget implementation, on the
- * other hand, would like the system default traversal behavior. Using
- * only the doit flag, both implementations are possible. The text widget
- * implementor sets doit to false
, ensuring that the system
- * will not traverse and that the tab key will be delivered to key listeners.
- * The list widget implementor sets doit to true
, indicating
- * that the system should perform tab traversal and that the key should not
- * be delivered to the list widget.
- *
- * How can the traversal event be used to override system traversal?
- * When the return key is pressed in a single line text control, the
- * detail field is TRAVERSE_RETURN
and the doit field
- * is true
. This means that the return key will be processed
- * by the default button, not the text widget. If the text widget has
- * a default selection listener, it will not run because the return key
- * will be processed by the default button. Imagine that the text control
- * is being used as an in-place editor and return is used to dispose the
- * widget. Setting doit to false
will stop the system from
- * activating the default button but the key will be delivered to the text
- * control, running the key and selection listeners for the text. How
- * can TRAVERSE_RETURN
be implemented so that the default button
- * will not be activated and the text widget will not see the return key?
- * This is achieved by setting doit to true
, and the detail
- * to TRAVERSE_NONE
.
- *
- * Note: A widget implementor will typically implement traversal using - * only the doit flag to either enable or disable system traversal. - *
- * - * @see TraverseListener - */ - -public final class TraverseEvent : KeyEvent { - - /** - * The traversal type. - *TRAVERSE_NONE
- * causes no traversal action to be taken.
- *
- * When used in conjunction with the doit
field, the
- * traversal detail field can be useful when overriding the default
- * traversal mechanism for a control. For example, setting the doit
- * field to false
will cancel the operation and allow
- * the traversal key stroke to be delivered to the control. Setting
- * the doit field to true
indicates that the traversal
- * described by the detail field is to be performed.
- */
- public int detail;
-
- //static final long serialVersionUID = 3257565105301239349L;
-
-/**
- * Constructs a new instance of this class based on the
- * information in the given untyped event.
- *
- * @param e the untyped event containing the information
- */
-public this(Event e) {
- super(e);
- this.detail = e.detail;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString() {
- return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail );
-}
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/events/TraverseListener.d
--- a/org/eclipse/swt/events/TraverseListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.events.TraverseListener;
-
-
-public import org.eclipse.swt.internal.SWTEventListener;
-public import org.eclipse.swt.events.TraverseEvent;
-
-/**
- * Classes which implement this interface provide a method
- * that deals with the events that are generated when a
- * traverse event occurs in a control.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a control using the
- * addTraverseListener
method and removed using
- * the removeTraverseListener
method. When a
- * traverse event occurs in a control, the keyTraversed method
- * will be invoked.
- *
- * A traverse event occurs when the user presses a traversal
- * key. Traversal keys are typically tab and arrow keys, along
- * with certain other keys on some platforms. Traversal key
- * constants beginning with TRAVERSE_
are defined
- * in the SWT
class.
- *
TreeListener
interface.
- *
- * Classes that wish to deal with TreeEvent
s can
- * extend this class and override only the methods which they are
- * interested in.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a tree control using the
- * addTreeListener
method and removed using
- * the removeTreeListener
method. When a branch
- * of the tree is expanded or collapsed, the appropriate method
- * will be invoked.
- *
- * After creating an instance of a class that :
- * this interface it can be added to a text control using the
- * addVerifyListener
method and removed using
- * the removeVerifyListener
method. When the
- * text is about to be modified, the verifyText method
- * will be invoked.
- *
- * A verify event occurs after the user has done something - * to modify the text (typically typed a key), but before - * the text is modified. The doit field in the verify event - * indicates whether or not to modify the text. - *
- * - * @param e an event containing information about the verify - */ -public void verifyText(VerifyEvent e); -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/DeviceData.d --- a/org/eclipse/swt/graphics/DeviceData.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/******************************************************************************* - * 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.graphics.DeviceData; - -import tango.core.Exception; - -public class DeviceData { - /* - * The following fields are platform dependent. - *- * IMPORTANT: These fields are not part of the SWT - * public API. They are marked public only so that they can be shared - * within the packages provided by SWT. They are not available on all - * platforms and should never be accessed from application code. - *
- */ - public char[] display_name; - public char[] application_name; - public char[] application_class; - - /* - * Debug fields - may not be honoured - * on some SWT platforms. - */ - public bool debugging; - public bool tracking; - public TracedException [] errors; - public Object [] objects; -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/FontData.d --- a/org/eclipse/swt/graphics/FontData.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,439 +0,0 @@ -/******************************************************************************* - * 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.graphics.FontData; - - -import org.eclipse.swt.SWT; - -import tango.text.convert.Format; -import tango.text.Util : locate; -import tango.util.Convert; - -/** - * Instances of this class describe operating system fonts. - *- * For platform-independent behaviour, use the get and set methods - * corresponding to the following properties: - *
FontData
- * corresponds to a Windows LOGFONT
structure whose fields
- * may be retrieved and modified.FontData
correspond
- * to the entries in the font's XLFD name and may be retrieved and modified.
- * dispose()
method is provided.
- *
- * @see Font
- */
-public final class FontData {
- /**
- * the font name
- * (Warning: This field is platform dependent)
- * - * IMPORTANT: This field is not part of the SWT - * public API. It is marked public only so that it can be shared - * within the packages provided by SWT. It is not available on all - * platforms and should never be accessed from application code. - *
- */ - public char[] name; - - /** - * The height of the font data in points - * (Warning: This field is platform dependent) - *- * IMPORTANT: This field is not part of the SWT - * public API. It is marked public only so that it can be shared - * within the packages provided by SWT. It is not available on all - * platforms and should never be accessed from application code. - *
- */ - public float height; - - /** - * the font style - * (Warning: This field is platform dependent) - *- * IMPORTANT: This field is not part of the SWT - * public API. It is marked public only so that it can be shared - * within the packages provided by SWT. It is not available on all - * platforms and should never be accessed from application code. - *
- */ - public int style; - - /** - * the Pango string - * (Warning: This field is platform dependent) - *- * IMPORTANT: This field is not part of the SWT - * public API. It is marked public only so that it can be shared - * within the packages provided by SWT. It is not available on all - * platforms and should never be accessed from application code. - *
- */ - public byte[] str; - - /** - * The locales of the font - */ - char[] lang, country, variant; - -/** - * Constructs a new uninitialized font data. - */ -public this () { - this("", 12, SWT.NORMAL); -} - -/** - * Constructs a new FontData given a string representation - * in the form generated by theFontData.toString
- * method.
- * - * Note that the representation varies between platforms, - * and a FontData can only be created from a string that was - * generated on the same platform. - *
- * - * @param string the string representation of aFontData
(must not be null)
- *
- * @exception IllegalArgumentException true
if the object is the same as this object and false
otherwise
- *
- * @see #hashCode
- */
-public override int opEquals (Object object) {
- if (object is this) return true;
- if( auto data = cast(FontData)object ){
- return name == data.name && height == data.height && style == data.style;
- }
- return false;
-}
-
-/**
- * Returns the height of the receiver in points.
- *
- * @return the height of this FontData
- *
- * @see #setHeight(int)
- */
-public int getHeight() {
- return cast(int)(0.5f + height);
-}
-
-/*public*/ float getHeightF() {
- return height;
-}
-
-/**
- * Returns the locale of the receiver.
- * - * The locale determines which platform character set this - * font is going to use. Widgets and graphics operations that - * use this font will convert UNICODE strings to the platform - * character set of the specified locale. - *
- *- * On platforms where there are multiple character sets for a - * given language/country locale, the variant portion of the - * locale will determine the character set. - *
- * - * @return theString
representing a Locale object
- * @since 3.0
- */
-public char[] getLocale () {
- char[] result;
- const char sep = '_';
- if (lang != null) {
- result ~= lang;
- result ~= sep;
- }
- if (country != null) {
- result ~= country;
- result ~= sep;
- }
- if (variant != null) {
- result ~= variant;
- }
-
- if (result) {
- if (result[$-1] == sep) {
- result = result[0 .. $ - 1];
- }
- }
- return result;
-}
-
-/**
- * Returns the name of the receiver.
- * On platforms that support font foundries, the return value will
- * be the foundry followed by a dash ("-") followed by the face name.
- *
- * @return the name of this FontData
- *
- * @see #setName
- */
-public char[] getName() {
- return name;
-}
-
-/**
- * Returns the style of the receiver which is a bitwise OR of
- * one or more of the SWT
constants NORMAL, BOLD
- * and ITALIC.
- *
- * @return the style of this FontData
- *
- * @see #setStyle
- */
-public int getStyle() {
- return style;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects that return true
when passed to
- * equals
must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public hash_t toHash () {
- return typeid(char[]).getHash(&name) ^ getHeight() ^ style;
-}
-
-/**
- * Sets the height of the receiver. The parameter is
- * specified in terms of points, where a point is one
- * seventy-second of an inch.
- *
- * @param height the height of the FontData
- *
- * @exception IllegalArgumentException - * The locale determines which platform character set this - * font is going to use. Widgets and graphics operations that - * use this font will convert UNICODE strings to the platform - * character set of the specified locale. - *
- *- * On platforms where there are multiple character sets for a - * given language/country locale, the variant portion of the - * locale will determine the character set. - *
- * - * @param locale theString
representing a Locale object
- * @see java.util.Locale#toString
- */
-public void setLocale(char[] locale) {
- lang = country = variant = null;
- if (locale !is null) {
- char sep = '_';
- int length = locale.length;
- int firstSep, secondSep;
-
- firstSep = locate( locale, sep );
- if (firstSep == locale.length) {
- firstSep = secondSep = length;
- } else {
- secondSep = locate( locale, sep, firstSep + 1);
- if (secondSep == locale.length) secondSep = length;
- }
- if (firstSep > 0) lang = locale[0 .. firstSep];
- if (secondSep > firstSep + 1) country = locale[firstSep + 1 .. secondSep ];
- if (length > secondSep + 1) variant = locale[secondSep + 1 .. $ ];
- }
-}
-
-/**
- * Sets the name of the receiver.
- * - * Some platforms support font foundries. On these platforms, the name - * of the font specified in setName() may have one of the following forms: - *
- * On platforms that do not support font foundries, only the face name
- * (for example, "courier") is used in setName()
and
- * getName()
.
- *
SWT
- * constants NORMAL, BOLD and ITALIC. All other style bits are
- * ignored.
- *
- * @param style the new style for this FontData
- *
- * @see #getStyle
- */
-public void setStyle(int style) {
- this.style = style;
- this.str = null;
-}
-
-/**
- * Returns a string representation of the receiver which is suitable
- * for constructing an equivalent instance using the
- * FontData(String)
constructor.
- *
- * @return a string representation of the FontData
- *
- * @see FontData
- */
-public char[] toString() {
- return Format( "1|{}|{}|{}|GTK|1|", getName, getHeightF, getStyle );
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/FontMetrics.d
--- a/org/eclipse/swt/graphics/FontMetrics.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * 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.graphics.FontMetrics;
-
-
-/**
- * Instances of this class provide measurement information
- * about fonts including ascent, descent, height, leading
- * space between rows, and average character width.
- * FontMetrics
are obtained from GC
s
- * using the getFontMetrics()
method.
- *
- * @see GC#getFontMetrics
- */
-public final class FontMetrics {
- int ascent, descent, averageCharWidth, leading, height;
-
-package this() {
-}
-
-/**
- * Compares the argument to the receiver, and returns true
- * if they represent the same object using a class
- * specific comparison.
- *
- * @param object the object to compare with this object
- * @return true
if the object is the same as this object and false
otherwise
- *
- * @see #hashCode
- */
-public int opEquals (Object object) {
- if (object is this) return true;
- if( auto metrics = cast(FontMetrics)object ){
- return ascent == metrics.ascent && descent == metrics.descent &&
- averageCharWidth == metrics.averageCharWidth && leading == metrics.leading &&
- height == metrics.height;
- }
- return false;
-}
-
-/**
- * Returns the ascent of the font described by the receiver. A
- * font's ascent is the distance from the baseline to the
- * top of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the ascent of the font
- */
-public int getAscent() {
- return ascent;
-}
-
-/**
- * Returns the average character width, measured in pixels,
- * of the font described by the receiver.
- *
- * @return the average character width of the font
- */
-public int getAverageCharWidth() {
- return averageCharWidth;
-}
-
-/**
- * Returns the descent of the font described by the receiver. A
- * font's descent is the distance from the baseline to the
- * bottom of actual characters, not including any of the leading area,
- * measured in pixels.
- *
- * @return the descent of the font
- */
-public int getDescent() {
- return descent;
-}
-
-/**
- * Returns the height of the font described by the receiver,
- * measured in pixels. A font's height is the sum of
- * its ascent, descent and leading area.
- *
- * @return the height of the font
- *
- * @see #getAscent
- * @see #getDescent
- * @see #getLeading
- */
-public int getHeight() {
- return height;
-}
-
-/**
- * Returns the leading area of the font described by the
- * receiver. A font's leading area is the space
- * above its ascent which may include accents or other marks.
- *
- * @return the leading space of the font
- */
-public int getLeading() {
- return leading;
-}
-
-public static FontMetrics gtk_new(int ascent, int descent, int averageCharWidth, int leading, int height) {
- FontMetrics fontMetrics = new FontMetrics();
- fontMetrics.ascent = ascent;
- fontMetrics.descent = descent;
- fontMetrics.averageCharWidth = averageCharWidth;
- fontMetrics.leading = leading;
- fontMetrics.height = height;
- return fontMetrics;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects that return true
when passed to
- * equals
must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals
- */
-public hash_t toHash() {
- return ascent ^ descent ^ averageCharWidth ^ leading ^ height;
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/ImageData.d
--- a/org/eclipse/swt/graphics/ImageData.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3610 +0,0 @@
-/*******************************************************************************
- * 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.graphics.ImageData;
-
-
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.ImageDataLoader;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.internal.CloneableCompatibility;
-
-import tango.io.model.IConduit;
-
-// PORTING_TYPE
-class GC{
- void drawImage(Image, int, int, int, int, int, int, int, int );
-}
-class Device{}
-class Image{
- this( Device, ImageData ){}
- void dispose(){}
-}
-
-/**
- * Instances of this class are device-independent descriptions
- * of images. They are typically used as an intermediate format
- * between loading from or writing to streams and creating an
- * Image
.
- *
- * Note that the public fields x
, y
,
- * disposalMethod
and delayTime
are
- * typically only used when the image is in a set of images used
- * for animation.
- *
- * Note that a depth of 8 or less does not necessarily - * mean that the image is palette indexed, or - * conversely that a depth greater than 8 means that - * the image is direct color. Check the associated - * PaletteData's isDirect field for such determinations. - */ - public int depth; - - /** - * The scanline padding. - *
- * If one scanline of the image is not a multiple of - * this number, it will be padded with zeros until it is. - *
- */ - public int scanlinePad; - - /** - * The number of bytes per scanline. - *- * This is a multiple of the scanline padding. - *
- */ - public int bytesPerLine; - - /** - * The pixel data of the image. - *- * Note that for 16 bit depth images the pixel data is stored - * in least significant byte order; however, for 24bit and - * 32bit depth images the pixel data is stored in most - * significant byte order. - *
- */ - public byte[] data; - - /** - * The color table for the image. - */ - public PaletteData palette; - - /** - * The transparent pixel. - *- * Pixels with this value are transparent. - *
- * The default is -1 which means 'no transparent pixel'. - *
- */ - public int transparentPixel; - - /** - * An icon-specific field containing the data from the icon mask. - *- * This is a 1 bit bitmap stored with the most significant - * bit first. The number of bytes per scanline is - * '((width + 7) / 8 + (maskPad - 1)) / maskPad * maskPad'. - *
- * The default is null which means 'no transparency mask'. - *
- */ - public byte[] maskData; - - /** - * An icon-specific field containing the scanline pad of the mask. - *- * If one scanline of the transparency mask is not a - * multiple of this number, it will be padded with zeros until - * it is. - *
- */ - public int maskPad; - - /** - * The alpha data of the image. - *- * Every pixel can have an alpha blending value that - * varies from 0, meaning fully transparent, to 255 meaning - * fully opaque. The number of bytes per scanline is - * 'width'. - *
- */ - public byte[] alphaData; - - /** - * The global alpha value to be used for every pixel. - *
- * If this value is set, the alphaData
field
- * is ignored and when the image is rendered each pixel
- * will be blended with the background an amount
- * proportional to this value.
- *
- * The default is -1 which means 'no global alpha value' - *
- */ - public int alpha; - - /** - * The type of file from which the image was read. - * - * It is expressed as one of the following values: - *IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
DM_UNSPECIFIED
DM_FILL_NONE
DM_FILL_BACKGROUND
DM_FILL_PREVIOUS
ImageData
loaded from the specified
- * input stream. Throws an error if an error occurs while loading
- * the image, or if the image has an unsupported type. Application
- * code is still responsible for closing the input stream.
- *
- * This constructor is provided for convenience when loading a single
- * image only. If the stream contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * ImageLoader.load()
.
- *
- * This constructor may be used to load a resource as follows: - *
- *- * static ImageData loadImageData (Class clazz, String string) { - * InputStream stream = clazz.getResourceAsStream (string); - * if (stream == null) return null; - * ImageData imageData = null; - * try { - * imageData = new ImageData (stream); - * } catch (SWTException ex) { - * } finally { - * try { - * stream.close (); - * } catch (IOException ex) {} - * } - * return imageData; - * } - *- * - * @param stream the input stream to load the image from (must not be null) - * - * @exception IllegalArgumentException
ImageData
loaded from a file with the
- * specified name. Throws an error if an error occurs loading the
- * image, or if the image has an unsupported type.
- *
- * This constructor is provided for convenience when loading a single
- * image only. If the file contains multiple images, only the first
- * one will be loaded. To load multiple images, use
- * ImageLoader.load()
.
- *
- * This method is for internal use, and is not described further. - *
- */ -this( - int width, int height, int depth, PaletteData palette, - int scanlinePad, byte[] data, int maskPad, byte[] maskData, - byte[] alphaData, int alpha, int transparentPixel, int type, - int x, int y, int disposalMethod, int delayTime) -{ - - if (palette == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (!(depth == 1 || depth == 2 || depth == 4 || depth == 8 - || depth == 16 || depth == 24 || depth == 32)) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - if (width <= 0 || height <= 0) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - if (scanlinePad == 0) SWT.error (SWT.ERROR_CANNOT_BE_ZERO); - - int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) - / scanlinePad * scanlinePad; - setAllFields( - width, - height, - depth, - scanlinePad, - bytesPerLine, - data != null ? data : new byte[bytesPerLine * height], - palette, - transparentPixel, - maskData, - maskPad, - alphaData, - alpha, - type, - x, - y, - disposalMethod, - delayTime); -} - -/** - * Initializes all fields in the receiver. This method must be called - * by all public constructors to ensure that all fields are initialized - * for a new ImageData object. If a new field is added to the class, - * then it must be added to this method. - *- * This method is for internal use, and is not described further. - *
- */ -void setAllFields(int width, int height, int depth, int scanlinePad, - int bytesPerLine, byte[] data, PaletteData palette, int transparentPixel, - byte[] maskData, int maskPad, byte[] alphaData, int alpha, - int type, int x, int y, int disposalMethod, int delayTime) { - - this.width = width; - this.height = height; - this.depth = depth; - this.scanlinePad = scanlinePad; - this.bytesPerLine = bytesPerLine; - this.data = data; - this.palette = palette; - this.transparentPixel = transparentPixel; - this.maskData = maskData; - this.maskPad = maskPad; - this.alphaData = alphaData; - this.alpha = alpha; - this.type = type; - this.x = x; - this.y = y; - this.disposalMethod = disposalMethod; - this.delayTime = delayTime; -} - -/** - * Invokes internal SWT functionality to create a new instance of - * this class. - *
- * IMPORTANT: This method is not part of the public
- * API for ImageData
. It is marked public only so that it
- * can be shared within the packages provided by SWT. It is subject
- * to change without notice, and should never be called from
- * application code.
- *
- * This method is for internal use, and is not described further. - *
- */ -public static ImageData internal_new( - int width, int height, int depth, PaletteData palette, - int scanlinePad, byte[] data, int maskPad, byte[] maskData, - byte[] alphaData, int alpha, int transparentPixel, int type, - int x, int y, int disposalMethod, int delayTime) -{ - return new ImageData( - width, height, depth, palette, scanlinePad, data, maskPad, maskData, - alphaData, alpha, transparentPixel, type, x, y, disposalMethod, delayTime); -} - -ImageData colorMaskImage(int pixel) { - ImageData mask = new ImageData(width, height, 1, bwPalette(), - 2, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, - 0, 0, 0, 0); - int[] row = new int[width]; - for (int y = 0; y < height; y++) { - getPixels(0, y, width, row, 0); - for (int i = 0; i < width; i++) { - if (pixel != -1 && row[i] == pixel) { - row[i] = 0; - } else { - row[i] = 1; - } - } - mask.setPixels(0, y, width, row, 0); - } - return mask; -} - -static byte[] checkData(byte [] data) { - if (data == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return data; -} - -/** - * Returns a new instance of the same class as the receiver, - * whose slots have been filled in with copies of - * the values in the slots of the receiver. That is, the - * returned object is a deep copy of the receiver. - * - * @return a copy of the receiver. - */ -public Object clone() { - byte[] cloneData = data.dup; - byte[] cloneMaskData = null; - if (maskData != null) { - cloneMaskData = maskData.dup; - } - byte[] cloneAlphaData = null; - if (alphaData != null) { - cloneAlphaData = alphaData.dup; - } - return new ImageData( - width, - height, - depth, - palette, - scanlinePad, - cloneData, - maskPad, - cloneMaskData, - cloneAlphaData, - alpha, - transparentPixel, - type, - x, - y, - disposalMethod, - delayTime); -} - -/** - * Returns the alpha value at offsetx
in
- * scanline y
in the receiver's alpha data.
- *
- * @param x the x coordinate of the pixel to get the alpha value of
- * @param y the y coordinate of the pixel to get the alpha value of
- * @return the alpha value at the given coordinates
- *
- * @exception IllegalArgumentException getWidth
alpha values starting at offset
- * x
in scanline y
in the receiver's alpha
- * data starting at startIndex
.
- *
- * @param x the x position of the pixel to begin getting alpha values
- * @param y the y position of the pixel to begin getting alpha values
- * @param getWidth the width of the data to get
- * @param alphas the buffer in which to put the alpha values
- * @param startIndex the offset into the image to begin getting alpha values
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException x
in
- * scanline y
in the receiver's data.
- *
- * @param x the x position of the pixel to get
- * @param y the y position of the pixel to get
- * @return the pixel at the given coordinates
- *
- * @exception IllegalArgumentException getWidth
pixel values starting at offset
- * x
in scanline y
in the receiver's
- * data starting at startIndex
.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the byte array to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException getWidth
pixel values starting at offset
- * x
in scanline y
in the receiver's
- * data starting at startIndex
.
- *
- * @param x the x position of the first pixel to get
- * @param y the y position of the first pixel to get
- * @param getWidth the width of the data to get
- * @param pixels the buffer in which to put the pixels
- * @param startIndex the offset into the buffer to begin storing pixels
- *
- * @exception IndexOutOfBoundsException if getWidth is too large
- * @exception IllegalArgumentException RGB
s which comprise the
- * indexed color table of the receiver, or null if the receiver
- * has a direct color model.
- *
- * @return the RGB values for the image or null if direct color
- *
- * @see PaletteData#getRGBs()
- */
-public RGB[] getRGBs() {
- return palette.getRGBs();
-}
-
-/**
- * Returns an ImageData
which specifies the
- * transparency mask information for the receiver. If the
- * receiver has no transparency or is not an icon, returns
- * an opaque mask.
- *
- * @return the transparency mask
- */
-public ImageData getTransparencyMask() {
- if (getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- return new ImageData(width, height, 1, bwPalette(), maskPad, maskData);
- } else {
- return colorMaskImage(transparentPixel);
- }
-}
-
-/**
- * Returns the image transparency type, which will be one of
- * SWT.TRANSPARENCY_NONE
, SWT.TRANSPARENCY_MASK
,
- * SWT.TRANSPARENCY_PIXEL
or SWT.TRANSPARENCY_ALPHA
.
- *
- * @return the receiver's transparency type
- */
-public int getTransparencyType() {
- if (maskData != null) return SWT.TRANSPARENCY_MASK;
- if (transparentPixel != -1) return SWT.TRANSPARENCY_PIXEL;
- if (alphaData != null) return SWT.TRANSPARENCY_ALPHA;
- return SWT.TRANSPARENCY_NONE;
-}
-
-/**
- * Returns the byte order of the receiver.
- *
- * @return MSB_FIRST or LSB_FIRST
- */
-int getByteOrder() {
- return depth != 16 ? MSB_FIRST : LSB_FIRST;
-}
-
-/**
- * Returns a copy of the receiver which has been stretched or
- * shrunk to the specified size. If either the width or height
- * is negative, the resulting image will be inverted in the
- * associated axis.
- *
- * @param width the width of the new ImageData
- * @param height the height of the new ImageData
- * @return a scaled copy of the image
- */
-public ImageData scaledTo(int width, int height) {
- /* Create a destination image with no data */
- bool flipX = (width < 0);
- if (flipX) width = - width;
- bool flipY = (height < 0);
- if (flipY) height = - height;
-
- ImageData dest = new ImageData(
- width, height, depth, palette,
- scanlinePad, null, 0, null,
- null, -1, transparentPixel, type,
- x, y, disposalMethod, delayTime);
-
- /* Scale the image contents */
- if (palette.isDirect) blit(BLIT_SRC,
- this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, 0, 0, 0,
- ALPHA_OPAQUE, null, 0, 0, 0,
- dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, 0, 0, 0,
- flipX, flipY);
- else blit(BLIT_SRC,
- this.data, this.depth, this.bytesPerLine, this.getByteOrder(), 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0, 0, 0,
- dest.data, dest.depth, dest.bytesPerLine, dest.getByteOrder(), 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
-
- /* Scale the image mask or alpha */
- if (maskData != null) {
- dest.maskPad = this.maskPad;
- int destBpl = (dest.width + 7) / 8;
- destBpl = (destBpl + (dest.maskPad - 1)) / dest.maskPad * dest.maskPad;
- dest.maskData = new byte[destBpl * dest.height];
- int srcBpl = (this.width + 7) / 8;
- srcBpl = (srcBpl + (this.maskPad - 1)) / this.maskPad * this.maskPad;
- blit(BLIT_SRC,
- this.maskData, 1, srcBpl, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0, 0, 0,
- dest.maskData, 1, destBpl, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
- } else if (alpha != -1) {
- dest.alpha = this.alpha;
- } else if (alphaData != null) {
- dest.alphaData = new byte[dest.width * dest.height];
- blit(BLIT_SRC,
- this.alphaData, 8, this.width, MSB_FIRST, 0, 0, this.width, this.height, null, null, null,
- ALPHA_OPAQUE, null, 0, 0, 0,
- dest.alphaData, 8, dest.width, MSB_FIRST, 0, 0, dest.width, dest.height, null, null, null,
- flipX, flipY);
- }
- return dest;
-}
-
-/**
- * Sets the alpha value at offset x
in
- * scanline y
in the receiver's alpha data.
- *
- * @param x the x coordinate of the alpha value to set
- * @param y the y coordinate of the alpha value to set
- * @param alpha the value to set the alpha to
- *
- * @exception IllegalArgumentException x
in
- * scanline y
in the receiver's alpha data to the
- * values from the array alphas
starting at
- * startIndex
.
- *
- * @param x the x coordinate of the pixel to being setting the alpha values
- * @param y the y coordinate of the pixel to being setting the alpha values
- * @param putWidth the width of the alpha values to set
- * @param alphas the alpha values to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException x
in
- * scanline y
in the receiver's data.
- *
- * @param x the x coordinate of the pixel to set
- * @param y the y coordinate of the pixel to set
- * @param pixelValue the value to set the pixel to
- *
- * @exception IllegalArgumentException x
in
- * scanline y
in the receiver's data to the
- * values from the array pixels
starting at
- * startIndex
.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException x
in
- * scanline y
in the receiver's data to the
- * values from the array pixels
starting at
- * startIndex
.
- *
- * @param x the x position of the pixel to set
- * @param y the y position of the pixel to set
- * @param putWidth the width of the pixels to set
- * @param pixels the pixels to set
- * @param startIndex the index at which to begin setting
- *
- * @exception IndexOutOfBoundsException if putWidth is too large
- * @exception IllegalArgumentException - * Note: When the source and destination depth, order and masks - * are pairwise equal and the blitter operation is BLIT_SRC, - * the masks are ignored. Hence when not changing the image - * data format, 0 may be specified for the masks. - *
- * - * @param op the blitter operation: a combination of BLIT_xxx flags - * (see BLIT_xxx constants) - * @param srcData the source byte array containing image data - * @param srcDepth the source depth: one of 8, 16, 24, 32 - * @param srcStride the source number of bytes per line - * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if srcDepth is not 16 or 32 - * @param srcX the top-left x-coord of the source blit region - * @param srcY the top-left y-coord of the source blit region - * @param srcWidth the width of the source blit region - * @param srcHeight the height of the source blit region - * @param srcRedMask the source red channel mask - * @param srcGreenMask the source green channel mask - * @param srcBlueMask the source blue channel mask - * @param alphaMode the alpha blending or mask mode, may be - * an integer 0-255 for global alpha; ignored if BLIT_ALPHA - * not specified in the blitter operations - * (see ALPHA_MODE_xxx constants) - * @param alphaData the alpha blending or mask data, varies depending - * on the value of alphaMode and sometimes ignored - * @param alphaStride the alpha data number of bytes per line - * @param alphaX the top-left x-coord of the alpha blit region - * @param alphaY the top-left y-coord of the alpha blit region - * @param destData the destination byte array containing image data - * @param destDepth the destination depth: one of 8, 16, 24, 32 - * @param destStride the destination number of bytes per line - * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if destDepth is not 16 or 32 - * @param destX the top-left x-coord of the destination blit region - * @param destY the top-left y-coord of the destination blit region - * @param destWidth the width of the destination blit region - * @param destHeight the height of the destination blit region - * @param destRedMask the destination red channel mask - * @param destGreenMask the destination green channel mask - * @param destBlueMask the destination blue channel mask - * @param flipX if true the resulting image is flipped along the vertical axis - * @param flipY if true the resulting image is flipped along the horizontal axis - */ -static void blit(int op, - byte[] srcData, int srcDepth, int srcStride, int srcOrder, - int srcX, int srcY, int srcWidth, int srcHeight, - int srcRedMask, int srcGreenMask, int srcBlueMask, - int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, - byte[] destData, int destDepth, int destStride, int destOrder, - int destX, int destY, int destWidth, int destHeight, - int destRedMask, int destGreenMask, int destBlueMask, - bool flipX, bool flipY) { - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; - - // these should be supplied as params later - const int srcAlphaMask = 0, destAlphaMask = 0; - - /*** Prepare scaling data ***/ - int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; - int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; - - /*** Prepare source-related data ***/ - int sbpp, stype; - switch (srcDepth) { - case 8: - sbpp = 1; - stype = TYPE_GENERIC_8; - break; - case 16: - sbpp = 2; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; - break; - case 24: - sbpp = 3; - stype = TYPE_GENERIC_24; - break; - case 32: - sbpp = 4; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int spr = srcY * srcStride + srcX * sbpp; - - /*** Prepare destination-related data ***/ - int dbpp, dtype; - switch (destDepth) { - case 8: - dbpp = 1; - dtype = TYPE_GENERIC_8; - break; - case 16: - dbpp = 2; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; - break; - case 24: - dbpp = 3; - dtype = TYPE_GENERIC_24; - break; - case 32: - dbpp = 4; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid destination type"); - return; - } - int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; - int dprxi = (flipX) ? -dbpp : dbpp; - int dpryi = (flipY) ? -destStride : destStride; - - /*** Prepare special processing data ***/ - int apr; - if ((op & BLIT_ALPHA) != 0) { - switch (alphaMode) { - case ALPHA_MASK_UNPACKED: - case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; - alphaStride <<= 3; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_INDEX: - //throw new IllegalArgumentException("Invalid alpha type"); - return; - case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; - apr = 0; - break; - default: - alphaMode = (alphaMode << 16) / 255; // prescale - case ALPHA_CHANNEL_SOURCE: - apr = 0; - break; - } - } else { - alphaMode = 0x10000; - apr = 0; - } - - /*** Blit ***/ - int dp = dpr; - int sp = spr; - if ((alphaMode == 0x10000) && (stype == dtype) && - (srcRedMask == destRedMask) && (srcGreenMask == destGreenMask) && - (srcBlueMask == destBlueMask) && (srcAlphaMask == destAlphaMask)) { - /*** Fast blit (straight copy) ***/ - switch (sbpp) { - case 1: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - destData[dp] = srcData[sp]; - sp += (sfx >>> 16); - } - } - break; - case 2: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - destData[dp] = srcData[sp]; - destData[dp + 1] = srcData[sp + 1]; - sp += (sfx >>> 16) * 2; - } - } - break; - case 3: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - destData[dp] = srcData[sp]; - destData[dp + 1] = srcData[sp + 1]; - destData[dp + 2] = srcData[sp + 2]; - sp += (sfx >>> 16) * 3; - } - } - break; - case 4: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - destData[dp] = srcData[sp]; - destData[dp + 1] = srcData[sp + 1]; - destData[dp + 2] = srcData[sp + 2]; - destData[dp + 3] = srcData[sp + 3]; - sp += (sfx >>> 16) * 4; - } - } - break; - } - return; - } - /*** Comprehensive blit (apply transformations) ***/ - int srcRedShift = getChannelShift(srcRedMask); - byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)]; - int srcGreenShift = getChannelShift(srcGreenMask); - byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)]; - int srcBlueShift = getChannelShift(srcBlueMask); - byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)]; - int srcAlphaShift = getChannelShift(srcAlphaMask); - byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)]; - - int destRedShift = getChannelShift(destRedMask); - int destRedWidth = getChannelWidth(destRedMask, destRedShift); - byte[] destReds = ANY_TO_EIGHT[destRedWidth]; - int destRedPreShift = 8 - destRedWidth; - int destGreenShift = getChannelShift(destGreenMask); - int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift); - byte[] destGreens = ANY_TO_EIGHT[destGreenWidth]; - int destGreenPreShift = 8 - destGreenWidth; - int destBlueShift = getChannelShift(destBlueMask); - int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift); - byte[] destBlues = ANY_TO_EIGHT[destBlueWidth]; - int destBluePreShift = 8 - destBlueWidth; - int destAlphaShift = getChannelShift(destAlphaMask); - int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift); - byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth]; - int destAlphaPreShift = 8 - destAlphaWidth; - - int ap = apr, alpha = alphaMode; - int r = 0, g = 0, b = 0, a = 0; - int rq = 0, gq = 0, bq = 0, aq = 0; - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, - sp = spr += (sfy >>> 16) * srcStride, - ap = apr += (sfy >>> 16) * alphaStride, - sfy = (sfy & 0xffff) + sfyi, - dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, - dp += dprxi, - sfx = (sfx & 0xffff) + sfxi) { - /*** READ NEXT PIXEL ***/ - switch (stype) { - case TYPE_GENERIC_8: { - int data = srcData[sp] & 0xff; - sp += (sfx >>> 16); - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_MSB: { - int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff); - sp += (sfx >>> 16) * 2; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_LSB: { - int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff); - sp += (sfx >>> 16) * 2; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_24: { - int data = (( ((srcData[sp] & 0xff) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp + 2] & 0xff); - sp += (sfx >>> 16) * 3; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_MSB: { - int data = (( (( ((srcData[sp] & 0xff) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp + 2] & 0xff)) << 8) | - (srcData[sp + 3] & 0xff); - sp += (sfx >>> 16) * 4; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_LSB: { - int data = (( (( ((srcData[sp + 3] & 0xff) << 8) | - (srcData[sp + 2] & 0xff)) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp] & 0xff); - sp += (sfx >>> 16) * 4; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - } - - /*** DO SPECIAL PROCESSING IF REQUIRED ***/ - switch (alphaMode) { - case ALPHA_CHANNEL_SEPARATE: - alpha = ((alphaData[ap] & 0xff) << 16) / 255; - ap += (sfx >> 16); - break; - case ALPHA_CHANNEL_SOURCE: - alpha = (a << 16) / 255; - break; - case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; - ap += (sfx >> 16); - break; - case ALPHA_MASK_PACKED: - alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; - ap += (sfx >> 16); - break; - case ALPHA_MASK_RGB: - alpha = 0x10000; - for (int i = 0; i < alphaData.length; i += 3) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { - alpha = 0x0000; - break; - } - } - break; - } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; - switch (dtype) { - case TYPE_GENERIC_8: { - int data = destData[dp] & 0xff; - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_MSB: { - int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_LSB: { - int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_24: { - int data = (( ((destData[dp] & 0xff) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp + 2] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_MSB: { - int data = (( (( ((destData[dp] & 0xff) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp + 2] & 0xff)) << 8) | - (destData[dp + 3] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_LSB: { - int data = (( (( ((destData[dp + 3] & 0xff) << 8) | - (destData[dp + 2] & 0xff)) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - } - // Perform alpha blending - a = aq + ((a - aq) * alpha >> 16); - r = rq + ((r - rq) * alpha >> 16); - g = gq + ((g - gq) * alpha >> 16); - b = bq + ((b - bq) * alpha >> 16); - } - - /*** WRITE NEXT PIXEL ***/ - int data = - (r >>> destRedPreShift << destRedShift) | - (g >>> destGreenPreShift << destGreenShift) | - (b >>> destBluePreShift << destBlueShift) | - (a >>> destAlphaPreShift << destAlphaShift); - switch (dtype) { - case TYPE_GENERIC_8: { - destData[dp] = cast(byte) data; - } break; - case TYPE_GENERIC_16_MSB: { - destData[dp] = cast(byte) (data >>> 8); - destData[dp + 1] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_16_LSB: { - destData[dp] = cast(byte) (data & 0xff); - destData[dp + 1] = cast(byte) (data >>> 8); - } break; - case TYPE_GENERIC_24: { - destData[dp] = cast(byte) (data >>> 16); - destData[dp + 1] = cast(byte) (data >>> 8); - destData[dp + 2] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_32_MSB: { - destData[dp] = cast(byte) (data >>> 24); - destData[dp + 1] = cast(byte) (data >>> 16); - destData[dp + 2] = cast(byte) (data >>> 8); - destData[dp + 3] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_32_LSB: { - destData[dp] = cast(byte) (data & 0xff); - destData[dp + 1] = cast(byte) (data >>> 8); - destData[dp + 2] = cast(byte) (data >>> 16); - destData[dp + 3] = cast(byte) (data >>> 24); - } break; - } - } - } -} - -/** - * Blits an index palette image into an index palette image. - *- * Note: The source and destination red, green, and blue - * arrays may be null if no alpha blending or dither is to be - * performed. - *
- * - * @param op the blitter operation: a combination of BLIT_xxx flags - * (see BLIT_xxx constants) - * @param srcData the source byte array containing image data - * @param srcDepth the source depth: one of 1, 2, 4, 8 - * @param srcStride the source number of bytes per line - * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if srcDepth is not 1 - * @param srcX the top-left x-coord of the source blit region - * @param srcY the top-left y-coord of the source blit region - * @param srcWidth the width of the source blit region - * @param srcHeight the height of the source blit region - * @param srcReds the source palette red component intensities - * @param srcGreens the source palette green component intensities - * @param srcBlues the source palette blue component intensities - * @param alphaMode the alpha blending or mask mode, may be - * an integer 0-255 for global alpha; ignored if BLIT_ALPHA - * not specified in the blitter operations - * (see ALPHA_MODE_xxx constants) - * @param alphaData the alpha blending or mask data, varies depending - * on the value of alphaMode and sometimes ignored - * @param alphaStride the alpha data number of bytes per line - * @param alphaX the top-left x-coord of the alpha blit region - * @param alphaY the top-left y-coord of the alpha blit region - * @param destData the destination byte array containing image data - * @param destDepth the destination depth: one of 1, 2, 4, 8 - * @param destStride the destination number of bytes per line - * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if destDepth is not 1 - * @param destX the top-left x-coord of the destination blit region - * @param destY the top-left y-coord of the destination blit region - * @param destWidth the width of the destination blit region - * @param destHeight the height of the destination blit region - * @param destReds the destination palette red component intensities - * @param destGreens the destination palette green component intensities - * @param destBlues the destination palette blue component intensities - * @param flipX if true the resulting image is flipped along the vertical axis - * @param flipY if true the resulting image is flipped along the horizontal axis - */ -static void blit(int op, - byte[] srcData, int srcDepth, int srcStride, int srcOrder, - int srcX, int srcY, int srcWidth, int srcHeight, - byte[] srcReds, byte[] srcGreens, byte[] srcBlues, - int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, - byte[] destData, int destDepth, int destStride, int destOrder, - int destX, int destY, int destWidth, int destHeight, - byte[] destReds, byte[] destGreens, byte[] destBlues, - bool flipX, bool flipY) { - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; - - /*** Prepare scaling data ***/ - int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; - int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; - - /*** Prepare source-related data ***/ - int stype; - switch (srcDepth) { - case 8: - stype = TYPE_INDEX_8; - break; - case 4: - srcStride <<= 1; - stype = TYPE_INDEX_4; - break; - case 2: - srcStride <<= 2; - stype = TYPE_INDEX_2; - break; - case 1: - srcStride <<= 3; - stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int spr = srcY * srcStride + srcX; - - /*** Prepare destination-related data ***/ - int dtype; - switch (destDepth) { - case 8: - dtype = TYPE_INDEX_8; - break; - case 4: - destStride <<= 1; - dtype = TYPE_INDEX_4; - break; - case 2: - destStride <<= 2; - dtype = TYPE_INDEX_2; - break; - case 1: - destStride <<= 3; - dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); - int dprxi = (flipX) ? -1 : 1; - int dpryi = (flipY) ? -destStride : destStride; - - /*** Prepare special processing data ***/ - int apr; - if ((op & BLIT_ALPHA) != 0) { - switch (alphaMode) { - case ALPHA_MASK_UNPACKED: - case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; - alphaStride <<= 3; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_INDEX: - case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; - apr = 0; - break; - default: - alphaMode = (alphaMode << 16) / 255; // prescale - case ALPHA_CHANNEL_SOURCE: - apr = 0; - break; - } - } else { - alphaMode = 0x10000; - apr = 0; - } - bool ditherEnabled = (op & BLIT_DITHER) != 0; - - /*** Blit ***/ - int dp = dpr; - int sp = spr; - int ap = apr; - int destPaletteSize = 1 << destDepth; - if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; - byte[] paletteMapping = null; - bool isExactPaletteMapping = true; - switch (alphaMode) { - case 0x10000: - /*** If the palettes and formats are equivalent use a one-to-one mapping ***/ - if ((stype == dtype) && - (srcReds == destReds) && (srcGreens == destGreens) && (srcBlues == destBlues)) { - paletteMapping = ONE_TO_ONE_MAPPING; - break; - /*** If palettes have not been supplied, supply a suitable mapping ***/ - } else if ((srcReds == null) || (destReds == null)) { - if (srcDepth <= destDepth) { - paletteMapping = ONE_TO_ONE_MAPPING; - } else { - paletteMapping = new byte[1 << srcDepth]; - int mask = (0xff << destDepth) >>> 8; - for (int i = 0; i < paletteMapping.length; ++i) paletteMapping[i] = cast(byte)(i & mask); - } - break; - } - case ALPHA_MASK_UNPACKED: - case ALPHA_MASK_PACKED: - case ALPHA_MASK_INDEX: - case ALPHA_MASK_RGB: - /*** Generate a palette mapping ***/ - int srcPaletteSize = 1 << srcDepth; - paletteMapping = new byte[srcPaletteSize]; - if ((srcReds != null) && (srcReds.length < srcPaletteSize)) srcPaletteSize = srcReds.length; - for (int i = 0, r, g, b, index; i < srcPaletteSize; ++i) { - r = srcReds[i] & 0xff; - g = srcGreens[i] & 0xff; - b = srcBlues[i] & 0xff; - index = 0; - int minDistance = 0x7fffffff; - for (int j = 0, dr, dg, db, distance; j < destPaletteSize; ++j) { - dr = (destReds[j] & 0xff) - r; - dg = (destGreens[j] & 0xff) - g; - db = (destBlues[j] & 0xff) - b; - distance = dr * dr + dg * dg + db * db; - if (distance < minDistance) { - index = j; - if (distance == 0) break; - minDistance = distance; - } - } - paletteMapping[i] = cast(byte)index; - if (minDistance != 0) isExactPaletteMapping = false; - } - break; - } - if ((paletteMapping != null) && (isExactPaletteMapping || ! ditherEnabled)) { - if ((stype == dtype) && (alphaMode == 0x10000)) { - /*** Fast blit (copy w/ mapping) ***/ - switch (stype) { - case TYPE_INDEX_8: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - destData[dp] = paletteMapping[srcData[sp] & 0xff]; - sp += (sfx >>> 16); - } - } - break; - case TYPE_INDEX_4: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - int v; - if ((sp & 1) != 0) v = paletteMapping[srcData[sp >> 1] & 0x0f]; - else v = (srcData[sp >> 1] >>> 4) & 0x0f; - sp += (sfx >>> 16); - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | v); - else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (v << 4)); - } - } - break; - case TYPE_INDEX_2: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - int index = paletteMapping[(srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03]; - sp += (sfx >>> 16); - int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); - } - } - break; - case TYPE_INDEX_1_MSB: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - int index = paletteMapping[(srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01]; - sp += (sfx >>> 16); - int shift = 7 - (dp & 7); - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); - } - } - break; - case TYPE_INDEX_1_LSB: - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, sp = spr += (sfy >>> 16) * srcStride, sfy = (sfy & 0xffff) + sfyi, dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, dp += dprxi, sfx = (sfx & 0xffff) + sfxi) { - int index = paletteMapping[(srcData[sp >> 3] >>> (sp & 7)) & 0x01]; - sp += (sfx >>> 16); - int shift = dp & 7; - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); - } - } - break; - } - } else { - /*** Convert between indexed modes using mapping and mask ***/ - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, - sp = spr += (sfy >>> 16) * srcStride, - sfy = (sfy & 0xffff) + sfyi, - dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, - dp += dprxi, - sfx = (sfx & 0xffff) + sfxi) { - int index; - /*** READ NEXT PIXEL ***/ - switch (stype) { - case TYPE_INDEX_8: - index = srcData[sp] & 0xff; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; - else index = (srcData[sp >> 1] >>> 4) & 0x0f; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_2: - index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_MSB: - index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_LSB: - index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; - sp += (sfx >>> 16); - break; - default: - return; - } - /*** APPLY MASK ***/ - switch (alphaMode) { - case ALPHA_MASK_UNPACKED: { - byte mask = alphaData[ap]; - ap += (sfx >> 16); - if (mask == 0) continue; - } break; - case ALPHA_MASK_PACKED: { - int mask = alphaData[ap >> 3] & (1 << (ap & 7)); - ap += (sfx >> 16); - if (mask == 0) continue; - } break; - case ALPHA_MASK_INDEX: { - int i = 0; - while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; - } - if (i < alphaData.length) continue; - } break; - case ALPHA_MASK_RGB: { - byte r = srcReds[index], g = srcGreens[index], b = srcBlues[index]; - int i = 0; - while (i < alphaData.length) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) break; - i += 3; - } - if (i < alphaData.length) continue; - } break; - } - index = paletteMapping[index] & 0xff; - - /*** WRITE NEXT PIXEL ***/ - switch (dtype) { - case TYPE_INDEX_8: - destData[dp] = cast(byte) index; - break; - case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | index); - else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (index << 4)); - break; - case TYPE_INDEX_2: { - int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (index << shift)); - } break; - case TYPE_INDEX_1_MSB: { - int shift = 7 - (dp & 7); - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); - } break; - case TYPE_INDEX_1_LSB: { - int shift = dp & 7; - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (index << shift)); - } break; - } - } - } - } - return; - } - - /*** Comprehensive blit (apply transformations) ***/ - int alpha = alphaMode; - int index = 0; - int indexq = 0; - int lastindex = 0, lastr = -1, lastg = -1, lastb = -1; - int[] rerr, gerr, berr; - if (ditherEnabled) { - rerr = new int[destWidth + 2]; - gerr = new int[destWidth + 2]; - berr = new int[destWidth + 2]; - } else { - rerr = null; gerr = null; berr = null; - } - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, - sp = spr += (sfy >>> 16) * srcStride, - ap = apr += (sfy >>> 16) * alphaStride, - sfy = (sfy & 0xffff) + sfyi, - dp = dpr += dpryi) { - int lrerr = 0, lgerr = 0, lberr = 0; - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, - dp += dprxi, - sfx = (sfx & 0xffff) + sfxi) { - /*** READ NEXT PIXEL ***/ - switch (stype) { - case TYPE_INDEX_8: - index = srcData[sp] & 0xff; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; - else index = (srcData[sp >> 1] >>> 4) & 0x0f; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_2: - index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_MSB: - index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_LSB: - index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; - sp += (sfx >>> 16); - break; - } - - /*** DO SPECIAL PROCESSING IF REQUIRED ***/ - int r = srcReds[index] & 0xff, g = srcGreens[index] & 0xff, b = srcBlues[index] & 0xff; - switch (alphaMode) { - case ALPHA_CHANNEL_SEPARATE: - alpha = ((alphaData[ap] & 0xff) << 16) / 255; - ap += (sfx >> 16); - break; - case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; - ap += (sfx >> 16); - break; - case ALPHA_MASK_PACKED: - alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; - ap += (sfx >> 16); - break; - case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices - int i = 0; - while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; - } - if (i < alphaData.length) continue; - } break; - case ALPHA_MASK_RGB: { - int i = 0; - while (i < alphaData.length) { - if ((r == (alphaData[i] & 0xff)) && - (g == (alphaData[i + 1] & 0xff)) && - (b == (alphaData[i + 2] & 0xff))) break; - i += 3; - } - if (i < alphaData.length) continue; - } break; - } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; - switch (dtype) { - case TYPE_INDEX_8: - indexq = destData[dp] & 0xff; - break; - case TYPE_INDEX_4: - if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; - else indexq = (destData[dp >> 1] >>> 4) & 0x0f; - break; - case TYPE_INDEX_2: - indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03; - break; - case TYPE_INDEX_1_MSB: - indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01; - break; - case TYPE_INDEX_1_LSB: - indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01; - break; - } - // Perform alpha blending - int rq = destReds[indexq] & 0xff; - int gq = destGreens[indexq] & 0xff; - int bq = destBlues[indexq] & 0xff; - r = rq + ((r - rq) * alpha >> 16); - g = gq + ((g - gq) * alpha >> 16); - b = bq + ((b - bq) * alpha >> 16); - } - - /*** MAP COLOR TO THE PALETTE ***/ - if (ditherEnabled) { - // Floyd-Steinberg error diffusion - r += rerr[dx] >> 4; - if (r < 0) r = 0; else if (r > 255) r = 255; - g += gerr[dx] >> 4; - if (g < 0) g = 0; else if (g > 255) g = 255; - b += berr[dx] >> 4; - if (b < 0) b = 0; else if (b > 255) b = 255; - rerr[dx] = lrerr; - gerr[dx] = lgerr; - berr[dx] = lberr; - } - if (r != lastr || g != lastg || b != lastb) { - // moving the variable declarations out seems to make the JDK JIT happier... - for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { - dr = (destReds[j] & 0xff) - r; - dg = (destGreens[j] & 0xff) - g; - db = (destBlues[j] & 0xff) - b; - distance = dr * dr + dg * dg + db * db; - if (distance < minDistance) { - lastindex = j; - if (distance == 0) break; - minDistance = distance; - } - } - lastr = r; lastg = g; lastb = b; - } - if (ditherEnabled) { - // Floyd-Steinberg error diffusion, cont'd... - int dxm1 = dx - 1, dxp1 = dx + 1; - int acc; - rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr; - rerr[dx] += acc += lrerr + lrerr; - rerr[dxm1] += acc + lrerr + lrerr; - gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr; - gerr[dx] += acc += lgerr + lgerr; - gerr[dxm1] += acc + lgerr + lgerr; - berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr; - berr[dx] += acc += lberr + lberr; - berr[dxm1] += acc + lberr + lberr; - } - - /*** WRITE NEXT PIXEL ***/ - switch (dtype) { - case TYPE_INDEX_8: - destData[dp] = cast(byte) lastindex; - break; - case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); - else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); - break; - case TYPE_INDEX_2: { - int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); - } break; - case TYPE_INDEX_1_MSB: { - int shift = 7 - (dp & 7); - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; - case TYPE_INDEX_1_LSB: { - int shift = dp & 7; - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; - } - } - } -} - -/** - * Blits an index palette image into a direct palette image. - *- * Note: The source and destination masks and palettes must - * always be fully specified. - *
- * - * @param op the blitter operation: a combination of BLIT_xxx flags - * (see BLIT_xxx constants) - * @param srcData the source byte array containing image data - * @param srcDepth the source depth: one of 1, 2, 4, 8 - * @param srcStride the source number of bytes per line - * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if srcDepth is not 1 - * @param srcX the top-left x-coord of the source blit region - * @param srcY the top-left y-coord of the source blit region - * @param srcWidth the width of the source blit region - * @param srcHeight the height of the source blit region - * @param srcReds the source palette red component intensities - * @param srcGreens the source palette green component intensities - * @param srcBlues the source palette blue component intensities - * @param alphaMode the alpha blending or mask mode, may be - * an integer 0-255 for global alpha; ignored if BLIT_ALPHA - * not specified in the blitter operations - * (see ALPHA_MODE_xxx constants) - * @param alphaData the alpha blending or mask data, varies depending - * on the value of alphaMode and sometimes ignored - * @param alphaStride the alpha data number of bytes per line - * @param alphaX the top-left x-coord of the alpha blit region - * @param alphaY the top-left y-coord of the alpha blit region - * @param destData the destination byte array containing image data - * @param destDepth the destination depth: one of 8, 16, 24, 32 - * @param destStride the destination number of bytes per line - * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if destDepth is not 16 or 32 - * @param destX the top-left x-coord of the destination blit region - * @param destY the top-left y-coord of the destination blit region - * @param destWidth the width of the destination blit region - * @param destHeight the height of the destination blit region - * @param destRedMask the destination red channel mask - * @param destGreenMask the destination green channel mask - * @param destBlueMask the destination blue channel mask - * @param flipX if true the resulting image is flipped along the vertical axis - * @param flipY if true the resulting image is flipped along the horizontal axis - */ -static void blit(int op, - byte[] srcData, int srcDepth, int srcStride, int srcOrder, - int srcX, int srcY, int srcWidth, int srcHeight, - byte[] srcReds, byte[] srcGreens, byte[] srcBlues, - int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, - byte[] destData, int destDepth, int destStride, int destOrder, - int destX, int destY, int destWidth, int destHeight, - int destRedMask, int destGreenMask, int destBlueMask, - bool flipX, bool flipY) { - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; - - // these should be supplied as params later - int destAlphaMask = 0; - - /*** Prepare scaling data ***/ - int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; - int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; - - /*** Prepare source-related data ***/ - int stype; - switch (srcDepth) { - case 8: - stype = TYPE_INDEX_8; - break; - case 4: - srcStride <<= 1; - stype = TYPE_INDEX_4; - break; - case 2: - srcStride <<= 2; - stype = TYPE_INDEX_2; - break; - case 1: - srcStride <<= 3; - stype = (srcOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int spr = srcY * srcStride + srcX; - - /*** Prepare destination-related data ***/ - int dbpp, dtype; - switch (destDepth) { - case 8: - dbpp = 1; - dtype = TYPE_GENERIC_8; - break; - case 16: - dbpp = 2; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; - break; - case 24: - dbpp = 3; - dtype = TYPE_GENERIC_24; - break; - case 32: - dbpp = 4; - dtype = (destOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid destination type"); - return; - } - int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX) * dbpp; - int dprxi = (flipX) ? -dbpp : dbpp; - int dpryi = (flipY) ? -destStride : destStride; - - /*** Prepare special processing data ***/ - int apr; - if ((op & BLIT_ALPHA) != 0) { - switch (alphaMode) { - case ALPHA_MASK_UNPACKED: - case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; - alphaStride <<= 3; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_INDEX: - case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; - apr = 0; - break; - default: - alphaMode = (alphaMode << 16) / 255; // prescale - case ALPHA_CHANNEL_SOURCE: - apr = 0; - break; - } - } else { - alphaMode = 0x10000; - apr = 0; - } - - /*** Comprehensive blit (apply transformations) ***/ - int destRedShift = getChannelShift(destRedMask); - int destRedWidth = getChannelWidth(destRedMask, destRedShift); - byte[] destReds = ANY_TO_EIGHT[destRedWidth]; - int destRedPreShift = 8 - destRedWidth; - int destGreenShift = getChannelShift(destGreenMask); - int destGreenWidth = getChannelWidth(destGreenMask, destGreenShift); - byte[] destGreens = ANY_TO_EIGHT[destGreenWidth]; - int destGreenPreShift = 8 - destGreenWidth; - int destBlueShift = getChannelShift(destBlueMask); - int destBlueWidth = getChannelWidth(destBlueMask, destBlueShift); - byte[] destBlues = ANY_TO_EIGHT[destBlueWidth]; - int destBluePreShift = 8 - destBlueWidth; - int destAlphaShift = getChannelShift(destAlphaMask); - int destAlphaWidth = getChannelWidth(destAlphaMask, destAlphaShift); - byte[] destAlphas = ANY_TO_EIGHT[destAlphaWidth]; - int destAlphaPreShift = 8 - destAlphaWidth; - - int dp = dpr; - int sp = spr; - int ap = apr, alpha = alphaMode; - int r = 0, g = 0, b = 0, a = 0, index = 0; - int rq = 0, gq = 0, bq = 0, aq = 0; - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, - sp = spr += (sfy >>> 16) * srcStride, - ap = apr += (sfy >>> 16) * alphaStride, - sfy = (sfy & 0xffff) + sfyi, - dp = dpr += dpryi) { - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, - dp += dprxi, - sfx = (sfx & 0xffff) + sfxi) { - /*** READ NEXT PIXEL ***/ - switch (stype) { - case TYPE_INDEX_8: - index = srcData[sp] & 0xff; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_4: - if ((sp & 1) != 0) index = srcData[sp >> 1] & 0x0f; - else index = (srcData[sp >> 1] >>> 4) & 0x0f; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_2: - index = (srcData[sp >> 2] >>> (6 - (sp & 3) * 2)) & 0x03; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_MSB: - index = (srcData[sp >> 3] >>> (7 - (sp & 7))) & 0x01; - sp += (sfx >>> 16); - break; - case TYPE_INDEX_1_LSB: - index = (srcData[sp >> 3] >>> (sp & 7)) & 0x01; - sp += (sfx >>> 16); - break; - } - - /*** DO SPECIAL PROCESSING IF REQUIRED ***/ - r = srcReds[index] & 0xff; - g = srcGreens[index] & 0xff; - b = srcBlues[index] & 0xff; - switch (alphaMode) { - case ALPHA_CHANNEL_SEPARATE: - alpha = ((alphaData[ap] & 0xff) << 16) / 255; - ap += (sfx >> 16); - break; - case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; - ap += (sfx >> 16); - break; - case ALPHA_MASK_PACKED: - alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; - ap += (sfx >> 16); - break; - case ALPHA_MASK_INDEX: { // could speed up using binary search if we sorted the indices - int i = 0; - while (i < alphaData.length) { - if (index == (alphaData[i] & 0xff)) break; - } - if (i < alphaData.length) continue; - } break; - case ALPHA_MASK_RGB: { - int i = 0; - while (i < alphaData.length) { - if ((r == (alphaData[i] & 0xff)) && - (g == (alphaData[i + 1] & 0xff)) && - (b == (alphaData[i + 2] & 0xff))) break; - i += 3; - } - if (i < alphaData.length) continue; - } break; - } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; - switch (dtype) { - case TYPE_GENERIC_8: { - int data = destData[dp] & 0xff; - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_MSB: { - int data = ((destData[dp] & 0xff) << 8) | (destData[dp + 1] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_LSB: { - int data = ((destData[dp + 1] & 0xff) << 8) | (destData[dp] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_24: { - int data = (( ((destData[dp] & 0xff) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp + 2] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_MSB: { - int data = (( (( ((destData[dp] & 0xff) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp + 2] & 0xff)) << 8) | - (destData[dp + 3] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_LSB: { - int data = (( (( ((destData[dp + 3] & 0xff) << 8) | - (destData[dp + 2] & 0xff)) << 8) | - (destData[dp + 1] & 0xff)) << 8) | - (destData[dp] & 0xff); - rq = destReds[(data & destRedMask) >>> destRedShift] & 0xff; - gq = destGreens[(data & destGreenMask) >>> destGreenShift] & 0xff; - bq = destBlues[(data & destBlueMask) >>> destBlueShift] & 0xff; - aq = destAlphas[(data & destAlphaMask) >>> destAlphaShift] & 0xff; - } break; - } - // Perform alpha blending - a = aq + ((a - aq) * alpha >> 16); - r = rq + ((r - rq) * alpha >> 16); - g = gq + ((g - gq) * alpha >> 16); - b = bq + ((b - bq) * alpha >> 16); - } - - /*** WRITE NEXT PIXEL ***/ - int data = - (r >>> destRedPreShift << destRedShift) | - (g >>> destGreenPreShift << destGreenShift) | - (b >>> destBluePreShift << destBlueShift) | - (a >>> destAlphaPreShift << destAlphaShift); - switch (dtype) { - case TYPE_GENERIC_8: { - destData[dp] = cast(byte) data; - } break; - case TYPE_GENERIC_16_MSB: { - destData[dp] = cast(byte) (data >>> 8); - destData[dp + 1] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_16_LSB: { - destData[dp] = cast(byte) (data & 0xff); - destData[dp + 1] = cast(byte) (data >>> 8); - } break; - case TYPE_GENERIC_24: { - destData[dp] = cast(byte) (data >>> 16); - destData[dp + 1] = cast(byte) (data >>> 8); - destData[dp + 2] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_32_MSB: { - destData[dp] = cast(byte) (data >>> 24); - destData[dp + 1] = cast(byte) (data >>> 16); - destData[dp + 2] = cast(byte) (data >>> 8); - destData[dp + 3] = cast(byte) (data & 0xff); - } break; - case TYPE_GENERIC_32_LSB: { - destData[dp] = cast(byte) (data & 0xff); - destData[dp + 1] = cast(byte) (data >>> 8); - destData[dp + 2] = cast(byte) (data >>> 16); - destData[dp + 3] = cast(byte) (data >>> 24); - } break; - } - } - } -} - -/** - * Blits a direct palette image into an index palette image. - *- * Note: The source and destination masks and palettes must - * always be fully specified. - *
- * - * @param op the blitter operation: a combination of BLIT_xxx flags - * (see BLIT_xxx constants) - * @param srcData the source byte array containing image data - * @param srcDepth the source depth: one of 8, 16, 24, 32 - * @param srcStride the source number of bytes per line - * @param srcOrder the source byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if srcDepth is not 16 or 32 - * @param srcX the top-left x-coord of the source blit region - * @param srcY the top-left y-coord of the source blit region - * @param srcWidth the width of the source blit region - * @param srcHeight the height of the source blit region - * @param srcRedMask the source red channel mask - * @param srcGreenMask the source green channel mask - * @param srcBlueMask the source blue channel mask - * @param alphaMode the alpha blending or mask mode, may be - * an integer 0-255 for global alpha; ignored if BLIT_ALPHA - * not specified in the blitter operations - * (see ALPHA_MODE_xxx constants) - * @param alphaData the alpha blending or mask data, varies depending - * on the value of alphaMode and sometimes ignored - * @param alphaStride the alpha data number of bytes per line - * @param alphaX the top-left x-coord of the alpha blit region - * @param alphaY the top-left y-coord of the alpha blit region - * @param destData the destination byte array containing image data - * @param destDepth the destination depth: one of 1, 2, 4, 8 - * @param destStride the destination number of bytes per line - * @param destOrder the destination byte ordering: one of MSB_FIRST or LSB_FIRST; - * ignored if destDepth is not 1 - * @param destX the top-left x-coord of the destination blit region - * @param destY the top-left y-coord of the destination blit region - * @param destWidth the width of the destination blit region - * @param destHeight the height of the destination blit region - * @param destReds the destination palette red component intensities - * @param destGreens the destination palette green component intensities - * @param destBlues the destination palette blue component intensities - * @param flipX if true the resulting image is flipped along the vertical axis - * @param flipY if true the resulting image is flipped along the horizontal axis - */ -static void blit(int op, - byte[] srcData, int srcDepth, int srcStride, int srcOrder, - int srcX, int srcY, int srcWidth, int srcHeight, - int srcRedMask, int srcGreenMask, int srcBlueMask, - int alphaMode, byte[] alphaData, int alphaStride, int alphaX, int alphaY, - byte[] destData, int destDepth, int destStride, int destOrder, - int destX, int destY, int destWidth, int destHeight, - byte[] destReds, byte[] destGreens, byte[] destBlues, - bool flipX, bool flipY) { - if ((destWidth <= 0) || (destHeight <= 0) || (alphaMode == ALPHA_TRANSPARENT)) return; - - // these should be supplied as params later - int srcAlphaMask = 0; - - /*** Prepare scaling data ***/ - int dwm1 = destWidth - 1; - int sfxi = (dwm1 != 0) ? cast(int)(((cast(long)srcWidth << 16) - 1) / dwm1) : 0; - int dhm1 = destHeight - 1; - int sfyi = (dhm1 != 0) ? cast(int)(((cast(long)srcHeight << 16) - 1) / dhm1) : 0; - - /*** Prepare source-related data ***/ - int sbpp, stype; - switch (srcDepth) { - case 8: - sbpp = 1; - stype = TYPE_GENERIC_8; - break; - case 16: - sbpp = 2; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_16_MSB : TYPE_GENERIC_16_LSB; - break; - case 24: - sbpp = 3; - stype = TYPE_GENERIC_24; - break; - case 32: - sbpp = 4; - stype = (srcOrder == MSB_FIRST) ? TYPE_GENERIC_32_MSB : TYPE_GENERIC_32_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int spr = srcY * srcStride + srcX * sbpp; - - /*** Prepare destination-related data ***/ - int dtype; - switch (destDepth) { - case 8: - dtype = TYPE_INDEX_8; - break; - case 4: - destStride <<= 1; - dtype = TYPE_INDEX_4; - break; - case 2: - destStride <<= 2; - dtype = TYPE_INDEX_2; - break; - case 1: - destStride <<= 3; - dtype = (destOrder == MSB_FIRST) ? TYPE_INDEX_1_MSB : TYPE_INDEX_1_LSB; - break; - default: - //throw new IllegalArgumentException("Invalid source type"); - return; - } - int dpr = ((flipY) ? destY + dhm1 : destY) * destStride + ((flipX) ? destX + dwm1 : destX); - int dprxi = (flipX) ? -1 : 1; - int dpryi = (flipY) ? -destStride : destStride; - - /*** Prepare special processing data ***/ - int apr; - if ((op & BLIT_ALPHA) != 0) { - switch (alphaMode) { - case ALPHA_MASK_UNPACKED: - case ALPHA_CHANNEL_SEPARATE: - if (alphaData == null) alphaMode = 0x10000; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_PACKED: - if (alphaData == null) alphaMode = 0x10000; - alphaStride <<= 3; - apr = alphaY * alphaStride + alphaX; - break; - case ALPHA_MASK_INDEX: - //throw new IllegalArgumentException("Invalid alpha type"); - return; - case ALPHA_MASK_RGB: - if (alphaData == null) alphaMode = 0x10000; - apr = 0; - break; - default: - alphaMode = (alphaMode << 16) / 255; // prescale - case ALPHA_CHANNEL_SOURCE: - apr = 0; - break; - } - } else { - alphaMode = 0x10000; - apr = 0; - } - bool ditherEnabled = (op & BLIT_DITHER) != 0; - - /*** Comprehensive blit (apply transformations) ***/ - int srcRedShift = getChannelShift(srcRedMask); - byte[] srcReds = ANY_TO_EIGHT[getChannelWidth(srcRedMask, srcRedShift)]; - int srcGreenShift = getChannelShift(srcGreenMask); - byte[] srcGreens = ANY_TO_EIGHT[getChannelWidth(srcGreenMask, srcGreenShift)]; - int srcBlueShift = getChannelShift(srcBlueMask); - byte[] srcBlues = ANY_TO_EIGHT[getChannelWidth(srcBlueMask, srcBlueShift)]; - int srcAlphaShift = getChannelShift(srcAlphaMask); - byte[] srcAlphas = ANY_TO_EIGHT[getChannelWidth(srcAlphaMask, srcAlphaShift)]; - - int dp = dpr; - int sp = spr; - int ap = apr, alpha = alphaMode; - int r = 0, g = 0, b = 0, a = 0; - int indexq = 0; - int lastindex = 0, lastr = -1, lastg = -1, lastb = -1; - int[] rerr, gerr, berr; - int destPaletteSize = 1 << destDepth; - if ((destReds != null) && (destReds.length < destPaletteSize)) destPaletteSize = destReds.length; - if (ditherEnabled) { - rerr = new int[destWidth + 2]; - gerr = new int[destWidth + 2]; - berr = new int[destWidth + 2]; - } else { - rerr = null; gerr = null; berr = null; - } - for (int dy = destHeight, sfy = sfyi; dy > 0; --dy, - sp = spr += (sfy >>> 16) * srcStride, - ap = apr += (sfy >>> 16) * alphaStride, - sfy = (sfy & 0xffff) + sfyi, - dp = dpr += dpryi) { - int lrerr = 0, lgerr = 0, lberr = 0; - for (int dx = destWidth, sfx = sfxi; dx > 0; --dx, - dp += dprxi, - sfx = (sfx & 0xffff) + sfxi) { - /*** READ NEXT PIXEL ***/ - switch (stype) { - case TYPE_GENERIC_8: { - int data = srcData[sp] & 0xff; - sp += (sfx >>> 16); - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_MSB: { - int data = ((srcData[sp] & 0xff) << 8) | (srcData[sp + 1] & 0xff); - sp += (sfx >>> 16) * 2; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_16_LSB: { - int data = ((srcData[sp + 1] & 0xff) << 8) | (srcData[sp] & 0xff); - sp += (sfx >>> 16) * 2; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_24: { - int data = (( ((srcData[sp] & 0xff) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp + 2] & 0xff); - sp += (sfx >>> 16) * 3; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_MSB: { - int data = (( (( ((srcData[sp] & 0xff) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp + 2] & 0xff)) << 8) | - (srcData[sp + 3] & 0xff); - sp += (sfx >>> 16) * 4; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - case TYPE_GENERIC_32_LSB: { - int data = (( (( ((srcData[sp + 3] & 0xff) << 8) | - (srcData[sp + 2] & 0xff)) << 8) | - (srcData[sp + 1] & 0xff)) << 8) | - (srcData[sp] & 0xff); - sp += (sfx >>> 16) * 4; - r = srcReds[(data & srcRedMask) >>> srcRedShift] & 0xff; - g = srcGreens[(data & srcGreenMask) >>> srcGreenShift] & 0xff; - b = srcBlues[(data & srcBlueMask) >>> srcBlueShift] & 0xff; - a = srcAlphas[(data & srcAlphaMask) >>> srcAlphaShift] & 0xff; - } break; - } - - /*** DO SPECIAL PROCESSING IF REQUIRED ***/ - switch (alphaMode) { - case ALPHA_CHANNEL_SEPARATE: - alpha = ((alphaData[ap] & 0xff) << 16) / 255; - ap += (sfx >> 16); - break; - case ALPHA_CHANNEL_SOURCE: - alpha = (a << 16) / 255; - break; - case ALPHA_MASK_UNPACKED: - alpha = (alphaData[ap] != 0) ? 0x10000 : 0; - ap += (sfx >> 16); - break; - case ALPHA_MASK_PACKED: - alpha = (alphaData[ap >> 3] << ((ap & 7) + 9)) & 0x10000; - ap += (sfx >> 16); - break; - case ALPHA_MASK_RGB: - alpha = 0x10000; - for (int i = 0; i < alphaData.length; i += 3) { - if ((r == alphaData[i]) && (g == alphaData[i + 1]) && (b == alphaData[i + 2])) { - alpha = 0x0000; - break; - } - } - break; - } - if (alpha != 0x10000) { - if (alpha == 0x0000) continue; - switch (dtype) { - case TYPE_INDEX_8: - indexq = destData[dp] & 0xff; - break; - case TYPE_INDEX_4: - if ((dp & 1) != 0) indexq = destData[dp >> 1] & 0x0f; - else indexq = (destData[dp >> 1] >>> 4) & 0x0f; - break; - case TYPE_INDEX_2: - indexq = (destData[dp >> 2] >>> (6 - (dp & 3) * 2)) & 0x03; - break; - case TYPE_INDEX_1_MSB: - indexq = (destData[dp >> 3] >>> (7 - (dp & 7))) & 0x01; - break; - case TYPE_INDEX_1_LSB: - indexq = (destData[dp >> 3] >>> (dp & 7)) & 0x01; - break; - } - // Perform alpha blending - int rq = destReds[indexq] & 0xff; - int gq = destGreens[indexq] & 0xff; - int bq = destBlues[indexq] & 0xff; - r = rq + ((r - rq) * alpha >> 16); - g = gq + ((g - gq) * alpha >> 16); - b = bq + ((b - bq) * alpha >> 16); - } - - /*** MAP COLOR TO THE PALETTE ***/ - if (ditherEnabled) { - // Floyd-Steinberg error diffusion - r += rerr[dx] >> 4; - if (r < 0) r = 0; else if (r > 255) r = 255; - g += gerr[dx] >> 4; - if (g < 0) g = 0; else if (g > 255) g = 255; - b += berr[dx] >> 4; - if (b < 0) b = 0; else if (b > 255) b = 255; - rerr[dx] = lrerr; - gerr[dx] = lgerr; - berr[dx] = lberr; - } - if (r != lastr || g != lastg || b != lastb) { - // moving the variable declarations out seems to make the JDK JIT happier... - for (int j = 0, dr, dg, db, distance, minDistance = 0x7fffffff; j < destPaletteSize; ++j) { - dr = (destReds[j] & 0xff) - r; - dg = (destGreens[j] & 0xff) - g; - db = (destBlues[j] & 0xff) - b; - distance = dr * dr + dg * dg + db * db; - if (distance < minDistance) { - lastindex = j; - if (distance == 0) break; - minDistance = distance; - } - } - lastr = r; lastg = g; lastb = b; - } - if (ditherEnabled) { - // Floyd-Steinberg error diffusion, cont'd... - int dxm1 = dx - 1, dxp1 = dx + 1; - int acc; - rerr[dxp1] += acc = (lrerr = r - (destReds[lastindex] & 0xff)) + lrerr + lrerr; - rerr[dx] += acc += lrerr + lrerr; - rerr[dxm1] += acc + lrerr + lrerr; - gerr[dxp1] += acc = (lgerr = g - (destGreens[lastindex] & 0xff)) + lgerr + lgerr; - gerr[dx] += acc += lgerr + lgerr; - gerr[dxm1] += acc + lgerr + lgerr; - berr[dxp1] += acc = (lberr = b - (destBlues[lastindex] & 0xff)) + lberr + lberr; - berr[dx] += acc += lberr + lberr; - berr[dxm1] += acc + lberr + lberr; - } - - /*** WRITE NEXT PIXEL ***/ - switch (dtype) { - case TYPE_INDEX_8: - destData[dp] = cast(byte) lastindex; - break; - case TYPE_INDEX_4: - if ((dp & 1) != 0) destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0xf0) | lastindex); - else destData[dp >> 1] = cast(byte)((destData[dp >> 1] & 0x0f) | (lastindex << 4)); - break; - case TYPE_INDEX_2: { - int shift = 6 - (dp & 3) * 2; - destData[dp >> 2] = cast(byte)(destData[dp >> 2] & ~(0x03 << shift) | (lastindex << shift)); - } break; - case TYPE_INDEX_1_MSB: { - int shift = 7 - (dp & 7); - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; - case TYPE_INDEX_1_LSB: { - int shift = dp & 7; - destData[dp >> 3] = cast(byte)(destData[dp >> 3] & ~(0x01 << shift) | (lastindex << shift)); - } break; - } - } - } -} - -/** - * Computes the required channel shift from a mask. - */ -static int getChannelShift(int mask) { - if (mask == 0) return 0; - int i; - for (i = 0; ((mask & 1) == 0) && (i < 32); ++i) { - mask >>>= 1; - } - return i; -} - -/** - * Computes the required channel width (depth) from a mask. - */ -static int getChannelWidth(int mask, int shift) { - if (mask == 0) return 0; - int i; - mask >>>= shift; - for (i = shift; ((mask & 1) != 0) && (i < 32); ++i) { - mask >>>= 1; - } - return i - shift; -} - -/** - * Extracts a field from packed RGB data given a mask for that field. - */ -static byte getChannelField(int data, int mask) { - int shift = getChannelShift(mask); - return ANY_TO_EIGHT[getChannelWidth(mask, shift)][(data & mask) >>> shift]; -} - -/** - * Creates an ImageData containing one band's worth of a gradient filled - * block. Ifvertical
is true, the band must be tiled
- * horizontally to fill a region, otherwise it must be tiled vertically.
- *
- * @param width the width of the region to be filled
- * @param height the height of the region to be filled
- * @param vertical if true sweeps from top to bottom, else
- * sweeps from left to right
- * @param fromRGB the color to start with
- * @param toRGB the color to end with
- * @param redBits the number of significant red bits, 0 for palette modes
- * @param greenBits the number of significant green bits, 0 for palette modes
- * @param blueBits the number of significant blue bits, 0 for palette modes
- * @return the new ImageData
- */
-static ImageData createGradientBand(
- int width, int height, bool vertical,
- RGB fromRGB, RGB toRGB,
- int redBits, int greenBits, int blueBits) {
- /* Gradients are drawn as tiled bands */
- int bandWidth, bandHeight, bitmapDepth;
- byte[] bitmapData;
- PaletteData paletteData;
- /* Select an algorithm depending on the depth of the screen */
- if (redBits != 0 && greenBits != 0 && blueBits != 0) {
- paletteData = new PaletteData(0x0000ff00, 0x00ff0000, 0xff000000);
- bitmapDepth = 32;
- if (redBits >= 8 && greenBits >= 8 && blueBits >= 8) {
- /* Precise color */
- int steps;
- if (vertical) {
- bandWidth = 1;
- bandHeight = height;
- steps = bandHeight > 1 ? bandHeight - 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = 1;
- steps = bandWidth > 1 ? bandWidth - 1 : 1;
- }
- int bytesPerLine = bandWidth * 4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- buildPreciseGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine);
- buildPreciseGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine);
- buildPreciseGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine);
- } else {
- /* Dithered color */
- int steps;
- if (vertical) {
- bandWidth = (width < 8) ? width : 8;
- bandHeight = height;
- steps = bandHeight > 1 ? bandHeight - 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = (height < 8) ? height : 8;
- steps = bandWidth > 1 ? bandWidth - 1 : 1;
- }
- int bytesPerLine = bandWidth * 4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- buildDitheredGradientChannel(fromRGB.blue, toRGB.blue, steps, bandWidth, bandHeight, vertical, bitmapData, 0, bytesPerLine, blueBits);
- buildDitheredGradientChannel(fromRGB.green, toRGB.green, steps, bandWidth, bandHeight, vertical, bitmapData, 1, bytesPerLine, greenBits);
- buildDitheredGradientChannel(fromRGB.red, toRGB.red, steps, bandWidth, bandHeight, vertical, bitmapData, 2, bytesPerLine, redBits);
- }
- } else {
- /* Dithered two tone */
- paletteData = new PaletteData([ fromRGB, toRGB ]);
- bitmapDepth = 8;
- int blendi;
- if (vertical) {
- bandWidth = (width < 8) ? width : 8;
- bandHeight = height;
- blendi = (bandHeight > 1) ? 0x1040000 / (bandHeight - 1) + 1 : 1;
- } else {
- bandWidth = width;
- bandHeight = (height < 8) ? height : 8;
- blendi = (bandWidth > 1) ? 0x1040000 / (bandWidth - 1) + 1 : 1;
- }
- int bytesPerLine = (bandWidth + 3) & -4;
- bitmapData = new byte[bandHeight * bytesPerLine];
- if (vertical) {
- for (int dy = 0, blend = 0, dp = 0; dy < bandHeight;
- ++dy, blend += blendi, dp += bytesPerLine) {
- for (int dx = 0; dx < bandWidth; ++dx) {
- bitmapData[dp + dx] = (blend + DITHER_MATRIX[dy & 7][dx]) <
- 0x1000000 ? cast(byte)0 : cast(byte)1;
- }
- }
- } else {
- for (int dx = 0, blend = 0; dx < bandWidth; ++dx, blend += blendi) {
- for (int dy = 0, dptr = dx; dy < bandHeight; ++dy, dptr += bytesPerLine) {
- bitmapData[dptr] = (blend + DITHER_MATRIX[dy][dx & 7]) <
- 0x1000000 ? cast(byte)0 : cast(byte)1;
- }
- }
- }
- }
- return new ImageData(bandWidth, bandHeight, bitmapDepth, paletteData, 4, bitmapData);
-}
-
-/*
- * Fill in gradated values for a color channel
- */
-static final void buildPreciseGradientChannel(int from, int to, int steps,
- int bandWidth, int bandHeight, bool vertical,
- byte[] bitmapData, int dp, int bytesPerLine) {
- int val = from << 16;
- int inc = ((to << 16) - val) / steps + 1;
- if (vertical) {
- for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
- bitmapData[dp] = cast(byte)(val >>> 16);
- val += inc;
- }
- } else {
- for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
- bitmapData[dp] = cast(byte)(val >>> 16);
- val += inc;
- }
- }
-}
-
-/*
- * Fill in dithered gradated values for a color channel
- */
-static final void buildDitheredGradientChannel(int from, int to, int steps,
- int bandWidth, int bandHeight, bool vertical,
- byte[] bitmapData, int dp, int bytesPerLine, int bits) {
- int mask = 0xff00 >>> bits;
- int val = from << 16;
- int inc = ((to << 16) - val) / steps + 1;
- if (vertical) {
- for (int dy = 0; dy < bandHeight; ++dy, dp += bytesPerLine) {
- for (int dx = 0, dptr = dp; dx < bandWidth; ++dx, dptr += 4) {
- int thresh = DITHER_MATRIX[dy & 7][dx] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask);
- }
- val += inc;
- }
- } else {
- for (int dx = 0; dx < bandWidth; ++dx, dp += 4) {
- for (int dy = 0, dptr = dp; dy < bandHeight; ++dy, dptr += bytesPerLine) {
- int thresh = DITHER_MATRIX[dy][dx & 7] >>> bits;
- int temp = val + thresh;
- if (temp > 0xffffff) bitmapData[dptr] = -1;
- else bitmapData[dptr] = cast(byte)((temp >>> 16) & mask);
- }
- val += inc;
- }
- }
-}
-
-/**
- * Renders a gradient onto a GC.
- * - * This is a GC helper. - *
- * - * @param gc the GC to render the gradient onto - * @param device the device the GC belongs to - * @param x the top-left x coordinate of the region to be filled - * @param y the top-left y coordinate of the region to be filled - * @param width the width of the region to be filled - * @param height the height of the region to be filled - * @param vertical if true sweeps from top to bottom, else - * sweeps from left to right - * @param fromRGB the color to start with - * @param toRGB the color to end with - * @param redBits the number of significant red bits, 0 for palette modes - * @param greenBits the number of significant green bits, 0 for palette modes - * @param blueBits the number of significant blue bits, 0 for palette modes - */ -static void fillGradientRectangle(GC gc, Device device, - int x, int y, int width, int height, bool vertical, - RGB fromRGB, RGB toRGB, - int redBits, int greenBits, int blueBits) { - /* Create the bitmap and tile it */ - ImageData band = createGradientBand(width, height, vertical, - fromRGB, toRGB, redBits, greenBits, blueBits); - Image image = new Image(device, band); - if ((band.width == 1) || (band.height == 1)) { - gc.drawImage(image, 0, 0, band.width, band.height, x, y, width, height); - } else { - if (vertical) { - for (int dx = 0; dx < width; dx += band.width) { - int blitWidth = width - dx; - if (blitWidth > band.width) blitWidth = band.width; - gc.drawImage(image, 0, 0, blitWidth, band.height, dx + x, y, blitWidth, band.height); - } - } else { - for (int dy = 0; dy < height; dy += band.height) { - int blitHeight = height - dy; - if (blitHeight > band.height) blitHeight = band.height; - gc.drawImage(image, 0, 0, band.width, blitHeight, x, dy + y, band.width, blitHeight); - } - } - } - image.dispose(); -} - -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/ImageDataLoader.d --- a/org/eclipse/swt/graphics/ImageDataLoader.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/******************************************************************************* - * 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.graphics.ImageDataLoader; - -public import org.eclipse.swt.graphics.ImageData; - -import org.eclipse.swt.graphics.ImageLoader; -import tango.io.model.IConduit; - -/** - * Internal class that separates ImageData from ImageLoader - * to allow removal of ImageLoader from the toolkit. - */ -class ImageDataLoader { - - public static ImageData[] load(InputStream stream) { - return (new ImageLoader()).load(stream); - } - - public static ImageData[] load(char[] filename) { - return (new ImageLoader()).load(filename); - } - -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/ImageLoader.d --- a/org/eclipse/swt/graphics/ImageLoader.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -/******************************************************************************* - * 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.graphics.ImageLoader; - - -public import org.eclipse.swt.graphics.ImageLoaderListener; -public import org.eclipse.swt.graphics.ImageLoaderEvent; -public import org.eclipse.swt.graphics.ImageData; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.internal.Compatibility; -//import org.eclipse.swt.internal.image.*; - -import tango.core.Exception; -import tango.core.Array; -import tango.io.model.IConduit; - -class FileFormat{ - static ImageData[] load( InputStream, ImageLoader ){ return null; } - static void save( OutputStream, int, ImageLoader ){} -} - -/** - * Instances of this class are used to load images from, - * and save images to, a file or stream. - *- * Currently supported image formats are: - *
ImageLoaders
can be used to:
- * imageLoaderListeners
field.
- */
-void reset() {
- data = null;
- logicalScreenWidth = 0;
- logicalScreenHeight = 0;
- backgroundPixel = -1;
- repeatCount = 1;
-}
-
-/**
- * Loads an array of ImageData
objects from the
- * specified input stream. Throws an error if either an error
- * occurs while loading the images, or if the images are not
- * of a supported type. Returns the loaded image data array.
- *
- * @param stream the input stream to load the images from
- * @return an array of ImageData
objects loaded from the specified input stream
- *
- * @exception IllegalArgumentException ImageData
objects from the
- * file with the specified name. Throws an error if either
- * an error occurs while loading the images, or if the images are
- * not of a supported type. Returns the loaded image data array.
- *
- * @param filename the name of the file to load the images from
- * @return an array of ImageData
objects loaded from the specified file
- *
- * @exception IllegalArgumentException IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
- * An ImageLoaderListener should be added before invoking
- * one of the receiver's load methods. The listener's
- * imageDataLoaded
method is called when image
- * data has been partially loaded, as is supported by interlaced
- * GIF/PNG or progressive JPEG images.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException
true
if the receiver has image loader
- * listeners, and false
otherwise.
- *
- * @return true
if there are ImageLoaderListener
s, and false
otherwise
- *
- * @see #addImageLoaderListener(ImageLoaderListener)
- * @see #removeImageLoaderListener(ImageLoaderListener)
- */
-public bool hasListeners() {
- return imageLoaderListeners.length > 0;
-}
-
-/**
- * Notifies all image loader listeners that an image loader event
- * has occurred. Pass the specified event object to each listener.
- *
- * @param event the ImageLoaderEvent
to send to each ImageLoaderListener
- */
-public void notifyListeners(ImageLoaderEvent event) {
- if (!hasListeners()) return;
- foreach( listener; imageLoaderListeners ){
- listener.imageDataLoaded(event);
- }
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/ImageLoaderEvent.d
--- a/org/eclipse/swt/graphics/ImageLoaderEvent.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.graphics.ImageLoaderEvent;
-
-
-public import org.eclipse.swt.internal.SWTEventObject;
-public import org.eclipse.swt.graphics.ImageLoader;
-public import org.eclipse.swt.graphics.ImageData;
-
-import tango.text.convert.Format;
-
-/**
- * Instances of this class are sent as a result of the incremental
- * loading of image data.
- * - * Notes: - *
endOfImage
flag in the event will be set to true
- * after each individual image is loaded.endOfImage
flag is false, then this is a
- * partially complete copy of the current ImageData
,
- * otherwise this is a completely loaded ImageData
- */
- public ImageData imageData;
-
- /**
- * the zero-based count of image data increments -- this is
- * equivalent to the number of events that have been generated
- * while loading a particular image
- */
- public int incrementCount;
-
- /**
- * If this flag is true, then the current image data has been
- * completely loaded, otherwise the image data is only partially
- * loaded, and further ImageLoader events will occur unless an
- * exception is thrown
- */
- public bool endOfImage;
-
- //static final long serialVersionUID = 3257284738325558065L;
-
-/**
- * Constructs a new instance of this class given the event source and
- * the values to store in its fields.
- *
- * @param source the ImageLoader that was loading when the event occurred
- * @param imageData the image data for the event
- * @param incrementCount the image data increment for the event
- * @param endOfImage the end of image flag for the event
- */
-public this(ImageLoader source, ImageData imageData, int incrementCount, bool endOfImage) {
- super(source);
- this.imageData = imageData;
- this.incrementCount = incrementCount;
- this.endOfImage = endOfImage;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString () {
- return Format( "ImageLoaderEvent {source={} imageData={} incrementCount={} endOfImage={}}", source, imageData, incrementCount, endOfImage); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/ImageLoaderListener.d
--- a/org/eclipse/swt/graphics/ImageLoaderListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.graphics.ImageLoaderListener;
-
-
-public import org.eclipse.swt.graphics.ImageLoaderEvent;
-public import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * Classes which implement this interface provide methods
- * that deal with the incremental loading of image data.
- *
- * After creating an instance of a class that implements
- * this interface it can be added to an image loader using the
- * addImageLoaderListener
method and removed using
- * the removeImageLoaderListener
method. When
- * image data is either partially or completely loaded, this
- * method will be invoked.
- *
- * The timing of when this method is called varies depending on - * the format of the image being loaded. - *
- * - * @param e an event containing information about the image loading operation - */ -public void imageDataLoaded(ImageLoaderEvent e); - -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/LineAttributes.d --- a/org/eclipse/swt/graphics/LineAttributes.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/******************************************************************************* - * 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.graphics.LineAttributes; - -import org.eclipse.swt.SWT; - -/** - *LineAttributes
defines a set of line attributes that
- * can be modified in a GC.
- *
- * Application code does not need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no dispose()
method is provided.
- *
- * Depending on the depth of the image, the PaletteData can take one - * of two forms, indicated by the isDirect field: - *
- *false
, this palette is an indexed
- * palette which maps pixel values to RGBs. The actual RGB values
- * may be retrieved by using the getRGBs() method.
- * true
, this palette is a direct color
- * palette. Instead of containing RGB values, it contains red,
- * green and blue mask and shift information which indicates how
- * the color components may be extracted from a given pixel.
- * This means that the RGB value is actually encoded in the pixel value.
- * - * In this case, the shift data is the number of bits required to shift - * the RGB value to the left in order to align the high bit of the - * corresponding mask with the high bit of the first byte. This number - * may be negative, so care must be taken when shifting. For example, - * with a red mask of 0xFF0000, the red shift would be -16. With a red - * mask of 0x1F, the red shift would be 3. - *
- *RGB
s for the palette
- *
- * @exception IllegalArgumentException RGB
.
- *
- * @param rgb the RGB to get the pixel value for
- * @return the pixel value for the given RGB
- *
- * @exception IllegalArgumentException RGB
corresponding to the given pixel value.
- *
- * @param pixel the pixel to get the RGB value for
- * @return the RGB value for the given pixel
- *
- * @exception IllegalArgumentException RGB
s for the receiver or null
- */
-public RGB[] getRGBs() {
- return colors;
-}
-
-/**
- * Computes the shift value for a given mask.
- *
- * @param mask the mask to compute the shift for
- * @return the shift amount
- *
- * @see PaletteData
- */
-int shiftForMask(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return 7 - i;
- }
- return 32;
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/PathData.d
--- a/org/eclipse/swt/graphics/PathData.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.graphics.PathData;
-
-
-/**
- * Instances of this class describe device-independent paths.
- *
- * @see Path
- *
- * @since 3.1
- */
-public final class PathData {
-
- /**
- * The type of each point.
- */
- public byte[] types;
-
- /**
- * The points of a path.
- */
- public float[] points;
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/Point.d
--- a/org/eclipse/swt/graphics/Point.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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.graphics.Point;
-
-
-public import org.eclipse.swt.internal.SerializableCompatibility;
-
-import tango.text.convert.Format;
-
-/**
- * Instances of this class represent places on the (x, y)
- * coordinate plane.
- * - * The coordinate space for rectangles and points is considered - * to have increasing values downward and to the right from its - * origin making this the normal, computer graphics oriented notion - * of (x, y) coordinates rather than the strict mathematical one. - *
- *- * The hashCode() method in this class uses the values of the public - * fields to compute the hash value. When storing instances of the - * class in hashed collections, do not modify these fields after the - * object has been inserted. - *
- *
- * Application code does not need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no dispose()
method is provided.
- *
true
if the object is the same as this object and false
otherwise
- *
- * @see #hashCode()
- */
-public override int opEquals (Object object) {
- if (object is this) return true;
- if ( auto p = cast(Point)object ){
- return (p.x == this.x) && (p.y == this.y);
- }
- return false;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects that return true
when passed to
- * equals
must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals(Object)
- */
-public hash_t toHash () {
- return x ^ y;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the point
- */
-public char[] toString () {
- return Format( "Point {}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-}
-
-}
-
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/RGB.d
--- a/org/eclipse/swt/graphics/RGB.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * 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.graphics.RGB;
-
-public import org.eclipse.swt.internal.SerializableCompatibility;
-
-import org.eclipse.swt.SWT;
-import Math = tango.math.Math : min, max;
-import tango.text.convert.Format;
-
-/**
- * Instances of this class are descriptions of colors in
- * terms of the primary additive color model (red, green and
- * blue). A color may be described in terms of the relative
- * intensities of these three primary colors. The brightness
- * of each color is specified by a value in the range 0 to 255,
- * where 0 indicates no color (blackness) and 255 indicates
- * maximum intensity.
- * - * The hashCode() method in this class uses the values of the public - * fields to compute the hash value. When storing instances of the - * class in hashed collections, do not modify these fields after the - * object has been inserted. - *
- *
- * Application code does not need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no dispose()
method is provided.
- *
true
if the object is the same as this object and false
otherwise
- *
- * @see #hashCode()
- */
-public override int opEquals(Object object) {
- if (object is this) return true;
- if( auto rgb = cast(RGB) object ){
- return (rgb.red == this.red) && (rgb.green == this.green) && (rgb.blue == this.blue);
- }
- return false;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects that return true
when passed to
- * equals
must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals(Object)
- */
-public hash_t toHash() {
- return (blue << 16) | (green << 8) | red;
-}
-
-/**
- * Returns a String containing a concise, human-readable
- * description of the receiver.
- *
- * @return a String representation of the RGB
- */
-public override char[] toString() {
- return Format( "RGB {}, {}, {}}", red, green, blue ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-}
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/graphics/Rectangle.d
--- a/org/eclipse/swt/graphics/Rectangle.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*******************************************************************************
- * 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.graphics.Rectangle;
-
-public import org.eclipse.swt.graphics.Point;
-public import org.eclipse.swt.internal.SerializableCompatibility;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import tango.text.convert.Format;
-
-/**
- * Instances of this class represent rectangular areas in an
- * (x, y) coordinate system. The top left corner of the rectangle
- * is specified by its x and y values, and the extent of the
- * rectangle is specified by its width and height.
- * - * The coordinate space for rectangles and points is considered - * to have increasing values downward and to the right from its - * origin making this the normal, computer graphics oriented notion - * of (x, y) coordinates rather than the strict mathematical one. - *
- *- * The hashCode() method in this class uses the values of the public - * fields to compute the hash value. When storing instances of the - * class in hashed collections, do not modify these fields after the - * object has been inserted. - *
- *
- * Application code does not need to explicitly release the
- * resources managed by each instance when those instances are no longer
- * required, and thus no dispose()
method is provided.
- *
- * The union of two rectangles is the smallest single rectangle - * that completely covers both of the areas covered by the two - * given rectangles. - *
- * - * @param rect the rectangle to merge with the receiver - * - * @exception IllegalArgumentExceptiontrue
if the point specified by the
- * arguments is inside the area specified by the receiver,
- * and false
otherwise.
- *
- * @param x the x coordinate of the point to test for containment
- * @param y the y coordinate of the point to test for containment
- * @return true
if the rectangle contains the point and false
otherwise
- */
-public bool contains (int x, int y) {
- return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height);
-}
-
-/**
- * Returns true
if the given point is inside the
- * area specified by the receiver, and false
- * otherwise.
- *
- * @param pt the point to test for containment
- * @return true
if the rectangle contains the point and false
otherwise
- *
- * @exception IllegalArgumentException true
if the object is the same as this object and false
otherwise
- *
- * @see #hashCode()
- */
-public override int opEquals (Object object) {
- if (object is this) return true;
- if( auto r = cast(Rectangle) object ){
- return (r.x == this.x) && (r.y == this.y) && (r.width == this.width) && (r.height == this.height);
- }
- return false;
-}
-
-/**
- * Returns an integer hash code for the receiver. Any two
- * objects that return true
when passed to
- * equals
must return the same value for this
- * method.
- *
- * @return the receiver's hash
- *
- * @see #equals(Object)
- */
-public override hash_t toHash () {
- return x ^ y ^ width ^ height;
-}
-
-/**
- * Destructively replaces the x, y, width and height values
- * in the receiver with ones which represent the intersection of the
- * rectangles specified by the receiver and the given rectangle.
- *
- * @param rect the rectangle to intersect with the receiver
- *
- * @exception IllegalArgumentException - * The intersection of two rectangles is the rectangle that - * covers the area which is contained within both rectangles. - *
- * - * @param rect the rectangle to intersect with the receiver - * @return the intersection of the receiver and the argument - * - * @exception IllegalArgumentExceptiontrue
if the rectangle described by the
- * arguments intersects with the receiver and false
- * otherwise.
- * - * Two rectangles intersect if the area of the rectangle - * representing their intersection is not empty. - *
- * - * @param x the x coordinate of the origin of the rectangle - * @param y the y coordinate of the origin of the rectangle - * @param width the width of the rectangle - * @param height the height of the rectangle - * @returntrue
if the rectangle intersects with the receiver, and false
otherwise
- *
- * @exception IllegalArgumentException true
if the given rectangle intersects
- * with the receiver and false
otherwise.
- * - * Two rectangles intersect if the area of the rectangle - * representing their intersection is not empty. - *
- * - * @param rect the rectangle to test for intersection - * @returntrue
if the rectangle intersects with the receiver, and false
otherwise
- *
- * @exception IllegalArgumentException true
if the receiver does not cover any
- * area in the (x, y) coordinate plane, and false
if
- * the receiver does cover some area in the plane.
- * - * A rectangle is considered to cover area in the - * (x, y) coordinate plane if both its width and height are - * non-zero. - *
- * - * @returntrue
if the receiver is empty, and false
otherwise
- */
-public bool isEmpty () {
- return (width <= 0) || (height <= 0);
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the rectangle
- */
-public override char[] toString () {
- return Format( "Rectangle {}, {}, {}, {}}", x, y, width, height ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
-}
-
-/**
- * Returns a new rectangle which represents the union of
- * the receiver and the given rectangle.
- * - * The union of two rectangles is the smallest single rectangle - * that completely covers both of the areas covered by the two - * given rectangles. - *
- * - * @param rect the rectangle to perform union with - * @return the union of the receiver and the argument - * - * @exception IllegalArgumentException- * IMPORTANT: This class is intended to be subclassed only - * within the SWT implementation. However, it has not been marked - * final to allow those outside of the SWT development team to implement - * patched versions of the class in order to get around specific - * limitations in advance of when those limitations can be addressed - * by the team. Any class built using subclassing to access the internals - * of this class will likely fail to compile or run between releases and - * may be strongly platform specific. Subclassing should not be attempted - * without an intimate and detailed understanding of the workings of the - * hierarchy. No support is provided for user-written classes which are - * implemented as subclasses of this class. - *
- * - * @see #dispose - * @see #isDisposed - * - * @since 3.1 - */ -public abstract class Resource { - - /** - * the device where this resource was created - */ - Device device; - -/** - * Disposes of the operating system resources associated with - * this resource. Applications must dispose of all resources - * which they allocate. - */ -public abstract void dispose(); - -/** - * Returns theDevice
where this resource was
- * created.
- *
- * @return Device
the device of the receiver
- *
- * @since 3.2
- */
-public Device getDevice() {
- Device device = this.device;
- if (device is null || isDisposed ()) SWT.error (SWT.ERROR_GRAPHIC_DISPOSED);
- return device;
-}
-
-/**
- * Returns true
if the resource has been disposed,
- * and false
otherwise.
- *
- * This method gets the dispose state for the resource.
- * When a resource has been disposed, it is an error to
- * invoke any other method using the resource.
- *
- * @return true
when the resource is disposed and false
otherwise
- */
-public abstract bool isDisposed();
-
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/BidiUtil.d
--- a/org/eclipse/swt/internal/BidiUtil.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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.BidiUtil;
-
-//import org.eclipse.swt.graphics.GC;
-
-// PORTING_TYPE
-class GC{}
-class Runnable{}
-
-/*
- * This class is supplied so that the StyledText code that supports bidi text (supported
- * for win platforms) is not platform dependent. Bidi text is not implemented on
- * emulated platforms.
- */
-public class BidiUtil {
- // Keyboard language types
- public static const int KEYBOARD_NON_BIDI = 0;
- public static const int KEYBOARD_BIDI = 1;
-
- // bidi rendering input flag constants, not used
- // on emulated platforms
- public static const int CLASSIN = 1;
- public static const int LINKBEFORE = 2;
- public static const int LINKAFTER = 4;
-
- // bidi rendering/ordering constants, not used on
- // emulated platforms
- public static const int CLASS_HEBREW = 2;
- public static const int CLASS_ARABIC = 2;
- public static const int CLASS_LOCALNUMBER = 4;
- public static const int CLASS_LATINNUMBER = 5;
- public static const int REORDER = 0;
- public static const int LIGATE = 0;
- public static const int GLYPHSHAPE = 0;
-
-/*
- * Not implemented.
- */
-public static void addLanguageListener(int /*long*/ hwnd, Runnable runnable) {
-}
-/*
- * Not implemented.
- *
- */
-public static void drawGlyphs(GC gc, char[] renderBuffer, int[] renderDx, int x, int y) {
-}
-/*
- * Bidi not supported on emulated platforms.
- *
- */
-public static bool isBidiPlatform() {
- return false;
-}
-/*
- * Not implemented.
- */
-public static bool isKeyboardBidi() {
- return false;
-}
-/*
- * Not implemented.
- */
-public static int getFontBidiAttributes(GC gc) {
- return 0;
-}
-/*
- * Not implemented.
- *
- */
-public static void getOrderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int flags, int [] offsets) {
-}
-/*
- * Not implemented. Returns null.
- *
- */
-public static char[] getRenderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) {
- return null;
-}
-/*
- * Not implemented. Returns 0.
- */
-public static int getKeyboardLanguage() {
- return 0;
-}
-/*
- * Not implemented.
- */
-public static void removeLanguageListener(int /*long*/ hwnd) {
-}
-/*
- * Not implemented.
- */
-public static void setKeyboardLanguage(int language) {
-}
-/*
- * Not implemented.
- */
-public static bool setOrientation(int /*long*/ hwnd, int orientation) {
- return false;
-}
-}
diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/CloneableCompatibility.d
--- a/org/eclipse/swt/internal/CloneableCompatibility.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.CloneableCompatibility;
-
-//PORTING_TYPE
-interface Cloneable{}
-
-/**
- * This interface is the cross-platform version of the
- * java.lang.Cloneable interface.
- *
- * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * implement CloneableCompatibility instead of java.lang.Cloneable. - *
- *- * Note: java.lang.Cloneable is not part of CLDC. - *
- */ -public interface CloneableCompatibility : Cloneable { -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/Compatibility.d --- a/org/eclipse/swt/internal/Compatibility.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,350 +0,0 @@ -/******************************************************************************* - * 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 org.eclipse.swt.SWT; - -import Math = tango.math.Math; -import Unicode = tango.text.Unicode; -import tango.sys.Process; -import tango.io.stream.FileStream; -import tango.io.compress.ZlibStream; - -/** - * 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) {
- return new ZlibInput(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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/Converter.d --- a/org/eclipse/swt/internal/Converter.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/******************************************************************************* - * 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; -} - -/+ // only difference with String vs. char[] arg, so no diff in dwt -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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/LONG.d --- a/org/eclipse/swt/internal/LONG.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/******************************************************************************* - * 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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/Library.d --- a/org/eclipse/swt/internal/Library.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/******************************************************************************* - * 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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/Lock.d
--- a/org/eclipse/swt/internal/Lock.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/Platform.d
--- a/org/eclipse/swt/internal/Platform.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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 a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/SWTEventListener.d
--- a/org/eclipse/swt/internal/SWTEventListener.d Sat Jan 05 17:34:03 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 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.SWTEventListener;
-
-
-//import java.util.EventListener;
-
-///PORTING_TYPE
-interface EventListener{
-}
-
-/**
- * This interface is the cross-platform version of the
- * java.util.EventListener interface.
- * - * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * implement SWTEventListener instead of java.util.EventListener. - *
- *- * Note: java.util.EventListener is not part of CDC and CLDC. - *
- */ -public interface SWTEventListener : EventListener { -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/SWTEventObject.d --- a/org/eclipse/swt/internal/SWTEventObject.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/******************************************************************************* - * 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.SWTEventObject; - - -//import java.util.EventObject; -import tango.core.Exception; - -///PORTING_TYPE -class EventObject { - protected Object source; - - public this(Object source) { - if (source is null) - throw new IllegalArgumentException( "null arg" ); - this.source = source; - } - - public Object getSource() { - return source; - } - - public override char[] toString() { - return this.classinfo.name ~ "[source=" ~ source.toString() ~ "]"; - } -} - - - - -/** - * This class is the cross-platform version of the - * java.util.EventObject class. - *- * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * extend SWTEventObject instead of java.util.EventObject. - *
- *- * Note: java.util.EventObject is not part of CDC and CLDC. - *
- */ -public class SWTEventObject : EventObject { - - //static final long serialVersionUID = 3258125873411470903L; - -/** - * Constructs a new instance of this class. - * - * @param source the object which fired the event - */ -public this(Object source) { - super(source); -} -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/SWTMessages.properties --- a/org/eclipse/swt/internal/SWTMessages.properties Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -############################################################################### -# 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 diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/SerializableCompatibility.d --- a/org/eclipse/swt/internal/SerializableCompatibility.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 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.SerializableCompatibility; - - -//import java.io.Serializable; -///PORTING_TYPE -interface Serializable{} - -/** - * This interface is the cross-platform version of the - * java.io.Serializable interface. - *- * It is part of our effort to provide support for both J2SE - * and J2ME platforms. Under this scheme, classes need to - * implement SerializableCompatibility instead of - * java.io.Serializable. - *
- *- * Note: java.io.Serializable is not part of CLDC. - *
- */ -public interface SerializableCompatibility : Serializable { -} diff -r a1f832ca7d17 -r ad2b69216039 org/eclipse/swt/internal/gtk/OS.d --- a/org/eclipse/swt/internal/gtk/OS.d Sat Jan 05 17:34:03 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2851 +0,0 @@ -/******************************************************************************* - * 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.gtk.OS; - -import org.eclipse.swt.internal.Platform; -import tango.core.Traits; - -template NameOfFunc(alias f) { - // Note: highly dependent on the .stringof formatting - // the value begins with "& " which is why the first two chars are cut off - const char[] NameOfFunc = (&f).stringof[2 .. $]; -} - -template ForwardGtkOsCFunc( alias cFunc ) { - alias ParameterTupleOf!(cFunc) P; - alias ReturnTypeOf!(cFunc) R; - mixin("public static R " ~ NameOfFunc!(cFunc) ~ "( P p ){ - lock.lock(); - scope(exit) lock.unlock(); - return cFunc(p); - }"); -} - -//import org.eclipse.swt.internal.*; - -// opaque structs used in the parameters -// they do not have a separated module -public { - struct GtkEntry{} - struct GtkWidget{} - struct PangoLayout{} -} - -private extern(C){ -// int /*long*/ localeconv_decimal_point(); -// int /*long*/ realpath(byte[] path, byte[] realPath); -// int GTK_WIDGET_HEIGHT(int /*long*/ widget); -// int GTK_WIDGET_WIDTH(int /*long*/ widget); -// int /*long*/ GTK_WIDGET_WINDOW(int /*long*/ widget); -// int GTK_WIDGET_X(int /*long*/ widget); -// int GTK_WIDGET_Y(int /*long*/ widget); -// int /*long*/ GTK_SCROLLED_WINDOW_HSCROLLBAR(int /*long*/ widget); -// int /*long*/ GTK_SCROLLED_WINDOW_VSCROLLBAR(int /*long*/ widget); -// int GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(int /*long*/ widget); -// void GTK_ACCEL_LABEL_SET_ACCEL_STRING(int /*long*/ acce_label, int /*long*/ string); -// int /*long*/ GTK_ACCEL_LABEL_GET_ACCEL_STRING(int /*long*/ acce_label); -// int /*long*/ GTK_ENTRY_IM_CONTEXT(int /*long*/ widget); -// int /*long*/ GTK_TEXTVIEW_IM_CONTEXT(int /*long*/ widget); -// int /*long*/ GTK_TOOLTIPS_TIP_WINDOW(int /*long*/ widget); -// void GTK_TOOLTIPS_SET_ACTIVE(int /*long*/ widget, int /*long*/ data); -// void GTK_WIDGET_SET_HEIGHT(int /*long*/ widget, int height); -// void GTK_WIDGET_SET_WIDTH(int /*long*/ widget, int width); -// void GTK_WIDGET_SET_X(int /*long*/ widget, int x); -// void GTK_WIDGET_SET_Y(int /*long*/ widget, int y); -// int GTK_WIDGET_REQUISITION_WIDTH(int /*long*/ widget); -// int GTK_WIDGET_REQUISITION_HEIGHT(int /*long*/ widget); -// int GDK_EVENT_TYPE(int /*long*/ event); -// int /*long*/ GDK_EVENT_WINDOW(int /*long*/ event); -// int X_EVENT_TYPE(int /*long*/ xevent); -// int /*long*/ X_EVENT_WINDOW(int /*long*/ xevent); -// int _Call(int /*long*/ proc, int /*long*/ arg1, int /*long*/ arg2); -// int /*long*/ _call (int /*long*/ function, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ arg3, int /*long*/ arg4, int /*long*/ arg5, int /*long*/ arg6); -// bool GDK_WINDOWING_X11(); -// int /*long*/ _GDK_PIXMAP_XID(int /*long*/ pixmap); -// bool _XCheckMaskEvent(int /*long*/ display, int /*long*/ event_mask, int /*long*/ event_return); -// bool _XCheckWindowEvent(int /*long*/ display, int /*long*/ window, int /*long*/ event_mask, int /*long*/ event_return); -// bool _XCheckIfEvent(int /*long*/ display, int /*long*/ event_return, int /*long*/ predicate, int /*long*/ arg); -// int _XDefaultScreen(int /*long*/ display); -// int /*long*/ _XDefaultRootWindow(int /*long*/ display); -// void _XFlush(int /*long*/ display); -// void _XFree(int /*long*/ address); -// int /*long*/ _XGetSelectionOwner(int /*long*/ display, int /*long*/ selection); -// int /*long*/ _XInternAtom(int /*long*/ display, byte[] name, bool ifExists); -// int _XQueryTree(int /*long*/ display, int /*long*/ w, int /*long*/[] root_return, int /*long*/[] parent_return, int /*long*/[] children_return, int[] nchildren_return); -// int _XKeysymToKeycode(int /*long*/ display, int /*long*/ keysym); -// int /*long*/ _XListProperties(int /*long*/ display, int /*long*/ window, int[] num_prop_return); -// int _XReconfigureWMWindow(int /*long*/ display, int /*long*/ window, int screen, int valueMask, XWindowChanges values); -// int _XSendEvent(int /*long*/ display, int /*long*/ w, bool propogate, int /*long*/ event_mask, int /*long*/ event_send); -// int /*long*/ _XSetIOErrorHandler(int /*long*/ handler); -// int /*long*/ _XSetErrorHandler(int /*long*/ handler); -// int _XSetInputFocus(int /*long*/ display, int /*long*/ window, int revert, int time); -// int /*long*/ _XSynchronize(int /*long*/ display, bool onoff); -// void _XTestFakeButtonEvent(int /*long*/ display, int button, bool is_press, int /*long*/ delay); -// void _XTestFakeKeyEvent(int /*long*/ display, int keycode, bool is_press, int /*long*/ delay); -// void _XTestFakeMotionEvent(int /*long*/ display, int screen_number, int x, int y, int /*long*/ delay); -// int _XWarpPointer(int /*long*/ display, int /*long*/ sourceWindow, int /*long*/ destWindow, int sourceX, int sourceY, int sourceWidth, int sourceHeight, int destX, int destY); -// int /*long*/ _gdk_x11_atom_to_xatom(int /*long*/ atom); -// int /*long*/ _gdk_x11_colormap_get_xcolormap(int /*long*/ colormap); -// int /*long*/ _gdk_x11_drawable_get_xdisplay(int /*long*/ drawable); -// int /*long*/ _gdk_x11_drawable_get_xid(int /*long*/ drawable); -// int /*long*/ _gdk_x11_screen_lookup_visual(int /*long*/ screen, int xvisualid); -// int /*long*/ _gdk_x11_screen_get_window_manager_name(int /*long*/ screen); -// int /*long*/ _gdk_x11_visual_get_xvisual(int /*long*/ visual); -// int /*long*/ _gdk_pixmap_foreign_new(int /*long*/ anid); -// int /*long*/ _gdk_window_lookup(int /*long*/ xid); -// void _gdk_window_add_filter(int /*long*/ window, int /*long*/ function, int /*long*/ data); -// void _gdk_window_remove_filter(int /*long*/ window, int /*long*/ function, int /*long*/ data); -// /** X render natives and constants */ -// int XRenderPictureAttributes_sizeof(); -// bool _XRenderQueryExtension(int /*long*/ display, int[] event_basep, int[] error_basep); -// int _XRenderQueryVersion(int /*long*/ display, int[] major_versionp, int[] minor_versionp); -// int /*long*/ _XRenderCreatePicture(int /*long*/ display, int /*long*/ drawable, int /*long*/ format, int /*long*/ valuemask, XRenderPictureAttributes attributes); -// void _XRenderSetPictureClipRectangles(int /*long*/ display, int /*long*/ picture, int xOrigin, int yOrigin, short[] rects, int count); -// void _XRenderSetPictureTransform(int /*long*/ display, int /*long*/ picture, int[] transform); -// void _XRenderFreePicture(int /*long*/ display, int /*long*/ picture); -// void _XRenderComposite(int /*long*/ display, int op, int /*long*/ src, int /*long*/ mask, int /*long*/ dst, int src_x, int src_y, int mask_x, int mask_y, int dst_x, int dst_y, int width, int height); -// int /*long*/ _XRenderFindStandardFormat(int /*long*/ display, int format); -// int /*long*/ _XRenderFindVisualFormat(int /*long*/ display, int /*long*/ visual); -// int Call (int /*long*/ func, int /*long*/ arg0, int arg1, int arg2); -// int /*long*/ _GDK_DISPLAY(); -// int /*long*/ _GDK_ROOT_PARENT(); -// int /*long*/ _GDK_TYPE_COLOR(); -// int /*long*/ _GDK_TYPE_PIXBUF(); -// bool _GTK_IS_BUTTON(int /*long*/ obj); -// bool _GTK_IS_WINDOW(int /*long*/ obj); -// bool _GTK_IS_CELL_RENDERER_PIXBUF(int /*long*/ obj); -// bool _GTK_IS_CELL_RENDERER_TEXT(int /*long*/ obj); -// bool _GTK_IS_CELL_RENDERER_TOGGLE(int /*long*/ obj); -// bool _GTK_IS_CONTAINER(int /*long*/ obj); -// bool _GTK_IS_IMAGE_MENU_ITEM(int /*long*/ obj); -// bool _GTK_IS_PLUG(int /*long*/ obj); -// int /*long*/ _GTK_STOCK_CANCEL(); -// int /*long*/ _GTK_STOCK_OK(); -// int /*long*/ _GTK_TYPE_CELL_RENDERER_TEXT(); -// int /*long*/ _GTK_TYPE_CELL_RENDERER_PIXBUF(); -// int /*long*/ _GTK_TYPE_CELL_RENDERER_TOGGLE(); -// int /*long*/ _GTK_TYPE_FIXED(); -// int /*long*/ _GTK_TYPE_MENU(); -// int /*long*/ _GTK_TYPE_WIDGET(); -// int _GTK_WIDGET_FLAGS(int /*long*/ wid); -// int _GTK_WIDGET_STATE(int /*long*/ wid); -// bool _GTK_WIDGET_HAS_DEFAULT(int /*long*/ wid); -// bool _GTK_WIDGET_HAS_FOCUS(int /*long*/ wid); -// bool _GTK_WIDGET_IS_SENSITIVE(int /*long*/ wid); -// bool _GTK_WIDGET_MAPPED(int /*long*/ wid); -// bool _GTK_WIDGET_SENSITIVE(int /*long*/ wid); -// void _GTK_WIDGET_SET_FLAGS(int /*long*/ wid, int flag); -// void _GTK_WIDGET_UNSET_FLAGS(int /*long*/ wid, int flag); -// bool _GTK_WIDGET_VISIBLE(int /*long*/ wid); -// int /*long*/ _G_OBJECT_CLASS (int /*long*/ klass); -// int /*long*/ _G_OBJECT_GET_CLASS (int /*long*/ object); -// int /*long*/ _G_OBJECT_TYPE_NAME (int /*long*/ object); -// int /*long*/ _G_TYPE_BOOLEAN(); -// int /*long*/ _G_TYPE_INT(); -// int /*long*/ _G_OBJECT_TYPE (int /*long*/ instance); -// int /*long*/ _G_TYPE_STRING(); -// int _PANGO_PIXELS(int dimension); -// int /*long*/ _PANGO_TYPE_FONT_DESCRIPTION(); -// int /*long*/ _g_cclosure_new(int /*long*/ callback_func, int /*long*/ user_data, int /*long*/ destroy_data); -// int /*long*/ _g_closure_ref(int /*long*/ closure); -// void _g_closure_unref(int /*long*/ closure); -// bool _g_main_context_acquire(int /*long*/ context); -// int _g_main_context_check(int /*long*/ context, int max_priority, int /*long*/ fds, int n_fds); -// int /*long*/ _g_main_context_default(); -// bool _g_main_context_iteration(int /*long*/ context, bool may_block); -// bool _g_main_context_pending(int /*long*/ context); -// int /*long*/ _g_main_context_get_poll_func(int /*long*/ context); -// bool _g_main_context_prepare(int /*long*/ context, int[] priority); -// int _g_main_context_query(int /*long*/ context, int max_priority, int[] timeout_, int /*long*/ fds, int n_fds); -// void _g_main_context_release(int /*long*/ context); -// void g_main_context_wakeup(int /*long*/ context); -// int /*long*/ _g_filename_to_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); -// int /*long*/ _g_filename_to_uri(int /*long*/ filename, int /*long*/ hostname, int /*long*/[] error); -// int /*long*/ _g_filename_from_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); -// int /*long*/ _g_filename_from_uri(int /*long*/ uri, int /*long*/[] hostname, int /*long*/[] error); -// void _g_free(int /*long*/ mem); -// int _g_idle_add(int /*long*/ function, int /*long*/ data); -// int /*long*/ _g_list_append(int /*long*/ list, int /*long*/ data); -// int /*long*/ _g_list_data(int /*long*/ list); -// void _g_list_free(int /*long*/ list); -// void _g_list_free_1(int /*long*/ list); -// int _g_list_length(int /*long*/ list); -// void _g_list_set_next(int /*long*/ list, int /*long*/ llist); -// int /*long*/ _g_list_next(int /*long*/ list); -// int /*long*/ _g_list_nth(int /*long*/ list, int n); -// int /*long*/ _g_list_nth_data(int /*long*/ list, int n); -// int /*long*/ _g_list_prepend(int /*long*/ list, int /*long*/ data); -// void _g_list_set_previous(int /*long*/ list, int /*long*/ llist); -// int /*long*/ _g_list_previous(int /*long*/ list); -// int /*long*/ _g_list_remove_link(int /*long*/ list, int /*long*/ link); -// int /*long*/ _g_list_reverse(int /*long*/ list); -// int /*long*/ _g_locale_from_utf8(int /*long*/ utf8string, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); -// int /*long*/ _g_locale_to_utf8(int /*long*/ opsysstring, int /*long*/ len, int /*long*/[] bytes_read, int /*long*/[] bytes_written, int /*long*/[] error); -// void _g_log_default_handler(int /*long*/ log_domain, int log_levels, int /*long*/ message, int /*long*/ unused_data); -// void _g_log_remove_handler(byte[] log_domain, int handler_id); -// int _g_log_set_handler(byte[] log_domain, int log_levels, int /*long*/ log_func, int /*long*/ user_data); -// int /*long*/ _g_malloc(int /*long*/ size); -// void _g_object_get(int /*long*/ object, byte[] first_property_name, int[] value, int /*long*/ terminator); -// int /*long*/ _g_object_get_qdata(int /*long*/ object, int quark); -// int /*long*/ _g_object_new (int /*long*/ type, int /*long*/ first_property_name); -// int /*long*/ _g_object_ref(int /*long*/ object); -// void _g_object_set(int /*long*/ object, byte[] first_property_name, bool data, int /*long*/ terminator); -// void _g_object_set(int /*long*/ object, byte[] first_property_name, GdkColor data, int /*long*/ terminator); -// void _g_object_set(int /*long*/ object, byte[] first_property_name, int data, int /*long*/ terminator); -// void _g_object_set(int /*long*/ object, byte[] first_property_name, float data, int /*long*/ terminator); -// void _g_object_set(int /*long*/ object, byte[] first_property_name, long data, int /*long*/ terminator); -// void _g_object_set_qdata(int /*long*/ object, int quark, int /*long*/ data); -// void _g_object_unref(int /*long*/ object); -// int _g_quark_from_string(byte[] string); -// void _g_set_prgname(byte[] prgname); -// int _g_signal_connect(int /*long*/ instance, byte[] detailed_signal, int /*long*/ proc, int /*long*/ data); -// int _g_signal_connect_closure(int /*long*/ instance, byte[] detailed_signal, int /*long*/ closure, bool after); -// int _g_signal_connect_closure_by_id(int /*long*/ instance, int signal_id, int detail, int /*long*/ closure, bool after); -// int _g_signal_connect_after(int /*long*/ instance, byte[] detailed_signal, int /*long*/ proc, int /*long*/ data); -// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal); -// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, int /*long*/ data); -// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, int /*long*/ data1, int /*long*/ data2); -// void _g_signal_emit_by_name(int /*long*/ instance, byte[] detailed_signal, byte [] data); -// void _g_signal_handler_disconnect(int /*long*/ instance, int handler_id); -// int _g_signal_handlers_block_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); -// int _g_signal_handlers_disconnect_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); -// int _g_signal_handlers_unblock_matched(int /*long*/ instance, int mask, int signal_id, int detail, int /*long*/ closure, int /*long*/ func, int /*long*/ data); -// int _g_signal_lookup (byte[] name, int /*long*/ itype); -// void _g_signal_stop_emission_by_name(int /*long*/ instance, byte[] detailed_signal); -// bool /*long*/ _g_source_remove (int /*long*/ tag); -// int /*long*/ _g_slist_data (int /*long*/ list); -// void _g_slist_free (int /*long*/ list); -// int /*long*/ _g_slist_next (int /*long*/ list); -// int _g_slist_length (int /*long*/ list); -// void _g_strfreev(int /*long*/ string_array); -// double _g_strtod(int /*long*/ str, int /*long*/[] endptr); -// void _g_type_add_interface_static (int /*long*/ instance_type, int /*long*/ interface_type, int /*long*/ info); -// int /*long*/ _g_type_class_peek (int /*long*/ g_class); -// int /*long*/ _g_type_class_peek_parent (int /*long*/ g_class); -// int /*long*/ _g_type_from_name (byte[] name); -// int /*long*/ _g_type_interface_peek_parent (int /*long*/ iface); -// bool _g_type_is_a (int /*long*/ type, int /*long*/ is_a_type); -// int /*long*/ _g_type_name (int /*long*/ handle); -// int /*long*/ _g_type_parent (int /*long*/ type); -// void _g_type_query (int /*long*/ type, int /*long*/ query); -// int /*long*/ _g_type_register_static (int /*long*/ parent_type, byte[] type_name, int /*long*/ info, int flags); -// void _g_thread_init(int /*long*/ vtable); -// bool _g_thread_supported(); -// int /*long*/ _g_utf16_to_utf8(char[] str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); -// int /*long*/ _g_utf8_offset_to_pointer(int /*long*/ str, int /*long*/ offset); -// int /*long*/ _g_utf8_pointer_to_offset(int /*long*/ str, int /*long*/ pos); -// int /*long*/ _g_utf8_strlen(int /*long*/ str, int /*long*/ max); -// int /*long*/ _g_utf8_to_utf16(byte[] str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); -// int /*long*/ _g_utf8_to_utf16(int /*long*/ str, int /*long*/ len, int /*long*/[] items_read, int /*long*/[] items_written, int /*long*/[] error); -// int /*long*/ _gdk_atom_intern(byte[] atom_name, bool only_if_exists); -// int /*long*/ _gdk_atom_name(int /*long*/ atom); -// void _gdk_beep(); -// int /*long*/ _gdk_bitmap_create_from_data(int /*long*/ window, byte[] data, int width, int height); -// void _gdk_cairo_region(int /*long*/ cairo, int /*long*/ region); -// void _gdk_cairo_set_source_color(int /*long*/ cairo, GdkColor color); -// bool _gdk_color_white(int /*long*/ colormap, GdkColor color); -// bool _gdk_colormap_alloc_color(int /*long*/ colormap, GdkColor color, bool writeable, bool best_match); -// void _gdk_colormap_free_colors(int /*long*/ colormap, GdkColor colors, int ncolors); -// int /*long*/ _gdk_colormap_get_system(); -// void _gdk_colormap_query_color(int /*long*/ colormap, int /*long*/ pixel, GdkColor result); -// void _gdk_cursor_destroy(int /*long*/ cursor); -// int /*long*/ _gdk_cursor_new(int /*long*/ cursor_type); -// int /*long*/ _gdk_cursor_new_from_pixmap(int /*long*/ source, int /*long*/ mask, GdkColor fg, GdkColor bg, int x, int y); -// int /*long*/ _gdk_cursor_new_from_pixbuf(int /*long*/ display, int /*long*/ pixbuf, int x, int y); -// int /*long*/ _gdk_display_get_default(); -// bool _gdk_display_supports_cursor_color(int /*long*/ display); -// void _gdk_drag_status(int /*long*/ context, int action, int time); -// void _gdk_draw_arc(int /*long*/ drawable, int /*long*/ gc, int filled, int x, int y, int width, int height, int angle1, int angle2); -// void _gdk_draw_drawable(int /*long*/ drawable, int /*long*/ gc, int /*long*/ src, int xsrc, int ysrc, int xdest, int ydest, int width, int height); -// void _gdk_draw_image(int /*long*/ drawable, int /*long*/ gc, int /*long*/ image, int xsrc, int ysrc, int xdest, int ydest, int width, int height); -// void _gdk_draw_layout(int /*long*/ drawable, int /*long*/ gc, int x, int y, int /*long*/ layout); -// void _gdk_draw_layout_with_colors(int /*long*/ drawable, int /*long*/ gc, int x, int y, int /*long*/ layout, GdkColor foreground, GdkColor background); -// void _gdk_draw_line(int /*long*/ drawable, int /*long*/ gc, int x1, int y1, int x2, int y2); -// void _gdk_draw_lines(int /*long*/ drawable, int /*long*/ gc, int[] points, int npoints); -// void _gdk_draw_pixbuf(int /*long*/ drawable, int /*long*/ gc, int /*long*/ pixbuf, int xsrc, int ysrc, int xdest, int ydest, int width, int height, int dither, int x_dither, int y_dither); -// void _gdk_draw_point(int /*long*/ drawable, int /*long*/ gc, int x, int y); -// void _gdk_draw_polygon(int /*long*/ drawable, int /*long*/ gc, int filled, int[] points, int npoints); -// void _gdk_draw_rectangle(int /*long*/ drawable, int /*long*/ gc, int filled, int x, int y, int width, int height); -// int _gdk_drawable_get_depth(int /*long*/ drawable); -// int /*long*/ _gdk_drawable_get_image(int /*long*/ drawable, int x, int y, int width, int height); -// void _gdk_drawable_get_size(int /*long*/ drawable, int[] width, int[] height); -// int /*long*/ _gdk_drawable_get_visible_region(int /*long*/ drawable); -// int /*long*/ _gdk_event_copy(int /*long*/ event); -// void _gdk_event_free(int /*long*/ event); -// int /*long*/ _gdk_event_get(); -// bool _gdk_event_get_root_coords(int /*long*/ event, double[] px, double[] py); -// bool _gdk_event_get_coords(int /*long*/ event, double[] px, double[] py); -// int /*long*/ _gdk_event_get_graphics_expose(int /*long*/ window); -// bool _gdk_event_get_state(int /*long*/ event, int[] pmod); -// int _gdk_event_get_time(int /*long*/ event); -// void _gdk_event_handler_set(int /*long*/ func, int /*long*/ data, int /*long*/ notify); -// int /*long*/ _gdk_event_peek(); -// void _gdk_event_put(int /*long*/ event); -// void _gdk_error_trap_push(); -// int _gdk_error_trap_pop(); -// void _gdk_flush(); -// void _gdk_free_text_list(int /*long*/ list); -// void _gdk_gc_get_values(int /*long*/ gc, GdkGCValues values); -// int /*long*/ _gdk_gc_new(int /*long*/ window); -// void _gdk_gc_set_background(int /*long*/ gc, GdkColor color); -// void _gdk_gc_set_clip_mask(int /*long*/ gc, int /*long*/ mask); -// void _gdk_gc_set_clip_origin(int /*long*/ gc, int x, int y); -// void _gdk_gc_set_clip_rectangle(int /*long*/ gc, GdkRectangle rectangle); -// void _gdk_gc_set_clip_region(int /*long*/ gc, int /*long*/ region); -// void _gdk_gc_set_dashes(int /*long*/ gc, int dash_offset, byte[] dash_list, int n); -// void _gdk_gc_set_exposures(int /*long*/ gc, bool exposures); -// void _gdk_gc_set_fill(int /*long*/ gc, int fill); -// void _gdk_gc_set_foreground(int /*long*/ gc, GdkColor color); -// void _gdk_gc_set_function(int /*long*/ gc, int /*long*/ function); -// void _gdk_gc_set_line_attributes(int /*long*/ gc, int line_width, int line_style, int cap_style, int join_style); -// void _gdk_gc_set_stipple(int /*long*/ gc, int /*long*/ stipple); -// void _gdk_gc_set_subwindow(int /*long*/ gc, int /*long*/ mode); -// void _gdk_gc_set_tile(int /*long*/ gc, int /*long*/ tile); -// void _gdk_gc_set_ts_origin(int /*long*/ gc, int x, int y); -// void _gdk_gc_set_values(int /*long*/ gc, GdkGCValues values, int values_mask); -// void _gdk_keyboard_ungrab(int time); -// int /*long*/ _gdk_keymap_get_default(); -// bool _gdk_keymap_translate_keyboard_state (int /*long*/ keymap, int hardware_keycode, int state, int group, int[] keyval, int[] effective_group, int[] level, int[] consumed_modifiers); -// int _gdk_keyval_to_lower(int keyval); -// int _gdk_keyval_to_unicode(int keyval); -// int /*long*/ _gdk_pango_context_get(); -// void _gdk_pango_context_set_colormap(int /*long*/ context, int /*long*/ colormap); -// int /*long*/ _gdk_pango_layout_get_clip_region(int /*long*/ layout, int x_origin, int y_origin, int[] index_ranges, int n_ranges); -// void _gdk_pixbuf_copy_area(int /*long*/ src_pixbuf, int src_x, int src_y, int width, int height, int /*long*/ dest_pixbuf, int dest_x, int dest_y); -// int /*long*/ _gdk_pixbuf_get_from_drawable(int /*long*/ dest, int /*long*/ src, int /*long*/ cmap, int src_x, int src_y, int dest_x, int dest_y, int width, int height); -// bool _gdk_pixbuf_get_has_alpha(int /*long*/ pixbuf); -// int _gdk_pixbuf_get_height(int /*long*/ pixbuf); -// int /*long*/ _gdk_pixbuf_get_pixels(int /*long*/ pixbuf); -// int _gdk_pixbuf_get_rowstride(int /*long*/ pixbuf); -// int _gdk_pixbuf_get_width(int /*long*/ pixbuf); -// int /*long*/ _gdk_pixbuf_new(int colorspace, bool has_alpha, int bits_per_sample, int width, int height); -// int /*long*/ _gdk_pixbuf_new_from_file(byte[] filename, int /*long*/ [] error); -// void _gdk_pixbuf_render_to_drawable(int /*long*/ pixbuf, int /*long*/ drawable, int /*long*/ gc, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int dither, int x_dither, int y_dither); -// void _gdk_pixbuf_render_to_drawable_alpha(int /*long*/ pixbuf, int /*long*/ drawable, int src_x, int src_y, int dest_x, int dest_y, int width, int height, int alpha_mode, int alpha_threshold, int dither, int x_dither, int y_dither); -// void _gdk_pixbuf_render_pixmap_and_mask(int /*long*/ pixbuf, int /*long*/[] pixmap_return, int /*long*/[] mask_return, int alpha_threshold); -// void _gdk_pixbuf_scale(int /*long*/ src, int /*long*/ dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, int interp_type); -// int /*long*/ _gdk_pixbuf_scale_simple(int /*long*/ src, int dest_width, int dest_height, int interp_type); -// int /*long*/ _gdk_pixmap_new(int /*long*/ window, int width, int height, int depth); -// int _gdk_pointer_grab(int /*long*/ window, bool owner_events, int event_mask, int /*long*/ confine_to, int /*long*/ cursor, int time); -// bool _gdk_pointer_is_grabbed(); -// void _gdk_pointer_ungrab(int time); -// bool _gdk_property_get(int /*long*/ window, int /*long*/ property, int /*long*/ type, int /*long*/ offset, int /*long*/ length, int pdelete, int /*long*/[] actual_property_type, int[] actual_format, int[] actual_length, int /*long*/[] data); -// void _gdk_region_destroy(int /*long*/ region); -// bool _gdk_region_empty(int /*long*/ region); -// void _gdk_region_get_clipbox(int /*long*/ region, GdkRectangle rectangle); -// void _gdk_region_get_rectangles(int /*long*/ region, int /*long*/[] rectangles, int[] n_rectangles); -// void _gdk_region_intersect(int /*long*/ source1, int /*long*/ source2); -// int /*long*/ _gdk_region_new(); -// void _gdk_region_offset(int /*long*/ region, int dx, int dy); -// bool _gdk_region_point_in(int /*long*/ region, int x, int y); -// int /*long*/ _gdk_region_polygon(int[] points, int npoints, int fill_rule); -// int /*long*/ _gdk_region_rectangle(GdkRectangle rectangle); -// int /*long*/ _gdk_region_rect_in(int /*long*/ region, GdkRectangle rect); -// void _gdk_region_subtract(int /*long*/ source1, int /*long*/ source2); -// void _gdk_region_union(int /*long*/ source1, int /*long*/ source2); -// void _gdk_region_union_with_rect(int /*long*/ region, GdkRectangle rect); -// void _gdk_rgb_init(); -// int /*long*/ _gdk_screen_get_default(); -// int _gdk_screen_get_monitor_at_point (int /*long*/ screen, int x, int y); -// int _gdk_screen_get_monitor_at_window(int /*long*/ screen, int /*long*/ window); -// void _gdk_screen_get_monitor_geometry (int /*long*/ screen, int monitor_num, GdkRectangle dest); -// int _gdk_screen_get_n_monitors(int /*long*/ screen); -// int _gdk_screen_get_number(int /*long*/ screen); -// int _gdk_screen_height(); -// int _gdk_screen_width(); -// int _gdk_screen_width_mm(); -// void _gdk_set_program_class(byte[] program_class); -// bool _gdk_utf8_to_compound_text(byte[] str, int /*long*/[] encoding, int[] format, int /*long*/[] ctext, int[] length); -// int /*long*/ _gdk_utf8_to_string_target(byte[] str); -// int _gdk_text_property_to_utf8_list (int /*long*/ encoding, int format, int /*long*/ text, int length, int /*long*/[] list); -// int _gdk_unicode_to_keyval(int wc); -// int /*long*/ _gdk_visual_get_system(); -// int /*long*/ _gdk_window_at_pointer(int[] win_x, int[] win_y); -// void _gdk_window_begin_paint_rect(int /*long*/ window, GdkRectangle rectangle); -// void _gdk_window_clear_area(int /*long*/ window, int x, int y, int width, int height); -// void _gdk_window_destroy(int /*long*/ window); -// void _gdk_window_end_paint(int /*long*/ window); -// int /*long*/ _gdk_window_get_children(int /*long*/ window); -// int _gdk_window_get_events(int /*long*/ window); -// void _gdk_window_focus(int /*long*/ window, int timestamp); -// void _gdk_window_freeze_updates(int /*long*/ window); -// void _gdk_window_get_frame_extents(int /*long*/ window, GdkRectangle rect); -// void _gdk_window_get_internal_paint_info(int /*long*/ window, int /*long*/ [] real_drawable, int[] x_offset, int[] y_offset); -// int _gdk_window_get_origin(int /*long*/ window, int[] x, int[] y); -// int /*long*/ _gdk_window_get_parent(int /*long*/ window); -// int /*long*/ _gdk_window_get_pointer(int /*long*/ window, int[] x, int[] y, int[] mask); -// void _gdk_window_get_position(int /*long*/ window, int[] x, int[] y); -// void _gdk_window_get_user_data(int /*long*/ window, int /*long*/[] data); -// void _gdk_window_hide(int /*long*/ window); -// void _gdk_window_invalidate_rect(int /*long*/ window, GdkRectangle rectangle, bool invalidate_children); -// void _gdk_window_invalidate_region(int /*long*/ window, int /*long*/ region, bool invalidate_children); -// void _gdk_window_move(int /*long*/ window, int x, int y); -// int /*long*/ _gdk_window_new(int /*long*/ parent, GdkWindowAttr attributes, int attributes_mask); -// void _gdk_window_lower(int /*long*/ window); -// void _gdk_window_process_all_updates(); -// void _gdk_window_process_updates(int /*long*/ window, bool update_children); -// void _gdk_window_raise(int /*long*/ window); -// void _gdk_window_resize(int /*long*/ window, int width, int height); -// void _gdk_window_scroll(int /*long*/ window, int dx, int dy); -// void _gdk_window_set_accept_focus(int /*long*/ window, bool accept_focus); -// void _gdk_window_set_back_pixmap(int /*long*/ window, int /*long*/ pixmap, bool parent_relative); -// void _gdk_window_set_cursor(int /*long*/ window, int /*long*/ cursor); -// void _gdk_window_set_debug_updates(bool setting); -// void _gdk_window_set_decorations(int /*long*/ window, int decorations); -// void _gdk_window_set_events(int /*long*/ window, int event_mask); -// void _gdk_window_set_icon(int /*long*/ window, int /*long*/ icon_window, int /*long*/ pixmap, int /*long*/ mask); -// void _gdk_window_set_icon_list(int /*long*/ window, int /*long*/ pixbufs); -// void _gdk_window_set_keep_above(int /*long*/ window, bool setting); -// void _gdk_window_set_override_redirect(int /*long*/ window, bool override_redirect); -// void _gdk_window_set_user_data(int /*long*/ window, int /*long*/ user_data); -// void _gdk_window_shape_combine_region (int /*long*/ window, int /*long*/ shape_region, int offset_x, int offset_y); -// void _gdk_window_show(int /*long*/ window); -// void _gdk_window_show_unraised(int /*long*/ window); -// void _gdk_window_thaw_updates(int /*long*/ window); -// int /*long*/ _gtk_accel_group_new(); -// bool _gtk_accel_groups_activate(int /*long*/ accelGroup, int accelKey, int accelMods); -// void _gtk_accel_label_set_accel_widget(int /*long*/ accel_label, int /*long*/ accel_widget); -// void _gtk_adjustment_changed(int /*long*/ adjustment); -// int /*long*/ _gtk_adjustment_new(double value, double lower, double upper, double step_increment, double page_increment, double page_size); -// void _gtk_adjustment_set_value(int /*long*/ adjustment, double value); -// void _gtk_adjustment_value_changed(int /*long*/ adjustment); -// int /*long*/ _gtk_arrow_new(int arrow_type, int shadow_type); -// void _gtk_arrow_set(int /*long*/ arrow, int arrow_type, int shadow_type); -// int /*long*/ _gtk_bin_get_child(int /*long*/ bin); -// void _gtk_box_set_spacing(int /*long*/ box, int spacing); -// void _gtk_box_set_child_packing(int /*long*/ box, int /*long*/ child, bool expand, bool fill, int padding, int pack_type); -// void _gtk_button_clicked(int /*long*/ button); -// int _gtk_button_get_relief(int /*long*/ button); -// int /*long*/ _gtk_button_new(); -// void _gtk_button_set_relief(int /*long*/ button, int newstyle); -// int /*long*/ _gtk_calendar_new(); -// bool /*long*/ _gtk_calendar_select_month(int /*long*/ calendar, int month, int year); -// void _gtk_calendar_select_day(int /*long*/ calendar, int day); -// void _gtk_calendar_set_display_options(int /*long*/ calendar, int flags); -// void _gtk_calendar_display_options(int /*long*/ calendar, int flags); -// void _gtk_calendar_get_date(int /*long*/ calendar, int[] year, int[] month, int[] day); -// void _gtk_cell_layout_clear(int /*long*/ cell_layout); -// void _gtk_cell_layout_set_attributes(int /*long*/ cell_layout, int /*long*/ cell, byte[] attribute, int column, int /*long*/ sentinel); -// void _gtk_cell_layout_pack_start(int /*long*/ cell_layout, int /*long*/ cell, bool expand); -// void _gtk_cell_renderer_get_size(int /*long*/ cell, int /*long*/ widget, GdkRectangle area, int[] x_offset, int[] y_offset, int[] width, int[] height); -// int /*long*/ _gtk_cell_renderer_pixbuf_new(); -// int /*long*/ _gtk_cell_renderer_text_new(); -// int /*long*/ _gtk_cell_renderer_toggle_new(); -// int /*long*/ _gtk_check_button_new(); -// bool _gtk_check_menu_item_get_active(int /*long*/ check_menu_item); -// int /*long*/ _gtk_check_menu_item_new_with_label(byte[] label); -// void _gtk_check_menu_item_set_active(int /*long*/ wid, bool active); -// int /*long*/ _gtk_check_version(int required_major, int required_minor, int required_micro); -// void _gtk_clipboard_clear(int /*long*/ clipboard); -// int /*long*/ _gtk_clipboard_get(int /*long*/ selection); -// bool _gtk_clipboard_set_with_data(int /*long*/ clipboard, int /*long*/ target, int n_targets, int /*long*/ get_func, int /*long*/ clear_func, int /*long*/ user_data); -// int /*long*/ _gtk_clipboard_wait_for_contents(int /*long*/ clipboard, int /*long*/ target); -// int /*long*/ _gtk_color_selection_dialog_new(byte[] title); -// void _gtk_color_selection_get_current_color(int /*long*/ colorsel, GdkColor color); -// void _gtk_color_selection_set_current_color(int /*long*/ colorsel, GdkColor color); -// void _gtk_color_selection_set_has_palette(int /*long*/ colorsel, bool has_palette); -// void _gtk_combo_disable_activate(int /*long*/ combo); -// int /*long*/ _gtk_combo_new(); -// void _gtk_combo_set_case_sensitive(int /*long*/ combo, bool val); -// void _gtk_combo_set_popdown_strings(int /*long*/ combo, int /*long*/ strings); -// int /*long*/ _gtk_combo_box_entry_new_text(); -// int /*long*/ _gtk_combo_box_new_text(); -// void _gtk_combo_box_insert_text(int /*long*/ combo_box, int position, byte[] text); -// void _gtk_combo_box_remove_text(int /*long*/ combo_box, int position); -// int _gtk_combo_box_get_active(int /*long*/ combo_box); -// int /*long*/ _gtk_combo_box_get_model(int /*long*/ combo_box); -// void _gtk_combo_box_set_active(int /*long*/ combo_box, int index); -// void _gtk_combo_box_popup(int /*long*/ combo_box); -// void _gtk_combo_box_popdown(int /*long*/ combo_box); -// void _gtk_container_add(int /*long*/ container, int /*long*/ widget); -// void _gtk_container_forall(int /*long*/ container, int /*long*/ callback, int /*long*/ callback_data); -// int _gtk_container_get_border_width(int /*long*/ container); -// int /*long*/ _gtk_container_get_children(int /*long*/ container); -// void _gtk_container_remove(int /*long*/ container, int /*long*/ widget); -// void _gtk_container_resize_children(int /*long*/ container); -// void _gtk_container_set_border_width(int /*long*/ container, int border_width); -// int /*long*/ _gtk_dialog_add_button(int /*long*/ dialog, byte[] button_text, int response_id); -// int _gtk_dialog_run(int /*long*/ dialog); -// int /*long*/ _gtk_drag_begin(int /*long*/ widget, int /*long*/ targets, int actions, int button, int /*long*/ event); -// bool _gtk_drag_check_threshold(int /*long*/ widget, int start_x, int start_y, int current_x, int current_y); -// int /*long*/ _gtk_drag_dest_find_target(int /*long*/ widget, int /*long*/ context, int /*long*/ target_list); -// void _gtk_drag_dest_set(int /*long*/ widget, int flags, int /*long*/ targets, int n_targets, int actions); -// void _gtk_drag_dest_unset(int /*long*/ widget); -// void _gtk_drag_finish(int /*long*/ context, bool success, bool delete, int time); -// void _gtk_drag_get_data(int /*long*/ widget, int /*long*/ context, int /*long*/ target, int time); -// void _gtk_drag_set_icon_pixbuf(int /*long*/ context, int /*long*/ pixbuf, int hot_x, int hot_y); -// int /*long*/ _gtk_drawing_area_new(); -// void _gtk_editable_copy_clipboard(int /*long*/ editable); -// void _gtk_editable_cut_clipboard(int /*long*/ editable); -// void _gtk_editable_delete_selection(int /*long*/ editable); -// void _gtk_editable_delete_text(int /*long*/ editable, int start_pos, int end_pos); -// int /*long*/ _gtk_editable_get_chars(int /*long*/ editable, int start_pos, int end_pos); -// bool _gtk_editable_get_editable(int /*long*/ editable); -// int _gtk_editable_get_position(int /*long*/ editable); -// bool _gtk_editable_get_selection_bounds(int /*long*/ editable, int[] start, int[] end); -// void _gtk_editable_insert_text(int /*long*/ editable, byte[] new_text, int new_text_length, int[] position); -// void _gtk_editable_paste_clipboard(int /*long*/ editable); -// void _gtk_editable_select_region(int /*long*/ editable, int start, int end); -// void _gtk_editable_set_editable(int /*long*/ entry, bool editable); -// void _gtk_editable_set_position(int /*long*/ editable, int position); - char gtk_entry_get_invisible_char(GtkEntry* entry); - PangoLayout* gtk_entry_get_layout (GtkEntry* entry); - void gtk_entry_get_layout_offsets (GtkEntry* layout, int* x, int* y); - int gtk_entry_text_index_to_layout_index (GtkEntry* entry, int index); - int gtk_entry_get_max_length(GtkEntry* entry); - char* gtk_entry_get_text(GtkEntry* entry); -// bool _FcConfigAppFontAddFile(int /*long*/ config, byte[] file); - bool gtk_entry_get_visibility(GtkEntry* entry); - GtkWidget* gtk_entry_new(); - void gtk_entry_set_activates_default(GtkEntry* entry, bool setting); - void gtk_entry_set_alignment(GtkEntry* entry, float xalign); - void gtk_entry_set_has_frame(GtkEntry* entry, bool setting); - void gtk_entry_set_invisible_char(GtkEntry* entry, char ch); - void gtk_entry_set_max_length(GtkEntry* entry, int max); - void gtk_entry_set_text(GtkEntry* entry, char* text); - void gtk_entry_set_visibility(GtkEntry* entry, bool visible); -// int _gtk_events_pending(); -// bool _gtk_expander_get_expanded(int /*long*/ expander); -// int /*long*/ _gtk_expander_get_label_widget(int /*long*/ expander); -// int /*long*/ _gtk_expander_new(byte[] label); -// void _gtk_expander_set_expanded(int /*long*/ expander, bool expanded); -// void _gtk_expander_set_label(int /*long*/ expander, byte[] label); -// void _gtk_expander_set_label_widget(int /*long*/ expander, int /*long*/ label_widget); -// void _gtk_file_chooser_add_filter(int /*long*/ chooser, int /*long*/ filter); -// int /*long*/ _gtk_file_chooser_dialog_new(byte[] title, int /*long*/ parent, int action, int /*long*/ first_button_text, int first_button_id, int /*long*/ second_button_text, int second_button_id, int /*long*/ terminator); -// int /*long*/ _gtk_file_chooser_get_current_folder(int /*long*/ chooser); -// int /*long*/ _gtk_file_chooser_get_filename(int /*long*/ chooser); -// int /*long*/ _gtk_file_chooser_get_filenames(int /*long*/ chooser); -// void _gtk_file_chooser_set_current_folder(int /*long*/ chooser, byte[] filename); -// void _gtk_file_chooser_set_current_name(int /*long*/ chooser, byte[] name); -// void _gtk_file_chooser_set_extra_widget(int /*long*/ chooser, int /*long*/ extra_widget); -// void _gtk_file_chooser_set_filename(int /*long*/ chooser, int /*long*/ name); -// void _gtk_file_chooser_set_select_multiple(int /*long*/ chooser, bool select_multiple); -// void _gtk_file_filter_add_pattern(int /*long*/ filter, byte[] pattern); -// int /*long*/ _gtk_file_filter_new(); -// void _gtk_file_filter_set_name(int /*long*/ filter, byte[] name); -// int /*long*/ _gtk_file_selection_get_filename(int /*long*/ filesel); -// int /*long*/ _gtk_file_selection_get_selections(int /*long*/ filesel); -// void _gtk_file_selection_hide_fileop_buttons(int /*long*/ filesel); -// int /*long*/ _gtk_file_selection_new(byte[] title); -// void _gtk_file_selection_set_filename(int /*long*/ filesel, int /*long*/ filename); -// void _gtk_file_selection_set_select_multiple(int /*long*/ filesel, bool select_multiple); -// void _gtk_fixed_move(int /*long*/ fixed, int /*long*/ widget, int x, int y); -// int /*long*/ _gtk_fixed_new(); -// void _gtk_fixed_set_has_window(int /*long*/ fixed, bool has_window); -// int /*long*/ _gtk_font_selection_dialog_get_font_name(int /*long*/ fsd); -// int /*long*/ _gtk_font_selection_dialog_new(byte[] title); -// bool _gtk_font_selection_dialog_set_font_name(int /*long*/ fsd, byte[] fontname); -// int /*long*/ _gtk_frame_new(byte[] label); -// int /*long*/ _gtk_frame_get_label_widget(int /*long*/ frame); -// void _gtk_frame_set_label(int /*long*/ frame, byte[] label); -// void _gtk_frame_set_label_widget(int /*long*/ frame, int /*long*/ label_widget); -// void _gtk_frame_set_shadow_type(int /*long*/ frame, int type); -// int /*long*/ _gtk_get_current_event(); -// bool _gtk_get_current_event_state (int[] state); -// int _gtk_get_current_event_time(); -// int /*long*/ _gtk_get_default_language(); -// int /*long*/ _gtk_get_event_widget(int /*long*/ event); -// void _gtk_grab_add(int /*long*/ widget); -// int /*long*/ _gtk_grab_get_current(); -// void _gtk_grab_remove(int /*long*/ widget); -// int /*long*/ _gtk_hbox_new(bool homogeneous, int spacing); -// int /*long*/ _gtk_hscale_new(int /*long*/ adjustment); -// int /*long*/ _gtk_hscrollbar_new(int /*long*/ adjustment); -// int /*long*/ _gtk_hseparator_new(); -// int /*long*/ _gtk_icon_factory_lookup_default(byte[] stock_id); -// void _gtk_icon_source_free(int /*long*/ source); -// int /*long*/ _gtk_icon_source_new(); -// void _gtk_icon_source_set_pixbuf(int /*long*/ source, int /*long*/ pixbuf); -// int /*long*/ _gtk_icon_set_render_icon(int /*long*/ icon_set, int /*long*/ style, int direction, int state, int size, int /*long*/ widget, int /*long*/ detail); -// bool _gtk_im_context_filter_keypress(int /*long*/ context, int /*long*/ event); -// void _gtk_im_context_focus_in(int /*long*/ context); -// void _gtk_im_context_focus_out(int /*long*/ context); -// void _gtk_im_context_get_preedit_string(int /*long*/ context, int /*long*/[] str, int /*long*/[] attrs, int[] cursor_pos); -// int /*long*/ _gtk_im_context_get_type(); -// void _gtk_im_context_reset(int /*long*/ context); -// void _gtk_im_context_set_client_window(int /*long*/ context, int /*long*/ window); -// void _gtk_im_context_set_cursor_location(int /*long*/ context, GdkRectangle area); -// void _gtk_im_multicontext_append_menuitems (int /*long*/ context, int /*long*/ menushell); -// int /*long*/ _gtk_im_multicontext_new(); -// int /*long*/ _gtk_image_menu_item_new_with_label(byte[] label); -// void _gtk_image_menu_item_set_image(int /*long*/ menu_item, int /*long*/ image); -// int /*long*/ _gtk_image_new(); -// int /*long*/ _gtk_image_new_from_pixbuf(int /*long*/ pixbuf); -// int /*long*/ _gtk_image_new_from_pixmap(int /*long*/ pixmap, int /*long*/ mask); -// void _gtk_image_set_from_pixbuf(int /*long*/ image, int /*long*/ pixbuf); -// void _gtk_image_set_from_pixmap(int /*long*/ image, int /*long*/ pixmap, int /*long*/ mask); -// bool _gtk_init_check(int /*long*/[] argc, int /*long*/[] argv); -// int /*long*/ _gtk_label_get_layout(int /*long*/ label); -// int _gtk_label_get_mnemonic_keyval(int /*long*/ label); -// int /*long*/ _gtk_label_new(byte[] label); -// int /*long*/ _gtk_label_new_with_mnemonic(byte[] str); -// void _gtk_label_set_attributes(int /*long*/ label, int /*long*/ attrs); -// void _gtk_label_set_justify(int /*long*/ label, int jtype); -// void _gtk_label_set_line_wrap(int /*long*/ label, bool wrap); -// void _gtk_label_set_text(int /*long*/ label, int /*long*/ str); -// void _gtk_label_set_text(int /*long*/ label, byte[] str); -// void _gtk_label_set_text_with_mnemonic(int /*long*/ label, byte[] str); -// void _gtk_list_append_items(int /*long*/ list, int /*long*/ items); -// void _gtk_list_clear_items(int /*long*/ list, int start, int end); -// void _gtk_list_insert_items(int /*long*/ list, int /*long*/ items, int position); -// int /*long*/ _gtk_list_item_new_with_label(byte[] label); -// void _gtk_list_remove_items(int /*long*/ list, int /*long*/ items); -// void _gtk_list_select_item(int /*long*/ list, int item); -// void _gtk_list_unselect_all(int /*long*/ list); -// void _gtk_list_unselect_item(int /*long*/ list, int item); -// void _gtk_list_store_append(int /*long*/ list_store, int /*long*/ iter); -// void _gtk_list_store_clear(int /*long*/ store); -// void _gtk_list_store_insert(int /*long*/ list_store, int /*long*/ iter, int position); -// int /*long*/ _gtk_list_store_newv(int numColumns, int /*long*/[] types); -// void _gtk_list_store_remove(int /*long*/ list_store, int /*long*/ iter); -// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, byte[] value, int /*long*/ terminator); -// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, int value, int /*long*/ terminator); -// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, long value, int /*long*/ terminator); -// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, GdkColor value, int /*long*/ terminator); -// void _gtk_list_store_set(int /*long*/ store, int /*long*/ iter, int column, bool value, int /*long*/ terminator); -// int _gtk_major_version(); -// int _gtk_minor_version(); -// int _gtk_micro_version(); -// void _gtk_main(); -// int _gtk_main_iteration(); -// void _gtk_main_do_event(int /*long*/ event); -// int /*long*/ _gtk_menu_bar_new(); -// void _gtk_menu_item_remove_submenu(int /*long*/ menu_item); -// void _gtk_menu_item_set_submenu(int /*long*/ menu_item, int /*long*/ submenu); -// int /*long*/ _gtk_menu_new(); -// void _gtk_menu_popdown(int /*long*/ menu); -// void _gtk_menu_popup(int /*long*/ menu, int /*long*/ parent_menu_shell, int /*long*/ parent_menu_item, int /*long*/ func, int /*long*/ data, int button, int activate_time); -// void _gtk_menu_shell_deactivate(int /*long*/ menu_shell); -// void _gtk_menu_shell_insert(int /*long*/ menu_shell, int /*long*/ child, int position); -// void _gtk_menu_shell_select_item(int /*long*/ menu_shell, int /*long*/ menu_item); -// void _gtk_menu_shell_set_take_focus(int /*long*/ menu_shell, bool take_focus); -// int /*long*/ _gtk_message_dialog_new(int /*long*/ parent, int flags, int type, int buttons, byte[] message_format); -// void _gtk_misc_set_alignment(int /*long*/ misc, float xalign, float yalign); -// int _gtk_notebook_get_current_page(int /*long*/ notebook); -// bool _gtk_notebook_get_scrollable(int /*long*/ notebook); -// void _gtk_notebook_insert_page(int /*long*/ notebook, int /*long*/ child, int /*long*/ tab_label, int position); -// int /*long*/ _gtk_notebook_new(); -// void _gtk_notebook_next_page(int /*long*/ notebook); -// void _gtk_notebook_prev_page(int /*long*/ notebook); -// void _gtk_notebook_remove_page(int /*long*/ notebook, int page_num); -// void _gtk_notebook_set_current_page(int /*long*/ notebook, int page_num); -// void _gtk_notebook_set_scrollable(int /*long*/ notebook, bool scrollable); -// void _gtk_notebook_set_show_tabs(int /*long*/ notebook, bool show_tabs); -// void _gtk_notebook_set_tab_pos(int /*long*/ notebook, int pos); -// void _gtk_object_sink(int /*long*/ object); -// int /*long*/ _gtk_page_setup_new (); -// int _gtk_page_setup_get_orientation(int /*long*/ setup); -// void _gtk_page_setup_set_orientation(int /*long*/ setup, int orientation); -// int /*long*/ _gtk_page_setup_get_paper_size(int /*long*/ setup); -// void _gtk_page_setup_set_paper_size(int /*long*/ setup, int /*long*/ size); -// double _gtk_page_setup_get_top_margin(int /*long*/ setup, int unit); -// void _gtk_page_setup_set_top_margin(int /*long*/ setup, double margin, int unit); -// double _gtk_page_setup_get_bottom_margin(int /*long*/ setup, int unit); -// void _gtk_page_setup_set_bottom_margin(int /*long*/ setup, double margin, int unit); -// double _gtk_page_setup_get_left_margin(int /*long*/ setup, int unit); -// void _gtk_page_setup_set_left_margin(int /*long*/ setup, double margin, int unit); -// double _gtk_page_setup_get_right_margin(int /*long*/ setup, int unit); -// void _gtk_page_setup_set_right_margin(int /*long*/ setup, double margin, int unit); -// double _gtk_page_setup_get_paper_width(int /*long*/ setup, int unit); -// double _gtk_page_setup_get_paper_height(int /*long*/ setup, int unit); -// double _gtk_page_setup_get_page_width(int /*long*/ setup, int unit); -// double _gtk_page_setup_get_page_height(int /*long*/ setup, int unit); -// void _gtk_paint_handle(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int orientation); -// void _gtk_paint_flat_box(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_focus(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_option(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_slider(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int orientation); -// void _gtk_paint_tab(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_arrow(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int arrow_type, bool fill, int x, int y, int width, int height); -// void _gtk_paint_box(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_box_gap(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width); -// void _gtk_paint_check(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_expander(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int expander_style); -// void _gtk_paint_extension(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side); -// void _gtk_paint_hline(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x1 , int x2, int y); -// void _gtk_paint_layout(int /*long*/ style, int /*long*/ window, int state_type, bool use_text, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int /*long*/ layout); -// void _gtk_paint_shadow_gap(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height, int gap_side, int gap_x, int gap_width); -// void _gtk_paint_shadow(int /*long*/ style, int /*long*/ window, int state_type, int shadow_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int x , int y, int width, int height); -// void _gtk_paint_vline(int /*long*/ style, int /*long*/ window, int state_type, GdkRectangle area, int /*long*/ widget, byte[] detail, int y1 , int y2, int x); -// int /*long*/ _gtk_paper_size_new(byte [] name); -// int /*long*/ _gtk_paper_size_new_from_ppd(byte [] ppd_name, byte [] ppd_display_name, double width, double height); -// int /*long*/ _gtk_paper_size_new_custom(byte [] name, byte [] display_name, double width, double height, int unit); -// int /*long*/ _gtk_paper_size_get_name(int /*long*/ size); -// int /*long*/ _gtk_paper_size_get_display_name(int /*long*/ size); -// int /*long*/ _gtk_paper_size_get_ppd_name(int /*long*/ size); -// double _gtk_paper_size_get_width(int /*long*/ size, int unit); -// double _gtk_paper_size_get_height(int /*long*/ size, int unit); -// bool _gtk_paper_size_is_custom(int /*long*/ size); -// int /*long*/ _gtk_plug_get_id(int /*long*/ plug); -// int /*long*/ _gtk_plug_new(int /*long*/ socket_id); -// int /*long*/ _gtk_printer_get_backend(int /*long*/ printer); -// int /*long*/ _gtk_printer_get_name(int /*long*/ printer); -// bool _gtk_printer_is_default(int /*long*/ printer); -// void _gtk_enumerate_printers(int /*long*/ func, int /*long*/data, int /*long*/ destroy, bool wait); -// int /*long*/ _gtk_print_job_new(byte[] title, int /*long*/ printer, int /*long*/ settings, int /*long*/ page_setup); -// int /*long*/ _gtk_print_job_get_settings(int /*long*/ job); -// int /*long*/ _gtk_print_job_get_printer(int /*long*/ job); -// int /*long*/ _gtk_print_job_get_title(int /*long*/ job); -// int _gtk_print_job_get_status(int /*long*/ job); -// bool _gtk_print_job_set_source_file(int /*long*/ job, byte[] filename, int /*long*/ error[]); -// int /*long*/ _gtk_print_job_get_surface(int /*long*/ job, int /*long*/ error[]); -// void _gtk_print_job_send(int /*long*/ job, int /*long*/ callback, int /*long*/ user_data, int /*long*/ dnotify); -// int /*long*/ _gtk_print_settings_new(); -// void _gtk_print_settings_foreach(int /*long*/ settings, int /*long*/ func, int /*long*/ data); -// int /*long*/ _gtk_print_settings_get(int /*long*/ settings, byte [] key); -// void _gtk_print_settings_set(int /*long*/ settings, byte [] key, byte [] value); -// int /*long*/ _gtk_print_settings_get_printer(int /*long*/ settings); -// void _gtk_print_settings_set_printer(int /*long*/ settings, byte[] printer); -// int _gtk_print_settings_get_orientation(int /*long*/ settings); -// void _gtk_print_settings_set_orientation(int /*long*/ settings, int orientation); -// bool _gtk_print_settings_get_collate(int /*long*/ settings); -// void _gtk_print_settings_set_collate(int /*long*/ settings, bool collate); -// int _gtk_print_settings_get_n_copies(int /*long*/ settings); -// void _gtk_print_settings_set_n_copies(int /*long*/ settings, int num_copies); -// int _gtk_print_settings_get_print_pages(int /*long*/ settings); -// void _gtk_print_settings_set_print_pages(int /*long*/ settings, int pages); -// int /*long*/ _gtk_print_settings_get_page_ranges(int /*long*/ settings, int[] num_ranges); -// void _gtk_print_settings_set_page_ranges(int /*long*/ settings, int[] page_ranges, int num_ranges); -// double _gtk_print_settings_get_paper_width(int /*long*/ settings, int unit); -// double _gtk_print_settings_get_paper_height(int /*long*/ settings, int unit); -// int _gtk_print_settings_get_resolution(int /*long*/ settings); -// int /*long*/ _gtk_print_unix_dialog_new(byte[] title, int /*long*/ parent); -// void _gtk_print_unix_dialog_set_page_setup(int /*long*/ dialog, int /*long*/ page_setup); -// int /*long*/ _gtk_print_unix_dialog_get_page_setup(int /*long*/ dialog); -// void _gtk_print_unix_dialog_set_current_page(int /*long*/ dialog, int current_page); -// int _gtk_print_unix_dialog_get_current_page(int /*long*/ dialog); -// void _gtk_print_unix_dialog_set_settings(int /*long*/ dialog, int /*long*/ settings); -// int /*long*/ _gtk_print_unix_dialog_get_settings(int /*long*/ dialog); -// int /*long*/ _gtk_print_unix_dialog_get_selected_printer(int /*long*/ dialog); -// void _gtk_print_unix_dialog_set_manual_capabilities(int /*long*/ dialog, int /*long*/ capabilities); -// int /*long*/ _gtk_progress_bar_new(); -// void _gtk_progress_bar_pulse(int /*long*/ pbar); -// void _gtk_progress_bar_set_fraction(int /*long*/ pbar, double fraction); -// void _gtk_progress_bar_set_orientation(int /*long*/ pbar, int orientation); -// int /*long*/ _gtk_radio_button_get_group(int /*long*/ radio_button); -// int /*long*/ _gtk_radio_button_new(int /*long*/ group); -// int /*long*/ _gtk_radio_menu_item_get_group(int /*long*/ radio_menu_item); -// int /*long*/ _gtk_radio_menu_item_new(int /*long*/ group); -// int /*long*/ _gtk_radio_menu_item_new_with_label(int /*long*/ group, byte[] label); -// int /*long*/ _gtk_range_get_adjustment(int /*long*/ range); -// void _gtk_range_set_increments(int /*long*/ range, double step, double page); -// void _gtk_range_set_inverted(int /*long*/ range, bool setting); -// void _gtk_range_set_range(int /*long*/ range, double min, double max); -// void _gtk_range_set_value(int /*long*/ range, double value); -// void _gtk_rc_parse_string(byte[] rc_string); -// int /*long*/ _gtk_rc_style_get_bg_pixmap_name(int /*long*/ style, int index); -// int _gtk_rc_style_get_color_flags(int /*long*/ style, int index); -// void _gtk_rc_style_set_bg(int /*long*/ style, int index, GdkColor color); -// void _gtk_rc_style_set_bg_pixmap_name(int /*long*/ style, int index, int /*long*/ name); -// void _gtk_rc_style_set_color_flags(int /*long*/ style, int index, int flag); -// void _gtk_scale_set_digits(int /*long*/ scale, int digits); -// void _gtk_scale_set_draw_value(int /*long*/ scale, bool draw_value); -// void _gtk_rc_style_set_fg(int /*long*/ style, int index, GdkColor color); -// void _gtk_rc_style_set_text(int /*long*/ style, int index, GdkColor color); -// void _gtk_scrolled_window_add_with_viewport(int /*long*/ scrolled_window, int /*long*/ child); -// int /*long*/ _gtk_scrolled_window_get_hadjustment(int /*long*/ scrolled_window); -// void _gtk_scrolled_window_get_policy(int /*long*/ scrolled_window, int[] hscrollbar_policy, int[] vscrollbar_policy); -// int _gtk_scrolled_window_get_shadow_type(int /*long*/ scrolled_window); -// int /*long*/ _gtk_scrolled_window_get_vadjustment(int /*long*/ scrolled_window); -// int /*long*/ _gtk_scrolled_window_new(int /*long*/ hadjustment, int /*long*/ vadjustment); -// void _gtk_scrolled_window_set_placement(int /*long*/ scrolled_window, int placement); -// void _gtk_scrolled_window_set_policy(int /*long*/ scrolled_window, int hscrollbar_policy, int vscrollbar_policy); -// void _gtk_scrolled_window_set_shadow_type(int /*long*/ scrolled_window, int type); -// int /*long*/ _gtk_settings_get_default(); -// void _gtk_selection_data_free(int /*long*/ selection_data); -// void _gtk_selection_data_set(int /*long*/ selection_data, int /*long*/ type, int format, int /*long*/ data, int length); -// int /*long*/ _gtk_separator_menu_item_new(); -// int /*long*/ _gtk_set_locale(); -// int /*long*/ _gtk_socket_get_id(int /*long*/ socket); -// int /*long*/ _gtk_socket_new(); -// int /*long*/ _gtk_spin_button_new(int /*long*/ adjustment, double climb_rate, int digits); -// int /*long*/ _gtk_spin_button_get_adjustment(int /*long*/ spin_button); -// int _gtk_spin_button_get_digits(int /*long*/ spin_button); -// void _gtk_spin_button_set_digits(int /*long*/ spin_button, int digits); -// void _gtk_spin_button_set_increments(int /*long*/ spin_button, double step, double page); -// void _gtk_spin_button_set_range(int /*long*/ spin_button, double max, double min); -// void _gtk_spin_button_set_value(int /*long*/ spin_button, double value); -// void _gtk_spin_button_set_wrap(int /*long*/ spin_button, bool wrap); -// void _gtk_spin_button_update(int /*long*/ spin_button); -// void _gtk_style_get_base(int /*long*/ style, int index, GdkColor color); -// void _gtk_style_get_black(int /*long*/ style, GdkColor color); -// void _gtk_style_get_bg(int /*long*/ style, int index, GdkColor color); -// void _gtk_style_get_dark(int /*long*/ style, int index, GdkColor color); -// void _gtk_style_get_fg(int /*long*/ style, int index, GdkColor color); -// void _gtk_style_get_fg_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_bg_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_light_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_dark_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_mid_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_text_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_text_aa_gc(int /*long*/ style, int index, int /*long*/[] gc); -// void _gtk_style_get_black_gc(int /*long*/ style, int /*long*/[] gc); -// void _gtk_style_get_white_gc(int /*long*/ style, int /*long*/[] gc); -// int /*long*/ _gtk_style_get_font_desc(int /*long*/ style); -// void _gtk_style_get_light(int /*long*/ style, int index, GdkColor color); -// void _gtk_style_get_text(int /*long*/ style, int index, GdkColor color); -// int _gtk_style_get_xthickness(int /*long*/ style); -// int _gtk_style_get_ythickness(int /*long*/ style); -// int /*long*/ _gtk_style_render_icon(int /*long*/ style, int /*long*/ source, int direction, int state, int size, int /*long*/ widget, byte[] detail); -// int /*long*/ _gtk_target_list_new(int /*long*/ targets, int ntargets); -// void _gtk_target_list_unref(int /*long*/ list); -// void _gtk_text_buffer_copy_clipboard(int /*long*/ buffer, int /*long*/ clipboard); -// void _gtk_text_buffer_cut_clipboard(int /*long*/ buffer, int /*long*/ clipboard, bool default_editable); -// void _gtk_text_buffer_delete(int /*long*/ buffer, byte[] start, byte[] end); -// void _gtk_text_buffer_get_bounds(int /*long*/ buffer, byte[] start, byte[] end); -// int _gtk_text_buffer_get_char_count(int /*long*/ buffer); -// void _gtk_text_buffer_get_end_iter(int /*long*/ buffer, byte[] iter); -// int /*long*/ _gtk_text_buffer_get_insert(int /*long*/ buffer); -// void _gtk_text_buffer_get_iter_at_line(int /*long*/ buffer, byte[] iter, int line_number); -// void _gtk_text_buffer_get_iter_at_mark(int /*long*/ buffer, byte[] iter, int /*long*/ mark); -// void _gtk_text_buffer_get_iter_at_offset(int /*long*/ buffer, byte[] iter, int char_offset); -// int _gtk_text_buffer_get_line_count(int /*long*/ buffer); -// int /*long*/ _gtk_text_buffer_get_selection_bound(int /*long*/ buffer); -// bool _gtk_text_buffer_get_selection_bounds(int /*long*/ buffer, byte[] start, byte[] end); -// int /*long*/ _gtk_text_buffer_get_text(int /*long*/ buffer, byte[] start, byte[] end, bool include_hidden_chars); -// void _gtk_text_buffer_insert(int /*long*/ buffer, byte[] iter, byte[] text, int len); -// void _gtk_text_buffer_insert(int /*long*/ buffer, int /*long*/ iter, byte[] text, int len); -// void _gtk_text_buffer_move_mark(int /*long*/ buffer, int /*long*/ mark, byte[] where); -// void _gtk_text_buffer_paste_clipboard(int /*long*/ buffer, int /*long*/ clipboard, byte[] override_location, bool default_editable); -// void _gtk_text_buffer_place_cursor(int /*long*/ buffer, byte[] where); -// void _gtk_text_buffer_set_text(int /*long*/ buffer, byte[] text, int len); -// int _gtk_text_iter_get_line(byte[] iter); -// int _gtk_text_iter_get_offset(byte[] iter); -// void _gtk_text_view_buffer_to_window_coords(int /*long*/ text_view, int win, int buffer_x, int buffer_y, int[] window_x, int[] window_y); -// int /*long*/ _gtk_text_view_get_buffer(int /*long*/ text_view); -// bool _gtk_text_view_get_editable(int /*long*/ text_view); -// void _gtk_text_view_get_iter_at_location(int /*long*/ text_view, byte[] iter, int x, int y); -// void _gtk_text_view_get_iter_location(int /*long*/ text_view, byte[] iter, GdkRectangle location); -// void _gtk_text_view_get_line_at_y(int /*long*/ text_view, byte[] target_iter, int y, int[] line_top); -// void _gtk_text_view_get_visible_rect(int /*long*/ text_view, GdkRectangle visible_rect); -// int /*long*/ _gtk_text_view_get_window(int /*long*/ text_view, int win); -// int /*long*/ _gtk_text_view_new(); -// void _gtk_text_view_scroll_mark_onscreen(int /*long*/ text_view, int /*long*/ mark); -// bool _gtk_text_view_scroll_to_iter(int /*long*/ text_view, byte[] iter, double within_margin, bool use_align, double xalign, double yalign); -// void _gtk_text_view_set_editable(int /*long*/ text_view, bool setting); -// void _gtk_text_view_set_justification(int /*long*/ text_view, int justification); -// void _gtk_text_view_set_tabs(int /*long*/ text_view, int /*long*/ tabs); -// void _gtk_text_view_set_wrap_mode(int /*long*/ text_view, int wrap_mode); -// void _gtk_text_view_window_to_buffer_coords(int /*long*/ text_view, int win, int window_x, int window_y, int[] buffer_x, int[] buffer_y); -// int _gtk_timeout_add(int interval, int /*long*/ function, int /*long*/ data); -// void _gtk_timeout_remove(int timeout_handler_id); -// bool _gtk_toggle_button_get_active(int /*long*/ toggle_button); -// int /*long*/ _gtk_toggle_button_new(); -// void _gtk_toggle_button_set_active(int /*long*/ toggle_button, bool is_active); -// void _gtk_toggle_button_set_mode(int /*long*/ toggle_button, bool draw_indicator); -// void _gtk_toolbar_insert_widget(int /*long*/ toolbar, int /*long*/ widget, byte[] tooltip_text, byte[] tooltip_private_text, int position); -// int /*long*/ _gtk_toolbar_new(); -// void _gtk_toolbar_set_orientation(int /*long*/ toolbar, int orientation); -// int /*long*/ _gtk_tooltips_data_get(int /*long*/ widget); -// void _gtk_tooltips_disable(int /*long*/ tooltips); -// void _gtk_tooltips_enable(int /*long*/ tooltips); -// int /*long*/ _gtk_tooltips_new(); -// void _gtk_tooltips_force_window(int /*long*/ tooltips); -// void _gtk_tooltips_set_tip(int /*long*/ tooltips, int /*long*/ widget, byte[] tip_text, byte[] tip_private); -// void _gtk_tree_model_get(int /*long*/ tree_model, int /*long*/ iter, int column, int[] value, int /*long*/ terminator); -// void _gtk_tree_model_get(int /*long*/ tree_model, int /*long*/ iter, int column, long[] value, int /*long*/ terminator); -// bool _gtk_tree_model_get_iter(int /*long*/ tree_model, int /*long*/ iter, int /*long*/ path); -// bool _gtk_tree_model_get_iter_first(int /*long*/ tree_model, int /*long*/ iter); -// int _gtk_tree_model_get_n_columns(int /*long*/ tree_model); -// int /*long*/ _gtk_tree_model_get_path(int /*long*/ tree_model, int /*long*/ iter); -// int /*long*/ _gtk_tree_model_get_type(); -// bool _gtk_tree_model_iter_children(int /*long*/ model, int /*long*/ iter, int /*long*/ parent); -// int _gtk_tree_model_iter_n_children(int /*long*/ model, int /*long*/ iter); -// bool _gtk_tree_model_iter_next(int /*long*/ model, int /*long*/ iter); -// bool _gtk_tree_model_iter_nth_child(int /*long*/ tree_model, int /*long*/ iter, int /*long*/ parent, int n); -// void _gtk_tree_path_append_index(int /*long*/ path, int index); -// int /*long*/ _gtk_tree_path_compare(int /*long*/ a, int /*long*/ b); -// void _gtk_tree_path_down(int /*long*/ path); -// void _gtk_tree_path_free(int /*long*/ path); -// int _gtk_tree_path_get_depth(int /*long*/ path); -// int /*long*/ _gtk_tree_path_get_indices(int /*long*/ path); -// int /*long*/ _gtk_tree_path_new(); -// int /*long*/ _gtk_tree_path_new_first(); -// int /*long*/ _gtk_tree_path_new_from_string(byte[] path); -// int /*long*/ _gtk_tree_path_new_from_string(int /*long*/ path); -// void _gtk_tree_path_next(int /*long*/ path); -// bool _gtk_tree_path_prev(int /*long*/ path); -// bool _gtk_tree_path_up(int /*long*/ path); -// int _gtk_tree_selection_count_selected_rows(int /*long*/ selection); -// bool _gtk_tree_selection_get_selected(int /*long*/ selection, int /*long*/[] model, int /*long*/ iter); -// int /*long*/ _gtk_tree_selection_get_selected_rows(int /*long*/ selection, int /*long*/[] model); -// bool _gtk_tree_selection_path_is_selected(int /*long*/ selection, int /*long*/ path); -// void _gtk_tree_selection_select_all(int /*long*/ selection); -// void _gtk_tree_selection_select_iter(int /*long*/ selection, int /*long*/ iter); -// void _gtk_tree_selection_selected_foreach(int /*long*/ selection, int /*long*/ func, int /*long*/ data); -// void _gtk_tree_selection_set_mode(int /*long*/ selection, int mode); -// void _gtk_tree_selection_unselect_all(int /*long*/ selection); -// void _gtk_tree_selection_unselect_iter(int /*long*/ selection, int /*long*/ iter); -// void _gtk_tree_store_append(int /*long*/ store, int /*long*/ iter, int /*long*/ parent); -// void _gtk_tree_store_clear(int /*long*/ store); -// void _gtk_tree_store_insert(int /*long*/ store, int /*long*/ iter, int /*long*/ parent, int position); -// int /*long*/ _gtk_tree_store_newv(int numColumns, int /*long*/[] types); -// void _gtk_tree_store_remove(int /*long*/ store, int /*long*/ iter); -// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, byte[] value, int /*long*/ terminator); -// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, int value, int /*long*/ terminator); -// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, long value, int /*long*/ terminator); -// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, GdkColor value, int /*long*/ terminator); -// void _gtk_tree_store_set(int /*long*/ store, int /*long*/ iter, int column, bool value, int /*long*/ terminator); -// int /*long*/ _gtk_tree_view_create_row_drag_icon(int /*long*/ view, int /*long*/ path); -// bool _gtk_tree_view_collapse_row(int /*long*/ view, int /*long*/ path); -// void _gtk_tree_view_column_add_attribute(int /*long*/ treeColumn, int /*long*/ cellRenderer, byte[] attribute, int column); -// bool _gtk_tree_view_column_cell_get_position(int /*long*/ tree_column, int /*long*/ cell_renderer, int[] start_pos, int[] width); -// void _gtk_tree_view_column_cell_get_size(int /*long*/ tree_column, GdkRectangle cell_area, int[] x_offset, int[] y_offset, int[] width, int[] height); -// void _gtk_tree_view_column_cell_set_cell_data(int /*long*/ tree_column, int /*long*/ tree_model, int /*long*/ iter, bool is_expander, bool is_expanded); -// void _gtk_tree_view_column_clear(int /*long*/ tree_column); -// int /*long*/ _gtk_tree_view_column_get_cell_renderers(int /*long*/ tree_column); -// int _gtk_tree_view_column_get_fixed_width(int /*long*/ column); -// bool _gtk_tree_view_column_get_reorderable(int /*long*/ column); -// bool _gtk_tree_view_column_get_resizable(int /*long*/ column); -// int _gtk_tree_view_column_get_sizing(int /*long*/ tree_column); -// int _gtk_tree_view_column_get_spacing(int /*long*/ tree_column); -// bool _gtk_tree_view_column_get_visible(int /*long*/ column); -// bool _gtk_tree_view_column_get_sort_indicator(int /*long*/ tree_column); -// int _gtk_tree_view_column_get_sort_order(int /*long*/ tree_column); -// int _gtk_tree_view_column_get_width(int /*long*/ column); -// int /*long*/ _gtk_tree_view_column_new(); -// void _gtk_tree_view_column_pack_start(int /*long*/ tree_column, int /*long*/ cell_renderer, bool expand); -// void _gtk_tree_view_column_pack_end(int /*long*/ tree_column, int /*long*/ cell_renderer, bool expand); -// void _gtk_tree_view_column_set_alignment(int /*long*/ tree_column, float xalign); -// void _gtk_tree_view_column_set_cell_data_func(int /*long*/ tree_column, int /*long*/ cell_renderer, int /*long*/ func, int /*long*/ func_data, int /*long*/ destroy); -// void _gtk_tree_view_column_set_clickable(int /*long*/ column, bool clickable); -// void _gtk_tree_view_column_set_fixed_width(int /*long*/ column, int fixed_width); -// void _gtk_tree_view_column_set_min_width(int /*long*/ tree_column, int min_width); -// void _gtk_tree_view_column_set_reorderable(int /*long*/ column, bool reorderable); -// void _gtk_tree_view_column_set_resizable(int /*long*/ column, bool resizable); -// void _gtk_tree_view_column_set_sizing(int /*long*/ column, int type); -// void _gtk_tree_view_column_set_sort_indicator(int /*long*/ tree_column, bool setting); -// void _gtk_tree_view_column_set_sort_order(int /*long*/ tree_column, int order); -// void _gtk_tree_view_column_set_title(int /*long*/ tree_column, byte[] title); -// void _gtk_tree_view_column_set_visible (int /*long*/ tree_column, bool visible); -// void _gtk_tree_view_column_set_widget(int /*long*/ tree_column, int /*long*/ widget); -// void _gtk_tree_view_set_drag_dest_row(int /*long*/ view, int /*long*/ path, int pos); -// void _gtk_tree_view_set_enable_search (int /*long*/ view, bool enable_search); -// bool _gtk_tree_view_expand_row(int /*long*/ view, int /*long*/ path, bool open_all); -// void _gtk_tree_view_get_background_area(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, GdkRectangle rect); -// int /*long*/ _gtk_tree_view_get_bin_window(int /*long*/ tree_view); -// void _gtk_tree_view_get_cell_area(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, GdkRectangle rect); -// int /*long*/_gtk_tree_view_get_expander_column(int /*long*/ tree_view); -// int /*long*/ _gtk_tree_view_get_column(int /*long*/ tree_view, int n); -// int /*long*/ _gtk_tree_view_get_columns(int /*long*/ tree_view); -// void _gtk_tree_view_get_cursor(int /*long*/ tree_view, int /*long*/[] path, int /*long*/[] focus_column); -// bool _gtk_tree_view_get_headers_visible(int /*long*/ tree_view); -// bool _gtk_tree_view_get_path_at_pos(int /*long*/ tree_view, int x, int y, int /*long*/[] path, int /*long*/[] column, int[] cell_x, int[] cell_y); -// bool _gtk_tree_view_get_rules_hint(int /*long*/ tree_view); -// int /*long*/ _gtk_tree_view_get_selection(int /*long*/ tree_view); -// void _gtk_tree_view_get_visible_rect(int /*long*/ tree_view, GdkRectangle visible_rect); -// int _gtk_tree_view_insert_column(int /*long*/ tree_view, int /*long*/ column, int position); -// void _gtk_tree_view_move_column_after(int /*long*/ tree_view, int /*long*/ column, int /*long*/ base_column); -// int /*long*/ _gtk_tree_view_new_with_model(int /*long*/ model); -// void _gtk_tree_view_remove_column(int /*long*/ tree_view, int /*long*/ column); -// bool _gtk_tree_view_row_expanded(int /*long*/ view, int /*long*/ path); -// void _gtk_tree_view_scroll_to_cell(int /*long*/ tree_view, int /*long*/ path, int /*long*/ column, bool use_align, float row_aligh, float column_align); -// void _gtk_tree_view_scroll_to_point (int /*long*/ tree_view, int tree_x, int tree_y); -// void _gtk_tree_view_set_cursor(int /*long*/ tree_view, int /*long*/ path, int /*long*/ focus_column, bool start_editing); -// void _gtk_tree_view_set_headers_visible(int /*long*/ tree_view, bool visible); -// void _gtk_tree_view_set_model(int /*long*/ tree_view, int /*long*/ model); -// void _gtk_tree_view_set_rules_hint(int /*long*/ tree_view, bool setting); -// void _gtk_tree_view_set_search_column(int /*long*/ tree_view, int column); -// void _gtk_tree_view_tree_to_widget_coords(int /*long*/ tree_view, int tx, int ty, int[] wx, int[] wy); -// void _gtk_tree_view_unset_rows_drag_dest(int /*long*/ tree_view); -// void _gtk_tree_view_widget_to_tree_coords(int /*long*/ tree_view, int wx, int wy, int[] tx, int[] ty); -// int /*long*/ _gtk_vbox_new(bool homogeneous, int spacing); -// int /*long*/ _gtk_vscale_new(int /*long*/ adjustment); -// int /*long*/ _gtk_vscrollbar_new(int /*long*/ adjustment); -// int /*long*/ _gtk_vseparator_new(); -// void _gtk_widget_add_accelerator(int /*long*/ widget, byte[] accel_signal, int /*long*/ accel_group, int accel_key, int accel_mods, int accel_flags); -// void _gtk_widget_add_events(int /*long*/ widget, int events); -// bool _gtk_widget_child_focus(int /*long*/ widget, int direction); -// int /*long*/ _gtk_widget_create_pango_layout(int /*long*/ widget, byte[] text); -// int /*long*/ _gtk_widget_create_pango_layout(int /*long*/ widget, int /*long*/ text); -// void _gtk_widget_destroy(int /*long*/ widget); -// bool _gtk_widget_event(int /*long*/ widget, int /*long*/ event); -// int /*long*/ _gtk_widget_get_accessible (int /*long*/ widget); -// bool _gtk_widget_get_child_visible (int /*long*/ widget); -// int _gtk_widget_get_default_direction(); -// int /*long*/ _gtk_widget_get_default_style(); -// int _gtk_widget_get_direction(int /*long*/ widget); -// int _gtk_widget_get_events(int /*long*/ widget); -// int /*long*/ _gtk_widget_get_modifier_style(int /*long*/ widget); -// int /*long*/ _gtk_widget_get_pango_context(int /*long*/ widget); -// int /*long*/ _gtk_widget_get_parent(int /*long*/ widget); -// int /*long*/ _gtk_widget_get_style(int /*long*/ widget); -// void _gtk_widget_get_size_request(int /*long*/ widget, int [] width, int [] height); -// int /*long*/ _gtk_widget_get_toplevel (int /*long*/ widget); -// void _gtk_widget_grab_focus(int /*long*/ widget); -// void _gtk_widget_hide(int /*long*/ widget); -// bool _gtk_widget_is_focus(int /*long*/ widget); -// void _gtk_widget_map(int /*long*/ widget); -// bool _gtk_widget_mnemonic_activate(int /*long*/ widget, bool group_cycling); -// void _gtk_widget_modify_base(int /*long*/ widget, int state, GdkColor color); -// void _gtk_widget_modify_bg(int /*long*/ widget, int state, GdkColor color); -// void _gtk_widget_modify_fg(int /*long*/ widget, int state, GdkColor color); -// void _gtk_widget_modify_font(int /*long*/ widget, int /*long*/ pango_font_descr); -// void _gtk_widget_modify_style(int /*long*/ widget, int /*long*/ style); -// void _gtk_widget_modify_text(int /*long*/ widget, int state, GdkColor color); -// void _gtk_widget_queue_resize(int /*long*/ widget); -// void _gtk_widget_realize(int /*long*/ widget); -// void _gtk_widget_remove_accelerator(int /*long*/ widget, int /*long*/ accel_group, int accel_key, int accel_mods); -// void _gtk_widget_reparent(int /*long*/ widget, int /*long*/ new_parent); -// void _gtk_widget_set_app_paintable(int /*long*/ widget, bool app_paintable); -// void _gtk_widget_set_default_direction(int dir); -// void _gtk_widget_set_direction(int /*long*/ widget, int dir); -// void _gtk_widget_set_double_buffered(int /*long*/ widget, bool double_buffered); -// void _gtk_widget_set_name(int /*long*/ widget, byte[] name); -// void _gtk_widget_set_redraw_on_allocate(int /*long*/ widget, bool redraw); -// void _gtk_widget_set_sensitive(int /*long*/ widget, bool sensitive); -// void _gtk_widget_set_size_request(int /*long*/ widget, int width, int height); -// void _gtk_widget_set_state(int /*long*/ widget, int state); -// void _gtk_widget_set_style(int /*long*/ widget, int /*long*/ style); -// void _gtk_widget_shape_combine_mask(int /*long*/ widget, int /*long*/ shape_mask, int offset_x, int offset_y); -// void _gtk_widget_show(int /*long*/ widget); -// void _gtk_widget_show_now(int /*long*/ widget); -// void _gtk_widget_size_allocate(int /*long*/ widget, GtkAllocation allocation); -// void _gtk_widget_size_request(int /*long*/ widget, GtkRequisition requisition); -// void _gtk_widget_style_get(int /*long*/ widget, byte[] property_name, int[] value, int /*long*/ terminator); -// void _gtk_widget_style_get(int /*long*/ widget, byte[] property_name, long[] value, int /*long*/ terminator); -// bool _gtk_widget_translate_coordinates(int /*long*/ src_widget, int /*long*/ dest_widget, int src_x, int src_y, int[] dest_x, int[] dest_y); -// void _gtk_widget_unrealize(int /*long*/ widget); -// bool _gtk_window_activate_default(int /*long*/ window); -// void _gtk_window_add_accel_group(int /*long*/ window, int /*long*/ accel_group); -// void _gtk_window_deiconify(int /*long*/ handle); -// int /*long*/ _gtk_window_get_focus(int /*long*/ window); -// int /*long*/ _gtk_window_get_icon_list(int /*long*/ window); -// bool _gtk_window_get_modal(int /*long*/ window); -// int _gtk_window_get_mnemonic_modifier(int /*long*/ window); -// void _gtk_window_get_position(int /*long*/ handle, int[] x, int[] y); -// void _gtk_window_get_size(int /*long*/ handle, int[] x, int[] y); -// void _gtk_window_iconify(int /*long*/ handle); -// void _gtk_window_maximize(int /*long*/ handle); -// void _gtk_window_move(int /*long*/ handle, int x, int y); -// int /*long*/ _gtk_window_new(int type); -// void _gtk_window_present(int /*long*/ window); -// void _gtk_window_remove_accel_group(int /*long*/ window, int /*long*/ accel_group); -// void _gtk_window_resize(int /*long*/ handle, int x, int y); -// void _gtk_window_set_default(int /*long*/ window, int /*long*/ widget); -// void _gtk_window_set_destroy_with_parent(int /*long*/ window, bool setting); -// void _gtk_window_set_geometry_hints(int /*long*/ window, int /*long*/ geometry_widget, GdkGeometry geometry, int geom_mask); -// void _gtk_window_set_icon_list(int /*long*/ window, int /*long*/ list); -// void _gtk_window_set_modal(int /*long*/ window, bool modal); -// void _gtk_widget_set_parent_window(int /*long*/ widget, int /*long*/ parent_window); -// void _gtk_window_set_resizable(int /*long*/ window, bool resizable); -// void _gtk_window_set_title(int /*long*/ window, byte[] title); -// void _gtk_window_set_skip_taskbar_hint(int /*long*/ window, bool skips_taskbar); -// void _gtk_window_set_type_hint(int /*long*/ window, int hint); -// void _gtk_window_set_transient_for(int /*long*/ window, int /*long*/ parent); -// void _gtk_window_unmaximize(int /*long*/ handle); -// -// int /*long*/ _pango_attr_background_new (short red, short green, short blue); -// int /*long*/ _pango_attr_font_desc_new(int /*long*/ desc); -// int /*long*/ _pango_attr_foreground_new (short red, short green, short blue); -// int /*long*/ _pango_attr_rise_new(int rise); -// int /*long*/ _pango_attr_shape_new(PangoRectangle ink_rect, PangoRectangle logical_rect); -// void _pango_attr_list_insert(int /*long*/ list, int /*long*/ attr); -// void _pango_attr_list_change(int /*long*/ list, int /*long*/ attr); -// int /*long*/ _pango_attr_list_new(); -// void _pango_attr_list_unref(int /*long*/ list); -// int /*long*/ _pango_attr_strikethrough_new(bool strikethrough); -// int /*long*/ _pango_attr_underline_new(int underline); -// int /*long*/ _pango_attr_weight_new(int weight); -// int /*long*/ _pango_cairo_font_map_get_default(); -// int /*long*/ _pango_cairo_font_map_new(); -// int /*long*/ _pango_cairo_font_map_create_context(int /*long*/ fontmap); -// int /*long*/ _pango_cairo_create_layout(int /*long*/ cairo); -// int /*long*/ _pango_cairo_context_get_font_options(int /*long*/ context); -// void _pango_cairo_context_set_font_options(int /*long*/ context, int /*long*/ options); -// void _pango_cairo_font_map_set_resolution(int /*long*/ fontmap, double dpi); -// void _pango_cairo_layout_path(int /*long*/ cairo, int /*long*/ layout); -// void _pango_cairo_show_layout(int /*long*/ cairo, int /*long*/ layout); -// int _pango_context_get_base_dir(int /*long*/ context); -// int /*long*/ _pango_context_get_language(int /*long*/ context); -// int /*long*/ _pango_context_get_metrics(int /*long*/ context, int /*long*/ desc, int /*long*/ language); -// void _pango_context_list_families(int /*long*/ context, int /*long*/[] families, int[] n_families); -// void _pango_context_set_base_dir(int /*long*/ context, int direction); -// void _pango_context_set_language(int /*long*/ context, int /*long*/ language); -// int /*long*/ _pango_font_description_copy(int /*long*/ desc); -// void _pango_font_description_free(int /*long*/ desc); -// int /*long*/ _pango_font_description_from_string(byte[] str); -// int /*long*/ _pango_font_description_get_family(int /*long*/ desc); -// int _pango_font_description_get_size(int /*long*/ desc); -// int _pango_font_description_get_style(int /*long*/ desc); -// int _pango_font_description_get_weight(int /*long*/ desc); -// int /*long*/ _pango_font_description_new(); -// void _pango_font_description_set_family(int /*long*/ desc, byte[] family); -// void _pango_font_description_set_size(int /*long*/ desc, int size); -// void _pango_font_description_set_stretch(int /*long*/ desc, int stretch); -// void _pango_font_description_set_style(int /*long*/ desc, int weight); -// void _pango_font_description_set_weight(int /*long*/ desc, int weight); -// int /*long*/ _pango_font_description_to_string(int /*long*/ desc); -// int /*long*/ _pango_font_face_describe(int /*long*/ face); -// int /*long*/ _pango_font_family_get_name(int /*long*/ family); -// void _pango_font_family_list_faces(int /*long*/ family, int /*long*/[] faces, int[] n_faces); -// int /*long*/ _pango_font_get_metrics(int /*long*/ font, int /*long*/ language); -// int _pango_font_metrics_get_approximate_char_width(int /*long*/ metrics); -// int _pango_font_metrics_get_ascent(int /*long*/ metrics); -// int _pango_font_metrics_get_descent(int /*long*/ metrics); -// void _pango_font_metrics_unref(int /*long*/ metrics); -// int /*long*/ _pango_language_from_string(byte[] language); -// void _pango_layout_context_changed(int /*long*/ layout); -// int _pango_layout_get_alignment(int /*long*/ layout); -// int /*long*/ _pango_layout_get_context(int /*long*/ layout); -// int /*long*/ _pango_layout_get_attributes(int /*long*/ layout); -// int _pango_layout_get_indent(int /*long*/ layout); -// int /*long*/ _pango_layout_get_iter(int /*long*/ layout); -// bool _pango_layout_get_justify(int /*long*/ layout); -// int /*long*/ _pango_layout_get_line(int /*long*/ layout, int line); -// int _pango_layout_get_line_count(int /*long*/ layout); -// void _pango_layout_get_log_attrs(int /*long*/ layout, int /*long*/[] attrs, int[] n_attrs); -// void _pango_layout_get_size(int /*long*/ layout, int[] width, int[] height); -// int _pango_layout_get_spacing(int /*long*/ layout); -// int /*long*/ _pango_layout_get_tabs(int /*long*/ layout); -// int /*long*/ _pango_layout_get_text(int /*long*/ layout); -// int _pango_layout_get_width(int /*long*/ layout); -// void _pango_layout_index_to_pos(int /*long*/ layout, int index, PangoRectangle pos); -// void _pango_layout_iter_free(int /*long*/ iter); -// void _pango_layout_iter_get_line_extents(int /*long*/ iter, PangoRectangle ink_rect, PangoRectangle logical_rect); -// int _pango_layout_iter_get_index(int /*long*/ iter); -// int /*long*/ _pango_layout_iter_get_run(int /*long*/ iter); -// bool _pango_layout_iter_next_line(int /*long*/ iter); -// bool _pango_layout_iter_next_run(int /*long*/ iter); -// void _pango_layout_line_get_extents(int /*long*/ line, PangoRectangle ink_rect, PangoRectangle logical_rect); -// bool _pango_layout_line_x_to_index(int /*long*/ line, int x_pos, int[] index_, int[] trailing); -// int /*long*/ _pango_layout_new(int /*long*/ context); -// void _pango_layout_set_alignment (int /*long*/ layout, int alignment); -// void _pango_layout_set_attributes(int /*long*/ layout, int /*long*/ attrs); -// void _pango_layout_set_auto_dir(int /*long*/ layout, bool auto_dir); -// void _pango_layout_set_font_description(int /*long*/ context, int /*long*/ descr); -// void _pango_layout_set_indent(int /*long*/ layout, int indent); -// void _pango_layout_set_justify(int /*long*/ layout, bool justify); -// void _pango_layout_set_single_paragraph_mode(int /*long*/ context, bool setting); -// void _pango_layout_set_spacing(int /*long*/ layout, int spacing); -// void _pango_layout_set_tabs(int /*long*/ layout, int /*long*/ tabs); -// void _pango_layout_set_text(int /*long*/ layout, byte[] text, int length); -// void _pango_layout_set_width(int /*long*/ layout, int width); -// void _pango_layout_set_wrap (int /*long*/ layout, int wrap); -// bool _pango_layout_xy_to_index(int /*long*/ layout, int x, int y, int[] index, int[] trailing); -// int _pango_tab_array_get_size(int /*long*/ tab_array); -// void _pango_tab_array_get_tabs(int /*long*/ tab_array, int /*long*/[] alignments, int /*long*/[] locations); -// void _pango_tab_array_free(int /*long*/ tab_array); -// int /*long*/ _pango_tab_array_new(int initial_size, bool positions_in_pixels); -// void _pango_tab_array_set_tab(int /*long*/ tab_array, int tab_index, int /*long*/ alignment, int location); -// bool atk_object_add_relationship (int /*long*/ object, int relationship, int /*long*/ target); -} - -public class OS : Platform { - - /** OS Constants */ - public static const bool IsAIX, IsSunOS, IsLinux, IsHPUX; - static this() { - /* Initialize the OS flags and locale constants */ - char[] osName = "Linux";//System.getProperty ("os.name"); - bool isAIX = false, isSunOS = false, isLinux = false, isHPUX = false; - if (osName == "Linux") isLinux = true; - if (osName == "AIX") isAIX = true; - if (osName == "Solaris") isSunOS = true; - if (osName == "SunOS") isSunOS = true; - if (osName == "HP-UX") isHPUX = true; - IsAIX = isAIX; IsSunOS = isSunOS; IsLinux = isLinux; IsHPUX = isHPUX; - //PORTING_LEFT - GTK_VERSION = 0; //buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); - } - - /** Constants */ - public static const int ATK_RELATION_LABELLED_BY = 4; - public static const int G_SIGNAL_MATCH_DATA = 1 << 4; - public static const int G_SIGNAL_MATCH_ID = 1 << 0; - public static const int GDK_2BUTTON_PRESS = 0x5; - public static const int GDK_3BUTTON_PRESS = 0x6; - public static const int GDK_ACTION_COPY = 1 << 1; - public static const int GDK_ACTION_MOVE = 1 << 2; - public static const int GDK_ACTION_LINK = 1 << 3; - public static const int GDK_Alt_L = 0xffe9; - public static const int GDK_Alt_R = 0xffea; - public static const int GDK_AND = 4; - public static const int GDK_BackSpace = 0xff08; - public static const int GDK_BOTTOM_LEFT_CORNER = 0xc; - public static const int GDK_BOTTOM_RIGHT_CORNER = 0xe; - public static const int GDK_BOTTOM_SIDE = 0x10; - public static const int GDK_BUTTON1_MASK = 0x100; - public static const int GDK_BUTTON2_MASK = 0x200; - public static const int GDK_BUTTON3_MASK = 0x400; - public static const int GDK_BUTTON_MOTION_MASK = 1 << 4; - public static const int GDK_BUTTON1_MOTION_MASK = 1 << 5; - public static const int GDK_BUTTON2_MOTION_MASK = 1 << 6; - public static const int GDK_BUTTON3_MOTION_MASK = 1 << 7; - public static const int GDK_BUTTON_PRESS = 0x4; - public static const int GDK_BUTTON_PRESS_MASK = 0x100; - public static const int GDK_BUTTON_RELEASE = 0x7; - public static const int GDK_BUTTON_RELEASE_MASK = 0x200; - public static const int GDK_CAP_BUTT = 0x1; - public static const int GDK_CAP_PROJECTING = 3; - public static const int GDK_CAP_ROUND = 0x2; - public static const int GDK_COLORSPACE_RGB = 0; - public static const int GDK_CONFIGURE = 13; - public static const int GDK_CONTROL_MASK = 0x4; - public static const int GDK_COPY = 0x0; - public static const int GDK_CROSS = 0x1e; - public static const int GDK_CROSSING_NORMAL = 0; - public static const int GDK_CROSSING_GRAB = 1; - public static const int GDK_CROSSING_UNGRAB = 2; - public static const int GDK_Break = 0xff6b; - public static const int GDK_Cancel = 0xff69; - public static const int GDK_Caps_Lock = 0xffE5; - public static const int GDK_Clear = 0xff0B; - public static const int GDK_Control_L = 0xffe3; - public static const int GDK_Control_R = 0xffe4; - public static const int GDK_CURRENT_TIME = 0x0; - public static const int GDK_DECOR_BORDER = 0x2; - public static const int GDK_DECOR_MAXIMIZE = 0x40; - public static const int GDK_DECOR_MENU = 0x10; - public static const int GDK_DECOR_MINIMIZE = 0x20; - public static const int GDK_DECOR_RESIZEH = 0x4; - public static const int GDK_DECOR_TITLE = 0x8; - public static const int GDK_DOUBLE_ARROW = 0x2a; - public static const int GDK_Delete = 0xffff; - public static const int GDK_Down = 0xff54; - public static const int GDK_ENTER_NOTIFY_MASK = 0x1000; - public static const int GDK_ENTER_NOTIFY = 10; - public static const int GDK_EVEN_ODD_RULE = 0; - public static const int GTK_EXPANDER_COLAPSED = 0; - public static const int GTK_EXPANDER_SEMI_COLLAPSED = 1; - public static const int GTK_EXPANDER_SEMI_EXPANDED = 2; - public static const int GTK_EXPANDER_EXPANDED = 3; - public static const int GDK_EXPOSE = 2; - public static const int GDK_EXPOSURE_MASK = 0x2; - public static const int GDK_End = 0xff57; - public static const int GDK_Escape = 0xff1b; - public static const int GDK_F1 = 0xffbe; - public static const int GDK_F10 = 0xffc7; - public static const int GDK_F11 = 0xffc8; - public static const int GDK_F12 = 0xffc9; - public static const int GDK_F13 = 0xffca; - public static const int GDK_F14 = 0xffcb; - public static const int GDK_F15 = 0xffcc; - public static const int GDK_F2 = 0xffbf; - public static const int GDK_F3 = 0xffc0; - public static const int GDK_F4 = 0xffc1; - public static const int GDK_F5 = 0xffc2; - public static const int GDK_F6 = 0xffc3; - public static const int GDK_F7 = 0xffc4; - public static const int GDK_F8 = 0xffc5; - public static const int GDK_F9 = 0xffc6; - public static const int GDK_FLEUR = 0x34; - public static const int GDK_FOCUS_CHANGE = 0xc; - public static const int GDK_FOCUS_CHANGE_MASK = 0x4000; - public static const int GDK_GC_CLIP_MASK = 0x80; - public static const int GDK_GC_CLIP_X_ORIGIN = 0x800; - public static const int GDK_GC_CLIP_Y_ORIGIN = 0x1000; - public static const int GDK_GRAB_SUCCESS = 0x0; - public static const int GDK_HAND2 = 0x3c; - public static const int GDK_Help = 0xFF6A; - public static const int GDK_HINT_MIN_SIZE = 1 << 1; - public static const int GDK_Home = 0xff50; - public static const int GDK_INCLUDE_INFERIORS = 0x1; - public static const int GDK_INPUT_ONLY = 1; - public static const int GDK_INTERP_BILINEAR = 0x2; - public static const int GDK_Insert = 0xff63; - public static const int GDK_ISO_Left_Tab = 0xfe20; - public static const int GDK_JOIN_MITER = 0x0; - public static const int GDK_JOIN_ROUND = 0x1; - public static const int GDK_JOIN_BEVEL = 0x2; - public static const int GDK_KEY_PRESS = 0x8; - public static const int GDK_KEY_PRESS_MASK = 0x400; - public static const int GDK_KEY_RELEASE = 0x9; - public static const int GDK_KEY_RELEASE_MASK = 0x800; - public static const int GDK_KP_0 = 0xffb0; - public static const int GDK_KP_1 = 0xffb1; - public static const int GDK_KP_2 = 0xffb2; - public static const int GDK_KP_3 = 0xffb3; - public static const int GDK_KP_4 = 0xffb4; - public static const int GDK_KP_5 = 0xffb5; - public static const int GDK_KP_6 = 0xffb6; - public static const int GDK_KP_7 = 0xffb7; - public static const int GDK_KP_8 = 0xffb8; - public static const int GDK_KP_9 = 0xffb9; - public static const int GDK_KP_Add = 0xffab; - public static const int GDK_KP_Decimal = 0xffae; - public static const int GDK_KP_Delete = 0xFF9F; - public static const int GDK_KP_Divide = 0xffaf; - public static const int GDK_KP_Down = 0xFF99; - public static const int GDK_KP_End = 0xFF9C; - public static const int GDK_KP_Enter = 0xff8d; - public static const int GDK_KP_Equal = 0xffbd; - public static const int GDK_KP_Home = 0xFF95; - public static const int GDK_KP_Insert = 0xFF9E; - public static const int GDK_KP_Left = 0xFF96; - public static const int GDK_KP_Multiply = 0xffaa; - public static const int GDK_KP_Page_Down = 0xFF9B; - public static const int GDK_KP_Page_Up = 0xFF9A; - public static const int GDK_KP_Right = 0xFF98; - public static const int GDK_KP_Subtract = 0xffad; - public static const int GDK_KP_Up = 0xFF97; - public static const int GDK_LEAVE_NOTIFY = 11; - public static const int GDK_LEAVE_NOTIFY_MASK = 0x2000; - public static const int GDK_LEFT_PTR = 0x44; - public static const int GDK_LEFT_SIDE = 0x46; - public static const int GDK_LINE_ON_OFF_DASH = 0x1; - public static const int GDK_LINE_SOLID = 0x0; - public static const int GDK_Linefeed = 0xff0A; - public static const int GDK_LSB_FIRST = 0x0; - public static const int GDK_Left = 0xff51; - public static const int GDK_Meta_L = 0xFFE7; - public static const int GDK_Meta_R = 0xFFE8; - public static const int GDK_MAP = 14; - public static const int GDK_MOD1_MASK = 0x8; - public static const int GDK_MOTION_NOTIFY = 0x3; - public static const int GDK_NO_EXPOSE = 30; - public static const int GDK_NONE = 0; - public static const int GDK_NOTIFY_INFERIOR = 2; - public static const int GDK_Num_Lock = 0xFF7F; - public static const int GDK_OVERLAP_RECTANGLE_OUT = 0x1; - public static const int GDK_PIXBUF_ALPHA_BILEVEL = 0x0; - public static const int GDK_POINTER_MOTION_HINT_MASK = 0x8; - public static const int GDK_POINTER_MOTION_MASK = 0x4; - public static const int GDK_PROPERTY_NOTIFY = 16; - public static const int GDK_Page_Down = 0xff56; - public static const int GDK_Page_Up = 0xff55; - public static const int GDK_Pause = 0xff13; - public static const int GDK_Print = 0xff61; - public static const int GDK_QUESTION_ARROW = 0x5c; - public static const int GDK_RGB_DITHER_NORMAL = 0x1; - public static const int GDK_RIGHT_SIDE = 0x60; - public static const int GDK_Return = 0xff0d; - public static const int GDK_Right = 0xff53; - public static const int GDK_space = 0x20; - public static const int GDK_SB_H_DOUBLE_ARROW = 0x6c; - public static const int GDK_SB_UP_ARROW = 0x72; - public static const int GDK_SB_V_DOUBLE_ARROW = 0x74; - public static const int GDK_SCROLL_UP = 0; - public static const int GDK_SCROLL_DOWN = 1; - public static const int GDK_SCROLL_LEFT = 2; - public static const int GDK_SCROLL_RIGHT = 3; - public static const int GDK_SELECTION_CLEAR = 17; - public static const int GDK_SELECTION_NOTIFY = 19; - public static const int GDK_SELECTION_REQUEST = 18; - public static const int GDK_SHIFT_MASK = 0x1; - public static const int GDK_SIZING = 0x78; - public static const int GDK_STIPPLED = 0x2; - public static const int GDK_TILED = 0x1; - public static const int GDK_Shift_L = 0xffe1; - public static const int GDK_Shift_R = 0xffe2; - public static const int GDK_SCROLL = 31; - public static const int GDK_Scroll_Lock = 0xff14; - public static const int GDK_TOP_LEFT_CORNER = 0x86; - public static const int GDK_TOP_RIGHT_CORNER = 0x88; - public static const int GDK_TOP_SIDE = 0x8a; - public static const int GDK_Tab = 0xff09; - public static const int GDK_Up = 0xff52; - public static const int GDK_WATCH = 0x96; - public static const int GDK_XOR = 0x2; - public static const int GDK_XTERM = 0x98; - public static const int GDK_X_CURSOR = 0x0; - public static const int GDK_VISIBILITY_FULLY_OBSCURED = 2; - public static const int GDK_VISIBILITY_NOTIFY_MASK = 1 << 17; - public static const int GDK_WINDOW_CHILD = 2; - public static const int GDK_WINDOW_STATE_ICONIFIED = 1 << 1; - public static const int GDK_WINDOW_STATE_MAXIMIZED = 1 << 2; - public static const int GTK_ACCEL_VISIBLE = 0x1; - public static const int GTK_ARROW_DOWN = 0x1; - public static const int GTK_ARROW_LEFT = 0x2; - public static const int GTK_ARROW_RIGHT = 0x3; - public static const int GTK_ARROW_UP = 0x0; - public static const int GTK_CALENDAR_SHOW_HEADING = 1 << 0; - public static const int GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1; - public static const int GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2; - public static const int GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3; - public static const int GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4; - public static const int GTK_CAN_DEFAULT = 0x2000; - public static const int GTK_CAN_FOCUS = 0x800; - public static const int GTK_CELL_RENDERER_MODE_ACTIVATABLE = 1; - public static const int GTK_CELL_RENDERER_SELECTED = 1 << 0; - public static const int GTK_CELL_RENDERER_FOCUSED = 1 << 4; - public static const int GTK_CLIST_SHOW_TITLES = 0x4; - public static const int GTK_CORNER_TOP_LEFT = 0x0; - public static const int GTK_CORNER_TOP_RIGHT = 0x2; - public static const int GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1; - public static const int GTK_DIALOG_MODAL = 1 << 0; - public static const int GTK_DIR_TAB_FORWARD = 0; - public static const int GTK_DIR_TAB_BACKWARD = 1; - public static const int GTK_FILE_CHOOSER_ACTION_OPEN = 0; - public static const int GTK_FILE_CHOOSER_ACTION_SAVE = 1; - public static const int GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER = 2; - public static const int GTK_HAS_FOCUS = 1 << 12; - public static const int GTK_ICON_SIZE_MENU = 1; - public static const int GTK_ICON_SIZE_SMALL_TOOLBAR = 2; - public static const int GTK_ICON_SIZE_LARGE_TOOLBAR = 3; - public static const int GTK_ICON_SIZE_DIALOG = 6; - public static const int GTK_JUSTIFY_CENTER = 0x2; - public static const int GTK_JUSTIFY_LEFT = 0x0; - public static const int GTK_JUSTIFY_RIGHT = 0x1; - public static const int GTK_MAPPED = 1 << 7; - public static const int GTK_MESSAGE_INFO = 0; - public static const int GTK_MESSAGE_WARNING = 1; - public static const int GTK_MESSAGE_QUESTION = 2; - public static const int GTK_MESSAGE_ERROR = 3; - public static const int GTK_NO_WINDOW = 1 << 5; - public static const int GTK_ORIENTATION_HORIZONTAL = 0x0; - public static const int GTK_ORIENTATION_VERTICAL = 0x1; - public static const int GTK_PACK_END = 1; - public static const int GTK_PACK_START = 0; - public static const int GTK_POLICY_ALWAYS = 0x0; - public static const int GTK_POLICY_AUTOMATIC = 0x1; - public static const int GTK_POLICY_NEVER = 0x2; - public static const int GTK_POS_TOP = 0x2; - public static const int GTK_POS_BOTTOM = 0x3; - public static const int GTK_PRINT_CAPABILITY_PAGE_SET = 1 << 0; - public static const int GTK_PRINT_CAPABILITY_COPIES = 1 << 1; - public static const int GTK_PRINT_CAPABILITY_COLLATE = 1 << 2; - public static const int GTK_PRINT_CAPABILITY_REVERSE = 1 << 3; - public static const int GTK_PRINT_CAPABILITY_SCALE = 1 << 4; - public static const int GTK_PRINT_CAPABILITY_GENERATE_PDF = 1 << 5; - public static const int GTK_PRINT_CAPABILITY_GENERATE_PS = 1 << 6; - public static const int GTK_PRINT_CAPABILITY_PREVIEW = 1 << 7; - public static const int GTK_PRINT_PAGES_ALL = 0; - public static const int GTK_PRINT_PAGES_CURRENT = 1; - public static const int GTK_PRINT_PAGES_RANGES = 2; - public static const int GTK_PROGRESS_CONTINUOUS = 0x0; - public static const int GTK_PROGRESS_DISCRETE = 0x1; - public static const int GTK_PROGRESS_LEFT_TO_RIGHT = 0x0; - public static const int GTK_PROGRESS_BOTTOM_TO_TOP = 0x2; - public static const int GTK_REALIZED = 1 << 6; - public static const int GTK_RELIEF_NONE = 0x2; - public static const int GTK_RELIEF_NORMAL = 0; - public static const int GTK_RC_BG = 1 << 1; - public static const int GTK_RC_FG = 1 << 0; - public static const int GTK_RC_TEXT = 1 << 2; - public static const int GTK_RC_BASE = 1 << 3; - public static const int GTK_RESPONSE_APPLY = 0xfffffff6; - public static const int GTK_RESPONSE_CANCEL = 0xfffffffa; - public static const int GTK_RESPONSE_OK = 0xfffffffb; - public static const int GTK_SCROLL_NONE = 0; - public static const int GTK_SCROLL_JUMP = 1; - public static const int GTK_SCROLL_STEP_BACKWARD = 2; - public static const int GTK_SCROLL_STEP_FORWARD = 3; - public static const int GTK_SCROLL_PAGE_BACKWARD = 4; - public static const int GTK_SCROLL_PAGE_FORWARD = 5; - public static const int GTK_SCROLL_STEP_UP = 6; - public static const int GTK_SCROLL_STEP_DOWN = 7; - public static const int GTK_SCROLL_PAGE_UP = 8; - public static const int GTK_SCROLL_PAGE_DOWN = 9; - public static const int GTK_SCROLL_STEP_LEFT = 10; - public static const int GTK_SCROLL_STEP_RIGHT = 11; - public static const int GTK_SCROLL_PAGE_LEFT = 12; - public static const int GTK_SCROLL_PAGE_RIGHT = 13; - public static const int GTK_SCROLL_START = 14; - public static const int GTK_SCROLL_END = 15; - public static const int GTK_SELECTION_BROWSE = 0x2; - public static const int GTK_SELECTION_MULTIPLE = 0x3; - public static const int GTK_SENSITIVE = 0x200; - public static const int GTK_SHADOW_ETCHED_IN = 0x3; - public static const int GTK_SHADOW_ETCHED_OUT = 0x4; - public static const int GTK_SHADOW_IN = 0x1; - public static const int GTK_SHADOW_NONE = 0x0; - public static const int GTK_SHADOW_OUT = 0x2; - public static const int GTK_STATE_ACTIVE = 0x1; - public static const int GTK_STATE_INSENSITIVE = 0x4; - public static const int GTK_STATE_NORMAL = 0x0; - public static const int GTK_STATE_PRELIGHT = 0x2; - public static const int GTK_STATE_SELECTED = 0x3; - public static const int GTK_TEXT_DIR_LTR = 1; - public static const int GTK_TEXT_DIR_NONE = 0 ; - public static const int GTK_TEXT_DIR_RTL = 2; - public static const int GTK_TEXT_WINDOW_TEXT = 2; - public static const int GTK_TOOLBAR_CHILD_BUTTON = 0x1; - public static const int GTK_TOOLBAR_CHILD_RADIOBUTTON = 0x3; - public static const int GTK_TOOLBAR_CHILD_TOGGLEBUTTON = 0x2; - public static const int GTK_TREE_VIEW_COLUMN_GROW_ONLY = 0; - public static const int GTK_TREE_VIEW_COLUMN_AUTOSIZE = 1; - public static const int GTK_TREE_VIEW_COLUMN_FIXED = 2; - public static const int GTK_TREE_VIEW_DROP_BEFORE = 0; - public static const int GTK_TREE_VIEW_DROP_AFTER = 1; - public static const int GTK_TREE_VIEW_DROP_INTO_OR_BEFORE = 2; - public static const int GTK_TREE_VIEW_DROP_INTO_OR_AFTER = 3; - public static const int GDK_UNMAP = 15; - public static const int GTK_UNIT_PIXEL = 0; - public static const int GTK_UNIT_POINTS = 1; - public static const int GTK_UNIT_INCH = 2; - public static const int GTK_UNIT_MM = 3; - public static const int GTK_VISIBILITY_FULL = 0x2; - public static const int GTK_VISIBILITY_NONE = 0x0; - public static const int GTK_VISIBLE = 0x100; - public static const int GDK_WA_X = 1 << 2; - public static const int GDK_WA_Y = 1 << 3; - public static const int GDK_WA_VISUAL = 1 << 6; - public static const int GTK_WINDOW_POPUP = 0x1; - public static const int GTK_WINDOW_TOPLEVEL = 0x0; - public static const int GDK_WINDOW_TYPE_HINT_DIALOG = 1; - public static const int GTK_WRAP_NONE = 0; - public static const int GTK_WRAP_WORD = 2; - public static const int G_LOG_FLAG_FATAL = 0x2; - public static const int G_LOG_FLAG_RECURSION = 0x1; - public static const int G_LOG_LEVEL_MASK = 0xfffffffc; - public static const int None = 0; - public static const int PANGO_ALIGN_LEFT = 0; - public static const int PANGO_ALIGN_CENTER = 1; - public static const int PANGO_ALIGN_RIGHT = 2; - public static const int PANGO_DIRECTION_LTR = 0; - public static const int PANGO_DIRECTION_RTL = 1; - public static const int PANGO_SCALE = 1024; - public static const int PANGO_STRETCH_NORMAL = 0x4; - public static const int PANGO_STYLE_ITALIC = 0x2; - public static const int PANGO_STYLE_NORMAL = 0x0; - public static const int PANGO_STYLE_OBLIQUE = 0x1; - public static const int PANGO_TAB_LEFT = 0; - public static const int PANGO_UNDERLINE_LOW = 3; - public static const int PANGO_UNDERLINE_SINGLE = 1; - public static const int PANGO_WEIGHT_BOLD = 0x2bc; - public static const int PANGO_WEIGHT_NORMAL = 0x190; - public static const int PANGO_WRAP_WORD = 0; - public static const int PANGO_WRAP_WORD_CHAR = 2; - public static const int RTLD_LAZY = 1; - public static const int XA_CARDINAL = 6; - public static const int XA_WINDOW = 33; - - /** Signals */ - public static const char[] activate = "activate"; - public static const char[] button_press_event = "button-press-event"; - public static const char[] button_release_event = "button-release-event"; - public static const char[] changed = "changed"; - public static const char[] change_current_page = "change-current-page"; - public static const char[] change_value = "change-value"; - public static const char[] clicked = "clicked"; - public static const char[] commit = "commit"; - public static const char[] configure_event = "configure-event"; - public static const char[] delete_event = "delete-event"; - public static const char[] day_selected = "day-selected"; - public static const char[] delete_range = "delete-range"; - public static const char[] delete_text = "delete-text"; - public static const char[] drag_data_delete = "drag_data_delete"; - public static const char[] drag_data_get = "drag_data_get"; - public static const char[] drag_data_received = "drag_data_received"; - public static const char[] drag_drop = "drag_drop"; - public static const char[] drag_end = "drag_end"; - public static const char[] drag_leave = "drag_leave"; - public static const char[] drag_motion = "drag_motion"; - public static const char[] enter_notify_event = "enter-notify-event"; - public static const char[] event = "event"; - public static const char[] event_after = "event-after"; - public static const char[] expand_collapse_cursor_row = "expand-collapse-cursor-row"; - public static const char[] expose_event = "expose-event"; - public static const char[] focus = "focus"; - public static const char[] focus_in_event = "focus-in-event"; - public static const char[] focus_out_event = "focus-out-event"; - public static const char[] grab_focus = "grab-focus"; - public static const char[] hide = "hide"; - public static const char[] input = "input"; - public static const char[] insert_text = "insert-text"; - public static const char[] key_press_event = "key-press-event"; - public static const char[] key_release_event = "key-release-event"; - public static const char[] leave_notify_event = "leave-notify-event"; - public static const char[] map = "map"; - public static const char[] map_event = "map-event"; - public static const char[] mnemonic_activate = "mnemonic-activate"; - public static const char[] month_changed = "month-changed"; - public static const char[] motion_notify_event = "motion-notify-event"; - public static const char[] move_focus = "move-focus"; - public static const char[] output = "output"; - public static const char[] popup_menu = "popup-menu"; - public static const char[] preedit_changed = "preedit-changed"; - public static const char[] realize = "realize"; - public static const char[] row_activated = "row-activated"; - public static const char[] row_changed = "row-changed"; - public static const char[] scroll_child = "scroll-child"; - public static const char[] scroll_event = "scroll-event"; - public static const char[] select = "select"; - public static const char[] show = "show"; - public static const char[] show_help = "show-help"; - public static const char[] size_allocate = "size-allocate"; - public static const char[] size_request = "size-request"; - public static const char[] style_set = "style-set"; - public static const char[] switch_page = "switch-page"; - public static const char[] test_collapse_row = "test-collapse-row"; - public static const char[] test_expand_row = "test-expand-row"; - public static const char[] toggled = "toggled"; - public static const char[] unmap = "unmap"; - public static const char[] unmap_event = "unmap-event"; - public static const char[] unrealize = "unrealize"; - public static const char[] value_changed = "value-changed"; - public static const char[] visibility_notify_event = "visibility-notify-event"; - public static const char[] window_state_event = "window-state-event"; - - /** Properties */ - public static const char[] active = "active"; - public static const char[] background_gdk = "background-gdk"; - public static const char[] button_relief = "button-relief"; - public static const char[] cell_background_gdk = "cell-background-gdk"; - public static const char[] default_border = "default-border"; - public static const char[] expander_size = "expander-size"; - public static const char[] fixed_height_mode = "fixed-height-mode"; - public static const char[] focus_line_width = "focus-line-width"; - public static const char[] font_desc = "font-desc"; - public static const char[] foreground_gdk = "foreground-gdk"; - public static const char[] gtk_cursor_blink = "gtk-cursor-blink"; - public static const char[] gtk_cursor_blink_time = "gtk-cursor-blink-time"; - public static const char[] gtk_double_click_time = "gtk-double-click-time"; - public static const char[] gtk_entry_select_on_focus = "gtk-entry-select-on-focus"; - public static const char[] horizontal_separator = "horizontal-separator"; - public static const char[] inconsistent = "inconsistent"; - public static const char[] interior_focus = "interior-focus"; - public static const char[] mode = "mode"; - public static const char[] pixbuf = "pixbuf"; - public static const char[] text = "text"; - public static const char[] xalign = "xalign"; - public static const char[] ypad = "ypad"; - public static const char[] GTK_PRINT_SETTINGS_OUTPUT_URI = "output-uri"; - - public static const int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); - -/+ -protected static byte [] ascii (String name) { - int length = name.length (); - char [] chars = new char [length]; - name.getChars (0, length, chars, 0); - byte [] buffer = new byte [length + 1]; - for (int i=0; i- * Note: For a given event, only the fields which are appropriate - * will be filled in. The contents of the fields which are not used - * by the event are unspecified. - *
- * - * @see Listener - * @see org.eclipse.swt.events.TypedEvent - */ - -public class Event { - - /** - * the display where the event occurred - * - * @since 2.0 - */ - public Display display; - - /** - * the widget that issued the event - */ - public Widget widget; - - /** - * the type of event, as defined by the event type constants - * in classSWT
- *
- * @see org.eclipse.swt.SWT
- */
- public int type;
-
- /**
- * the event specific detail field, as defined by the detail constants
- * in class SWT
- *
- * @see org.eclipse.swt.SWT
- */
- public int detail;
-
- /**
- * the item that the event occurred in (can be null)
- */
- public Widget item;
-
- /**
- * the index of the item where the event occurred
- *
- * @since 3.2
- */
- public int index;
-
- /**
- * the graphics context to use when painting
- * that is configured to use the colors, font and
- * damaged region of the control. It is valid
- * only during the paint and must not be disposed
- */
- public GC gc;
-
- /**
- * depending on the event type, the x offset of the bounding
- * rectangle of the region that requires painting or the
- * widget-relative, x coordinate of the pointer at the
- * time the mouse button was pressed or released
- */
- public int x;
-
- /**
- * depending on the event type, the y offset of the bounding
- * rectangle of the region that requires painting or the
- * widget-relative, y coordinate of the pointer at the
- * time the mouse button was pressed or released
- */
- public int y;
-
- /**
- * the width of the bounding rectangle of the
- * region that requires painting
- */
- public int width;
-
- /**
- * the height of the bounding rectangle of the
- * region that requires painting
- */
- public int height;
-
- /**
- * depending on the event type, the number of following
- * paint events which are pending which may always be zero
- * on some platforms or the number of lines or pages to
- * scroll using the mouse wheel
- */
- public int count;
-
- /**
- * the time that the event occurred.
- *
- * NOTE: This field is an unsigned integer and should
- * be AND'ed with 0xFFFFFFFFL so that it can be treated
- * as a signed long.
- */
- public int time;
-
- /**
- * the button that was pressed or released; 1 for the
- * first button, 2 for the second button, and 3 for the
- * third button, etc.
- */
- public int button;
-
- /**
- * depending on the event, the character represented by the key
- * that was typed. This is the final character that results
- * after all modifiers have been applied. For example, when the
- * user types Ctrl+A, the character value is 0x01 (ASCII SOH).
- * It is important that applications do not attempt to modify the
- * character value based on a stateMask (such as SWT.CTRL) or the
- * resulting character will not be correct.
- */
- public char character;
-
- /**
- * depending on the event, the key code of the key that was typed,
- * as defined by the key code constants in class SWT
.
- * When the character field of the event is ambiguous, this field
- * contains the unaffected value of the original character. For
- * example, typing Ctrl+M or Enter both result in the character '\r'
- * but the keyCode field will also contain '\r' when Enter was typed
- * and 'm' when Ctrl+M was typed.
- *
- * @see org.eclipse.swt.SWT
- */
- public int keyCode;
-
- /**
- * depending on the event, the state of the keyboard modifier
- * keys and mouse masks at the time the event was generated.
- *
- * @see org.eclipse.swt.SWT
- */
- public int stateMask;
-
- /**
- * depending on the event, the range of text being modified.
- * Setting these fields has no effect.
- */
- public int start, end;
-
- /**
- * depending on the event, the new text that will be inserted.
- * Setting this field will change the text that is about to
- * be inserted or deleted.
- */
- public char[] text;
-
- /**
- * depending on the event, a flag indicating whether the operation
- * should be allowed. Setting this field to false will cancel the
- * operation.
- */
- public bool doit = true;
-
- /**
- * a field for application use
- */
- public Object data;
-
-/**
- * Gets the bounds.
- *
- * @return a rectangle that is the bounds.
- */
-public Rectangle getBounds () {
- return new Rectangle (x, y, width, height);
-}
-
-/**
- * Sets the bounds.
- *
- * @param rect the new rectangle
- */
-public void setBounds (Rectangle rect) {
- this.x = rect.x;
- this.y = rect.y;
- this.width = rect.width;
- this.height = rect.height;
-}
-
-/**
- * Returns a string containing a concise, human-readable
- * description of the receiver.
- *
- * @return a string representation of the event
- */
-public char[] toString () {
- return Format( "Event {type={} {} time={} data={} x={} y={} width={} height={} detail={}}",
- type, widget, time, data, x, y, width, height, detail ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
-}
-}