# HG changeset patch
# User Frank Benoit
- * 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 dwt.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 dwt.graphics.GC#setLineCap(int)
- * @see dwt.graphics.GC#getLineCap()
- *
- * @since 3.1
- */
- public static const int CAP_FLAT = 1;
-
- /**
- * Line drawing style for rounded end caps (value is 2).
- *
- * @see dwt.graphics.GC#setLineCap(int)
- * @see dwt.graphics.GC#getLineCap()
- *
- * @since 3.1
- */
- public static const int CAP_ROUND = 2;
-
- /**
- * Line drawing style for square end caps (value is 3).
- *
- * @see dwt.graphics.GC#setLineCap(int)
- * @see dwt.graphics.GC#getLineCap()
- *
- * @since 3.1
- */
- public static const int CAP_SQUARE = 3;
-
- /**
- * Line drawing style for miter joins (value is 1).
- *
- * @see dwt.graphics.GC#setLineJoin(int)
- * @see dwt.graphics.GC#getLineJoin()
- *
- * @since 3.1
- */
- public static const int JOIN_MITER = 1;
-
- /**
- * Line drawing style for rounded joins (value is 2).
- *
- * @see dwt.graphics.GC#setLineJoin(int)
- * @see dwt.graphics.GC#getLineJoin()
- *
- * @since 3.1
- */
- public static const int JOIN_ROUND = 2;
-
- /**
- * Line drawing style for bevel joins (value is 3).
- *
- * @see dwt.graphics.GC#setLineJoin(int)
- * @see dwt.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 dwt.graphics.GC#setLineDash(int[])
- * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
- * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
- * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
- * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
- * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
- * @see dwt.graphics.TextLayout#getPreviousOffset(int, int)
- *
- * @since 3.3
- */
- public static const int MOVEMENT_WORD_START = 1 << 4;
+ /* 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 dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addKeyListener
+ * @see dwt.widgets.Tracker#addKeyListener
+ * @see dwt.events.KeyListener#keyPressed
+ * @see dwt.events.KeyEvent
+ */
+ public static const int KeyDown = 1;
+
+ /**
+ * The key up event type (value is 2).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addKeyListener
+ * @see dwt.widgets.Tracker#addKeyListener
+ * @see dwt.events.KeyListener#keyReleased
+ * @see dwt.events.KeyEvent
+ */
+ public static const int KeyUp = 2;
+
+ /**
+ * The mouse down event type (value is 3).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseListener
+ * @see dwt.events.MouseListener#mouseDown
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseDown = 3;
+
+ /**
+ * The mouse up event type (value is 4).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseListener
+ * @see dwt.events.MouseListener#mouseUp
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseUp = 4;
+
+ /**
+ * The mouse move event type (value is 5).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseMoveListener
+ * @see dwt.events.MouseMoveListener#mouseMove
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseMove = 5;
+
+ /**
+ * The mouse enter event type (value is 6).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseTrackListener
+ * @see dwt.events.MouseTrackListener#mouseEnter
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseEnter = 6;
+
+ /**
+ * The mouse exit event type (value is 7).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseTrackListener
+ * @see dwt.events.MouseTrackListener#mouseExit
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseExit = 7;
+
+ /**
+ * The mouse double click event type (value is 8).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseListener
+ * @see dwt.events.MouseListener#mouseDoubleClick
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseDoubleClick = 8;
+
+ /**
+ * The paint event type (value is 9).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addPaintListener
+ * @see dwt.events.PaintListener#paintControl
+ * @see dwt.events.PaintEvent
+ */
+ public static const int Paint = 9;
+
+ /**
+ * The move event type (value is 10).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addControlListener
+ * @see dwt.widgets.TableColumn#addControlListener
+ * @see dwt.widgets.Tracker#addControlListener
+ * @see dwt.widgets.TreeColumn#addControlListener
+ * @see dwt.events.ControlListener#controlMoved
+ * @see dwt.events.ControlEvent
+ */
+ public static const int Move = 10;
+
+ /**
+ * The resize event type (value is 11).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addControlListener
+ * @see dwt.widgets.TableColumn#addControlListener
+ * @see dwt.widgets.Tracker#addControlListener
+ * @see dwt.widgets.TreeColumn#addControlListener
+ * @see dwt.events.ControlListener#controlResized
+ * @see dwt.events.ControlEvent
+ */
+ public static const int Resize = 11;
+
+ /**
+ * The dispose event type (value is 12).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Widget#addDisposeListener
+ * @see dwt.events.DisposeListener#widgetDisposed
+ * @see dwt.events.DisposeEvent
+ */
+ public static const int Dispose = 12;
+
+ /**
+ * The selection event type (value is 13).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Button#addSelectionListener
+ * @see dwt.widgets.Combo#addSelectionListener
+ * @see dwt.widgets.CoolItem#addSelectionListener
+ * @see dwt.widgets.Link#addSelectionListener
+ * @see dwt.widgets.List#addSelectionListener
+ * @see dwt.widgets.MenuItem#addSelectionListener
+ * @see dwt.widgets.Sash#addSelectionListener
+ * @see dwt.widgets.Scale#addSelectionListener
+ * @see dwt.widgets.ScrollBar#addSelectionListener
+ * @see dwt.widgets.Slider#addSelectionListener
+ * @see dwt.widgets.TabFolder#addSelectionListener
+ * @see dwt.widgets.Table#addSelectionListener
+ * @see dwt.widgets.TableColumn#addSelectionListener
+ * @see dwt.widgets.ToolItem#addSelectionListener
+ * @see dwt.widgets.TrayItem#addSelectionListener
+ * @see dwt.widgets.Tree#addSelectionListener
+ * @see dwt.widgets.TreeColumn#addSelectionListener
+ * @see dwt.events.SelectionListener#widgetSelected
+ * @see dwt.events.SelectionEvent
+ */
+ public static const int Selection = 13;
+
+ /**
+ * The default selection event type (value is 14).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Combo#addSelectionListener
+ * @see dwt.widgets.List#addSelectionListener
+ * @see dwt.widgets.Spinner#addSelectionListener
+ * @see dwt.widgets.Table#addSelectionListener
+ * @see dwt.widgets.Text#addSelectionListener
+ * @see dwt.widgets.TrayItem#addSelectionListener
+ * @see dwt.widgets.Tree#addSelectionListener
+ * @see dwt.events.SelectionListener#widgetDefaultSelected
+ * @see dwt.events.SelectionEvent
+ */
+ public static const int DefaultSelection = 14;
+
+ /**
+ * The focus in event type (value is 15).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addFocusListener
+ * @see dwt.events.FocusListener#focusGained
+ * @see dwt.events.FocusEvent
+ */
+ public static const int FocusIn = 15;
+
+ /**
+ * The focus out event type (value is 16).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addFocusListener
+ * @see dwt.events.FocusListener#focusLost
+ * @see dwt.events.FocusEvent
+ */
+ public static const int FocusOut = 16;
+
+ /**
+ * The expand event type (value is 17).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Tree#addTreeListener
+ * @see dwt.events.TreeListener#treeExpanded
+ * @see dwt.events.TreeEvent
+ */
+ public static const int Expand = 17;
+
+ /**
+ * The collapse event type (value is 18).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Tree#addTreeListener
+ * @see dwt.events.TreeListener#treeCollapsed
+ * @see dwt.events.TreeEvent
+ */
+ public static const int Collapse = 18;
+
+ /**
+ * The iconify event type (value is 19).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Shell#addShellListener
+ * @see dwt.events.ShellListener#shellIconified
+ * @see dwt.events.ShellEvent
+ */
+ public static const int Iconify = 19;
+
+ /**
+ * The de-iconify event type (value is 20).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Shell#addShellListener
+ * @see dwt.events.ShellListener#shellDeiconified
+ * @see dwt.events.ShellEvent
+ */
+ public static const int Deiconify = 20;
+
+ /**
+ * The close event type (value is 21).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Shell#addShellListener
+ * @see dwt.events.ShellListener#shellClosed
+ * @see dwt.events.ShellEvent
+ */
+ public static const int Close = 21;
+
+ /**
+ * The show event type (value is 22).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Menu#addMenuListener
+ * @see dwt.events.MenuListener#menuShown
+ * @see dwt.events.MenuEvent
+ */
+ public static const int Show = 22;
+
+ /**
+ * The hide event type (value is 23).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Menu#addMenuListener
+ * @see dwt.events.MenuListener#menuHidden
+ * @see dwt.events.MenuEvent
+ */
+ public static const int Hide = 23;
+
+ /**
+ * The modify event type (value is 24).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Combo#addModifyListener
+ * @see dwt.widgets.Spinner#addModifyListener
+ * @see dwt.widgets.Text#addModifyListener
+ * @see dwt.events.ModifyListener#modifyText
+ * @see dwt.events.ModifyEvent
+ */
+ public static const int Modify = 24;
+
+ /**
+ * The verify event type (value is 25).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Combo#addVerifyListener
+ * @see dwt.widgets.Text#addVerifyListener
+ * @see dwt.events.VerifyListener#verifyText
+ * @see dwt.events.VerifyEvent
+ */
+ public static const int Verify = 25;
+
+ /**
+ * The activate event type (value is 26).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Shell#addShellListener
+ * @see dwt.events.ShellListener#shellActivated
+ * @see dwt.events.ShellEvent
+ */
+ public static const int Activate = 26;
+
+ /**
+ * The deactivate event type (value is 27).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Shell#addShellListener
+ * @see dwt.events.ShellListener#shellDeactivated
+ * @see dwt.events.ShellEvent
+ */
+ public static const int Deactivate = 27;
+
+ /**
+ * The help event type (value is 28).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addHelpListener
+ * @see dwt.widgets.Menu#addHelpListener
+ * @see dwt.widgets.MenuItem#addHelpListener
+ * @see dwt.events.HelpListener#helpRequested
+ * @see dwt.events.HelpEvent
+ */
+ public static const int Help = 28;
+
+ /**
+ * The drag detect event type (value is 29).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.dnd.DragSource
+ */
+ public static const int DragDetect = 29;
+
+ /**
+ * The arm event type (value is 30).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.MenuItem#addArmListener
+ * @see dwt.events.ArmListener#widgetArmed
+ * @see dwt.events.ArmEvent
+ */
+ public static const int Arm = 30;
+
+ /**
+ * The traverse event type (value is 31).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addTraverseListener
+ * @see dwt.events.TraverseListener#keyTraversed
+ * @see dwt.events.TraverseEvent
+ */
+ public static const int Traverse = 31;
+
+ /**
+ * The mouse hover event type (value is 32).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Control#addMouseTrackListener
+ * @see dwt.events.MouseTrackListener#mouseHover
+ * @see dwt.events.MouseEvent
+ */
+ public static const int MouseHover = 32;
+
+ /**
+ * The hardware key down event type (value is 33).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ */
+ public static const int HardKeyDown = 33;
+
+ /**
+ * The hardware key up event type (value is 34).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ */
+ public static const int HardKeyUp = 34;
+
+ /**
+ * The menu detect event type (value is 35).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @since 3.0
+ */
+ public static const int MenuDetect = 35;
+
+ /**
+ * The set data event type (value is 36).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.widgets.Event
+ *
+ * @see dwt.widgets.Table
+ * @see dwt.widgets.Tree
+ *
+ * @since 3.0
+ */
+ public static const int SetData = 36;
+
+ /**
+ * The mouse wheel event type (value is 37).
+ *
+ * @see dwt.widgets.Widget#addListener
+ * @see dwt.widgets.Display#addFilter
+ * @see dwt.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 dwt.widgets.Display#addListener + * @see dwt.widgets.Event + * + * @since 3.2 + */ + public static const int Settings = 39; + + /** + * The erase item event type (value is 40). + * + * @see dwt.widgets.Widget#addListener + * @see dwt.widgets.Display#addFilter + * @see dwt.widgets.Event + * + * @since 3.2 + */ + public static const int EraseItem = 40; + + /** + * The measure item event type (value is 41). + * + * @see dwt.widgets.Widget#addListener + * @see dwt.widgets.Display#addFilter + * @see dwt.widgets.Event + * + * @since 3.2 + */ + public static const int MeasureItem = 41; + + /** + * The paint item event type (value is 42). + * + * @see dwt.widgets.Widget#addListener + * @see dwt.widgets.Display#addFilter + * @see dwt.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 dwt.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 dwt.graphics.GC#setLineCap(int)
+ * @see dwt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_FLAT = 1;
+
+ /**
+ * Line drawing style for rounded end caps (value is 2).
+ *
+ * @see dwt.graphics.GC#setLineCap(int)
+ * @see dwt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_ROUND = 2;
+
+ /**
+ * Line drawing style for square end caps (value is 3).
+ *
+ * @see dwt.graphics.GC#setLineCap(int)
+ * @see dwt.graphics.GC#getLineCap()
+ *
+ * @since 3.1
+ */
+ public static const int CAP_SQUARE = 3;
+
+ /**
+ * Line drawing style for miter joins (value is 1).
+ *
+ * @see dwt.graphics.GC#setLineJoin(int)
+ * @see dwt.graphics.GC#getLineJoin()
+ *
+ * @since 3.1
+ */
+ public static const int JOIN_MITER = 1;
+
+ /**
+ * Line drawing style for rounded joins (value is 2).
+ *
+ * @see dwt.graphics.GC#setLineJoin(int)
+ * @see dwt.graphics.GC#getLineJoin()
+ *
+ * @since 3.1
+ */
+ public static const int JOIN_ROUND = 2;
+
+ /**
+ * Line drawing style for bevel joins (value is 3).
+ *
+ * @see dwt.graphics.GC#setLineJoin(int)
+ * @see dwt.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 dwt.graphics.GC#setLineDash(int[])
+ * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
+ * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
+ * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
+ * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
+ * @see dwt.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 dwt.graphics.TextLayout#getNextOffset(int, int)
+ * @see dwt.graphics.TextLayout#getPreviousOffset(int, int)
+ *
+ * @since 3.3
+ */
+ public static const int MOVEMENT_WORD_START = 1 << 4;
/**
@@ -3373,49 +3373,49 @@
* @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$
+ 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$
default:
- }
- return "Unknown error"; //$NON-NLS-1$
+ }
+ return "Unknown error"; //$NON-NLS-1$
}
@@ -3432,7 +3432,7 @@
public static char[] getMessage(char[] key) {
// PORTING_FIXME: Implement
return "msg not found";
- //return Compatibility.getMessage(key);
+ //return Compatibility.getMessage(key);
}
/**
@@ -3442,7 +3442,7 @@
* @return the SWT platform name
*/
public static char[] getPlatform () {
- return Platform.PLATFORM;
+ return Platform.PLATFORM;
}
/**
@@ -3452,7 +3452,7 @@
* @return the SWT version number
*/
public static int getVersion () {
- return Library.SWT_VERSION;
+ return Library.SWT_VERSION;
}
/**
@@ -3461,7 +3461,7 @@
* @param code the SWT error code
*/
public static void error (int code) {
- error (code, null);
+ error (code, null);
}
/**
@@ -3490,7 +3490,7 @@
* @see IllegalArgumentException
*/
public static void error (int code, TracedException throwable) {
- error (code, throwable, null);
+ error (code, throwable, null);
}
/**
@@ -3523,120 +3523,120 @@
*/
public static void error (int code, TracedException throwable, char[] detail) {
- /*
- * This code prevents the creation of "chains" of SWTErrors and
- * SWTExceptions which in turn contain other SWTErrors and
- * SWTExceptions as their throwable. This can occur when low level
- * code throws an exception past a point where a higher layer is
- * being "safe" and catching all exceptions. (Note that, this is
- * _a_bad_thing_ which we always try to avoid.)
- *
- * On the theory that the low level code is closest to the
- * original problem, we simply re-throw the original exception here.
- *
- * NOTE: Exceptions thrown in syncExec and asyncExec must be
- * wrapped.
- */
- if (code != SWT.ERROR_FAILED_EXEC) {
- if (auto t = cast(SWTError)throwable) throw t;
- if (auto t = cast(SWTException)throwable) throw t;
- }
-
- char[] message = findErrorText (code);
- if (detail != null) message ~= detail;
- switch (code) {
-
- /* Illegal Arguments (non-fatal) */
- case ERROR_NULL_ARGUMENT:
- case ERROR_CANNOT_BE_ZERO:
- case ERROR_INVALID_ARGUMENT:
- case ERROR_MENU_NOT_BAR:
- case ERROR_MENU_NOT_DROP_DOWN:
- case ERROR_MENU_NOT_POP_UP:
- case ERROR_MENUITEM_NOT_CASCADE:
- case ERROR_INVALID_PARENT:
- case ERROR_INVALID_RANGE: {
- throw new IllegalArgumentException (message);
- }
-
- /* SWT Exceptions (non-fatal) */
- case ERROR_INVALID_SUBCLASS:
- case ERROR_THREAD_INVALID_ACCESS:
- case ERROR_WIDGET_DISPOSED:
- case ERROR_GRAPHIC_DISPOSED:
- case ERROR_DEVICE_DISPOSED:
- case ERROR_INVALID_IMAGE:
- case ERROR_UNSUPPORTED_DEPTH:
- case ERROR_UNSUPPORTED_FORMAT:
- case ERROR_FAILED_EXEC:
- case ERROR_CANNOT_INVERT_MATRIX:
- case ERROR_NO_GRAPHICS_LIBRARY:
- case ERROR_IO: {
- SWTException exception = new SWTException (code, message);
- exception.throwable = throwable;
- throw exception;
- }
-
- /* Operation System Errors (fatal, may occur only on some platforms) */
- case ERROR_CANNOT_GET_COUNT:
- case ERROR_CANNOT_GET_ENABLED:
- case ERROR_CANNOT_GET_ITEM:
- case ERROR_CANNOT_GET_ITEM_HEIGHT:
- case ERROR_CANNOT_GET_SELECTION:
- case ERROR_CANNOT_GET_TEXT:
- case ERROR_CANNOT_SET_ENABLED:
- case ERROR_CANNOT_SET_MENU:
- case ERROR_CANNOT_SET_SELECTION:
- case ERROR_CANNOT_SET_TEXT:
- case ERROR_ITEM_NOT_ADDED:
- case ERROR_ITEM_NOT_REMOVED:
- case ERROR_NO_HANDLES:
- //FALL THROUGH
-
- /* SWT Errors (fatal, may occur only on some platforms) */
- case ERROR_FAILED_LOAD_LIBRARY:
- case ERROR_NO_MORE_CALLBACKS:
- case ERROR_NOT_IMPLEMENTED:
- case ERROR_UNSPECIFIED: {
- SWTError error = new SWTError (code, message);
- error.throwable = throwable;
- throw error;
- }
+ /*
+ * This code prevents the creation of "chains" of SWTErrors and
+ * SWTExceptions which in turn contain other SWTErrors and
+ * SWTExceptions as their throwable. This can occur when low level
+ * code throws an exception past a point where a higher layer is
+ * being "safe" and catching all exceptions. (Note that, this is
+ * _a_bad_thing_ which we always try to avoid.)
+ *
+ * On the theory that the low level code is closest to the
+ * original problem, we simply re-throw the original exception here.
+ *
+ * NOTE: Exceptions thrown in syncExec and asyncExec must be
+ * wrapped.
+ */
+ if (code != SWT.ERROR_FAILED_EXEC) {
+ if (auto t = cast(SWTError)throwable) throw t;
+ if (auto t = cast(SWTException)throwable) throw t;
+ }
+
+ char[] message = findErrorText (code);
+ if (detail != null) message ~= detail;
+ switch (code) {
+
+ /* Illegal Arguments (non-fatal) */
+ case ERROR_NULL_ARGUMENT:
+ case ERROR_CANNOT_BE_ZERO:
+ case ERROR_INVALID_ARGUMENT:
+ case ERROR_MENU_NOT_BAR:
+ case ERROR_MENU_NOT_DROP_DOWN:
+ case ERROR_MENU_NOT_POP_UP:
+ case ERROR_MENUITEM_NOT_CASCADE:
+ case ERROR_INVALID_PARENT:
+ case ERROR_INVALID_RANGE: {
+ throw new IllegalArgumentException (message);
+ }
+
+ /* SWT Exceptions (non-fatal) */
+ case ERROR_INVALID_SUBCLASS:
+ case ERROR_THREAD_INVALID_ACCESS:
+ case ERROR_WIDGET_DISPOSED:
+ case ERROR_GRAPHIC_DISPOSED:
+ case ERROR_DEVICE_DISPOSED:
+ case ERROR_INVALID_IMAGE:
+ case ERROR_UNSUPPORTED_DEPTH:
+ case ERROR_UNSUPPORTED_FORMAT:
+ case ERROR_FAILED_EXEC:
+ case ERROR_CANNOT_INVERT_MATRIX:
+ case ERROR_NO_GRAPHICS_LIBRARY:
+ case ERROR_IO: {
+ SWTException exception = new SWTException (code, message);
+ exception.throwable = throwable;
+ throw exception;
+ }
+
+ /* Operation System Errors (fatal, may occur only on some platforms) */
+ case ERROR_CANNOT_GET_COUNT:
+ case ERROR_CANNOT_GET_ENABLED:
+ case ERROR_CANNOT_GET_ITEM:
+ case ERROR_CANNOT_GET_ITEM_HEIGHT:
+ case ERROR_CANNOT_GET_SELECTION:
+ case ERROR_CANNOT_GET_TEXT:
+ case ERROR_CANNOT_SET_ENABLED:
+ case ERROR_CANNOT_SET_MENU:
+ case ERROR_CANNOT_SET_SELECTION:
+ case ERROR_CANNOT_SET_TEXT:
+ case ERROR_ITEM_NOT_ADDED:
+ case ERROR_ITEM_NOT_REMOVED:
+ case ERROR_NO_HANDLES:
+ //FALL THROUGH
+
+ /* SWT Errors (fatal, may occur only on some platforms) */
+ case ERROR_FAILED_LOAD_LIBRARY:
+ case ERROR_NO_MORE_CALLBACKS:
+ case ERROR_NOT_IMPLEMENTED:
+ case ERROR_UNSPECIFIED: {
+ SWTError error = new SWTError (code, message);
+ error.throwable = throwable;
+ throw error;
+ }
default:
- }
-
- /* Unknown/Undefined Error */
- SWTError error = new SWTError (code, message);
- error.throwable = throwable;
- throw error;
+ }
+
+ /* Unknown/Undefined Error */
+ SWTError error = new SWTError (code, message);
+ error.throwable = throwable;
+ throw error;
}
public static void static_this() {
- /*
- * These values represent bit masks that may need to
- * expand in the future. Therefore they are not initialized
- * in the declaration to stop the compiler from inlining.
- */
- BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5;
- MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND;
-
- /*
- * These values can be different on different platforms.
- * Therefore they are not initialized in the declaration
- * to stop the compiler from inlining.
- */
- char[] platform = getPlatform ();
- if ("carbon" == platform ) { //$NON-NLS-1$
- MOD1 = COMMAND;
- MOD2 = SHIFT;
- MOD3 = ALT;
- MOD4 = CONTROL;
- } else {
- MOD1 = CONTROL;
- MOD2 = SHIFT;
- MOD3 = ALT;
- MOD4 = 0;
- }
+ /*
+ * These values represent bit masks that may need to
+ * expand in the future. Therefore they are not initialized
+ * in the declaration to stop the compiler from inlining.
+ */
+ BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5;
+ MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND;
+
+ /*
+ * These values can be different on different platforms.
+ * Therefore they are not initialized in the declaration
+ * to stop the compiler from inlining.
+ */
+ char[] platform = getPlatform ();
+ if ("carbon" == platform ) { //$NON-NLS-1$
+ MOD1 = COMMAND;
+ MOD2 = SHIFT;
+ MOD3 = ALT;
+ MOD4 = CONTROL;
+ } else {
+ MOD1 = CONTROL;
+ MOD2 = SHIFT;
+ MOD3 = ALT;
+ MOD4 = 0;
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/SWTError.d
--- a/dwt/SWTError.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/SWTError.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -45,13 +45,13 @@
/**
* The SWT error code, one of SWT.ERROR_*.
*/
- public int code;
+ public int code;
- /**
- * The underlying throwable that caused the problem,
- * or null if this information is not available.
- */
- public TracedException throwable;
+ /**
+ * The underlying throwable that caused the problem,
+ * or null if this information is not available.
+ */
+ public TracedException throwable;
//static final long serialVersionUID = 3833467327105808433L;
@@ -61,7 +61,7 @@
* unspecified value.
*/
public this () {
- this (SWT.ERROR_UNSPECIFIED);
+ this (SWT.ERROR_UNSPECIFIED);
}
/**
@@ -73,7 +73,7 @@
* @param message the detail message for the exception
*/
public this (char[] message) {
- this (SWT.ERROR_UNSPECIFIED, message);
+ this (SWT.ERROR_UNSPECIFIED, message);
}
/**
@@ -83,7 +83,7 @@
* @param code the SWT error code
*/
public this (int code) {
- this (code, SWT.findErrorText (code));
+ this (code, SWT.findErrorText (code));
}
/**
@@ -96,8 +96,8 @@
* @param message the detail message for the exception
*/
public this (int code, char[] message) {
- super (message);
- this.code = code;
+ super (message);
+ this.code = code;
}
/**
@@ -113,7 +113,7 @@
* @since 3.1
*/
public Exception getCause() {
- return throwable;
+ return throwable;
}
/**
@@ -125,9 +125,9 @@
* @return the error message string of this SWTError object
*/
public char[] getMessage () {
- if (throwable is null)
+ if (throwable is null)
return super.toString();
- return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -143,12 +143,12 @@
foreach( msg; this ){
Stderr.formatln( "{}", msg );
}
- if ( throwable !is null) {
- Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$
+ if ( throwable !is null) {
+ Stderr.formatln ("*** Stack trace of contained error ***"); //$NON-NLS-1$
foreach( msg; throwable ){
Stderr.formatln( "{}", msg );
}
- }
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/SWTException.d
--- a/dwt/SWTException.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/SWTException.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -33,18 +33,18 @@
*/
public class SWTException : TracedException {
- /**
- * The SWT error code, one of SWT.ERROR_*.
- */
- public int code;
+ /**
+ * 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;
+ /**
+ * The underlying throwable that caused the problem,
+ * or null if this information is not available.
+ */
+ public TracedException throwable;
- //static final long serialVersionUID = 3257282552304842547L;
+ //static final long serialVersionUID = 3257282552304842547L;
/**
* Constructs a new instance of this class with its
@@ -52,7 +52,7 @@
* unspecified value.
*/
public this () {
- this (SWT.ERROR_UNSPECIFIED);
+ this (SWT.ERROR_UNSPECIFIED);
}
/**
@@ -64,7 +64,7 @@
* @param message the detail message for the exception
*/
public this (char[] message) {
- this (SWT.ERROR_UNSPECIFIED, message);
+ this (SWT.ERROR_UNSPECIFIED, message);
}
/**
@@ -74,7 +74,7 @@
* @param code the SWT error code
*/
public this (int code) {
- this (code, SWT.findErrorText (code));
+ this (code, SWT.findErrorText (code));
}
/**
@@ -87,8 +87,8 @@
* @param message the detail message for the exception
*/
public this (int code, char[] message) {
- super (message);
- this.code = code;
+ super (message);
+ this.code = code;
}
/**
@@ -104,7 +104,7 @@
* @since 3.1
*/
public TracedException getCause() {
- return throwable;
+ return throwable;
}
/**
@@ -116,8 +116,8 @@
* @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$
+ if (throwable is null) return super.toString ();
+ return super.toString () ~ " (" ~ throwable.toString () ~ ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -134,11 +134,11 @@
Stderr.formatln( "{}", msg );
}
if ( throwable !is null) {
- Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$
+ Stderr.formatln ("*** Stack trace of contained exception ***"); //$NON-NLS-1$
foreach( msg; throwable ){
Stderr.formatln( "{}", msg );
}
- }
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/accessibility/ACC.d
--- a/dwt/accessibility/ACC.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/accessibility/ACC.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -18,60 +18,60 @@
* @since 2.0
*/
public class ACC {
- public static const int STATE_NORMAL = 0x00000000;
- public static const int STATE_SELECTED = 0x00000002;
- public static const int STATE_SELECTABLE = 0x00200000;
- public static const int STATE_MULTISELECTABLE = 0x1000000;
- public static const int STATE_FOCUSED = 0x00000004;
- public static const int STATE_FOCUSABLE = 0x00100000;
- public static const int STATE_PRESSED = 0x8;
- public static const int STATE_CHECKED = 0x10;
- public static const int STATE_EXPANDED = 0x200;
- public static const int STATE_COLLAPSED = 0x400;
- public static const int STATE_HOTTRACKED = 0x80;
- public static const int STATE_BUSY = 0x800;
- public static const int STATE_READONLY = 0x40;
- public static const int STATE_INVISIBLE = 0x8000;
- public static const int STATE_OFFSCREEN = 0x10000;
- public static const int STATE_SIZEABLE = 0x20000;
- public static const int STATE_LINKED = 0x400000;
+ public static const int STATE_NORMAL = 0x00000000;
+ public static const int STATE_SELECTED = 0x00000002;
+ public static const int STATE_SELECTABLE = 0x00200000;
+ public static const int STATE_MULTISELECTABLE = 0x1000000;
+ public static const int STATE_FOCUSED = 0x00000004;
+ public static const int STATE_FOCUSABLE = 0x00100000;
+ public static const int STATE_PRESSED = 0x8;
+ public static const int STATE_CHECKED = 0x10;
+ public static const int STATE_EXPANDED = 0x200;
+ public static const int STATE_COLLAPSED = 0x400;
+ public static const int STATE_HOTTRACKED = 0x80;
+ public static const int STATE_BUSY = 0x800;
+ public static const int STATE_READONLY = 0x40;
+ public static const int STATE_INVISIBLE = 0x8000;
+ public static const int STATE_OFFSCREEN = 0x10000;
+ public static const int STATE_SIZEABLE = 0x20000;
+ public static const int STATE_LINKED = 0x400000;
- public static const int ROLE_CLIENT_AREA = 0xa;
- public static const int ROLE_WINDOW = 0x9;
- public static const int ROLE_MENUBAR = 0x2;
- public static const int ROLE_MENU = 0xb;
- public static const int ROLE_MENUITEM = 0xc;
- public static const int ROLE_SEPARATOR = 0x15;
- public static const int ROLE_TOOLTIP = 0xd;
- public static const int ROLE_SCROLLBAR = 0x3;
- public static const int ROLE_DIALOG = 0x12;
- public static const int ROLE_LABEL = 0x29;
- public static const int ROLE_PUSHBUTTON = 0x2b;
- public static const int ROLE_CHECKBUTTON = 0x2c;
- public static const int ROLE_RADIOBUTTON = 0x2d;
- public static const int ROLE_COMBOBOX = 0x2e;
- public static const int ROLE_TEXT = 0x2a;
- public static const int ROLE_TOOLBAR = 0x16;
- public static const int ROLE_LIST = 0x21;
- public static const int ROLE_LISTITEM = 0x22;
- public static const int ROLE_TABLE = 0x18;
- public static const int ROLE_TABLECELL = 0x1d;
- public static const int ROLE_TABLECOLUMNHEADER = 0x19;
- /** @deprecated use ROLE_TABLECOLUMNHEADER */
- public static const int ROLE_TABLECOLUMN = ROLE_TABLECOLUMNHEADER;
- public static const int ROLE_TABLEROWHEADER = 0x1a;
- public static const int ROLE_TREE = 0x23;
- public static const int ROLE_TREEITEM = 0x24;
- public static const int ROLE_TABFOLDER = 0x3c;
- public static const int ROLE_TABITEM = 0x25;
- public static const int ROLE_PROGRESSBAR = 0x30;
- public static const int ROLE_SLIDER = 0x33;
- public static const int ROLE_LINK = 0x1e;
+ public static const int ROLE_CLIENT_AREA = 0xa;
+ public static const int ROLE_WINDOW = 0x9;
+ public static const int ROLE_MENUBAR = 0x2;
+ public static const int ROLE_MENU = 0xb;
+ public static const int ROLE_MENUITEM = 0xc;
+ public static const int ROLE_SEPARATOR = 0x15;
+ public static const int ROLE_TOOLTIP = 0xd;
+ public static const int ROLE_SCROLLBAR = 0x3;
+ public static const int ROLE_DIALOG = 0x12;
+ public static const int ROLE_LABEL = 0x29;
+ public static const int ROLE_PUSHBUTTON = 0x2b;
+ public static const int ROLE_CHECKBUTTON = 0x2c;
+ public static const int ROLE_RADIOBUTTON = 0x2d;
+ public static const int ROLE_COMBOBOX = 0x2e;
+ public static const int ROLE_TEXT = 0x2a;
+ public static const int ROLE_TOOLBAR = 0x16;
+ public static const int ROLE_LIST = 0x21;
+ public static const int ROLE_LISTITEM = 0x22;
+ public static const int ROLE_TABLE = 0x18;
+ public static const int ROLE_TABLECELL = 0x1d;
+ public static const int ROLE_TABLECOLUMNHEADER = 0x19;
+ /** @deprecated use ROLE_TABLECOLUMNHEADER */
+ public static const int ROLE_TABLECOLUMN = ROLE_TABLECOLUMNHEADER;
+ public static const int ROLE_TABLEROWHEADER = 0x1a;
+ public static const int ROLE_TREE = 0x23;
+ public static const int ROLE_TREEITEM = 0x24;
+ public static const int ROLE_TABFOLDER = 0x3c;
+ public static const int ROLE_TABITEM = 0x25;
+ public static const int ROLE_PROGRESSBAR = 0x30;
+ public static const int ROLE_SLIDER = 0x33;
+ public static const int ROLE_LINK = 0x1e;
- public static const int CHILDID_SELF = -1;
- public static const int CHILDID_NONE = -2;
- public static const int CHILDID_MULTIPLE = -3;
+ public static const int CHILDID_SELF = -1;
+ public static const int CHILDID_NONE = -2;
+ public static const int CHILDID_MULTIPLE = -3;
- public static const int TEXT_INSERT = 0;
- public static const int TEXT_DELETE = 1;
+ public static const int TEXT_INSERT = 0;
+ public static const int TEXT_DELETE = 1;
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/accessibility/Accessible.d
--- a/dwt/accessibility/Accessible.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/accessibility/Accessible.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -47,346 +47,346 @@
* @since 2.0
*/
public class Accessible {
- AccessibleListener[] accessibleListeners;
- AccessibleControlListener[] controlListeners;
- AccessibleTextListener[] textListeners;
- AccessibleObject accessibleObject;
- Control control;
+ AccessibleListener[] accessibleListeners;
+ AccessibleControlListener[] controlListeners;
+ AccessibleTextListener[] textListeners;
+ AccessibleObject accessibleObject;
+ Control control;
- this (Control control) {
- this.control = control;
- AccessibleFactory.registerAccessible (this);
- control.addDisposeListener (new class () DisposeListener {
- public void widgetDisposed (DisposeEvent e) {
- release ();
- }
- });
- }
+ this (Control control) {
+ this.control = control;
+ AccessibleFactory.registerAccessible (this);
+ control.addDisposeListener (new class () DisposeListener {
+ public void widgetDisposed (DisposeEvent e) {
+ release ();
+ }
+ });
+ }
- /**
- * Adds the listener to the collection of listeners who will
- * be notified when an accessible client asks for certain strings,
- * such as name, description, help, or keyboard shortcut. The
- * listener is notified by sending it one of the messages defined
- * in the AccessibleListener
interface.
- *
- * @param listener the listener that should be notified when the receiver
- * is asked for a name, description, help, or keyboard shortcut string
- *
- * @exception IllegalArgumentException AccessibleListener
interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for a name, description, help, or keyboard shortcut string
+ *
+ * @exception IllegalArgumentException AccessibleControlListener
- * interface.
- *
- * @param listener the listener that should be notified when the receiver
- * is asked for custom control specific information
- *
- * @exception IllegalArgumentException AccessibleControlListener
+ * interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for custom control specific information
+ *
+ * @exception IllegalArgumentException AccessibleTextListener
- * interface.
- *
- * @param listener the listener that should be notified when the receiver
- * is asked for custom text control specific information
- *
- * @exception IllegalArgumentException AccessibleTextListener
+ * interface.
+ *
+ * @param listener the listener that should be notified when the receiver
+ * is asked for custom text control specific information
+ *
+ * @exception IllegalArgumentException
- * IMPORTANT: This method is not part of the public
- * API for Accessible
. 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 called from
- * application code.
- *
+ * IMPORTANT: This method is not part of the public
+ * API for Accessible
. 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 called from
+ * application code.
+ *
ACC.NOTIFY_TEXT_INSERT
- * or ACC.NOTIFY_TEXT_DELETE
- * @param startIndex the text index within the control where the insertion or deletion begins
- * @param length the non-negative length in characters of the insertion or deletion
- *
- * @exception SWTException ACC.NOTIFY_TEXT_INSERT
+ * or ACC.NOTIFY_TEXT_DELETE
+ * @param startIndex the text index within the control where the insertion or deletion begins
+ * @param length the non-negative length in characters of the insertion or deletion
+ *
+ * @exception SWTException
- * Return the name of the control or specified child in the
- * result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a name, and returning null tells the client
- * to use the platform name.
- *
+ * Return the name of the control or specified child in the
+ * result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a name, and returning null tells the client
+ * to use the platform name.
+ *
- * The information in this property should be similar to the help - * provided by toolTipText. It describes what the control or child - * does or how to use it, as opposed to getDescription, which - * describes appearance. - *
- * Return the help string of the control or specified child in
- * the result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a help string, and returning null tells the
- * client to use the platform help string.
- *
+ * The information in this property should be similar to the help + * provided by toolTipText. It describes what the control or child + * does or how to use it, as opposed to getDescription, which + * describes appearance. + *
+ * Return the help string of the control or specified child in
+ * the result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a help string, and returning null tells the
+ * client to use the platform help string.
+ *
- * A keyboard shortcut can either be a mnemonic, or an accelerator. - * As a general rule, if the control or child can receive keyboard focus, - * then you should expose its mnemonic, and if it cannot receive keyboard - * focus, then you should expose its accelerator. - *
- * Return the keyboard shortcut string of the control or specified child
- * in the result
field of the event object. Returning an
- * empty string tells the client that the control or child does not
- * have a keyboard shortcut string, and returning null tells the client
- * to use the platform keyboard shortcut string.
- *
+ * A keyboard shortcut can either be a mnemonic, or an accelerator. + * As a general rule, if the control or child can receive keyboard focus, + * then you should expose its mnemonic, and if it cannot receive keyboard + * focus, then you should expose its accelerator. + *
+ * Return the keyboard shortcut string of the control or specified child
+ * in the result
field of the event object. Returning an
+ * empty string tells the client that the control or child does not
+ * have a keyboard shortcut string, and returning null tells the client
+ * to use the platform keyboard shortcut string.
+ *
- * This is a textual description of the control or child's visual - * appearance, which is typically only necessary if it cannot be - * determined from other properties such as role. - *
- * Return the description of the control or specified child in
- * the result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a description, and returning null tells the
- * client to use the platform description.
- *
+ * This is a textual description of the control or child's visual + * appearance, which is typically only necessary if it cannot be + * determined from other properties such as role. + *
+ * Return the description of the control or specified child in
+ * the result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a description, and returning null tells the
+ * client to use the platform description.
+ *
- * Return the identifier of the child at display point (x, y)
- * in the childID
field of the event object.
- * Return CHILDID_SELF if point (x, y) is in the control itself
- * and not in any child. Return CHILDID_NONE if point (x, y)
- * is not contained in either the control or any of its children.
- *
+ * Return the identifier of the child at display point (x, y)
+ * in the childID
field of the event object.
+ * Return CHILDID_SELF if point (x, y) is in the control itself
+ * and not in any child. Return CHILDID_NONE if point (x, y)
+ * is not contained in either the control or any of its children.
+ *
- * Return a rectangle describing the location of the specified
- * control or child in the x, y, width, and height
- * fields of the event object.
- *
+ * Return a rectangle describing the location of the specified
+ * control or child in the x, y, width, and height
+ * fields of the event object.
+ *
- * Return an Accessible
for the specified control or
- * child in the accessible
field of the event object.
- * Return null if the specified child does not have its own
- * Accessible
.
- *
+ * Return an Accessible
for the specified control or
+ * child in the accessible
field of the event object.
+ * Return null if the specified child does not have its own
+ * Accessible
.
+ *
- * Return the number of child items in the detail
- * field of the event object.
- *
+ * Return the number of child items in the detail
+ * field of the event object.
+ *
- * This string is typically a verb describing what the user does to it. - * For example, a Push Button's default action is "Press", a Check Button's - * is "Check" or "UnCheck", and List items have the default action "Double Click". - *
- * Return a string describing the default action of the specified
- * control or child in the result
field of the event object.
- * Returning null tells the client to use the platform default action string.
- *
+ * This string is typically a verb describing what the user does to it. + * For example, a Push Button's default action is "Press", a Check Button's + * is "Check" or "UnCheck", and List items have the default action "Double Click". + *
+ * Return a string describing the default action of the specified
+ * control or child in the result
field of the event object.
+ * Returning null tells the client to use the platform default action string.
+ *
- * Return the identifier of the child that has focus in the
- * childID
field of the event object.
- * Return CHILDID_SELF if the control itself has keyboard focus.
- * Return CHILDID_NONE if neither the control nor any of its children has focus.
- *
+ * Return the identifier of the child that has focus in the
+ * childID
field of the event object.
+ * Return CHILDID_SELF if the control itself has keyboard focus.
+ * Return CHILDID_NONE if neither the control nor any of its children has focus.
+ *
- * Return a role constant (constant defined in ACC beginning with ROLE_)
- * that describes the role of the specified control or child in the
- * detail
field of the event object.
- *
+ * Return a role constant (constant defined in ACC beginning with ROLE_)
+ * that describes the role of the specified control or child in the
+ * detail
field of the event object.
+ *
- * Return the identifier of the selected child in the
- * childID
field of the event object.
- * Return CHILDID_SELF if the control itself is selected.
- * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the children
field.
- * Return CHILDID_NONE if neither the control nor any of its children are selected.
- *
+ * Return the identifier of the selected child in the
+ * childID
field of the event object.
+ * Return CHILDID_SELF if the control itself is selected.
+ * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the children
field.
+ * Return CHILDID_NONE if neither the control nor any of its children are selected.
+ *
- * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
- * that describes the current state of the specified control or child in the
- * detail
field of the event object.
- *
+ * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
+ * that describes the current state of the specified control or child in the
+ * detail
field of the event object.
+ *
- * Many controls do not return a value. Examples of controls - * that do are: Combo returns the text string, Text returns - * its contents, ProgressBar returns a string representing a - * percentage, and Tree items return a string representing - * their level in the tree. - *
- * Return a string describing the value of the specified control
- * or child in the result
field of the event object.
- * Returning null tells the client to use the platform value string.
- *
+ * Many controls do not return a value. Examples of controls + * that do are: Combo returns the text string, Text returns + * its contents, ProgressBar returns a string representing a + * percentage, and Tree items return a string representing + * their level in the tree. + *
+ * Return a string describing the value of the specified control
+ * or child in the result
field of the event object.
+ * Returning null tells the client to use the platform value string.
+ *
- * Return the children as an array of childIDs in the children
- * field of the event object.
- *
+ * Return the children as an array of childIDs in the children
+ * field of the event object.
+ *
- * Return the identifier of the child at display point (x, y)
- * in the childID
field of the event object.
- * Return CHILDID_SELF if point (x, y) is in the control itself
- * and not in any child. Return CHILDID_NONE if point (x, y)
- * is not contained in either the control or any of its children.
- *
+ * Return the identifier of the child at display point (x, y)
+ * in the childID
field of the event object.
+ * Return CHILDID_SELF if point (x, y) is in the control itself
+ * and not in any child. Return CHILDID_NONE if point (x, y)
+ * is not contained in either the control or any of its children.
+ *
- * Return a rectangle describing the location of the specified
- * control or child in the x, y, width, and height
- * fields of the event object.
- *
+ * Return a rectangle describing the location of the specified
+ * control or child in the x, y, width, and height
+ * fields of the event object.
+ *
- * Return an Accessible
for the specified control or
- * child in the accessible
field of the event object.
- * Return null if the specified child does not have its own
- * Accessible
.
- *
+ * Return an Accessible
for the specified control or
+ * child in the accessible
field of the event object.
+ * Return null if the specified child does not have its own
+ * Accessible
.
+ *
- * Return the number of child items in the detail
- * field of the event object.
- *
+ * Return the number of child items in the detail
+ * field of the event object.
+ *
- * This string is typically a verb describing what the user does to it. - * For example, a Push Button's default action is "Press", a Check Button's - * is "Check" or "UnCheck", and List items have the default action "Double Click". - *
- * Return a string describing the default action of the specified
- * control or child in the result
field of the event object.
- * Returning null tells the client to use the platform default action string.
- *
+ * This string is typically a verb describing what the user does to it. + * For example, a Push Button's default action is "Press", a Check Button's + * is "Check" or "UnCheck", and List items have the default action "Double Click". + *
+ * Return a string describing the default action of the specified
+ * control or child in the result
field of the event object.
+ * Returning null tells the client to use the platform default action string.
+ *
- * Return the identifier of the child that has focus in the
- * childID
field of the event object.
- * Return CHILDID_SELF if the control itself has keyboard focus.
- * Return CHILDID_NONE if neither the control nor any of its children has focus.
- *
+ * Return the identifier of the child that has focus in the
+ * childID
field of the event object.
+ * Return CHILDID_SELF if the control itself has keyboard focus.
+ * Return CHILDID_NONE if neither the control nor any of its children has focus.
+ *
- * Return a role constant (constant defined in ACC beginning with ROLE_)
- * that describes the role of the specified control or child in the
- * detail
field of the event object.
- *
+ * Return a role constant (constant defined in ACC beginning with ROLE_)
+ * that describes the role of the specified control or child in the
+ * detail
field of the event object.
+ *
- * Return the identifier of the selected child in the
- * childID
field of the event object.
- * Return CHILDID_SELF if the control itself is selected.
- * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the children
field.
- * Return CHILDID_NONE if neither the control nor any of its children are selected.
- *
+ * Return the identifier of the selected child in the
+ * childID
field of the event object.
+ * Return CHILDID_SELF if the control itself is selected.
+ * Return CHILDID_MULTIPLE if multiple children are selected, and return an array of childIDs in the children
field.
+ * Return CHILDID_NONE if neither the control nor any of its children are selected.
+ *
- * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
- * that describes the current state of the specified control or child in the
- * detail
field of the event object.
- *
+ * Return a state mask (mask bit constants defined in ACC beginning with STATE_)
+ * that describes the current state of the specified control or child in the
+ * detail
field of the event object.
+ *
- * Many controls do not return a value. Examples of controls - * that do are: Combo returns the text string, Text returns - * its contents, ProgressBar returns a string representing a - * percentage, and Tree items return a string representing - * their level in the tree. - *
- * Return a string describing the value of the specified control
- * or child in the result
field of the event object.
- * Returning null tells the client to use the platform value string.
- *
+ * Many controls do not return a value. Examples of controls + * that do are: Combo returns the text string, Text returns + * its contents, ProgressBar returns a string representing a + * percentage, and Tree items return a string representing + * their level in the tree. + *
+ * Return a string describing the value of the specified control
+ * or child in the result
field of the event object.
+ * Returning null tells the client to use the platform value string.
+ *
- * Return the children as an array of childIDs in the children
- * field of the event object.
- *
+ * Return the children as an array of childIDs in the children
+ * field of the event object.
+ *
- * Return the name of the control or specified child in the
- * result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a name, and returning null tells the client
- * to use the platform name.
- *
+ * Return the name of the control or specified child in the
+ * result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a name, and returning null tells the client
+ * to use the platform name.
+ *
- * The information in this property should be similar to the help - * provided by toolTipText. It describes what the control or child - * does or how to use it, as opposed to getDescription, which - * describes appearance. - *
- * Return the help string of the control or specified child in
- * the result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a help string, and returning null tells the
- * client to use the platform help string.
- *
+ * The information in this property should be similar to the help + * provided by toolTipText. It describes what the control or child + * does or how to use it, as opposed to getDescription, which + * describes appearance. + *
+ * Return the help string of the control or specified child in
+ * the result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a help string, and returning null tells the
+ * client to use the platform help string.
+ *
- * A keyboard shortcut can either be a mnemonic, or an accelerator. - * As a general rule, if the control or child can receive keyboard focus, - * then you should expose its mnemonic, and if it cannot receive keyboard - * focus, then you should expose its accelerator. - *
- * Return the keyboard shortcut string of the control or specified child
- * in the result
field of the event object. Returning an
- * empty string tells the client that the control or child does not
- * have a keyboard shortcut string, and returning null tells the client
- * to use the platform keyboard shortcut string.
- *
+ * A keyboard shortcut can either be a mnemonic, or an accelerator. + * As a general rule, if the control or child can receive keyboard focus, + * then you should expose its mnemonic, and if it cannot receive keyboard + * focus, then you should expose its accelerator. + *
+ * Return the keyboard shortcut string of the control or specified child
+ * in the result
field of the event object. Returning an
+ * empty string tells the client that the control or child does not
+ * have a keyboard shortcut string, and returning null tells the client
+ * to use the platform keyboard shortcut string.
+ *
- * This is a textual description of the control or child's visual - * appearance, which is typically only necessary if it cannot be - * determined from other properties such as role. - *
- * Return the description of the control or specified child in
- * the result
field of the event object. Returning
- * an empty string tells the client that the control or child
- * does not have a description, and returning null tells the
- * client to use the platform description.
- *
+ * This is a textual description of the control or child's visual + * appearance, which is typically only necessary if it cannot be + * determined from other properties such as role. + *
+ * Return the description of the control or specified child in
+ * the result
field of the event object. Returning
+ * an empty string tells the client that the control or child
+ * does not have a description, and returning null tells the
+ * client to use the platform description.
+ *
- * Return the caret offset in the offset
- * field of the event object.
- *
+ * Return the caret offset in the offset
+ * field of the event object.
+ *
- * Return the selection start offset and non-negative length in the
- * offset
and length
fields of the event object.
- *
+ * Return the selection start offset and non-negative length in the
+ * offset
and length
fields of the event object.
+ *
- * Return the caret offset in the offset
- * field of the event object.
- *
+ * Return the caret offset in the offset
+ * field of the event object.
+ *
- * Return the selection start offset and non-negative length in the
- * offset
and length
fields of the event object.
- *
+ * Return the selection start offset and non-negative length in the
+ * offset
and length
fields of the event object.
+ *
SWT
.
- * 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 dwt.SWT
- */
- public int keyCode;
+ /**
+ * 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 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 dwt.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 dwt.SWT
- */
- public int stateMask;
+ /**
+ * 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 dwt.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;
+ /**
+ * 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;
+ static final long serialVersionUID = 3256442491011412789L;
/**
* Constructs a new instance of this class based on the
@@ -83,11 +83,11 @@
* @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;
+ super(e);
+ this.character = e.character;
+ this.keyCode = e.keyCode;
+ this.stateMask = e.stateMask;
+ this.doit = e.doit;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/MenuDetectEvent.d
--- a/dwt/events/MenuDetectEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/MenuDetectEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -26,25 +26,25 @@
public final class MenuDetectEvent : TypedEvent {
- /**
- * the display-relative x coordinate of the pointer
- * at the time the context menu trigger occurred
- */
- public int x;
+ /**
+ * the display-relative x coordinate of the pointer
+ * at the time the context menu trigger occurred
+ */
+ public int x;
- /**
- * the display-relative y coordinate of the pointer
- * at the time the context menu trigger occurred
- */
- public int y;
+ /**
+ * the display-relative y coordinate of the pointer
+ * at the time the context menu trigger occurred
+ */
+ public int y;
- /**
- * A flag indicating whether the operation should be allowed.
- * Setting this field to false
will cancel the operation.
- */
- public bool doit;
+ /**
+ * A flag indicating whether the operation should be allowed.
+ * Setting this field to false
will cancel the operation.
+ */
+ public bool doit;
- //private static final long serialVersionUID = -3061660596590828941L;
+ //private static final long serialVersionUID = -3061660596590828941L;
/**
* Constructs a new instance of this class based on the
@@ -53,10 +53,10 @@
* @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;
+ super(e);
+ this.x = e.x;
+ this.y = e.y;
+ this.doit = e.doit;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/MenuEvent.d
--- a/dwt/events/MenuEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/MenuEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -23,7 +23,7 @@
public final class MenuEvent : TypedEvent {
- //static final long serialVersionUID = 3258132440332383025L;
+ //static final long serialVersionUID = 3258132440332383025L;
/**
* Constructs a new instance of this class based on the
@@ -32,7 +32,7 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
+ super(e);
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/ModifyEvent.d
--- a/dwt/events/ModifyEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/ModifyEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -23,7 +23,7 @@
public final class ModifyEvent : TypedEvent {
- //static final long serialVersionUID = 3258129146227011891L;
+ //static final long serialVersionUID = 3258129146227011891L;
/**
* Constructs a new instance of this class based on the
@@ -32,7 +32,7 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
+ super(e);
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/MouseEvent.d
--- a/dwt/events/MouseEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/MouseEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -34,41 +34,41 @@
public class MouseEvent : TypedEvent {
- /**
- * 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;
+ /**
+ * 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;
- /**
- * the state of the keyboard modifier keys at the time
- * the event was generated
- */
- public int stateMask;
+ /**
+ * the state of the keyboard modifier keys at the time
+ * the event was generated
+ */
+ public int stateMask;
- /**
- * the widget-relative, x coordinate of the pointer
- * at the time the mouse button was pressed or released
- */
- public int x;
+ /**
+ * the widget-relative, x coordinate of the pointer
+ * at the time the mouse button was pressed or released
+ */
+ public int x;
- /**
- * the widget-relative, y coordinate of the pointer
- * at the time the mouse button was pressed or released
- */
- public int y;
+ /**
+ * the widget-relative, y coordinate of the pointer
+ * at the time the mouse button was pressed or released
+ */
+ public int y;
- /**
- * the number times the mouse has been clicked, as defined
- * by the operating system; 1 for the first click, 2 for the
- * second click and so on.
- *
- * @since 3.3
- */
- public int count;
+ /**
+ * the number times the mouse has been clicked, as defined
+ * by the operating system; 1 for the first click, 2 for the
+ * second click and so on.
+ *
+ * @since 3.3
+ */
+ public int count;
- //static final long serialVersionUID = 3257288037011566898L;
+ //static final long serialVersionUID = 3257288037011566898L;
/**
* Constructs a new instance of this class based on the
@@ -77,12 +77,12 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
- this.x = e.x;
- this.y = e.y;
- this.button = e.button;
- this.stateMask = e.stateMask;
- this.count = e.count;
+ super(e);
+ this.x = e.x;
+ this.y = e.y;
+ this.button = e.button;
+ this.stateMask = e.stateMask;
+ this.count = e.count;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/PaintEvent.d
--- a/dwt/events/PaintEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/PaintEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -27,46 +27,46 @@
public final class PaintEvent : TypedEvent {
- /**
- * 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;
+ /**
+ * 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;
- /**
- * the x offset of the bounding rectangle of the
- * region that requires painting
- */
- public int x;
+ /**
+ * the x offset of the bounding rectangle of the
+ * region that requires painting
+ */
+ public int x;
- /**
- * the y offset of the bounding rectangle of the
- * region that requires painting
- */
- public int y;
+ /**
+ * the y offset of the bounding rectangle of the
+ * region that requires painting
+ */
+ public int y;
- /**
- * the width of the bounding rectangle of the
- * region that requires painting
- */
- public int width;
+ /**
+ * 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;
+ /**
+ * the height of the bounding rectangle of the
+ * region that requires painting
+ */
+ public int height;
- /**
- * the number of following paint events which
+ /**
+ * the number of following paint events which
* are pending which may always be zero on
- * some platforms
- */
- public int count;
+ * some platforms
+ */
+ public int count;
- //static final long serialVersionUID = 3256446919205992497L;
+ //static final long serialVersionUID = 3256446919205992497L;
/**
* Constructs a new instance of this class based on the
@@ -75,13 +75,13 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
- this.gc = e.gc;
- this.x = e.x;
- this.y = e.y;
- this.width = e.width;
- this.height = e.height;
- this.count = e.count;
+ super(e);
+ this.gc = e.gc;
+ this.x = e.x;
+ this.y = e.y;
+ this.width = e.width;
+ this.height = e.height;
+ this.count = e.count;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/SelectionEvent.d
--- a/dwt/events/SelectionEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/SelectionEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -28,78 +28,78 @@
public class SelectionEvent : TypedEvent {
- /**
- * The item that was selected.
- */
- public Widget item;
+ /**
+ * 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
Sash
ScrollBar and Slider
Table and Tree
Text
CoolItem and ToolItem
false
will cancel the
- * operation, depending on the widget.
- */
- public bool doit;
+ /**
+ * A flag indicating whether the operation should be allowed.
+ * Setting this field to false
will cancel the
+ * operation, depending on the widget.
+ */
+ public bool doit;
- //static final long serialVersionUID = 3976735856884987953L;
+ //static final long serialVersionUID = 3976735856884987953L;
/**
* Constructs a new instance of this class based on the
@@ -108,16 +108,16 @@
* @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;
+ 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;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/ShellEvent.d
--- a/dwt/events/ShellEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/ShellEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -25,13 +25,13 @@
public final class ShellEvent : TypedEvent {
- /**
- * A flag indicating whether the operation should be allowed.
- * Setting this field to false
will cancel the operation.
- */
- public bool doit;
+ /**
+ * 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 = 3257569490479888441L;
+ //static final long serialVersionUID = 3257569490479888441L;
/**
* Constructs a new instance of this class based on the
@@ -40,8 +40,8 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
- this.doit = e.doit;
+ super(e);
+ this.doit = e.doit;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/TraverseEvent.d
--- a/dwt/events/TraverseEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/TraverseEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -81,36 +81,36 @@
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;
+ /**
+ * 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;
+ //static final long serialVersionUID = 3257565105301239349L;
/**
* Constructs a new instance of this class based on the
@@ -119,8 +119,8 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
- this.detail = e.detail;
+ super(e);
+ this.detail = e.detail;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/TreeEvent.d
--- a/dwt/events/TreeEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/TreeEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -23,7 +23,7 @@
public final class TreeEvent : SelectionEvent {
- //static final long serialVersionUID = 3257282548009677109L;
+ //static final long serialVersionUID = 3257282548009677109L;
/**
* Constructs a new instance of this class based on the
@@ -32,7 +32,7 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
+ super(e);
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/TypedEvent.d
--- a/dwt/events/TypedEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/TypedEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -28,33 +28,33 @@
*/
public class TypedEvent : SWTEventObject {
- /**
- * the display where the event occurred
- *
- * @since 2.0
- */
- public Display display;
+ /**
+ * the display where the event occurred
+ *
+ * @since 2.0
+ */
+ public Display display;
- /**
- * the widget that issued the event
- */
- public Widget widget;
+ /**
+ * the widget that issued the event
+ */
+ public Widget widget;
- /**
- * 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 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;
- /**
- * a field for application use
- */
- public Object data;
+ /**
+ * a field for application use
+ */
+ public Object data;
- //static final long serialVersionUID = 3257285846578377524L;
+ //static final long serialVersionUID = 3257285846578377524L;
/**
* Constructs a new instance of this class.
@@ -62,7 +62,7 @@
* @param object the object that fired the event
*/
public this(Object object) {
- super(object);
+ super(object);
}
/**
@@ -72,11 +72,11 @@
* @param e the low level event to initialize the receiver with
*/
public this(Event e) {
- super(e.widget);
- this.display = e.display;
- this.widget = e.widget;
- this.time = e.time;
- this.data = e.data;
+ super(e.widget);
+ this.display = e.display;
+ this.widget = e.widget;
+ this.time = e.time;
+ this.data = e.data;
}
/**
@@ -86,7 +86,7 @@
* @return the name of the event
*/
char[] getName () {
- char[] str = this.classinfo.name;
+ char[] str = this.classinfo.name;
return split( str, "." )[$-1];
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/events/VerifyEvent.d
--- a/dwt/events/VerifyEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/events/VerifyEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -24,20 +24,20 @@
public final class VerifyEvent : KeyEvent {
- /**
- * the range of text being modified.
- * Setting these fields has no effect.
- */
- public int start, end;
+ /**
+ * the range of text being modified.
+ * Setting these fields has no effect.
+ */
+ public int start, end;
- /**
- * 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;
+ /**
+ * 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;
- //static final long serialVersionUID = 3257003246269577014L;
+ //static final long serialVersionUID = 3257003246269577014L;
/**
* Constructs a new instance of this class based on the
@@ -46,10 +46,10 @@
* @param e the untyped event containing the information
*/
public this(Event e) {
- super(e);
- this.start = e.start;
- this.end = e.end;
- this.text = e.text;
+ super(e);
+ this.start = e.start;
+ this.end = e.end;
+ this.text = e.text;
}
/**
@@ -59,6 +59,6 @@
* @return a string representation of the event
*/
public char[] toString() {
- return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-2 ], start, end, text );
+ return Format( "{} start={} end={} text={}}", super.toString[ 0 .. $-2 ], start, end, text );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Color.d
--- a/dwt/graphics/Color.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Color.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -35,17 +35,17 @@
* @see Device#getSystemColor
*/
public final class Color : Resource {
- /**
- * the handle to the OS color resource
- * (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 GdkColor* handle; + /** + * the handle to the OS color resource + * (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 GdkColor* handle; this() { } @@ -75,10 +75,10 @@ * @see #dispose */ public this(Device device, int red, int green, int blue) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - init(device, red, green, blue); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + init(device, red, green, blue); + if (device.tracking) device.new_Object(this); } /** @@ -104,11 +104,11 @@ * @see #dispose */ public this(Device device, RGB rgb) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (rgb is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - init(device, rgb.red, rgb.green, rgb.blue); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (rgb is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + init(device, rgb.red, rgb.green, rgb.blue); + if (device.tracking) device.new_Object(this); } /** @@ -117,20 +117,20 @@ * they allocate. */ public void dispose() { - if (handle is null) return; - if (device.isDisposed()) return; - int pixel = handle.pixel; - if (device.colorRefCount !is null) { - /* If this was the last reference, remove the color from the list */ - if (--device.colorRefCount[pixel] == 0) { - device.gdkColors[pixel] = null; - } - } - auto colormap = OS.gdk_colormap_get_system(); - OS.gdk_colormap_free_colors(colormap, handle, 1); - handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; + if (handle is null) return; + if (device.isDisposed()) return; + int pixel = handle.pixel; + if (device.colorRefCount !is null) { + /* If this was the last reference, remove the color from the list */ + if (--device.colorRefCount[pixel] == 0) { + device.gdkColors[pixel] = null; + } + } + auto colormap = OS.gdk_colormap_get_system(); + OS.gdk_colormap_free_colors(colormap, handle, 1); + handle = null; + if (device.tracking) device.dispose_Object(this); + device = null; } /** @@ -144,8 +144,8 @@ * @see #hashCode */ public override int opEquals(Object object) { - if (object is this) return true; - if ( auto color = cast(Color)object ){ + if (object is this) return true; + if ( auto color = cast(Color)object ){ GdkColor* gdkColor = color.handle; if (handle == gdkColor) return true; return device == color.device && handle.red == gdkColor.red && @@ -164,8 +164,8 @@ * */ public int getBlue() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return (handle.blue >> 8) & 0xFF; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return (handle.blue >> 8) & 0xFF; } /** @@ -178,8 +178,8 @@ * */ public int getGreen() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return (handle.green >> 8) & 0xFF; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return (handle.green >> 8) & 0xFF; } /** @@ -192,8 +192,8 @@ * */ public int getRed() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return (handle.red >> 8) & 0xFF; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return (handle.red >> 8) & 0xFF; } /** @@ -207,8 +207,8 @@ * @see #equals */ public override hash_t toHash() { - if (isDisposed()) return 0; - return handle.red ^ handle.green ^ handle.blue; + if (isDisposed()) return 0; + return handle.red ^ handle.green ^ handle.blue; } /** @@ -221,8 +221,8 @@ * */ public RGB getRGB () { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return new RGB(getRed(), getGreen(), getBlue()); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return new RGB(getRed(), getGreen(), getBlue()); } /** @@ -241,41 +241,41 @@ * @private */ public static Color gtk_new(Device device, GdkColor* gdkColor) { - if (device is null) device = Device.getDevice(); - Color color = new Color(); - color.handle = gdkColor; - color.device = device; - return color; + if (device is null) device = Device.getDevice(); + Color color = new Color(); + color.handle = gdkColor; + color.device = device; + return color; } void init(Device device, int red, int green, int blue) { - this.device = device; - if ((red > 255) || (red < 0) || - (green > 255) || (green < 0) || - (blue > 255) || (blue < 0)) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - GdkColor* gdkColor = new GdkColor(); - gdkColor.red = cast(short)((red & 0xFF) | ((red & 0xFF) << 8)); - gdkColor.green = cast(short)((green & 0xFF) | ((green & 0xFF) << 8)); - gdkColor.blue = cast(short)((blue & 0xFF) | ((blue & 0xFF) << 8)); - auto colormap = OS.gdk_colormap_get_system(); - if (!OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true)) { - /* Allocate black. */ - gdkColor = new GdkColor(); - OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true); - } - handle = gdkColor; - if (device.colorRefCount != null) { - /* Make a copy of the color to put in the colors array */ - GdkColor* colorCopy = new GdkColor(); - colorCopy.red = handle.red; - colorCopy.green = handle.green; - colorCopy.blue = handle.blue; - colorCopy.pixel = handle.pixel; - device.gdkColors[colorCopy.pixel] = colorCopy; - device.colorRefCount[colorCopy.pixel]++; - } + this.device = device; + if ((red > 255) || (red < 0) || + (green > 255) || (green < 0) || + (blue > 255) || (blue < 0)) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + GdkColor* gdkColor = new GdkColor(); + gdkColor.red = cast(short)((red & 0xFF) | ((red & 0xFF) << 8)); + gdkColor.green = cast(short)((green & 0xFF) | ((green & 0xFF) << 8)); + gdkColor.blue = cast(short)((blue & 0xFF) | ((blue & 0xFF) << 8)); + auto colormap = OS.gdk_colormap_get_system(); + if (!OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true)) { + /* Allocate black. */ + gdkColor = new GdkColor(); + OS.gdk_colormap_alloc_color(colormap, gdkColor, true, true); + } + handle = gdkColor; + if (device.colorRefCount != null) { + /* Make a copy of the color to put in the colors array */ + GdkColor* colorCopy = new GdkColor(); + colorCopy.red = handle.red; + colorCopy.green = handle.green; + colorCopy.blue = handle.blue; + colorCopy.pixel = handle.pixel; + device.gdkColors[colorCopy.pixel] = colorCopy; + device.colorRefCount[colorCopy.pixel]++; + } } /** @@ -289,7 +289,7 @@ * @returntrue
when the color is disposed and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -299,8 +299,8 @@
* @return a string representation of the receiver
*/
public override char[] toString () {
- if (isDisposed()) return "Color {*DISPOSED*}";
- return Format( "Color {{{}, {}, {}}", getRed(), getGreen(), getBlue());
+ if (isDisposed()) return "Color {*DISPOSED*}";
+ return Format( "Color {{{}, {}, {}}", getRed(), getGreen(), getBlue());
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Cursor.d
--- a/dwt/graphics/Cursor.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Cursor.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -48,43 +48,43 @@
*
*/
public final class Cursor : Resource {
- /**
- * the handle to the OS cursor resource
- * (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 GdkCursor* handle; + /** + * the handle to the OS cursor resource + * (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 GdkCursor* handle; - static const byte[] APPSTARTING_SRC = [ cast(byte) - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x7c, 0x00, 0x00, 0x00, cast(byte)0xfc, 0x00, 0x00, 0x00, cast(byte)0xfc, 0x01, 0x00, 0x00, - cast(byte)0xfc, 0x3b, 0x00, 0x00, 0x7c, 0x38, 0x00, 0x00, 0x6c, 0x54, 0x00, 0x00, - cast(byte)0xc4, cast(byte)0xdc, 0x00, 0x00, cast(byte)0xc0, 0x44, 0x00, 0x00, cast(byte)0x80, 0x39, 0x00, 0x00, - cast(byte)0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + static const byte[] APPSTARTING_SRC = [ cast(byte) + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, cast(byte)0xfc, 0x00, 0x00, 0x00, cast(byte)0xfc, 0x01, 0x00, 0x00, + cast(byte)0xfc, 0x3b, 0x00, 0x00, 0x7c, 0x38, 0x00, 0x00, 0x6c, 0x54, 0x00, 0x00, + cast(byte)0xc4, cast(byte)0xdc, 0x00, 0x00, cast(byte)0xc0, 0x44, 0x00, 0x00, cast(byte)0x80, 0x39, 0x00, 0x00, + cast(byte)0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; - static const byte[] APPSTARTING_MASK = [ cast(byte) - 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, - cast(byte)0xfe, 0x00, 0x00, 0x00, cast(byte)0xfe, 0x01, 0x00, 0x00, cast(byte)0xfe, 0x3b, 0x00, 0x00, - cast(byte)0xfe, 0x7f, 0x00, 0x00, cast(byte)0xfe, 0x7f, 0x00, 0x00, cast(byte)0xfe, cast(byte)0xfe, 0x00, 0x00, - cast(byte)0xee, cast(byte)0xff, 0x01, 0x00, cast(byte)0xe4, cast(byte)0xff, 0x00, 0x00, cast(byte)0xc0, 0x7f, 0x00, 0x00, - cast(byte)0xc0, 0x7f, 0x00, 0x00, cast(byte)0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + static const byte[] APPSTARTING_MASK = [ cast(byte) + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, + cast(byte)0xfe, 0x00, 0x00, 0x00, cast(byte)0xfe, 0x01, 0x00, 0x00, cast(byte)0xfe, 0x3b, 0x00, 0x00, + cast(byte)0xfe, 0x7f, 0x00, 0x00, cast(byte)0xfe, 0x7f, 0x00, 0x00, cast(byte)0xfe, cast(byte)0xfe, 0x00, 0x00, + cast(byte)0xee, cast(byte)0xff, 0x01, 0x00, cast(byte)0xe4, cast(byte)0xff, 0x00, 0x00, cast(byte)0xc0, 0x7f, 0x00, 0x00, + cast(byte)0xc0, 0x7f, 0x00, 0x00, cast(byte)0x80, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; this () { } @@ -131,43 +131,43 @@ * @see SWT#CURSOR_HAND */ public this(Device device, int style) { - if (device == null) device = Device.getDevice(); - if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = device; - int shape = 0; - switch (style) { - case SWT.CURSOR_APPSTARTING: break; - case SWT.CURSOR_ARROW: shape = OS.GDK_LEFT_PTR; break; - case SWT.CURSOR_WAIT: shape = OS.GDK_WATCH; break; - case SWT.CURSOR_CROSS: shape = OS.GDK_CROSS; break; - case SWT.CURSOR_HAND: shape = OS.GDK_HAND2; break; - case SWT.CURSOR_HELP: shape = OS.GDK_QUESTION_ARROW; break; - case SWT.CURSOR_SIZEALL: shape = OS.GDK_FLEUR; break; - case SWT.CURSOR_SIZENESW: shape = OS.GDK_SIZING; break; - case SWT.CURSOR_SIZENS: shape = OS.GDK_DOUBLE_ARROW; break; - case SWT.CURSOR_SIZENWSE: shape = OS.GDK_SIZING; break; - case SWT.CURSOR_SIZEWE: shape = OS.GDK_SB_H_DOUBLE_ARROW; break; - case SWT.CURSOR_SIZEN: shape = OS.GDK_TOP_SIDE; break; - case SWT.CURSOR_SIZES: shape = OS.GDK_BOTTOM_SIDE; break; - case SWT.CURSOR_SIZEE: shape = OS.GDK_RIGHT_SIDE; break; - case SWT.CURSOR_SIZEW: shape = OS.GDK_LEFT_SIDE; break; - case SWT.CURSOR_SIZENE: shape = OS.GDK_TOP_RIGHT_CORNER; break; - case SWT.CURSOR_SIZESE: shape = OS.GDK_BOTTOM_RIGHT_CORNER; break; - case SWT.CURSOR_SIZESW: shape = OS.GDK_BOTTOM_LEFT_CORNER; break; - case SWT.CURSOR_SIZENW: shape = OS.GDK_TOP_LEFT_CORNER; break; - case SWT.CURSOR_UPARROW: shape = OS.GDK_SB_UP_ARROW; break; - case SWT.CURSOR_IBEAM: shape = OS.GDK_XTERM; break; - case SWT.CURSOR_NO: shape = OS.GDK_X_CURSOR; break; - default: - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - if (shape == 0 && style == SWT.CURSOR_APPSTARTING) { - handle = createCursor(APPSTARTING_SRC, APPSTARTING_MASK, 32, 32, 2, 2, true); - } else { - handle = OS.gdk_cursor_new(shape); - } - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + if (device == null) device = Device.getDevice(); + if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = device; + int shape = 0; + switch (style) { + case SWT.CURSOR_APPSTARTING: break; + case SWT.CURSOR_ARROW: shape = OS.GDK_LEFT_PTR; break; + case SWT.CURSOR_WAIT: shape = OS.GDK_WATCH; break; + case SWT.CURSOR_CROSS: shape = OS.GDK_CROSS; break; + case SWT.CURSOR_HAND: shape = OS.GDK_HAND2; break; + case SWT.CURSOR_HELP: shape = OS.GDK_QUESTION_ARROW; break; + case SWT.CURSOR_SIZEALL: shape = OS.GDK_FLEUR; break; + case SWT.CURSOR_SIZENESW: shape = OS.GDK_SIZING; break; + case SWT.CURSOR_SIZENS: shape = OS.GDK_DOUBLE_ARROW; break; + case SWT.CURSOR_SIZENWSE: shape = OS.GDK_SIZING; break; + case SWT.CURSOR_SIZEWE: shape = OS.GDK_SB_H_DOUBLE_ARROW; break; + case SWT.CURSOR_SIZEN: shape = OS.GDK_TOP_SIDE; break; + case SWT.CURSOR_SIZES: shape = OS.GDK_BOTTOM_SIDE; break; + case SWT.CURSOR_SIZEE: shape = OS.GDK_RIGHT_SIDE; break; + case SWT.CURSOR_SIZEW: shape = OS.GDK_LEFT_SIDE; break; + case SWT.CURSOR_SIZENE: shape = OS.GDK_TOP_RIGHT_CORNER; break; + case SWT.CURSOR_SIZESE: shape = OS.GDK_BOTTOM_RIGHT_CORNER; break; + case SWT.CURSOR_SIZESW: shape = OS.GDK_BOTTOM_LEFT_CORNER; break; + case SWT.CURSOR_SIZENW: shape = OS.GDK_TOP_LEFT_CORNER; break; + case SWT.CURSOR_UPARROW: shape = OS.GDK_SB_UP_ARROW; break; + case SWT.CURSOR_IBEAM: shape = OS.GDK_XTERM; break; + case SWT.CURSOR_NO: shape = OS.GDK_X_CURSOR; break; + default: + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + if (shape == 0 && style == SWT.CURSOR_APPSTARTING) { + handle = createCursor(APPSTARTING_SRC, APPSTARTING_MASK, 32, 32, 2, 2, true); + } else { + handle = OS.gdk_cursor_new(shape); + } + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + if (device.tracking) device.new_Object(this); } /** @@ -202,61 +202,61 @@ * */ public this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) { - if (device == null) device = Device.getDevice(); - if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = device; - if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (mask == null) { - if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) SWT.error(SWT.ERROR_NULL_ARGUMENT); - mask = source.getTransparencyMask(); - } - /* Check the bounds. Mask must be the same size as source */ - if (mask.width != source.width || mask.height != source.height) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - /* Check the hotspots */ - if (hotspotX >= source.width || hotspotX < 0 || - hotspotY >= source.height || hotspotY < 0) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - /* Convert depth to 1 */ - source = ImageData.convertMask(source); - mask = ImageData.convertMask(mask); + if (device == null) device = Device.getDevice(); + if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = device; + if (source == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (mask == null) { + if (!(source.getTransparencyType() == SWT.TRANSPARENCY_MASK)) SWT.error(SWT.ERROR_NULL_ARGUMENT); + mask = source.getTransparencyMask(); + } + /* Check the bounds. Mask must be the same size as source */ + if (mask.width != source.width || mask.height != source.height) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + /* Check the hotspots */ + if (hotspotX >= source.width || hotspotX < 0 || + hotspotY >= source.height || hotspotY < 0) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + /* Convert depth to 1 */ + source = ImageData.convertMask(source); + mask = ImageData.convertMask(mask); - /* Swap the bits in each byte and convert to appropriate scanline pad */ - byte[] sourceData = new byte[source.data.length]; - byte[] maskData = new byte[mask.data.length]; - byte[] data = source.data; - for (int i = 0; i < data.length; i++) { - byte s = data[i]; - sourceData[i] = cast(byte)(((s & 0x80) >> 7) | - ((s & 0x40) >> 5) | - ((s & 0x20) >> 3) | - ((s & 0x10) >> 1) | - ((s & 0x08) << 1) | - ((s & 0x04) << 3) | - ((s & 0x02) << 5) | - ((s & 0x01) << 7)); - sourceData[i] = cast(byte) ~sourceData[i]; - } - sourceData = ImageData.convertPad(sourceData, source.width, source.height, source.depth, source.scanlinePad, 1); - data = mask.data; - for (int i = 0; i < data.length; i++) { - byte s = data[i]; - maskData[i] = cast(byte)(((s & 0x80) >> 7) | - ((s & 0x40) >> 5) | - ((s & 0x20) >> 3) | - ((s & 0x10) >> 1) | - ((s & 0x08) << 1) | - ((s & 0x04) << 3) | - ((s & 0x02) << 5) | - ((s & 0x01) << 7)); - maskData[i] = cast(byte) ~maskData[i]; - } - maskData = ImageData.convertPad(maskData, mask.width, mask.height, mask.depth, mask.scanlinePad, 1); - handle = createCursor(maskData, sourceData, source.width, source.height, hotspotX, hotspotY, true); - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + /* Swap the bits in each byte and convert to appropriate scanline pad */ + byte[] sourceData = new byte[source.data.length]; + byte[] maskData = new byte[mask.data.length]; + byte[] data = source.data; + for (int i = 0; i < data.length; i++) { + byte s = data[i]; + sourceData[i] = cast(byte)(((s & 0x80) >> 7) | + ((s & 0x40) >> 5) | + ((s & 0x20) >> 3) | + ((s & 0x10) >> 1) | + ((s & 0x08) << 1) | + ((s & 0x04) << 3) | + ((s & 0x02) << 5) | + ((s & 0x01) << 7)); + sourceData[i] = cast(byte) ~sourceData[i]; + } + sourceData = ImageData.convertPad(sourceData, source.width, source.height, source.depth, source.scanlinePad, 1); + data = mask.data; + for (int i = 0; i < data.length; i++) { + byte s = data[i]; + maskData[i] = cast(byte)(((s & 0x80) >> 7) | + ((s & 0x40) >> 5) | + ((s & 0x20) >> 3) | + ((s & 0x10) >> 1) | + ((s & 0x08) << 1) | + ((s & 0x04) << 3) | + ((s & 0x02) << 5) | + ((s & 0x01) << 7)); + maskData[i] = cast(byte) ~maskData[i]; + } + maskData = ImageData.convertPad(maskData, mask.width, mask.height, mask.depth, mask.scanlinePad, 1); + handle = createCursor(maskData, sourceData, source.width, source.height, hotspotX, hotspotY, true); + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + if (device.tracking) device.new_Object(this); } /** @@ -278,7 +278,7 @@ *true
when the cursor is disposed and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -543,8 +543,8 @@
* @return a string representation of the receiver
*/
public override char[] toString () {
- if (isDisposed()) return "Cursor {*DISPOSED*}";
- return Format( "Cursor {{{}}", handle );
+ if (isDisposed()) return "Cursor {*DISPOSED*}";
+ return Format( "Cursor {{{}}", handle );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Device.d
--- a/dwt/graphics/Device.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Device.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -35,83 +35,83 @@
* can be drawn on by sending messages to the associated GC.
*/
public abstract class Device : Drawable {
- /**
- * the handle to the X Display
- * (Warning: This field is platform dependent)
- * - * IMPORTANT: This field is not part of the SWT - * public API. It is marked protected 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. - *
- */ - protected void* xDisplay; - GtkWidget* shellHandle; + /** + * the handle to the X Display + * (Warning: This field is platform dependent) + *+ * IMPORTANT: This field is not part of the SWT + * public API. It is marked protected 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. + *
+ */ + protected void* xDisplay; + GtkWidget* shellHandle; - /* Debugging */ - public static bool DEBUG; - bool debugging; - bool tracking; - TracedException [] errors; - Object [] objects; + /* Debugging */ + public static bool DEBUG; + bool debugging; + bool tracking; + TracedException [] errors; + Object [] objects; - /* Colormap and reference count */ - GdkColor *[] gdkColors; - int [] colorRefCount; + /* Colormap and reference count */ + GdkColor *[] gdkColors; + int [] colorRefCount; - /* Disposed flag */ - bool disposed; + /* Disposed flag */ + bool disposed; - /* Warning and Error Handlers */ - //int /*long*/ logProcFld; - //GLogFunc logCallback; - //NOT DONE - get list of valid names - char[] [] log_domains = ["GLib-GObject"[], "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"]; - int [] handler_ids;// = new int [log_domains.length]; - int warningLevel; + /* Warning and Error Handlers */ + //int /*long*/ logProcFld; + //GLogFunc logCallback; + //NOT DONE - get list of valid names + char[] [] log_domains = ["GLib-GObject"[], "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"]; + int [] handler_ids;// = new int [log_domains.length]; + int warningLevel; - /* X Warning and Error Handlers */ + /* X Warning and Error Handlers */ static extern(C) int function(void *) mXIOErrorHandler; static extern(C) int function(void *, XErrorEvent *) mXErrorHandler; - //static int mXErrorCallback, mXIOErrorCallback; + //static int mXErrorCallback, mXIOErrorCallback; - static int /*long*/ XErrorProc, XIOErrorProc, XNullErrorProc, XNullIOErrorProc; - static Device[] Devices; + static int /*long*/ XErrorProc, XIOErrorProc, XNullErrorProc, XNullIOErrorProc; + static Device[] Devices; - /* - * The following colors are listed in the Windows - * Programmer's Reference as the colors in the default - * palette. - */ - Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE; - Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED; - Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE; + /* + * The following colors are listed in the Windows + * Programmer's Reference as the colors in the default + * palette. + */ + Color COLOR_BLACK, COLOR_DARK_RED, COLOR_DARK_GREEN, COLOR_DARK_YELLOW, COLOR_DARK_BLUE; + Color COLOR_DARK_MAGENTA, COLOR_DARK_CYAN, COLOR_GRAY, COLOR_DARK_GRAY, COLOR_RED; + Color COLOR_GREEN, COLOR_YELLOW, COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE; - /* System Font */ - Font systemFont; + /* System Font */ + Font systemFont; - PangoTabArray* emptyTab; + PangoTabArray* emptyTab; - bool useXRender; + bool useXRender; - static bool CAIRO_LOADED; + static bool CAIRO_LOADED; - static Object CREATE_LOCK; + static Object CREATE_LOCK; - /* - * TEMPORARY CODE. When a graphics object is - * created and the device parameter is null, - * the current Display is used. This presents - * a problem because SWT graphics does not - * reference classes in SWT widgets. The correct - * fix is to remove this feature. Unfortunately, - * too many application programs rely on this - * feature. - * - * This code will be removed in the future. - */ - protected static Device CurrentDevice; - protected static Runnable DeviceFinder; + /* + * TEMPORARY CODE. When a graphics object is + * created and the device parameter is null, + * the current Display is used. This presents + * a problem because SWT graphics does not + * reference classes in SWT widgets. The correct + * fix is to remove this feature. Unfortunately, + * too many application programs rely on this + * feature. + * + * This code will be removed in the future. + */ + protected static Device CurrentDevice; + protected static Runnable DeviceFinder; synchronized static void static_this(){ CREATE_LOCK = new Object(); @@ -121,10 +121,10 @@ * TEMPORARY CODE. */ static synchronized Device getDevice () { - if (DeviceFinder !is null) DeviceFinder.run(); - Device device = CurrentDevice; - CurrentDevice = null; - return device; + if (DeviceFinder !is null) DeviceFinder.run(); + Device device = CurrentDevice; + CurrentDevice = null; + return device; } /** @@ -139,7 +139,7 @@ * @since 3.1 */ public this() { - this(null); + this(null); } /** @@ -159,22 +159,22 @@ debugging = DEBUG; tracking = DEBUG; - synchronized (CREATE_LOCK) { - if (data !is null) { - debugging = data.debugging; - tracking = data.tracking; - } - if (tracking) { - errors = new TracedException [128]; - objects = new Object [128]; - } - create (data); - init (); - register (this); + synchronized (CREATE_LOCK) { + if (data !is null) { + debugging = data.debugging; + tracking = data.tracking; + } + if (tracking) { + errors = new TracedException [128]; + objects = new Object [128]; + } + create (data); + init (); + register (this); - /* Initialize the system font slot */ - systemFont = getSystemFont (); - } + /* Initialize the system font slot */ + systemFont = getSystemFont (); + } } void checkCairo() { @@ -200,7 +200,7 @@ *false
otherwise
*/
public bool isDisposed () {
- return disposed;
+ return disposed;
}
/**
@@ -670,32 +670,32 @@
* @since 3.3
*/
public bool loadFont (char[] path) {
- checkDevice();
- if (path is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path));
+ checkDevice();
+ if (path is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ return cast(bool) OS.FcConfigAppFontAddFile (null, toStringz(path));
}
private static extern(C) void logFunction (char* log_domain, int log_level, char* message, void* user_data) {
Device dev = cast(Device)user_data;
- if (dev.warningLevel is 0) {
- if (DEBUG || dev.debugging) {
+ if (dev.warningLevel is 0) {
+ if (DEBUG || dev.debugging) {
foreach( msg; new TracedException ("") ){
Stderr.formatln( "trc {}", msg );
}
- }
- OS.g_log_default_handler (log_domain, log_level, message, user_data);
- }
- return 0;
+ }
+ OS.g_log_default_handler (log_domain, log_level, message, user_data);
+ }
+ return 0;
}
void new_Object (Object object) {
- for (int i=0; i+ * 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; + /* + * Debug fields - may not be honoured + * on some SWT platforms. + */ + public bool debugging; + public bool tracking; + public TracedException [] errors; + public Object [] objects; } diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Font.d --- a/dwt/graphics/Font.d Sat Jan 12 07:02:08 2008 +0100 +++ b/dwt/graphics/Font.d Sat Jan 12 08:44:23 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -35,17 +35,17 @@ * @see FontData */ public final class Font : Resource { - /** - * the handle to the OS font resource - * (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 PangoFontDescription* handle; + /** + * the handle to the OS font resource + * (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 PangoFontDescription* handle; this() { } @@ -69,11 +69,11 @@ * */ public this(Device device, FontData fd) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (fd is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - init(device, fd.getName(), fd.getHeightF(), fd.getStyle(), fd.str); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (fd is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + init(device, fd.getName(), fd.getHeightF(), fd.getStyle(), fd.str); + if (device.tracking) device.new_Object(this); } /** @@ -100,16 +100,16 @@ * @since 2.1 */ public this(Device device, FontData[] fds) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (fds is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (fds.length == 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - for (int i=0; itrue
when the font is disposed and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -295,8 +295,8 @@
* @return a string representation of the receiver
*/
public char[] toString () {
- if (isDisposed()) return "Font {*DISPOSED*}";
- return Format( "Font {{{}}", handle );
+ if (isDisposed()) return "Font {*DISPOSED*}";
+ return Format( "Font {{{}}", handle );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/FontData.d
--- a/dwt/graphics/FontData.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/FontData.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -42,64 +42,64 @@
* @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 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 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 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 char[] str; + /** + * 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 char[] str; - /** - * The locales of the font - */ - char[] lang, country, variant; + /** + * The locales of the font + */ + char[] lang, country, variant; /** * Constructs a new uninitialized font data. */ public this () { - this("", 12, SWT.NORMAL); + this("", 12, SWT.NORMAL); } /** @@ -122,58 +122,58 @@ * @see #toString */ public this(char[] str) { - if (str is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - int start = 0; - int end = locate( str, '|' ); - if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - char[] version1 = str[ start .. end ]; - try { - if (to!(int)(version1) != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } catch (ConversionException e) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } + if (str is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + int start = 0; + int end = locate( str, '|' ); + if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + char[] version1 = str[ start .. end ]; + try { + if (to!(int)(version1) != 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } catch (ConversionException e) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } - start = end + 1; - end = locate( str, '|', start ); - if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - char[] name = str[start .. end ]; + start = end + 1; + end = locate( str, '|', start ); + if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + char[] name = str[start .. end ]; - start = end + 1; + start = end + 1; end = locate( str, '|', start ); if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - float height = 0; - try { - height = to!(float)(str[start .. end]); - } catch (ConversionException e) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } + float height = 0; + try { + height = to!(float)(str[start .. end]); + } catch (ConversionException e) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } - start = end + 1; + start = end + 1; end = locate( str, '|', start ); if (end == str.length ) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - int style = 0; - try { - style = to!(int)( str[start .. end ]); - } catch (ConversionException e) { - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } + int style = 0; + try { + style = to!(int)( str[start .. end ]); + } catch (ConversionException e) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } - start = end + 1; + start = end + 1; end = locate( str, '|', start ); - setName(name); - setHeight(height); - setStyle(style); - if (end == str.length) return; - char[] platform = str[ start .. end ]; + setName(name); + setHeight(height); + setStyle(style); + if (end == str.length) return; + char[] platform = str[ start .. end ]; - start = end + 1; + start = end + 1; end = locate( str, '|', start ); - if (end == str.length) return; - char[] version2 = str[ start .. end ]; + if (end == str.length) return; + char[] version2 = str[ start .. end ]; - if (platform == "GTK" && version2 == "1" ) { - return; - } + if (platform == "GTK" && version2 == "1" ) { + return; + } } /** @@ -191,15 +191,15 @@ * */ public this(char[] name, int height, int style) { - setName(name); - setHeight(height); - setStyle(style); + setName(name); + setHeight(height); + setStyle(style); } /*public*/ this(char[] name, float height, int style) { - setName(name); - setHeight(height); - setStyle(style); + setName(name); + setHeight(height); + setStyle(style); } /** @@ -213,7 +213,7 @@ * @see #hashCode */ public override int opEquals (Object object) { - if (object is this) return true; + if (object is this) return true; if( auto data = cast(FontData)object ){ return name == data.name && height == data.height && style == data.style; } @@ -228,11 +228,11 @@ * @see #setHeight(int) */ public int getHeight() { - return cast(int)(0.5f + height); + return cast(int)(0.5f + height); } /*public*/ float getHeightF() { - return height; + return height; } /** @@ -254,25 +254,25 @@ */ 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; - } + 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; + if (result) { + if (result[$-1] == sep) { + result = result[0 .. $ - 1]; + } + } + return result; } /** @@ -285,7 +285,7 @@ * @see #setName */ public char[] getName() { - return name; + return name; } /** @@ -298,7 +298,7 @@ * @see #setStyle */ public int getStyle() { - return style; + return style; } /** @@ -312,7 +312,7 @@ * @see #equals */ public hash_t toHash () { - return typeid(char[]).getHash(&name) ^ getHeight() ^ style; + return typeid(char[]).getHash(&name) ^ getHeight() ^ style; } /** @@ -329,15 +329,15 @@ * @see #getHeight */ public void setHeight(int height) { - if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - this.height = height; - this.str = null; + if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + this.height = height; + this.str = null; } /*public*/ void setHeight(float height) { - if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - this.height = height; - this.str = null; + if (height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + this.height = height; + this.str = null; } /** @@ -358,23 +358,23 @@ * @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; + 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 .. $ ]; - } + 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 .. $ ]; + } } /** @@ -403,9 +403,9 @@ * @see #getName */ public void setName(char[] name) { - if (name is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.name = name; - this.str = null; + if (name is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.name = name; + this.str = null; } /** @@ -419,8 +419,8 @@ * @see #getStyle */ public void setStyle(int style) { - this.style = style; - this.str = null; + this.style = style; + this.str = null; } /** diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/FontMetrics.d --- a/dwt/graphics/FontMetrics.d Sat Jan 12 07:02:08 2008 +0100 +++ b/dwt/graphics/FontMetrics.d Sat Jan 12 08:44:23 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -21,7 +21,7 @@ * @see GC#getFontMetrics */ public final class FontMetrics { - int ascent, descent, averageCharWidth, leading, height; + int ascent, descent, averageCharWidth, leading, height; package this() { } @@ -37,13 +37,13 @@ * @see #hashCode */ public int opEquals (Object object) { - if (object is this) return true; + 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; + return false; } /** @@ -55,7 +55,7 @@ * @return the ascent of the font */ public int getAscent() { - return ascent; + return ascent; } /** @@ -65,7 +65,7 @@ * @return the average character width of the font */ public int getAverageCharWidth() { - return averageCharWidth; + return averageCharWidth; } /** @@ -77,7 +77,7 @@ * @return the descent of the font */ public int getDescent() { - return descent; + return descent; } /** @@ -92,7 +92,7 @@ * @see #getLeading */ public int getHeight() { - return height; + return height; } /** @@ -103,17 +103,17 @@ * @return the leading space of the font */ public int getLeading() { - return leading; + 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; + FontMetrics fontMetrics = new FontMetrics(); + fontMetrics.ascent = ascent; + fontMetrics.descent = descent; + fontMetrics.averageCharWidth = averageCharWidth; + fontMetrics.leading = leading; + fontMetrics.height = height; + return fontMetrics; } /** @@ -127,7 +127,7 @@ * @see #equals */ public hash_t toHash() { - return ascent ^ descent ^ averageCharWidth ^ leading ^ height; + return ascent ^ descent ^ averageCharWidth ^ leading ^ height; } } diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/GC.d --- a/dwt/graphics/GC.d Sat Jan 12 07:02:08 2008 +0100 +++ b/dwt/graphics/GC.d Sat Jan 12 08:44:23 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * 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 @@ -110,42 +110,42 @@ * @see dwt.events.PaintEvent */ public final class GC : Resource { - /** - * the handle to the OS device context - * (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 GdkGC* handle; + /** + * the handle to the OS device context + * (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 GdkGC* handle; - Drawable drawable; - GCData data; + Drawable drawable; + GCData data; - const static int FOREGROUND = 1 << 0; - const static int BACKGROUND = 1 << 1; - const static int FONT = 1 << 2; - const static int LINE_STYLE = 1 << 3; - const static int LINE_CAP = 1 << 4; - const static int LINE_JOIN = 1 << 5; - const static int LINE_WIDTH = 1 << 6; - const static int LINE_MITERLIMIT = 1 << 7; - const static int BACKGROUND_BG = 1 << 8; - const static int DRAW_OFFSET = 1 << 9; - const static int DRAW = FOREGROUND | LINE_WIDTH | LINE_STYLE | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | DRAW_OFFSET; - const static int FILL = BACKGROUND; + const static int FOREGROUND = 1 << 0; + const static int BACKGROUND = 1 << 1; + const static int FONT = 1 << 2; + const static int LINE_STYLE = 1 << 3; + const static int LINE_CAP = 1 << 4; + const static int LINE_JOIN = 1 << 5; + const static int LINE_WIDTH = 1 << 6; + const static int LINE_MITERLIMIT = 1 << 7; + const static int BACKGROUND_BG = 1 << 8; + const static int DRAW_OFFSET = 1 << 9; + const static int DRAW = FOREGROUND | LINE_WIDTH | LINE_STYLE | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | DRAW_OFFSET; + const static int FILL = BACKGROUND; - static const float[] LINE_DOT = [1, 1]; - static const float[] LINE_DASH = [3, 1]; - static const float[] LINE_DASHDOT = [3, 1, 1, 1]; - static const float[] LINE_DASHDOTDOT = [3, 1, 1, 1, 1, 1]; - static const float[] LINE_DOT_ZERO = [3, 3]; - static const float[] LINE_DASH_ZERO = [18, 6]; - static const float[] LINE_DASHDOT_ZERO = [9, 6, 3, 6]; - static const float[] LINE_DASHDOTDOT_ZERO = [9, 3, 3, 3, 3, 3]; + static const float[] LINE_DOT = [1, 1]; + static const float[] LINE_DASH = [3, 1]; + static const float[] LINE_DASHDOT = [3, 1, 1, 1]; + static const float[] LINE_DASHDOTDOT = [3, 1, 1, 1, 1, 1]; + static const float[] LINE_DOT_ZERO = [3, 3]; + static const float[] LINE_DASH_ZERO = [18, 6]; + static const float[] LINE_DASHDOT_ZERO = [9, 6, 3, 6]; + static const float[] LINE_DASHDOTDOT_ZERO = [9, 3, 3, 3, 3, 3]; this() { } @@ -173,7 +173,7 @@ * */ public this(Drawable drawable) { - this(drawable, 0); + this(drawable, 0); } /** @@ -204,260 +204,260 @@ * @since 2.1.2 */ public this(Drawable drawable, int style) { - if (drawable is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - GCData data = new GCData(); - data.style = checkStyle(style); - auto gdkGC = drawable.internal_new_GC(data); - Device device = data.device; - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = data.device = device; - init(drawable, data, gdkGC); - if (device.tracking) device.new_Object(this); + if (drawable is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + GCData data = new GCData(); + data.style = checkStyle(style); + auto gdkGC = drawable.internal_new_GC(data); + Device device = data.device; + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = data.device = device; + init(drawable, data, gdkGC); + if (device.tracking) device.new_Object(this); } static void addCairoString(cairo_t* cairo, char[] str, float x, float y, Font font) { - char[] buffer = str.dup; - if (OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { - auto layout = OS.pango_cairo_create_layout(cairo); - if (layout is null) SWT.error(SWT.ERROR_NO_HANDLES); - OS.pango_layout_set_text(layout, buffer.ptr, -1); - OS.pango_layout_set_font_description(layout, font.handle); - Cairo.cairo_move_to(cairo, x, y); - OS.pango_cairo_layout_path(cairo, layout); - OS.g_object_unref(layout); - } else { - GC.setCairoFont(cairo, font); - cairo_font_extents_t* extents = new cairo_font_extents_t(); - Cairo.cairo_font_extents(cairo, extents); - double baseline = y + extents.ascent; - Cairo.cairo_move_to(cairo, x, baseline); - Cairo.cairo_text_path(cairo, buffer.ptr); - } + char[] buffer = str.dup; + if (OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) { + auto layout = OS.pango_cairo_create_layout(cairo); + if (layout is null) SWT.error(SWT.ERROR_NO_HANDLES); + OS.pango_layout_set_text(layout, buffer.ptr, -1); + OS.pango_layout_set_font_description(layout, font.handle); + Cairo.cairo_move_to(cairo, x, y); + OS.pango_cairo_layout_path(cairo, layout); + OS.g_object_unref(layout); + } else { + GC.setCairoFont(cairo, font); + cairo_font_extents_t* extents = new cairo_font_extents_t(); + Cairo.cairo_font_extents(cairo, extents); + double baseline = y + extents.ascent; + Cairo.cairo_move_to(cairo, x, baseline); + Cairo.cairo_text_path(cairo, buffer.ptr); + } } static int checkStyle (int style) { - if ((style & SWT.LEFT_TO_RIGHT) !is 0) style &= ~SWT.RIGHT_TO_LEFT; - return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); + if ((style & SWT.LEFT_TO_RIGHT) !is 0) style &= ~SWT.RIGHT_TO_LEFT; + return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); } public static GC gtk_new(Drawable drawable, GCData data) { - GC gc = new GC(); - auto gdkGC = drawable.internal_new_GC(data); - gc.device = data.device; - gc.init(drawable, data, gdkGC); - return gc; + GC gc = new GC(); + auto gdkGC = drawable.internal_new_GC(data); + gc.device = data.device; + gc.init(drawable, data, gdkGC); + return gc; } void checkGC (int mask) { - int state = data.state; - if ((state & mask) is mask) return; - state = (state ^ mask) & mask; - data.state |= mask; - auto cairo = data.cairo; - if (cairo !is null) { - if ((state & (BACKGROUND | FOREGROUND)) !is 0) { - GdkColor* color; - Pattern pattern; - if ((state & FOREGROUND) !is 0) { - color = data.foreground; - pattern = data.foregroundPattern; - data.state &= ~BACKGROUND; - } else { - color = data.background; - pattern = data.backgroundPattern; - data.state &= ~FOREGROUND; - } - if (pattern !is null) { - Cairo.cairo_set_source(cairo, pattern.handle); - } else { - Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / cast(float)0xFFFF, (color.green & 0xFFFF) / cast(float)0xFFFF, (color.blue & 0xFFFF) / cast(float)0xFFFF, data.alpha / cast(float)0xFF); - } - } - if ((state & FONT) !is 0) { - if (data.layout !is null) { - OS.pango_layout_set_font_description(data.layout, data.font); - } - if (OS.GTK_VERSION < OS.buildVERSION(2, 8, 0)) { - setCairoFont(cairo, data.font); - } - } - if ((state & LINE_CAP) !is 0) { - int cap_style = 0; - switch (data.lineCap) { - case SWT.CAP_ROUND: cap_style = Cairo.CAIRO_LINE_CAP_ROUND; break; - case SWT.CAP_FLAT: cap_style = Cairo.CAIRO_LINE_CAP_BUTT; break; - case SWT.CAP_SQUARE: cap_style = Cairo.CAIRO_LINE_CAP_SQUARE; break; + int state = data.state; + if ((state & mask) is mask) return; + state = (state ^ mask) & mask; + data.state |= mask; + auto cairo = data.cairo; + if (cairo !is null) { + if ((state & (BACKGROUND | FOREGROUND)) !is 0) { + GdkColor* color; + Pattern pattern; + if ((state & FOREGROUND) !is 0) { + color = data.foreground; + pattern = data.foregroundPattern; + data.state &= ~BACKGROUND; + } else { + color = data.background; + pattern = data.backgroundPattern; + data.state &= ~FOREGROUND; + } + if (pattern !is null) { + Cairo.cairo_set_source(cairo, pattern.handle); + } else { + Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / cast(float)0xFFFF, (color.green & 0xFFFF) / cast(float)0xFFFF, (color.blue & 0xFFFF) / cast(float)0xFFFF, data.alpha / cast(float)0xFF); + } + } + if ((state & FONT) !is 0) { + if (data.layout !is null) { + OS.pango_layout_set_font_description(data.layout, data.font); + } + if (OS.GTK_VERSION < OS.buildVERSION(2, 8, 0)) { + setCairoFont(cairo, data.font); + } + } + if ((state & LINE_CAP) !is 0) { + int cap_style = 0; + switch (data.lineCap) { + case SWT.CAP_ROUND: cap_style = Cairo.CAIRO_LINE_CAP_ROUND; break; + case SWT.CAP_FLAT: cap_style = Cairo.CAIRO_LINE_CAP_BUTT; break; + case SWT.CAP_SQUARE: cap_style = Cairo.CAIRO_LINE_CAP_SQUARE; break; default: - } - Cairo.cairo_set_line_cap(cairo, cap_style); - } - if ((state & LINE_JOIN) !is 0) { - int join_style = 0; - switch (data.lineJoin) { - case SWT.JOIN_MITER: join_style = Cairo.CAIRO_LINE_JOIN_MITER; break; - case SWT.JOIN_ROUND: join_style = Cairo.CAIRO_LINE_JOIN_ROUND; break; - case SWT.JOIN_BEVEL: join_style = Cairo.CAIRO_LINE_JOIN_BEVEL; break; + } + Cairo.cairo_set_line_cap(cairo, cap_style); + } + if ((state & LINE_JOIN) !is 0) { + int join_style = 0; + switch (data.lineJoin) { + case SWT.JOIN_MITER: join_style = Cairo.CAIRO_LINE_JOIN_MITER; break; + case SWT.JOIN_ROUND: join_style = Cairo.CAIRO_LINE_JOIN_ROUND; break; + case SWT.JOIN_BEVEL: join_style = Cairo.CAIRO_LINE_JOIN_BEVEL; break; default: - } - Cairo.cairo_set_line_join(cairo, join_style); - } - if ((state & LINE_WIDTH) !is 0) { - Cairo.cairo_set_line_width(cairo, data.lineWidth is 0 ? 1 : data.lineWidth); - switch (data.lineStyle) { - case SWT.LINE_DOT: - case SWT.LINE_DASH: - case SWT.LINE_DASHDOT: - case SWT.LINE_DASHDOTDOT: - state |= LINE_STYLE; + } + Cairo.cairo_set_line_join(cairo, join_style); + } + if ((state & LINE_WIDTH) !is 0) { + Cairo.cairo_set_line_width(cairo, data.lineWidth is 0 ? 1 : data.lineWidth); + switch (data.lineStyle) { + case SWT.LINE_DOT: + case SWT.LINE_DASH: + case SWT.LINE_DASHDOT: + case SWT.LINE_DASHDOTDOT: + state |= LINE_STYLE; default: - } - } - if ((state & LINE_STYLE) !is 0) { - float dashesOffset = 0; - float[] dashes = null; - float width = data.lineWidth; - switch (data.lineStyle) { - case SWT.LINE_SOLID: break; - case SWT.LINE_DASH: dashes = width !is 0 ? LINE_DASH : LINE_DASH_ZERO; break; - case SWT.LINE_DOT: dashes = width !is 0 ? LINE_DOT : LINE_DOT_ZERO; break; - case SWT.LINE_DASHDOT: dashes = width !is 0 ? LINE_DASHDOT : LINE_DASHDOT_ZERO; break; - case SWT.LINE_DASHDOTDOT: dashes = width !is 0 ? LINE_DASHDOTDOT : LINE_DASHDOTDOT_ZERO; break; - case SWT.LINE_CUSTOM: dashes = data.lineDashes; break; + } + } + if ((state & LINE_STYLE) !is 0) { + float dashesOffset = 0; + float[] dashes = null; + float width = data.lineWidth; + switch (data.lineStyle) { + case SWT.LINE_SOLID: break; + case SWT.LINE_DASH: dashes = width !is 0 ? LINE_DASH : LINE_DASH_ZERO; break; + case SWT.LINE_DOT: dashes = width !is 0 ? LINE_DOT : LINE_DOT_ZERO; break; + case SWT.LINE_DASHDOT: dashes = width !is 0 ? LINE_DASHDOT : LINE_DASHDOT_ZERO; break; + case SWT.LINE_DASHDOTDOT: dashes = width !is 0 ? LINE_DASHDOTDOT : LINE_DASHDOTDOT_ZERO; break; + case SWT.LINE_CUSTOM: dashes = data.lineDashes; break; default: - } - if (dashes !is null) { - dashesOffset = data.lineDashesOffset; - double[] cairoDashes = new double[dashes.length]; - for (int i = 0; i < cairoDashes.length; i++) { - cairoDashes[i] = width is 0 || data.lineStyle is SWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width; - } - Cairo.cairo_set_dash(cairo, cairoDashes.ptr, cairoDashes.length, dashesOffset); - } else { - Cairo.cairo_set_dash(cairo, null, 0, 0); - } - } - if ((state & LINE_MITERLIMIT) !is 0) { - Cairo.cairo_set_miter_limit(cairo, data.lineMiterLimit); - } - if ((state & DRAW_OFFSET) !is 0) { - data.cairoXoffset = data.cairoYoffset = 0; - double[] matrix = new double[6]; - Cairo.cairo_get_matrix(cairo,cast(cairo_matrix_t*) matrix.ptr); - double scaling = matrix[0]; - if (scaling < 0) scaling = -scaling; - double strokeWidth = data.lineWidth * scaling; - if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { - data.cairoXoffset = 0.5 / scaling; - } - scaling = matrix[3]; - if (scaling < 0) scaling = -scaling; - strokeWidth = data.lineWidth * scaling; - if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { - data.cairoYoffset = 0.5 / scaling; - } - } - return; - } - if ((state & (BACKGROUND | FOREGROUND)) !is 0) { - GdkColor* foreground; - if ((state & FOREGROUND) !is 0) { - foreground = data.foreground; - data.state &= ~BACKGROUND; - } else { - foreground = data.background; - data.state &= ~FOREGROUND; - } - OS.gdk_gc_set_foreground(handle, foreground); - } - if ((state & BACKGROUND_BG) !is 0) { - GdkColor* background = data.background; - OS.gdk_gc_set_background(handle, background); - } - if ((state & FONT) !is 0) { - if (data.layout !is null) { - OS.pango_layout_set_font_description(data.layout, data.font); - } - } - if ((state & (LINE_CAP | LINE_JOIN | LINE_STYLE | LINE_WIDTH)) !is 0) { - int cap_style = 0; - int join_style = 0; - int width = cast(int)data.lineWidth; - int line_style = 0; - float[] dashes = null; - switch (data.lineCap) { - case SWT.CAP_ROUND: cap_style = OS.GDK_CAP_ROUND; break; - case SWT.CAP_FLAT: cap_style = OS.GDK_CAP_BUTT; break; - case SWT.CAP_SQUARE: cap_style = OS.GDK_CAP_PROJECTING; break; + } + if (dashes !is null) { + dashesOffset = data.lineDashesOffset; + double[] cairoDashes = new double[dashes.length]; + for (int i = 0; i < cairoDashes.length; i++) { + cairoDashes[i] = width is 0 || data.lineStyle is SWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width; + } + Cairo.cairo_set_dash(cairo, cairoDashes.ptr, cairoDashes.length, dashesOffset); + } else { + Cairo.cairo_set_dash(cairo, null, 0, 0); + } + } + if ((state & LINE_MITERLIMIT) !is 0) { + Cairo.cairo_set_miter_limit(cairo, data.lineMiterLimit); + } + if ((state & DRAW_OFFSET) !is 0) { + data.cairoXoffset = data.cairoYoffset = 0; + double[] matrix = new double[6]; + Cairo.cairo_get_matrix(cairo,cast(cairo_matrix_t*) matrix.ptr); + double scaling = matrix[0]; + if (scaling < 0) scaling = -scaling; + double strokeWidth = data.lineWidth * scaling; + if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { + data.cairoXoffset = 0.5 / scaling; + } + scaling = matrix[3]; + if (scaling < 0) scaling = -scaling; + strokeWidth = data.lineWidth * scaling; + if (strokeWidth is 0 || (cast(int)strokeWidth % 2) is 1) { + data.cairoYoffset = 0.5 / scaling; + } + } + return; + } + if ((state & (BACKGROUND | FOREGROUND)) !is 0) { + GdkColor* foreground; + if ((state & FOREGROUND) !is 0) { + foreground = data.foreground; + data.state &= ~BACKGROUND; + } else { + foreground = data.background; + data.state &= ~FOREGROUND; + } + OS.gdk_gc_set_foreground(handle, foreground); + } + if ((state & BACKGROUND_BG) !is 0) { + GdkColor* background = data.background; + OS.gdk_gc_set_background(handle, background); + } + if ((state & FONT) !is 0) { + if (data.layout !is null) { + OS.pango_layout_set_font_description(data.layout, data.font); + } + } + if ((state & (LINE_CAP | LINE_JOIN | LINE_STYLE | LINE_WIDTH)) !is 0) { + int cap_style = 0; + int join_style = 0; + int width = cast(int)data.lineWidth; + int line_style = 0; + float[] dashes = null; + switch (data.lineCap) { + case SWT.CAP_ROUND: cap_style = OS.GDK_CAP_ROUND; break; + case SWT.CAP_FLAT: cap_style = OS.GDK_CAP_BUTT; break; + case SWT.CAP_SQUARE: cap_style = OS.GDK_CAP_PROJECTING; break; default: - } - switch (data.lineJoin) { - case SWT.JOIN_ROUND: join_style = OS.GDK_JOIN_ROUND; break; - case SWT.JOIN_MITER: join_style = OS.GDK_JOIN_MITER; break; - case SWT.JOIN_BEVEL: join_style = OS.GDK_JOIN_BEVEL; break; + } + switch (data.lineJoin) { + case SWT.JOIN_ROUND: join_style = OS.GDK_JOIN_ROUND; break; + case SWT.JOIN_MITER: join_style = OS.GDK_JOIN_MITER; break; + case SWT.JOIN_BEVEL: join_style = OS.GDK_JOIN_BEVEL; break; default: - } - switch (data.lineStyle) { - case SWT.LINE_SOLID: break; - case SWT.LINE_DASH: dashes = width !is 0 ? LINE_DASH : LINE_DASH_ZERO; break; - case SWT.LINE_DOT: dashes = width !is 0 ? LINE_DOT : LINE_DOT_ZERO; break; - case SWT.LINE_DASHDOT: dashes = width !is 0 ? LINE_DASHDOT : LINE_DASHDOT_ZERO; break; - case SWT.LINE_DASHDOTDOT: dashes = width !is 0 ? LINE_DASHDOTDOT : LINE_DASHDOTDOT_ZERO; break; - case SWT.LINE_CUSTOM: dashes = data.lineDashes; break; + } + switch (data.lineStyle) { + case SWT.LINE_SOLID: break; + case SWT.LINE_DASH: dashes = width !is 0 ? LINE_DASH : LINE_DASH_ZERO; break; + case SWT.LINE_DOT: dashes = width !is 0 ? LINE_DOT : LINE_DOT_ZERO; break; + case SWT.LINE_DASHDOT: dashes = width !is 0 ? LINE_DASHDOT : LINE_DASHDOT_ZERO; break; + case SWT.LINE_DASHDOTDOT: dashes = width !is 0 ? LINE_DASHDOTDOT : LINE_DASHDOTDOT_ZERO; break; + case SWT.LINE_CUSTOM: dashes = data.lineDashes; break; default: - } - if (dashes !is null) { - if ((state & LINE_STYLE) !is 0) { - char[] dash_list = new char[dashes.length]; - for (int i = 0; i < dash_list.length; i++) { - dash_list[i] = cast(char)(width is 0 || data.lineStyle is SWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width); - } - OS.gdk_gc_set_dashes(handle, 0, dash_list.ptr, dash_list.length); - } - line_style = OS.GDK_LINE_ON_OFF_DASH; - } else { - line_style = OS.GDK_LINE_SOLID; - } - OS.gdk_gc_set_line_attributes(handle, width, line_style, cap_style, join_style); - } + } + if (dashes !is null) { + if ((state & LINE_STYLE) !is 0) { + char[] dash_list = new char[dashes.length]; + for (int i = 0; i < dash_list.length; i++) { + dash_list[i] = cast(char)(width is 0 || data.lineStyle is SWT.LINE_CUSTOM ? dashes[i] : dashes[i] * width); + } + OS.gdk_gc_set_dashes(handle, 0, dash_list.ptr, dash_list.length); + } + line_style = OS.GDK_LINE_ON_OFF_DASH; + } else { + line_style = OS.GDK_LINE_SOLID; + } + OS.gdk_gc_set_line_attributes(handle, width, line_style, cap_style, join_style); + } } GdkRegion* convertRgn(GdkRegion* rgn, double[] matrix) { - auto newRgn = OS.gdk_region_new(); - int nRects; - GdkRectangle* rects; - OS.gdk_region_get_rectangles(rgn, &rects, &nRects); - GdkRectangle* rect = new GdkRectangle(); - int[] pointArray = new int[8]; - double x, y; - for (int i=0; itrue
when the GC is disposed and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
bool isIdentity(double[] matrix) {
- if (matrix is null) return true;
- return matrix[0] is 1 && matrix[1] is 0 && matrix[2] is 0 && matrix[3] is 1 && matrix[4] is 0 && matrix[5] is 0;
+ if (matrix is null) return true;
+ return matrix[0] is 1 && matrix[1] is 0 && matrix[2] is 0 && matrix[3] is 1 && matrix[4] is 0 && matrix[5] is 0;
}
/**
@@ -2932,22 +2932,22 @@
* @since 3.1
*/
public void setAdvanced(bool advanced) {
- if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (advanced && data.cairo !is null) return;
- if (advanced) {
- try {
- initCairo();
- } catch (SWTException e) {}
- } else {
- if (!data.disposeCairo) return;
- auto cairo = data.cairo;
- if (cairo !is null) Cairo.cairo_destroy(cairo);
- data.cairo = null;
- data.interpolation = SWT.DEFAULT;
- data.backgroundPattern = data.foregroundPattern = null;
- data.state = 0;
- setClipping(cast(GdkRegion*)null);
- }
+ if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (advanced && data.cairo !is null) return;
+ if (advanced) {
+ try {
+ initCairo();
+ } catch (SWTException e) {}
+ } else {
+ if (!data.disposeCairo) return;
+ auto cairo = data.cairo;
+ if (cairo !is null) Cairo.cairo_destroy(cairo);
+ data.cairo = null;
+ data.interpolation = SWT.DEFAULT;
+ data.backgroundPattern = data.foregroundPattern = null;
+ data.state = 0;
+ setClipping(cast(GdkRegion*)null);
+ }
}
/**
@@ -2970,11 +2970,11 @@
* @since 3.1
*/
public void setAlpha(int alpha) {
- if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data.cairo is null && (alpha & 0xff) is 0xff) return;
- initCairo();
- data.alpha = alpha & 0xff;
- data.state &= ~(BACKGROUND | FOREGROUND | BACKGROUND_BG);
+ if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (data.cairo is null && (alpha & 0xff) is 0xff) return;
+ initCairo();
+ data.alpha = alpha & 0xff;
+ data.state &= ~(BACKGROUND | FOREGROUND | BACKGROUND_BG);
}
/**
@@ -3006,17 +3006,17 @@
* @since 3.1
*/
public void setAntialias(int antialias) {
- if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (data.cairo is null && antialias is SWT.DEFAULT) return;
- int mode = 0;
- switch (antialias) {
- case SWT.DEFAULT: mode = Cairo.CAIRO_ANTIALIAS_DEFAULT; break;
- case SWT.OFF: mode = Cairo.CAIRO_ANTIALIAS_NONE; break;
- case SWT.ON: mode = Cairo.CAIRO_ANTIALIAS_GRAY;
+ if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (data.cairo is null && antialias is SWT.DEFAULT) return;
+ int mode = 0;
+ switch (antialias) {
+ case SWT.DEFAULT: mode = Cairo.CAIRO_ANTIALIAS_DEFAULT; break;
+ case SWT.OFF: mode = Cairo.CAIRO_ANTIALIAS_NONE; break;
+ case SWT.ON: mode = Cairo.CAIRO_ANTIALIAS_GRAY;
break;
- default:
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
+ default:
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
initCairo();
auto cairo = data.cairo;
Cairo.cairo_set_antialias(cairo, mode);
@@ -3038,12 +3038,12 @@
*
*/
public void setBackground(Color color) {
- if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- data.background = color.handle;
- data.backgroundPattern = null;
- data.state &= ~(BACKGROUND | BACKGROUND_BG);
+ if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (color is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ data.background = color.handle;
+ data.backgroundPattern = null;
+ data.state &= ~(BACKGROUND | BACKGROUND_BG);
}
/**
@@ -3071,97 +3071,97 @@
* @since 3.1
*/
public void setBackgroundPattern(Pattern pattern) {
- if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pattern !is null && pattern.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (data.cairo is null && pattern is null) return;
- initCairo();
- if (data.backgroundPattern is pattern) return;
- data.backgroundPattern = pattern;
- data.state &= ~BACKGROUND;
+ if (handle is null) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pattern !is null && pattern.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (data.cairo is null && pattern is null) return;
+ initCairo();
+ if (data.backgroundPattern is pattern) return;
+ data.backgroundPattern = pattern;
+ data.state &= ~BACKGROUND;
}
static void setCairoFont(cairo_t* cairo, Font font) {
- setCairoFont(cairo, font.handle);
+ setCairoFont(cairo, font.handle);
}
static void setCairoFont(cairo_t* cairo, PangoFontDescription* font) {
- auto family = OS.pango_font_description_get_family(font);
- int len = /*OS.*/strlen(family);
- char[] buffer = new char[len + 1];
- memmove(buffer.ptr, family, len);
- //TODO - convert font height from pango to cairo
- double height = OS.PANGO_PIXELS(OS.pango_font_description_get_size(font)) * 96 / 72;
- int pangoStyle = OS.pango_font_description_get_style(font);
- int pangoWeight = OS.pango_font_description_get_weight(font);
- int slant = Cairo.CAIRO_FONT_SLANT_NORMAL;
- if (pangoStyle is OS.PANGO_STYLE_ITALIC) slant = Cairo.CAIRO_FONT_SLANT_ITALIC;
- if (pangoStyle is OS.PANGO_STYLE_OBLIQUE) slant = Cairo.CAIRO_FONT_SLANT_OBLIQUE;
- int weight = Cairo.CAIRO_FONT_WEIGHT_NORMAL;
- if (pangoWeight is OS.PANGO_WEIGHT_BOLD) weight = Cairo.CAIRO_FONT_WEIGHT_BOLD;
- Cairo.cairo_select_font_face(cairo, buffer.ptr, slant, weight);
- Cairo.cairo_set_font_size(cairo, height);
+ auto family = OS.pango_font_description_get_family(font);
+ int len = /*OS.*/strlen(family);
+ char[] buffer = new char[len + 1];
+ memmove(buffer.ptr, family, len);
+ //TODO - convert font height from pango to cairo
+ double height = OS.PANGO_PIXELS(OS.pango_font_description_get_size(font)) * 96 / 72;
+ int pangoStyle = OS.pango_font_description_get_style(font);
+ int pangoWeight = OS.pango_font_description_get_weight(font);
+ int slant = Cairo.CAIRO_FONT_SLANT_NORMAL;
+ if (pangoStyle is OS.PANGO_STYLE_ITALIC) slant = Cairo.CAIRO_FONT_SLANT_ITALIC;
+ if (pangoStyle is OS.PANGO_STYLE_OBLIQUE) slant = Cairo.CAIRO_FONT_SLANT_OBLIQUE;
+ int weight = Cairo.CAIRO_FONT_WEIGHT_NORMAL;
+ if (pangoWeight is OS.PANGO_WEIGHT_BOLD) weight = Cairo.CAIRO_FONT_WEIGHT_BOLD;
+ Cairo.cairo_select_font_face(cairo, buffer.ptr, slant, weight);
+ Cairo.cairo_set_font_size(cairo, height);
}
static void setCairoClip(cairo_t* cairo, GdkRegion* clipRgn) {
- Cairo.cairo_reset_clip(cairo);
- if (clipRgn is null) return;
- if (OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- OS.gdk_cairo_region(cairo, clipRgn);
- } else {
- int nRects;
- GdkRectangle * rects;
- OS.gdk_region_get_rectangles(clipRgn, &rects, &nRects);
- GdkRectangle* rect = new GdkRectangle();
- for (int i=0; iGlyphMetrics
*/
public override char[] toString () {
- return Format( "GlyphMetrics {{{}, {}, {}}", ascent, descent, width ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ return Format( "GlyphMetrics {{{}, {}, {}}", ascent, descent, width ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Image.d
--- a/dwt/graphics/Image.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Image.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -89,79 +89,79 @@
*/
public final class Image : Resource, Drawable {
- /**
- * specifies whether the receiver is a bitmap or an icon
- * (one of SWT.BITMAP
, SWT.ICON
)
- * - * 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 type; + /** + * specifies whether the receiver is a bitmap or an icon + * (one ofSWT.BITMAP
, SWT.ICON
)
+ * + * 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 type; - /** - * The handle to the OS pixmap resource. - * (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 GdkDrawable* pixmap; + /** + * The handle to the OS pixmap resource. + * (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 GdkDrawable* pixmap; - /** - * The handle to the OS mask resource. - * (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 GdkDrawable* mask; + /** + * The handle to the OS mask resource. + * (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 GdkDrawable* mask; - cairo_surface_t* surface; + cairo_surface_t* surface; cairo_surface_t* surfaceData; - /** - * specifies the transparent pixel - */ - int transparentPixel = -1; + /** + * specifies the transparent pixel + */ + int transparentPixel = -1; - /** - * The GC the image is currently selected in. - */ - GC memGC; + /** + * The GC the image is currently selected in. + */ + GC memGC; - /** - * The alpha data of the image. - */ - byte[] alphaData; + /** + * The alpha data of the image. + */ + byte[] alphaData; - /** - * The global alpha value to be used for every pixel. - */ - int alpha = -1; + /** + * The global alpha value to be used for every pixel. + */ + int alpha = -1; - /** - * The width of the image. - */ - int width = -1; + /** + * The width of the image. + */ + int width = -1; - /** - * The height of the image. - */ - int height = -1; + /** + * The height of the image. + */ + int height = -1; - /** - * Specifies the default scanline padding. - */ - static const int DEFAULT_SCANLINE_PAD = 4; + /** + * Specifies the default scanline padding. + */ + static const int DEFAULT_SCANLINE_PAD = 4; this() { } @@ -197,10 +197,10 @@ * */ public this(Device device, int width, int height) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - init(device, width, height); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + init(device, width, height); + if (device.tracking) device.new_Object(this); } /** @@ -235,136 +235,136 @@ * */ public this(Device device, Image srcImage, int flag) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (srcImage is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - switch (flag) { - case SWT.IMAGE_COPY: - case SWT.IMAGE_DISABLE: - case SWT.IMAGE_GRAY: - break; - default: - SWT.error(SWT.ERROR_INVALID_ARGUMENT); - } - this.device = device; - this.type = srcImage.type; + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (srcImage is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (srcImage.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + switch (flag) { + case SWT.IMAGE_COPY: + case SWT.IMAGE_DISABLE: + case SWT.IMAGE_GRAY: + break; + default: + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + this.device = device; + this.type = srcImage.type; - /* Get source image size */ - int w, h; - OS.gdk_drawable_get_size(srcImage.pixmap, &w, &h); - int width = w; - int height = h; + /* Get source image size */ + int w, h; + OS.gdk_drawable_get_size(srcImage.pixmap, &w, &h); + int width = w; + int height = h; - /* Copy the mask */ - if ((srcImage.type == SWT.ICON && srcImage.mask !is null ) || srcImage.transparentPixel != -1) { - /* Generate the mask if necessary. */ - if (srcImage.transparentPixel != -1) srcImage.createMask(); + /* Copy the mask */ + if ((srcImage.type == SWT.ICON && srcImage.mask !is null ) || srcImage.transparentPixel != -1) { + /* Generate the mask if necessary. */ + if (srcImage.transparentPixel != -1) srcImage.createMask(); //PORTING_FIXME cast - GdkDrawable* mask = cast(GdkDrawable*) OS.gdk_pixmap_new( null, width, height, 1); - if (mask is null ) SWT.error(SWT.ERROR_NO_HANDLES); - auto gdkGC = OS.gdk_gc_new(mask); - if (gdkGC is null) SWT.error(SWT.ERROR_NO_HANDLES); - OS.gdk_draw_drawable(mask, gdkGC, srcImage.mask, 0, 0, 0, 0, width, height); - OS.g_object_unref(gdkGC); - this.mask = mask; - /* Destroy the image mask if the there is a GC created on the image */ - if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask(); - } + GdkDrawable* mask = cast(GdkDrawable*) OS.gdk_pixmap_new( null, width, height, 1); + if (mask is null ) SWT.error(SWT.ERROR_NO_HANDLES); + auto gdkGC = OS.gdk_gc_new(mask); + if (gdkGC is null) SWT.error(SWT.ERROR_NO_HANDLES); + OS.gdk_draw_drawable(mask, gdkGC, srcImage.mask, 0, 0, 0, 0, width, height); + OS.g_object_unref(gdkGC); + this.mask = mask; + /* Destroy the image mask if the there is a GC created on the image */ + if (srcImage.transparentPixel != -1 && srcImage.memGC != null) srcImage.destroyMask(); + } - /* Copy transparent pixel and alpha data */ - if (flag != SWT.IMAGE_DISABLE) transparentPixel = srcImage.transparentPixel; - alpha = srcImage.alpha; - if (srcImage.alphaData != null) { + /* Copy transparent pixel and alpha data */ + if (flag != SWT.IMAGE_DISABLE) transparentPixel = srcImage.transparentPixel; + alpha = srcImage.alpha; + if (srcImage.alphaData != null) { alphaData = new byte[srcImage.alphaData.length]; System.arraycopy(srcImage.alphaData, 0, alphaData, 0, alphaData.length); - } - createAlphaMask(width, height); + } + createAlphaMask(width, height); - /* Create the new pixmap */ - auto pixmap = cast(GdkDrawable*) OS.gdk_pixmap_new (cast(GdkDrawable*)OS.GDK_ROOT_PARENT(), width, height, -1); - if (pixmap is null) SWT.error(SWT.ERROR_NO_HANDLES); - auto gdkGC = OS.gdk_gc_new(pixmap); - if (gdkGC is null) SWT.error(SWT.ERROR_NO_HANDLES); - this.pixmap = pixmap; + /* Create the new pixmap */ + auto pixmap = cast(GdkDrawable*) OS.gdk_pixmap_new (cast(GdkDrawable*)OS.GDK_ROOT_PARENT(), width, height, -1); + if (pixmap is null) SWT.error(SWT.ERROR_NO_HANDLES); + auto gdkGC = OS.gdk_gc_new(pixmap); + if (gdkGC is null) SWT.error(SWT.ERROR_NO_HANDLES); + this.pixmap = pixmap; - if (flag == SWT.IMAGE_COPY) { - OS.gdk_draw_drawable(pixmap, gdkGC, srcImage.pixmap, 0, 0, 0, 0, width, height); - OS.g_object_unref(gdkGC); - if (device.tracking) device.new_Object(this); - return; - } + if (flag == SWT.IMAGE_COPY) { + OS.gdk_draw_drawable(pixmap, gdkGC, srcImage.pixmap, 0, 0, 0, 0, width, height); + OS.g_object_unref(gdkGC); + if (device.tracking) device.new_Object(this); + return; + } - /* Retrieve the source pixmap data */ - auto pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); - if (pixbuf is null) SWT.error(SWT.ERROR_NO_HANDLES); - auto colormap = OS.gdk_colormap_get_system(); - OS.gdk_pixbuf_get_from_drawable(pixbuf, srcImage.pixmap, colormap, 0, 0, 0, 0, width, height); - int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); - auto pixels = OS.gdk_pixbuf_get_pixels(pixbuf); + /* Retrieve the source pixmap data */ + auto pixbuf = OS.gdk_pixbuf_new(OS.GDK_COLORSPACE_RGB, false, 8, width, height); + if (pixbuf is null) SWT.error(SWT.ERROR_NO_HANDLES); + auto colormap = OS.gdk_colormap_get_system(); + OS.gdk_pixbuf_get_from_drawable(pixbuf, srcImage.pixmap, colormap, 0, 0, 0, 0, width, height); + int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); + auto pixels = OS.gdk_pixbuf_get_pixels(pixbuf); - /* Apply transformation */ - switch (flag) { - case SWT.IMAGE_DISABLE: { - Color zeroColor = device.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); - RGB zeroRGB = zeroColor.getRGB(); - byte zeroRed = cast(byte)zeroRGB.red; - byte zeroGreen = cast(byte)zeroRGB.green; - byte zeroBlue = cast(byte)zeroRGB.blue; - Color oneColor = device.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); - RGB oneRGB = oneColor.getRGB(); - byte oneRed = cast(byte)oneRGB.red; - byte oneGreen = cast(byte)oneRGB.green; - byte oneBlue = cast(byte)oneRGB.blue; - byte[] line = new byte[stride]; - for (int y=0; ytrue
when the image is disposed and false
otherwise
*/
public bool isDisposed() {
- return pixmap is null;
+ return pixmap is null;
}
/**
@@ -1183,11 +1183,11 @@
*
*/
public void setBackground(Color color) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (color is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (transparentPixel == -1) return;
- //NOT DONE
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (color is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (transparentPixel == -1) return;
+ //NOT DONE
}
/**
@@ -1197,9 +1197,9 @@
* @return a string representation of the receiver
*/
public char[] toString () {
- if (isDisposed()) return "Image {*DISPOSED*}";
- return Format( "Image {{{}}", pixmap);
+ if (isDisposed()) return "Image {*DISPOSED*}";
+ return Format( "Image {{{}}", pixmap);
}
}
-}
\ No newline at end of file
+}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/ImageData.d
--- a/dwt/graphics/ImageData.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/ImageData.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -41,183 +41,183 @@
public final class ImageData : CloneableCompatibility {
- /**
- * The width of the image, in pixels.
- */
- public int width;
+ /**
+ * The width of the image, in pixels.
+ */
+ public int width;
- /**
- * The height of the image, in pixels.
- */
- public int height;
+ /**
+ * The height of the image, in pixels.
+ */
+ public int height;
- /**
- * The color depth of the image, in bits per pixel.
- * - * 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 color depth of the image, in bits per pixel. + *
+ * 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 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 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 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 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; + /** + * 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 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; + /** + * 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 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 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
IMAGE_BMP
IMAGE_BMP_RLE
IMAGE_GIF
IMAGE_ICO
IMAGE_JPEG
IMAGE_PNG
DM_UNSPECIFIED
DM_FILL_NONE
DM_FILL_BACKGROUND
DM_FILL_PREVIOUS
DM_UNSPECIFIED
DM_FILL_NONE
DM_FILL_BACKGROUND
DM_FILL_PREVIOUS
imageLoaderListeners
field.
*/
void reset() {
- data = null;
- logicalScreenWidth = 0;
- logicalScreenHeight = 0;
- backgroundPixel = -1;
- repeatCount = 1;
+ data = null;
+ logicalScreenWidth = 0;
+ logicalScreenHeight = 0;
+ backgroundPixel = -1;
+ repeatCount = 1;
}
/**
@@ -128,10 +128,10 @@
*
*/
public ImageData[] load(InputStream stream) {
- if (stream is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- reset();
- data = FileFormat.load(stream, this);
- return data;
+ if (stream is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ reset();
+ data = FileFormat.load(stream, this);
+ return data;
}
/**
@@ -153,8 +153,8 @@
*
*/
public ImageData[] load(char[] filename) {
- if (filename is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- InputStream stream = null;
+ if (filename is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ InputStream stream = null;
void close(){
try {
if( stream !is null ) stream.close();
@@ -162,15 +162,15 @@
// Ignore error
}
}
- try {
- stream = Compatibility.newFileInputStream(filename);
+ try {
+ stream = Compatibility.newFileInputStream(filename);
scope(exit) close();
- return load(stream);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return null;
+ return load(stream);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ return null;
}
/**
@@ -204,8 +204,8 @@
*
*/
public void save(OutputStream stream, int format) {
- if (stream is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- FileFormat.save(stream, format, this);
+ if (stream is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ FileFormat.save(stream, format, this);
}
/**
@@ -239,18 +239,18 @@
*
*/
public void save(char[] filename, int format) {
- if (filename is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- OutputStream stream = null;
- try {
- stream = Compatibility.newFileOutputStream(filename);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- save(stream, format);
- try {
- stream.close();
- } catch (IOException e) {
- }
+ if (filename is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ OutputStream stream = null;
+ try {
+ stream = Compatibility.newFileOutputStream(filename);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ save(stream, format);
+ try {
+ stream.close();
+ } catch (IOException e) {
+ }
}
/**
@@ -273,8 +273,8 @@
* @see ImageLoaderEvent
*/
public void addImageLoaderListener(ImageLoaderListener listener) {
- if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- imageLoaderListeners ~= listener;
+ if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ imageLoaderListeners ~= listener;
}
/**
@@ -290,8 +290,8 @@
* @see #addImageLoaderListener(ImageLoaderListener)
*/
public void removeImageLoaderListener(ImageLoaderListener listener) {
- if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
- if (imageLoaderListeners.length == 0 ) return;
+ if (listener is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ if (imageLoaderListeners.length == 0 ) return;
tango.core.Array.remove( imageLoaderListeners, listener, delegate bool(ImageLoaderListener l1, ImageLoaderListener l2 ){ return l1 is l2; });
}
@@ -305,7 +305,7 @@
* @see #removeImageLoaderListener(ImageLoaderListener)
*/
public bool hasListeners() {
- return imageLoaderListeners.length > 0;
+ return imageLoaderListeners.length > 0;
}
/**
@@ -315,10 +315,10 @@
* @param event the ImageLoaderEvent
to send to each ImageLoaderListener
*/
public void notifyListeners(ImageLoaderEvent event) {
- if (!hasListeners()) return;
+ if (!hasListeners()) return;
foreach( listener; imageLoaderListeners ){
- listener.imageDataLoaded(event);
- }
+ listener.imageDataLoaded(event);
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/ImageLoaderEvent.d
--- a/dwt/graphics/ImageLoaderEvent.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/ImageLoaderEvent.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -37,29 +37,29 @@
public class ImageLoaderEvent : SWTEventObject {
- /**
- * if the 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;
+ /**
+ * if the 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;
+ /**
+ * 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;
+ /**
+ * 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;
+ //static final long serialVersionUID = 3257284738325558065L;
/**
* Constructs a new instance of this class given the event source and
@@ -71,10 +71,10 @@
* @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;
+ super(source);
+ this.imageData = imageData;
+ this.incrementCount = incrementCount;
+ this.endOfImage = endOfImage;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/LineAttributes.d
--- a/dwt/graphics/LineAttributes.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/LineAttributes.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -28,55 +28,55 @@
*/
public class LineAttributes {
- /**
- * The line width.
- */
- public float width;
+ /**
+ * The line width.
+ */
+ public float width;
- /**
- * The line style.
- *
- * @see dwt.SWT#LINE_CUSTOM
- * @see dwt.SWT#LINE_DASH
- * @see dwt.SWT#LINE_DASHDOT
- * @see dwt.SWT#LINE_DASHDOTDOT
- * @see dwt.SWT#LINE_DOT
- * @see dwt.SWT#LINE_SOLID
- */
- public int style;
+ /**
+ * The line style.
+ *
+ * @see dwt.SWT#LINE_CUSTOM
+ * @see dwt.SWT#LINE_DASH
+ * @see dwt.SWT#LINE_DASHDOT
+ * @see dwt.SWT#LINE_DASHDOTDOT
+ * @see dwt.SWT#LINE_DOT
+ * @see dwt.SWT#LINE_SOLID
+ */
+ public int style;
- /**
- * The line cap style.
- *
- * @see dwt.SWT#CAP_FLAT
- * @see dwt.SWT#CAP_ROUND
- * @see dwt.SWT#CAP_SQUARE
- */
- public int cap;
+ /**
+ * The line cap style.
+ *
+ * @see dwt.SWT#CAP_FLAT
+ * @see dwt.SWT#CAP_ROUND
+ * @see dwt.SWT#CAP_SQUARE
+ */
+ public int cap;
- /**
- * The line join style.
- *
- * @see dwt.SWT#JOIN_BEVEL
- * @see dwt.SWT#JOIN_MITER
- * @see dwt.SWT#JOIN_ROUND
- */
- public int join;
+ /**
+ * The line join style.
+ *
+ * @see dwt.SWT#JOIN_BEVEL
+ * @see dwt.SWT#JOIN_MITER
+ * @see dwt.SWT#JOIN_ROUND
+ */
+ public int join;
- /**
- * The line dash style for SWT.LINE_CUSTOM.
- */
- public float[] dash;
+ /**
+ * The line dash style for SWT.LINE_CUSTOM.
+ */
+ public float[] dash;
- /**
- * The line dash style offset for SWT.LINE_CUSTOM.
- */
- public float dashOffset;
+ /**
+ * The line dash style offset for SWT.LINE_CUSTOM.
+ */
+ public float dashOffset;
- /**
- * The line miter limit.
- */
- public float miterLimit;
+ /**
+ * The line miter limit.
+ */
+ public float miterLimit;
/**
* Create a new line attributes with the specified line width.
@@ -84,7 +84,7 @@
* @param width the line width
*/
public this(float width) {
- this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10);
+ this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10);
}
/**
@@ -95,7 +95,7 @@
* @param join the line join style
*/
public this(float width, int cap, int join) {
- this(width, cap, join, SWT.LINE_SOLID, null, 0, 10);
+ this(width, cap, join, SWT.LINE_SOLID, null, 0, 10);
}
/**
@@ -110,12 +110,12 @@
* @param miterLimit the line miter limit
*/
public this(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) {
- this.width = width;
- this.cap = cap;
- this.join = join;
- this.style = style;
- this.dash = dash;
- this.dashOffset = dashOffset;
- this.miterLimit = miterLimit;
+ this.width = width;
+ this.cap = cap;
+ this.join = join;
+ this.style = style;
+ this.dash = dash;
+ this.dashOffset = dashOffset;
+ this.miterLimit = miterLimit;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/PaletteData.d
--- a/dwt/graphics/PaletteData.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/PaletteData.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -55,47 +55,47 @@
public final class PaletteData {
- /**
- * true if the receiver is a direct palette,
- * and false otherwise
- */
- public bool isDirect;
+ /**
+ * true if the receiver is a direct palette,
+ * and false otherwise
+ */
+ public bool isDirect;
- /**
- * the RGB values for an indexed palette, where the
- * indices of the array correspond to pixel values
- */
- public RGB[] colors;
+ /**
+ * the RGB values for an indexed palette, where the
+ * indices of the array correspond to pixel values
+ */
+ public RGB[] colors;
- /**
- * the red mask for a direct palette
- */
- public int redMask;
+ /**
+ * the red mask for a direct palette
+ */
+ public int redMask;
- /**
- * the green mask for a direct palette
- */
- public int greenMask;
+ /**
+ * the green mask for a direct palette
+ */
+ public int greenMask;
- /**
- * the blue mask for a direct palette
- */
- public int blueMask;
+ /**
+ * the blue mask for a direct palette
+ */
+ public int blueMask;
- /**
- * the red shift for a direct palette
- */
- public int redShift;
+ /**
+ * the red shift for a direct palette
+ */
+ public int redShift;
- /**
- * the green shift for a direct palette
- */
- public int greenShift;
+ /**
+ * the green shift for a direct palette
+ */
+ public int greenShift;
- /**
- * the blue shift for a direct palette
- */
- public int blueShift;
+ /**
+ * the blue shift for a direct palette
+ */
+ public int blueShift;
/**
* Constructs a new indexed palette given an array of RGB values.
@@ -107,9 +107,9 @@
*
*/
public this(RGB[] colors) {
- if (colors == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.colors = colors;
- this.isDirect = false;
+ if (colors == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.colors = colors;
+ this.isDirect = false;
}
/**
@@ -120,13 +120,13 @@
* @param blueMask the blue mask
*/
public this(int redMask, int greenMask, int blueMask) {
- this.redMask = redMask;
- this.greenMask = greenMask;
- this.blueMask = blueMask;
- this.isDirect = true;
- this.redShift = shiftForMask(redMask);
- this.greenShift = shiftForMask(greenMask);
- this.blueShift = shiftForMask(blueMask);
+ this.redMask = redMask;
+ this.greenMask = greenMask;
+ this.blueMask = blueMask;
+ this.isDirect = true;
+ this.redShift = shiftForMask(redMask);
+ this.greenShift = shiftForMask(greenMask);
+ this.blueShift = shiftForMask(blueMask);
}
/**
@@ -141,21 +141,21 @@
*
*/
public int getPixel(RGB rgb) {
- if (rgb is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (isDirect) {
- int pixel = 0;
- pixel |= (redShift < 0 ? rgb.red << -redShift : rgb.red >>> redShift) & redMask;
- pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
- pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
- return pixel;
- } else {
- for (int i = 0; i < colors.length; i++) {
- if (colors[i] == rgb ) return i;
- }
- /* The RGB did not exist in the palette */
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- return 0;
- }
+ if (rgb is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (isDirect) {
+ int pixel = 0;
+ pixel |= (redShift < 0 ? rgb.red << -redShift : rgb.red >>> redShift) & redMask;
+ pixel |= (greenShift < 0 ? rgb.green << -greenShift : rgb.green >>> greenShift) & greenMask;
+ pixel |= (blueShift < 0 ? rgb.blue << -blueShift : rgb.blue >>> blueShift) & blueMask;
+ return pixel;
+ } else {
+ for (int i = 0; i < colors.length; i++) {
+ if (colors[i] == rgb ) return i;
+ }
+ /* The RGB did not exist in the palette */
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ return 0;
+ }
}
/**
@@ -170,20 +170,20 @@
*
*/
public RGB getRGB(int pixel) {
- if (isDirect) {
- int r = pixel & redMask;
- r = (redShift < 0) ? r >>> -redShift : r << redShift;
- int g = pixel & greenMask;
- g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;
- int b = pixel & blueMask;
- b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
- return new RGB(r, g, b);
- } else {
- if (pixel < 0 || pixel >= colors.length) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- return colors[pixel];
- }
+ if (isDirect) {
+ int r = pixel & redMask;
+ r = (redShift < 0) ? r >>> -redShift : r << redShift;
+ int g = pixel & greenMask;
+ g = (greenShift < 0) ? g >>> -greenShift : g << greenShift;
+ int b = pixel & blueMask;
+ b = (blueShift < 0) ? b >>> -blueShift : b << blueShift;
+ return new RGB(r, g, b);
+ } else {
+ if (pixel < 0 || pixel >= colors.length) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ return colors[pixel];
+ }
}
/**
@@ -193,7 +193,7 @@
* @return the RGB
s for the receiver or null
*/
public RGB[] getRGBs() {
- return colors;
+ return colors;
}
/**
@@ -205,10 +205,10 @@
* @see PaletteData
*/
int shiftForMask(int mask) {
- for (int i = 31; i >= 0; i--) {
- if (((mask >> i) & 0x1) != 0) return 7 - i;
- }
- return 32;
+ for (int i = 31; i >= 0; i--) {
+ if (((mask >> i) & 0x1) != 0) return 7 - i;
+ }
+ return 32;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Path.d
--- a/dwt/graphics/Path.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Path.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -42,19 +42,19 @@
*/
public class Path : Resource {
- /**
- * the OS resource for the Path
- * (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 cairo_t* handle; + /** + * the OS resource for the Path + * (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 cairo_t* handle; - bool moved, closed = true; + bool moved, closed = true; /** * Constructs a new empty Path. @@ -79,16 +79,16 @@ * @see #dispose() */ public this (Device device) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = device; - device.checkCairo(); - auto surface = Cairo.cairo_image_surface_create(Cairo.CAIRO_FORMAT_ARGB32, 1, 1); - if (surface is null) SWT.error(SWT.ERROR_NO_HANDLES); - handle = Cairo.cairo_create(surface); - Cairo.cairo_surface_destroy(surface); - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = device; + device.checkCairo(); + auto surface = Cairo.cairo_image_surface_create(Cairo.CAIRO_FORMAT_ARGB32, 1, 1); + if (surface is null) SWT.error(SWT.ERROR_NO_HANDLES); + handle = Cairo.cairo_create(surface); + Cairo.cairo_surface_destroy(surface); + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + if (device.tracking) device.new_Object(this); } /** @@ -121,31 +121,31 @@ * */ public void addArc(float x, float y, float width, float height, float startAngle, float arcAngle) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - moved = true; - if (width == height) { - float angle = -startAngle * cast(float)Compatibility.PI / 180; - if (closed) Cairo.cairo_move_to(handle, (x + width / 2f) + width / 2f * Math.cos(angle), (y + height / 2f) + height / 2f * Math.sin(angle)); - if (arcAngle >= 0) { - Cairo.cairo_arc_negative(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); - } else { - Cairo.cairo_arc(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); - } - } else { - Cairo.cairo_save(handle); - Cairo.cairo_translate(handle, x + width / 2f, y + height / 2f); - Cairo.cairo_scale(handle, width / 2f, height / 2f); - float angle = -startAngle * cast(float)Compatibility.PI / 180; - if (closed) Cairo.cairo_move_to(handle, Math.cos(angle), Math.sin(angle)); - if (arcAngle >= 0) { - Cairo.cairo_arc_negative(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); - } else { - Cairo.cairo_arc(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); - } - Cairo.cairo_restore(handle); - } - closed = false; - if (Math.abs(arcAngle) >= 360) close(); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + moved = true; + if (width == height) { + float angle = -startAngle * cast(float)Compatibility.PI / 180; + if (closed) Cairo.cairo_move_to(handle, (x + width / 2f) + width / 2f * Math.cos(angle), (y + height / 2f) + height / 2f * Math.sin(angle)); + if (arcAngle >= 0) { + Cairo.cairo_arc_negative(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); + } else { + Cairo.cairo_arc(handle, x + width / 2f, y + height / 2f, width / 2f, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); + } + } else { + Cairo.cairo_save(handle); + Cairo.cairo_translate(handle, x + width / 2f, y + height / 2f); + Cairo.cairo_scale(handle, width / 2f, height / 2f); + float angle = -startAngle * cast(float)Compatibility.PI / 180; + if (closed) Cairo.cairo_move_to(handle, Math.cos(angle), Math.sin(angle)); + if (arcAngle >= 0) { + Cairo.cairo_arc_negative(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); + } else { + Cairo.cairo_arc(handle, 0, 0, 1, angle, -(startAngle + arcAngle) * cast(float)Compatibility.PI / 180); + } + Cairo.cairo_restore(handle); + } + closed = false; + if (Math.abs(arcAngle) >= 360) close(); } /** @@ -162,15 +162,15 @@ * */ public void addPath(Path path) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (path is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (path.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - moved = false; - auto copy = Cairo.cairo_copy_path(path.handle); - if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_append_path(handle, copy); - Cairo.cairo_path_destroy(copy); - closed = path.closed; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (path is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (path.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + moved = false; + auto copy = Cairo.cairo_copy_path(path.handle); + if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); + Cairo.cairo_append_path(handle, copy); + Cairo.cairo_path_destroy(copy); + closed = path.closed; } /** @@ -186,10 +186,10 @@ * */ public void addRectangle(float x, float y, float width, float height) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - moved = false; - Cairo.cairo_rectangle(handle, x, y, width, height); - closed = true; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + moved = false; + Cairo.cairo_rectangle(handle, x, y, width, height); + closed = true; } /** @@ -210,12 +210,12 @@ * */ public void addString(char[] str, float x, float y, Font font) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - moved = false; - GC.addCairoString(handle, str, x, y, font); - closed = true; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (font == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + moved = false; + GC.addCairoString(handle, str, x, y, font); + closed = true; } /** @@ -228,10 +228,10 @@ * */ public void close() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - Cairo.cairo_close_path(handle); - moved = false; - closed = true; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + Cairo.cairo_close_path(handle); + moved = false; + closed = true; } /** @@ -258,25 +258,25 @@ * */ public bool contains(float x, float y, GC gc, bool outline) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - //TODO - see Windows - gc.initCairo(); - gc.checkGC(GC.LINE_CAP | GC.LINE_JOIN | GC.LINE_STYLE | GC.LINE_WIDTH); - bool result = false; - auto cairo = gc.data.cairo; - auto copy = Cairo.cairo_copy_path(handle); - if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_append_path(cairo, copy); - Cairo.cairo_path_destroy(copy); - if (outline) { - result = Cairo.cairo_in_stroke(cairo, x, y) != 0; - } else { - result = Cairo.cairo_in_fill(cairo, x, y) != 0; - } - Cairo.cairo_new_path(cairo); - return result; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (gc == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + //TODO - see Windows + gc.initCairo(); + gc.checkGC(GC.LINE_CAP | GC.LINE_JOIN | GC.LINE_STYLE | GC.LINE_WIDTH); + bool result = false; + auto cairo = gc.data.cairo; + auto copy = Cairo.cairo_copy_path(handle); + if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); + Cairo.cairo_append_path(cairo, copy); + Cairo.cairo_path_destroy(copy); + if (outline) { + result = Cairo.cairo_in_stroke(cairo, x, y) != 0; + } else { + result = Cairo.cairo_in_fill(cairo, x, y) != 0; + } + Cairo.cairo_new_path(cairo); + return result; } /** @@ -294,15 +294,15 @@ * */ public void cubicTo(float cx1, float cy1, float cx2, float cy2, float x, float y) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (!moved) { - double currentX, currentY; - Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); - Cairo.cairo_move_to(handle, currentX, currentY); - moved = true; - } - Cairo.cairo_curve_to(handle, cx1, cy1, cx2, cy2, x, y); - closed = false; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (!moved) { + double currentX, currentY; + Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); + Cairo.cairo_move_to(handle, currentX, currentY); + moved = true; + } + Cairo.cairo_curve_to(handle, cx1, cy1, cx2, cy2, x, y); + closed = false; } /** @@ -321,35 +321,35 @@ * */ public void getBounds(float[] bounds) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (bounds.length < 4) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - auto copy = Cairo.cairo_copy_path(handle); - if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); - cairo_path_t* path = new cairo_path_t(); - memmove(path, copy, cairo_path_t.sizeof); - double minX = 0, minY = 0, maxX = 0, maxY = 0; - if (path.num_data > 0) { - minX = minY = double.max; - maxX = maxY = -double.max; - int i = 0; - cairo_path_data_t* data = new cairo_path_data_t(); - while (i < path.num_data) { - *data = path.data[i]; - switch (data.header.type) { - case Cairo.CAIRO_PATH_MOVE_TO: - minX = Math.min(minX, path.data[i+1].point.x); - minY = Math.min(minY, path.data[i+1].point.y); - maxX = Math.max(maxX, path.data[i+1].point.x); - maxY = Math.max(maxY, path.data[i+1].point.y); - break; - case Cairo.CAIRO_PATH_LINE_TO: + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (bounds == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (bounds.length < 4) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + auto copy = Cairo.cairo_copy_path(handle); + if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); + cairo_path_t* path = new cairo_path_t(); + memmove(path, copy, cairo_path_t.sizeof); + double minX = 0, minY = 0, maxX = 0, maxY = 0; + if (path.num_data > 0) { + minX = minY = double.max; + maxX = maxY = -double.max; + int i = 0; + cairo_path_data_t* data = new cairo_path_data_t(); + while (i < path.num_data) { + *data = path.data[i]; + switch (data.header.type) { + case Cairo.CAIRO_PATH_MOVE_TO: minX = Math.min(minX, path.data[i+1].point.x); minY = Math.min(minY, path.data[i+1].point.y); maxX = Math.max(maxX, path.data[i+1].point.x); maxY = Math.max(maxY, path.data[i+1].point.y); - break; - case Cairo.CAIRO_PATH_CURVE_TO: + break; + case Cairo.CAIRO_PATH_LINE_TO: + minX = Math.min(minX, path.data[i+1].point.x); + minY = Math.min(minY, path.data[i+1].point.y); + maxX = Math.max(maxX, path.data[i+1].point.x); + maxY = Math.max(maxY, path.data[i+1].point.y); + break; + case Cairo.CAIRO_PATH_CURVE_TO: minX = Math.min(minX, path.data[i+1].point.x); minY = Math.min(minY, path.data[i+1].point.y); maxX = Math.max(maxX, path.data[i+1].point.x); @@ -362,18 +362,18 @@ minY = Math.min(minY, path.data[i+3].point.y); maxX = Math.max(maxX, path.data[i+3].point.x); maxY = Math.max(maxY, path.data[i+3].point.y); - break; - case Cairo.CAIRO_PATH_CLOSE_PATH: break; + break; + case Cairo.CAIRO_PATH_CLOSE_PATH: break; default: - } - i += data.header.length; - } - } - bounds[0] = cast(float)minX; - bounds[1] = cast(float)minY; - bounds[2] = cast(float)(maxX - minX); - bounds[3] = cast(float)(maxY - minY); - Cairo.cairo_path_destroy(copy); + } + i += data.header.length; + } + } + bounds[0] = cast(float)minX; + bounds[1] = cast(float)minY; + bounds[2] = cast(float)(maxX - minX); + bounds[3] = cast(float)(maxY - minY); + Cairo.cairo_path_destroy(copy); } /** @@ -391,13 +391,13 @@ * */ public void getCurrentPoint(float[] point) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - double x, y; - Cairo.cairo_get_current_point(handle, &x, &y); - point[0] = cast(float)x; - point[1] = cast(float)y; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (point == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (point.length < 2) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + double x, y; + Cairo.cairo_get_current_point(handle, &x, &y); + point[0] = cast(float)x; + point[1] = cast(float)y; } /** @@ -412,62 +412,62 @@ * @see PathData */ public PathData getPathData() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - auto copy = Cairo.cairo_copy_path(handle); - if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); - cairo_path_t* path = new cairo_path_t(); - *path = *copy; - byte[] types = new byte[path.num_data]; - float[] pts = new float[path.num_data * 6]; - int typeIndex = 0, ptsIndex = 0; - if (path.num_data > 0) { - int i = 0; - double[] points = new double[6]; - cairo_path_data_t* data = new cairo_path_data_t(); - while (i < path.num_data) { - switch (data.header.type) { - case Cairo.CAIRO_PATH_MOVE_TO: - types[typeIndex++] = SWT.PATH_MOVE_TO; - pts[ptsIndex++] = cast(float)path.data[i+1].point.x; - pts[ptsIndex++] = cast(float)path.data[i+1].point.y; - break; - case Cairo.CAIRO_PATH_LINE_TO: - types[typeIndex++] = SWT.PATH_LINE_TO; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + auto copy = Cairo.cairo_copy_path(handle); + if (copy is null) SWT.error(SWT.ERROR_NO_HANDLES); + cairo_path_t* path = new cairo_path_t(); + *path = *copy; + byte[] types = new byte[path.num_data]; + float[] pts = new float[path.num_data * 6]; + int typeIndex = 0, ptsIndex = 0; + if (path.num_data > 0) { + int i = 0; + double[] points = new double[6]; + cairo_path_data_t* data = new cairo_path_data_t(); + while (i < path.num_data) { + switch (data.header.type) { + case Cairo.CAIRO_PATH_MOVE_TO: + types[typeIndex++] = SWT.PATH_MOVE_TO; pts[ptsIndex++] = cast(float)path.data[i+1].point.x; pts[ptsIndex++] = cast(float)path.data[i+1].point.y; - break; - case Cairo.CAIRO_PATH_CURVE_TO: - types[typeIndex++] = SWT.PATH_CUBIC_TO; + break; + case Cairo.CAIRO_PATH_LINE_TO: + types[typeIndex++] = SWT.PATH_LINE_TO; + pts[ptsIndex++] = cast(float)path.data[i+1].point.x; + pts[ptsIndex++] = cast(float)path.data[i+1].point.y; + break; + case Cairo.CAIRO_PATH_CURVE_TO: + types[typeIndex++] = SWT.PATH_CUBIC_TO; pts[ptsIndex++] = cast(float)path.data[i+1].point.x; pts[ptsIndex++] = cast(float)path.data[i+1].point.y; pts[ptsIndex++] = cast(float)path.data[i+2].point.x; pts[ptsIndex++] = cast(float)path.data[i+2].point.y; pts[ptsIndex++] = cast(float)path.data[i+3].point.x; pts[ptsIndex++] = cast(float)path.data[i+3].point.y; - break; - case Cairo.CAIRO_PATH_CLOSE_PATH: - types[typeIndex++] = SWT.PATH_CLOSE; - break; + break; + case Cairo.CAIRO_PATH_CLOSE_PATH: + types[typeIndex++] = SWT.PATH_CLOSE; + break; default: - } - i += data.header.length; - } - } - if (typeIndex != types.length) { + } + i += data.header.length; + } + } + if (typeIndex != types.length) { byte[] newTypes = new byte[typeIndex]; System.arraycopy(types, 0, newTypes, 0, typeIndex); types = newTypes; - } - if (ptsIndex != pts.length) { + } + if (ptsIndex != pts.length) { float[] newPts = new float[ptsIndex]; System.arraycopy(pts, 0, newPts, 0, ptsIndex); pts = newPts; - } - Cairo.cairo_path_destroy(copy); - PathData result = new PathData(); - result.types = types; - result.points = pts; - return result; + } + Cairo.cairo_path_destroy(copy); + PathData result = new PathData(); + result.types = types; + result.points = pts; + return result; } /** @@ -482,15 +482,15 @@ * */ public void lineTo(float x, float y) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (!moved) { - double currentX, currentY; - Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); - Cairo.cairo_move_to(handle, currentX, currentY); - moved = true; - } - Cairo.cairo_line_to(handle, x, y); - closed = false; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (!moved) { + double currentX, currentY; + Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); + Cairo.cairo_move_to(handle, currentX, currentY); + moved = true; + } + Cairo.cairo_line_to(handle, x, y); + closed = false; } /** @@ -506,17 +506,17 @@ * */ public void moveTo(float x, float y) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - /* - * Bug in Cairo. If cairo_move_to() is not called at the - * begining of a subpath, the first cairo_line_to() or - * cairo_curve_to() segment do not output anything. The fix - * is to detect that the app did not call cairo_move_to() - * before those calls and call it explicitly. - */ - moved = true; - Cairo.cairo_move_to(handle, x, y); - closed = true; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + /* + * Bug in Cairo. If cairo_move_to() is not called at the + * begining of a subpath, the first cairo_line_to() or + * cairo_curve_to() segment do not output anything. The fix + * is to detect that the app did not call cairo_move_to() + * before those calls and call it explicitly. + */ + moved = true; + Cairo.cairo_move_to(handle, x, y); + closed = true; } /** @@ -532,21 +532,21 @@ * */ public void quadTo(float cx, float cy, float x, float y) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - double currentX, currentY; - Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); - if (!moved) { - Cairo.cairo_move_to(handle, currentX, currentY); - moved = true; - } - float x0 = cast(float)currentX; - float y0 = cast(float)currentY; - float cx1 = x0 + 2 * (cx - x0) / 3; - float cy1 = y0 + 2 * (cy - y0) / 3; - float cx2 = cx1 + (x - x0) / 3; - float cy2 = cy1 + (y - y0) / 3; - Cairo.cairo_curve_to(handle, cx1, cy1, cx2, cy2, x, y); - closed = false; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + double currentX, currentY; + Cairo.cairo_get_current_point(handle, ¤tX, ¤tY); + if (!moved) { + Cairo.cairo_move_to(handle, currentX, currentY); + moved = true; + } + float x0 = cast(float)currentX; + float y0 = cast(float)currentY; + float cx1 = x0 + 2 * (cx - x0) / 3; + float cy1 = y0 + 2 * (cy - y0) / 3; + float cx2 = cx1 + (x - x0) / 3; + float cy2 = cy1 + (y - y0) / 3; + Cairo.cairo_curve_to(handle, cx1, cy1, cx2, cy2, x, y); + closed = false; } /** @@ -555,11 +555,11 @@ * they allocate. */ public void dispose() { - if (handle is null) return; - Cairo.cairo_destroy(handle); - handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; + if (handle is null) return; + Cairo.cairo_destroy(handle); + handle = null; + if (device.tracking) device.dispose_Object(this); + device = null; } /** @@ -573,7 +573,7 @@ * @returntrue
when the Path is disposed, and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -583,8 +583,8 @@
* @return a string representation of the receiver
*/
public char[] toString() {
- if (isDisposed()) return "Path {*DISPOSED*}";
- return Format( "Path {{{}}", handle );
+ if (isDisposed()) return "Path {*DISPOSED*}";
+ return Format( "Path {{{}}", handle );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/PathData.d
--- a/dwt/graphics/PathData.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/PathData.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -20,13 +20,13 @@
*/
public final class PathData {
- /**
- * The type of each point.
- */
- public byte[] types;
+ /**
+ * The type of each point.
+ */
+ public byte[] types;
- /**
- * The points of a path.
- */
- public float[] points;
+ /**
+ * The points of a path.
+ */
+ public float[] points;
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Pattern.d
--- a/dwt/graphics/Pattern.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Pattern.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -38,17 +38,17 @@
*/
public class Pattern : Resource {
- /**
- * the OS resource for the Pattern
- * (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 cairo_pattern_t* handle; + /** + * the OS resource for the Pattern + * (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 cairo_pattern_t* handle; /** * Constructs a new Pattern given an image. Drawing with the resulting @@ -76,17 +76,17 @@ * @see #dispose() */ public this(Device device, Image image) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (image is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - this.device = device; - device.checkCairo(); - image.createSurface(); - handle = Cairo.cairo_pattern_create_for_surface(image.surface); - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (image is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + this.device = device; + device.checkCairo(); + image.createSurface(); + handle = Cairo.cairo_pattern_create_for_surface(image.surface); + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); + if (device.tracking) device.new_Object(this); } /** @@ -122,7 +122,7 @@ * @see #dispose() */ public this(Device device, float x1, float y1, float x2, float y2, Color color1, Color color2) { - this(device, x1, y1, x2, y2, color1, 0xFF, color2, 0xFF); + this(device, x1, y1, x2, y2, color1, 0xFF, color2, 0xFF); } /** * Constructs a new Pattern that represents a linear, two color @@ -161,20 +161,20 @@ * @since 3.2 */ public this(Device device, float x1, float y1, float x2, float y2, Color color1, int alpha1, Color color2, int alpha2) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (color1 is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (color1.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - if (color2 is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (color2.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - this.device = device; - device.checkCairo(); - handle = Cairo.cairo_pattern_create_linear(x1, y1, x2, y2); - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - GC.setCairoPatternColor(handle, 0, color1, alpha1); - GC.setCairoPatternColor(handle, 1, color2, alpha2); - Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (color1 is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (color1.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + if (color2 is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (color2.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + this.device = device; + device.checkCairo(); + handle = Cairo.cairo_pattern_create_linear(x1, y1, x2, y2); + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + GC.setCairoPatternColor(handle, 0, color1, alpha1); + GC.setCairoPatternColor(handle, 1, color2, alpha2); + Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); + if (device.tracking) device.new_Object(this); } /** @@ -183,12 +183,12 @@ * they allocate. */ public void dispose() { - if (handle is null) return; - if (device.isDisposed()) return; - Cairo.cairo_pattern_destroy(handle); - handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; + if (handle is null) return; + if (device.isDisposed()) return; + Cairo.cairo_pattern_destroy(handle); + handle = null; + if (device.tracking) device.dispose_Object(this); + device = null; } /** @@ -202,7 +202,7 @@ * @returntrue
when the Pattern is disposed, and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -212,8 +212,8 @@
* @return a string representation of the receiver
*/
public char[] toString() {
- if (isDisposed()) return "Pattern {*DISPOSED*}";
- return Format( "Pattern {{{}}", handle );
+ if (isDisposed()) return "Pattern {*DISPOSED*}";
+ return Format( "Pattern {{{}}", handle );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Point.d
--- a/dwt/graphics/Point.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Point.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -41,17 +41,17 @@
public final class Point : SerializableCompatibility {
- /**
- * the x coordinate of the point
- */
- public int x;
+ /**
+ * the x coordinate of the point
+ */
+ public int x;
- /**
- * the y coordinate of the point
- */
- public int y;
+ /**
+ * the y coordinate of the point
+ */
+ public int y;
- //static final long serialVersionUID = 3257002163938146354L;
+ //static final long serialVersionUID = 3257002163938146354L;
/**
* Constructs a new point with the given x and y coordinates.
@@ -60,8 +60,8 @@
* @param y the y coordinate of the new point
*/
public this (int x, int y) {
- this.x = x;
- this.y = y;
+ this.x = x;
+ this.y = y;
}
/**
@@ -75,8 +75,8 @@
* @see #hashCode()
*/
public override int opEquals (Object object) {
- if (object is this) return true;
- if ( auto p = cast(Point)object ){
+ if (object is this) return true;
+ if ( auto p = cast(Point)object ){
return (p.x == this.x) && (p.y == this.y);
}
return false;
@@ -93,7 +93,7 @@
* @see #equals(Object)
*/
public hash_t toHash () {
- return x ^ y;
+ return x ^ y;
}
/**
@@ -103,7 +103,7 @@
* @return a string representation of the point
*/
public char[] toString () {
- return Format( "Point {}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return Format( "Point {}, {}}", x, y );; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/RGB.d
--- a/dwt/graphics/RGB.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/RGB.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -41,22 +41,22 @@
public final class RGB : SerializableCompatibility {
- /**
- * the red component of the RGB
- */
- public int red;
+ /**
+ * the red component of the RGB
+ */
+ public int red;
- /**
- * the green component of the RGB
- */
- public int green;
+ /**
+ * the green component of the RGB
+ */
+ public int green;
- /**
- * the blue component of the RGB
- */
- public int blue;
+ /**
+ * the blue component of the RGB
+ */
+ public int blue;
- //static final long serialVersionUID = 3258415023461249074L;
+ //static final long serialVersionUID = 3258415023461249074L;
/**
* Constructs an instance of this class with the given
@@ -71,13 +71,13 @@
*
*/
public this (int red, int green, int blue) {
- if ((red > 255) || (red < 0) ||
- (green > 255) || (green < 0) ||
- (blue > 255) || (blue < 0))
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- this.red = red;
- this.green = green;
- this.blue = blue;
+ if ((red > 255) || (red < 0) ||
+ (green > 255) || (green < 0) ||
+ (blue > 255) || (blue < 0))
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ this.red = red;
+ this.green = green;
+ this.blue = blue;
}
/**
@@ -96,58 +96,58 @@
* @since 3.2
*/
public this (float hue, float saturation, float brightness) {
- if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 ||
- brightness < 0 || brightness > 1) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- float r, g, b;
- if (saturation == 0) {
- r = g = b = brightness;
- } else {
- if (hue == 360) hue = 0;
- hue /= 60;
- int i = cast(int)hue;
- float f = hue - i;
- float p = brightness * (1 - saturation);
- float q = brightness * (1 - saturation * f);
- float t = brightness * (1 - saturation * (1 - f));
- switch(i) {
- case 0:
- r = brightness;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = brightness;
- b = p;
- break;
- case 2:
- r = p;
- g = brightness;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = brightness;
- break;
- case 4:
- r = t;
- g = p;
- b = brightness;
- break;
- case 5:
- default:
- r = brightness;
- g = p;
- b = q;
- break;
- }
- }
- red = cast(int)(r * 255 + 0.5);
- green = cast(int)(g * 255 + 0.5);
- blue = cast(int)(b * 255 + 0.5);
+ if (hue < 0 || hue > 360 || saturation < 0 || saturation > 1 ||
+ brightness < 0 || brightness > 1) {
+ SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ }
+ float r, g, b;
+ if (saturation == 0) {
+ r = g = b = brightness;
+ } else {
+ if (hue == 360) hue = 0;
+ hue /= 60;
+ int i = cast(int)hue;
+ float f = hue - i;
+ float p = brightness * (1 - saturation);
+ float q = brightness * (1 - saturation * f);
+ float t = brightness * (1 - saturation * (1 - f));
+ switch(i) {
+ case 0:
+ r = brightness;
+ g = t;
+ b = p;
+ break;
+ case 1:
+ r = q;
+ g = brightness;
+ b = p;
+ break;
+ case 2:
+ r = p;
+ g = brightness;
+ b = t;
+ break;
+ case 3:
+ r = p;
+ g = q;
+ b = brightness;
+ break;
+ case 4:
+ r = t;
+ g = p;
+ b = brightness;
+ break;
+ case 5:
+ default:
+ r = brightness;
+ g = p;
+ b = q;
+ break;
+ }
+ }
+ red = cast(int)(r * 255 + 0.5);
+ green = cast(int)(g * 255 + 0.5);
+ blue = cast(int)(b * 255 + 0.5);
}
/**
@@ -158,29 +158,29 @@
* @since 3.2
*/
public float[] getHSB() {
- float r = red / 255f;
- float g = green / 255f;
- float b = blue / 255f;
- float max = Math.max(Math.max(r, g), b);
- float min = Math.min(Math.min(r, g), b);
- float delta = max - min;
- float hue = 0;
- float brightness = max;
- float saturation = max == 0 ? 0 : (max - min) / max;
- if (delta != 0) {
- if (r == max) {
- hue = (g - b) / delta;
- } else {
- if (g == max) {
- hue = 2 + (b - r) / delta;
- } else {
- hue = 4 + (r - g) / delta;
- }
- }
- hue *= 60;
- if (hue < 0) hue += 360;
- }
- return [ hue, saturation, brightness ];
+ float r = red / 255f;
+ float g = green / 255f;
+ float b = blue / 255f;
+ float max = Math.max(Math.max(r, g), b);
+ float min = Math.min(Math.min(r, g), b);
+ float delta = max - min;
+ float hue = 0;
+ float brightness = max;
+ float saturation = max == 0 ? 0 : (max - min) / max;
+ if (delta != 0) {
+ if (r == max) {
+ hue = (g - b) / delta;
+ } else {
+ if (g == max) {
+ hue = 2 + (b - r) / delta;
+ } else {
+ hue = 4 + (r - g) / delta;
+ }
+ }
+ hue *= 60;
+ if (hue < 0) hue += 360;
+ }
+ return [ hue, saturation, brightness ];
}
/**
@@ -194,11 +194,11 @@
* @see #hashCode()
*/
public override int opEquals(Object object) {
- if (object is this) return true;
+ 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;
+ return false;
}
/**
@@ -212,7 +212,7 @@
* @see #equals(Object)
*/
public hash_t toHash() {
- return (blue << 16) | (green << 8) | red;
+ return (blue << 16) | (green << 8) | red;
}
/**
@@ -222,7 +222,7 @@
* @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$
+ return Format( "RGB {}, {}, {}}", red, green, blue ); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Rectangle.d
--- a/dwt/graphics/Rectangle.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Rectangle.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -45,27 +45,27 @@
public final class Rectangle : SerializableCompatibility {
- /**
- * the x coordinate of the rectangle
- */
- public int x;
+ /**
+ * the x coordinate of the rectangle
+ */
+ public int x;
- /**
- * the y coordinate of the rectangle
- */
- public int y;
+ /**
+ * the y coordinate of the rectangle
+ */
+ public int y;
- /**
- * the width of the rectangle
- */
- public int width;
+ /**
+ * the width of the rectangle
+ */
+ public int width;
- /**
- * the height of the rectangle
- */
- public int height;
+ /**
+ * the height of the rectangle
+ */
+ public int height;
- //static final long serialVersionUID = 3256439218279428914L;
+ //static final long serialVersionUID = 3256439218279428914L;
/**
* Construct a new instance of this class given the
@@ -77,10 +77,10 @@
* @param height the height of the rectangle
*/
public this (int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
}
/**
@@ -100,16 +100,16 @@
*
*/
public void add (Rectangle rect) {
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int left = x < rect.x ? x : rect.x;
- int top = y < rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs > rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs > rhs ? lhs : rhs;
- x = left; y = top; width = right - left; height = bottom - top;
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int left = x < rect.x ? x : rect.x;
+ int top = y < rect.y ? y : rect.y;
+ int lhs = x + width;
+ int rhs = rect.x + rect.width;
+ int right = lhs > rhs ? lhs : rhs;
+ lhs = y + height;
+ rhs = rect.y + rect.height;
+ int bottom = lhs > rhs ? lhs : rhs;
+ x = left; y = top; width = right - left; height = bottom - top;
}
/**
@@ -122,7 +122,7 @@
* @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);
+ return (x >= this.x) && (y >= this.y) && ((x - this.x) < width) && ((y - this.y) < height);
}
/**
@@ -138,8 +138,8 @@
*
*/
public bool contains (Point pt) {
- if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return contains(pt.x, pt.y);
+ if (pt == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ return contains(pt.x, pt.y);
}
/**
@@ -153,11 +153,11 @@
* @see #hashCode()
*/
public override int opEquals (Object object) {
- if (object is this) return true;
+ 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;
+ return false;
}
/**
@@ -171,7 +171,7 @@
* @see #equals(Object)
*/
public override hash_t toHash () {
- return x ^ y ^ width ^ height;
+ return x ^ y ^ width ^ height;
}
/**
@@ -188,20 +188,20 @@
* since 3.0
*/
public void intersect (Rectangle rect) {
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (this is rect) return;
- int left = x > rect.x ? x : rect.x;
- int top = y > rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs < rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs < rhs ? lhs : rhs;
- x = right < left ? 0 : left;
- y = bottom < top ? 0 : top;
- width = right < left ? 0 : right - left;
- height = bottom < top ? 0 : bottom - top;
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (this is rect) return;
+ int left = x > rect.x ? x : rect.x;
+ int top = y > rect.y ? y : rect.y;
+ int lhs = x + width;
+ int rhs = rect.x + rect.width;
+ int right = lhs < rhs ? lhs : rhs;
+ lhs = y + height;
+ rhs = rect.y + rect.height;
+ int bottom = lhs < rhs ? lhs : rhs;
+ x = right < left ? 0 : left;
+ y = bottom < top ? 0 : top;
+ width = right < left ? 0 : right - left;
+ height = bottom < top ? 0 : bottom - top;
}
/**
@@ -220,21 +220,21 @@
*
*/
public Rectangle intersection (Rectangle rect) {
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (this is rect) return new Rectangle (x, y, width, height);
- int left = x > rect.x ? x : rect.x;
- int top = y > rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs < rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs < rhs ? lhs : rhs;
- return new Rectangle (
- right < left ? 0 : left,
- bottom < top ? 0 : top,
- right < left ? 0 : right - left,
- bottom < top ? 0 : bottom - top);
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (this is rect) return new Rectangle (x, y, width, height);
+ int left = x > rect.x ? x : rect.x;
+ int top = y > rect.y ? y : rect.y;
+ int lhs = x + width;
+ int rhs = rect.x + rect.width;
+ int right = lhs < rhs ? lhs : rhs;
+ lhs = y + height;
+ rhs = rect.y + rect.height;
+ int bottom = lhs < rhs ? lhs : rhs;
+ return new Rectangle (
+ right < left ? 0 : left,
+ bottom < top ? 0 : top,
+ right < left ? 0 : right - left,
+ bottom < top ? 0 : bottom - top);
}
/**
@@ -262,8 +262,8 @@
* @since 3.0
*/
public bool intersects (int x, int y, int width, int height) {
- return (x < this.x + this.width) && (y < this.y + this.height) &&
- (x + width > this.x) && (y + height > this.y);
+ return (x < this.x + this.width) && (y < this.y + this.height) &&
+ (x + width > this.x) && (y + height > this.y);
}
/**
@@ -285,8 +285,8 @@
* @see #isEmpty()
*/
public bool intersects (Rectangle rect) {
- if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return rect == this || intersects (rect.x, rect.y, rect.width, rect.height);
+ if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ return rect == this || intersects (rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -302,7 +302,7 @@
* @return true
if the receiver is empty, and false
otherwise
*/
public bool isEmpty () {
- return (width <= 0) || (height <= 0);
+ return (width <= 0) || (height <= 0);
}
/**
@@ -334,16 +334,16 @@
* @see #add(Rectangle)
*/
public Rectangle makeUnion (Rectangle rect) {
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- int left = x < rect.x ? x : rect.x;
- int top = y < rect.y ? y : rect.y;
- int lhs = x + width;
- int rhs = rect.x + rect.width;
- int right = lhs > rhs ? lhs : rhs;
- lhs = y + height;
- rhs = rect.y + rect.height;
- int bottom = lhs > rhs ? lhs : rhs;
- return new Rectangle (left, top, right - left, bottom - top);
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ int left = x < rect.x ? x : rect.x;
+ int top = y < rect.y ? y : rect.y;
+ int lhs = x + width;
+ int rhs = rect.x + rect.width;
+ int right = lhs > rhs ? lhs : rhs;
+ lhs = y + height;
+ rhs = rect.y + rect.height;
+ int bottom = lhs > rhs ? lhs : rhs;
+ return new Rectangle (left, top, right - left, bottom - top);
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Region.d
--- a/dwt/graphics/Region.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Region.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -31,17 +31,17 @@
*
*/
public final class Region : Resource {
- /**
- * the OS resource for the region
- * (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 GdkRegion* handle; + /** + * the OS resource for the region + * (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 GdkRegion* handle; /** * Constructs a new empty region. @@ -51,7 +51,7 @@ * */ public this() { - this(null); + this(null); } /** @@ -74,17 +74,17 @@ * @since 3.0 */ public this(Device device) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = device; - handle = OS.gdk_region_new(); - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = device; + handle = OS.gdk_region_new(); + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + if (device.tracking) device.new_Object(this); } this(Device device, GdkRegion* handle) { - this.device = device; - this.handle = handle; + this.device = device; + this.handle = handle; } /** @@ -104,12 +104,12 @@ * */ public void add (int[] pointArray) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (pointArray is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (pointArray is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); //PORTING_FIXME: shall the pointArray be changed to be GdkPoint[] ? - auto polyRgn = OS.gdk_region_polygon(cast(GdkPoint*)pointArray.ptr, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE); - OS.gdk_region_union(handle, polyRgn); - OS.gdk_region_destroy(polyRgn); + auto polyRgn = OS.gdk_region_polygon(cast(GdkPoint*)pointArray.ptr, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE); + OS.gdk_region_union(handle, polyRgn); + OS.gdk_region_destroy(polyRgn); } /** @@ -127,9 +127,9 @@ * */ public void add(Rectangle rect) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - add (rect.x, rect.y, rect.width, rect.height); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + add (rect.x, rect.y, rect.width, rect.height); } /** @@ -151,14 +151,14 @@ * @since 3.1 */ public void add(int x, int y, int width, int height) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - GdkRectangle* gdkRect = new GdkRectangle(); - gdkRect.x = x; - gdkRect.y = y; - gdkRect.width = width; - gdkRect.height = height; - OS.gdk_region_union_with_rect(handle, gdkRect); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + GdkRectangle* gdkRect = new GdkRectangle(); + gdkRect.x = x; + gdkRect.y = y; + gdkRect.width = width; + gdkRect.height = height; + OS.gdk_region_union_with_rect(handle, gdkRect); } /** @@ -177,10 +177,10 @@ * */ public void add(Region region) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - OS.gdk_region_union(handle, region.handle); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + OS.gdk_region_union(handle, region.handle); } /** @@ -197,8 +197,8 @@ * */ public bool contains(int x, int y) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - return cast(bool)OS.gdk_region_point_in(handle, x, y); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + return cast(bool)OS.gdk_region_point_in(handle, x, y); } /** @@ -217,8 +217,8 @@ * */ public bool contains(Point pt) { - if (pt is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - return contains(pt.x, pt.y); + if (pt is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + return contains(pt.x, pt.y); } /** @@ -227,12 +227,12 @@ * they allocate. */ public void dispose() { - if (handle is null) return; - if (device.isDisposed()) return; - OS.gdk_region_destroy(handle); - handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; + if (handle is null) return; + if (device.isDisposed()) return; + OS.gdk_region_destroy(handle); + handle = null; + if (device.tracking) device.dispose_Object(this); + device = null; } /** @@ -246,8 +246,8 @@ * @see #hashCode */ public int opEquals(Object object) { - if (this is object) return true; - if ( auto region = cast(Region)object ){ + if (this is object) return true; + if ( auto region = cast(Region)object ){ return handle is region.handle; } return false; @@ -267,14 +267,14 @@ * @see Rectangle#union */ public Rectangle getBounds() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - GdkRectangle* gdkRect = new GdkRectangle(); - OS.gdk_region_get_clipbox(handle, gdkRect); - return new Rectangle(gdkRect.x, gdkRect.y, gdkRect.width, gdkRect.height); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + GdkRectangle* gdkRect = new GdkRectangle(); + OS.gdk_region_get_clipbox(handle, gdkRect); + return new Rectangle(gdkRect.x, gdkRect.y, gdkRect.width, gdkRect.height); } public static Region gtk_new(Device device, GdkRegion* handle) { - return new Region(device, handle); + return new Region(device, handle); } /** @@ -288,7 +288,7 @@ * @see #equals */ public override hash_t toHash() { - return cast(hash_t)handle; + return cast(hash_t)handle; } /** @@ -308,9 +308,9 @@ * @since 3.0 */ public void intersect(Rectangle rect) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - intersect (rect.x, rect.y, rect.width, rect.height); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + intersect (rect.x, rect.y, rect.width, rect.height); } /** @@ -332,16 +332,16 @@ * @since 3.1 */ public void intersect(int x, int y, int width, int height) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - GdkRectangle* gdkRect = new GdkRectangle(); - gdkRect.x = x; - gdkRect.y = y; - gdkRect.width = width; - gdkRect.height = height; - auto rectRgn = OS.gdk_region_rectangle(gdkRect); - OS.gdk_region_intersect(handle, rectRgn); - OS.gdk_region_destroy(rectRgn); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + GdkRectangle* gdkRect = new GdkRectangle(); + gdkRect.x = x; + gdkRect.y = y; + gdkRect.width = width; + gdkRect.height = height; + auto rectRgn = OS.gdk_region_rectangle(gdkRect); + OS.gdk_region_intersect(handle, rectRgn); + OS.gdk_region_destroy(rectRgn); } /** @@ -362,10 +362,10 @@ * @since 3.0 */ public void intersect(Region region) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - OS.gdk_region_intersect(handle, region.handle); + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + OS.gdk_region_intersect(handle, region.handle); } /** @@ -386,13 +386,13 @@ * @see Rectangle#intersects(Rectangle) */ public bool intersects (int x, int y, int width, int height) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - GdkRectangle* gdkRect = new GdkRectangle(); - gdkRect.x = x; - gdkRect.y = y; - gdkRect.width = width; - gdkRect.height = height; - return OS.gdk_region_rect_in(handle, gdkRect) != OS.GDK_OVERLAP_RECTANGLE_OUT; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + GdkRectangle* gdkRect = new GdkRectangle(); + gdkRect.x = x; + gdkRect.y = y; + gdkRect.width = width; + gdkRect.height = height; + return OS.gdk_region_rect_in(handle, gdkRect) != OS.GDK_OVERLAP_RECTANGLE_OUT; } /** * Returnstrue
if the given rectangle intersects
@@ -412,8 +412,8 @@
* @see Rectangle#intersects(Rectangle)
*/
public bool intersects(Rectangle rect) {
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- return intersects(rect.x, rect.y, rect.width, rect.height);
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ return intersects(rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -427,7 +427,7 @@
* @return true
when the region is disposed, and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -442,8 +442,8 @@
*
*/
public bool isEmpty() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- return cast(bool)OS.gdk_region_empty(handle);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ return cast(bool)OS.gdk_region_empty(handle);
}
/**
@@ -462,11 +462,11 @@
* @since 3.0
*/
public void subtract (int[] pointArray) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- auto polyRgn = OS.gdk_region_polygon( cast(GdkPoint*)pointArray.ptr, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
- OS.gdk_region_subtract(handle, polyRgn);
- OS.gdk_region_destroy(polyRgn);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pointArray is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ auto polyRgn = OS.gdk_region_polygon( cast(GdkPoint*)pointArray.ptr, pointArray.length / 2, OS.GDK_EVEN_ODD_RULE);
+ OS.gdk_region_subtract(handle, polyRgn);
+ OS.gdk_region_destroy(polyRgn);
}
/**
@@ -486,9 +486,9 @@
* @since 3.0
*/
public void subtract(Rectangle rect) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- subtract (rect.x, rect.y, rect.width, rect.height);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (rect is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ subtract (rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -510,16 +510,16 @@
* @since 3.1
*/
public void subtract(int x, int y, int width, int height) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- GdkRectangle* gdkRect = new GdkRectangle();
- gdkRect.x = x;
- gdkRect.y = y;
- gdkRect.width = width;
- gdkRect.height = height;
- auto rectRgn = OS.gdk_region_rectangle(gdkRect);
- OS.gdk_region_subtract(handle, rectRgn);
- OS.gdk_region_destroy(rectRgn);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (width < 0 || height < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ GdkRectangle* gdkRect = new GdkRectangle();
+ gdkRect.x = x;
+ gdkRect.y = y;
+ gdkRect.width = width;
+ gdkRect.height = height;
+ auto rectRgn = OS.gdk_region_rectangle(gdkRect);
+ OS.gdk_region_subtract(handle, rectRgn);
+ OS.gdk_region_destroy(rectRgn);
}
/**
@@ -540,10 +540,10 @@
* @since 3.0
*/
public void subtract(Region region) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.gdk_region_subtract(handle, region.handle);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (region is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (region.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ OS.gdk_region_subtract(handle, region.handle);
}
/**
@@ -560,8 +560,8 @@
* @since 3.1
*/
public void translate (int x, int y) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- OS.gdk_region_offset (handle, x, y);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ OS.gdk_region_offset (handle, x, y);
}
/**
@@ -580,9 +580,9 @@
* @since 3.1
*/
public void translate (Point pt) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pt is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- translate (pt.x, pt.y);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pt is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ translate (pt.x, pt.y);
}
/**
@@ -592,7 +592,7 @@
* @return a string representation of the receiver
*/
public override char[] toString () {
- if (isDisposed()) return "Region {*DISPOSED*}";
- return Format( "Region {{{}}", handle );
+ if (isDisposed()) return "Region {*DISPOSED*}";
+ return Format( "Region {{{}}", handle );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Resource.d
--- a/dwt/graphics/Resource.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Resource.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -39,10 +39,10 @@
*/
public abstract class Resource {
- /**
- * the device where this resource was created
- */
- Device device;
+ /**
+ * the device where this resource was created
+ */
+ Device device;
/**
* Disposes of the operating system resources associated with
@@ -60,9 +60,9 @@
* @since 3.2
*/
public Device getDevice() {
- Device device = this.device;
- if (device is null || isDisposed ()) SWT.error (SWT.ERROR_GRAPHIC_DISPOSED);
- return device;
+ Device device = this.device;
+ if (device is null || isDisposed ()) SWT.error (SWT.ERROR_GRAPHIC_DISPOSED);
+ return device;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/TextLayout.d
--- a/dwt/graphics/TextLayout.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/TextLayout.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -50,25 +50,25 @@
*/
public final class TextLayout : Resource {
- static class StyleItem {
- TextStyle style;
- int start;
+ static class StyleItem {
+ TextStyle style;
+ int start;
- public char[] toString () {
- return Format( "StyleItem {{{}, {}}", start, style );
- }
- }
+ public char[] toString () {
+ return Format( "StyleItem {{{}, {}}", start, style );
+ }
+ }
- Font font;
- char[] text;
- int ascent, descent;
- int[] segments;
- int[] tabs;
- StyleItem[] styles;
- PangoLayout* layout;
+ Font font;
+ char[] text;
+ int ascent, descent;
+ int[] segments;
+ int[] tabs;
+ StyleItem[] styles;
+ PangoLayout* layout;
PangoContext* context;
PangoAttrList* attrList;
- int[] invalidOffsets;
+ int[] invalidOffsets;
static const wchar LTR_MARK = '\u200E', RTL_MARK = '\u200F', ZWS = '\u200B', ZWNBS = '\uFEFF';
/**
@@ -86,165 +86,165 @@
* @see #dispose()
*/
public this (Device device) {
- if (device is null) device = Device.getDevice();
- if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- this.device = device;
- context = OS.gdk_pango_context_get();
- if (context is null) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.pango_context_set_language(context, OS.gtk_get_default_language());
- OS.pango_context_set_base_dir(context, OS.PANGO_DIRECTION_LTR);
- OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system());
- layout = OS.pango_layout_new(context);
- if (layout is null) SWT.error(SWT.ERROR_NO_HANDLES);
- OS.pango_layout_set_wrap(layout, OS.PANGO_WRAP_WORD_CHAR);
- OS.pango_layout_set_tabs(layout, device.emptyTab);
- if (OS.GTK_VERSION >= OS.buildVERSION(2, 4, 0)) {
- OS.pango_layout_set_auto_dir(layout, false);
- }
- text = "";
- ascent = descent = -1;
- styles = new StyleItem[2];
- styles[0] = new StyleItem();
- styles[1] = new StyleItem();
- if (device.tracking) device.new_Object(this);
+ if (device is null) device = Device.getDevice();
+ if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ this.device = device;
+ context = OS.gdk_pango_context_get();
+ if (context is null) SWT.error(SWT.ERROR_NO_HANDLES);
+ OS.pango_context_set_language(context, OS.gtk_get_default_language());
+ OS.pango_context_set_base_dir(context, OS.PANGO_DIRECTION_LTR);
+ OS.gdk_pango_context_set_colormap(context, OS.gdk_colormap_get_system());
+ layout = OS.pango_layout_new(context);
+ if (layout is null) SWT.error(SWT.ERROR_NO_HANDLES);
+ OS.pango_layout_set_wrap(layout, OS.PANGO_WRAP_WORD_CHAR);
+ OS.pango_layout_set_tabs(layout, device.emptyTab);
+ if (OS.GTK_VERSION >= OS.buildVERSION(2, 4, 0)) {
+ OS.pango_layout_set_auto_dir(layout, false);
+ }
+ text = "";
+ ascent = descent = -1;
+ styles = new StyleItem[2];
+ styles[0] = new StyleItem();
+ styles[1] = new StyleItem();
+ if (device.tracking) device.new_Object(this);
}
void checkLayout() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
}
void computeRuns () {
- if (attrList !is null) return;
- char[] segmentsText = getSegmentsText();
- OS.pango_layout_set_text (layout, toStringz(segmentsText), segmentsText.length);
- if (styles.length == 2 && styles[0].style == null && ascent == -1 && descent == -1 && segments == null) return;
- auto ptr = OS.pango_layout_get_text(layout);
- attrList = OS.pango_attr_list_new();
- //PangoAttribute* attribute = new PangoAttribute();
- wchar[] charsW = null;
+ if (attrList !is null) return;
+ char[] segmentsText = getSegmentsText();
+ OS.pango_layout_set_text (layout, toStringz(segmentsText), segmentsText.length);
+ if (styles.length == 2 && styles[0].style == null && ascent == -1 && descent == -1 && segments == null) return;
+ auto ptr = OS.pango_layout_get_text(layout);
+ attrList = OS.pango_attr_list_new();
+ //PangoAttribute* attribute = new PangoAttribute();
+ wchar[] charsW = null;
wchar[] segmentsTextW = toString16( segmentsText );
- int segementsWLength = segmentsTextW.length;
- if ((ascent != -1 || descent != -1) && segementsWLength > 0) {
- auto iter = OS.pango_layout_get_iter(layout);
- if (iter is null) SWT.error(SWT.ERROR_NO_HANDLES);
- PangoRectangle* rect = new PangoRectangle();
- if (ascent != -1) rect.y = -(ascent * OS.PANGO_SCALE);
- rect.height = (Math.max(0, ascent) + Math.max(0, descent)) * OS.PANGO_SCALE;
- int lineCount = OS.pango_layout_get_line_count(layout);
- charsW = new wchar[segementsWLength + lineCount * 2];
- int oldPos = 0, count = 0;
- do {
- int bytePos = OS.pango_layout_iter_get_index(iter);
- /* Note: The length in bytes of ZWS and ZWNBS are both equals to 3 */
- int offset = count * 6;
- PangoAttribute* attr = OS.pango_attr_shape_new (rect, rect);
- attr.start_index = bytePos + offset;
- attr.end_index = bytePos + offset + 3;
- OS.pango_attr_list_insert(attrList, attr);
- attr = OS.pango_attr_shape_new (rect, rect);
- attr.start_index = bytePos + offset + 3;
- attr.end_index = bytePos + offset + 6;
- OS.pango_attr_list_insert(attrList, attr);
- int pos = OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
- charsW[pos + count * 2] = ZWS;
- charsW[pos + count * 2 + 1] = ZWNBS;
+ int segementsWLength = segmentsTextW.length;
+ if ((ascent != -1 || descent != -1) && segementsWLength > 0) {
+ auto iter = OS.pango_layout_get_iter(layout);
+ if (iter is null) SWT.error(SWT.ERROR_NO_HANDLES);
+ PangoRectangle* rect = new PangoRectangle();
+ if (ascent != -1) rect.y = -(ascent * OS.PANGO_SCALE);
+ rect.height = (Math.max(0, ascent) + Math.max(0, descent)) * OS.PANGO_SCALE;
+ int lineCount = OS.pango_layout_get_line_count(layout);
+ charsW = new wchar[segementsWLength + lineCount * 2];
+ int oldPos = 0, count = 0;
+ do {
+ int bytePos = OS.pango_layout_iter_get_index(iter);
+ /* Note: The length in bytes of ZWS and ZWNBS are both equals to 3 */
+ int offset = count * 6;
+ PangoAttribute* attr = OS.pango_attr_shape_new (rect, rect);
+ attr.start_index = bytePos + offset;
+ attr.end_index = bytePos + offset + 3;
+ OS.pango_attr_list_insert(attrList, attr);
+ attr = OS.pango_attr_shape_new (rect, rect);
+ attr.start_index = bytePos + offset + 3;
+ attr.end_index = bytePos + offset + 6;
+ OS.pango_attr_list_insert(attrList, attr);
+ int pos = OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
+ charsW[pos + count * 2] = ZWS;
+ charsW[pos + count * 2 + 1] = ZWNBS;
charsW[ oldPos + count*2 .. oldPos + count*2 + pos - oldPos ] =
segmentsTextW[ oldPos .. pos ];
- //segmentsTextW.getChars(oldPos, pos, chars, oldPos + count * 2);
- oldPos = pos;
- count++;
- } while (OS.pango_layout_iter_next_line(iter));
- OS.pango_layout_iter_free (iter);
+ //segmentsTextW.getChars(oldPos, pos, chars, oldPos + count * 2);
+ oldPos = pos;
+ count++;
+ } while (OS.pango_layout_iter_next_line(iter));
+ OS.pango_layout_iter_free (iter);
charsW[ oldPos + count*2 .. oldPos + count*2 + segementsWLength - oldPos ] =
segmentsTextW[ oldPos .. segementsWLength ];
- //segmentsTextW.getChars(oldPos, segementsWLength, chars, oldPos + count * 2);
- char[] buffer = .toString( charsW );// Converter.wcsToMbcs(null, chars, false);
- OS.pango_layout_set_text (layout, buffer.ptr, buffer.length);
- ptr = OS.pango_layout_get_text(layout);
- } else {
- charsW = segmentsTextW.dup;
- }
- int offsetCount = 0;
- for (int i = 0; i < charsW.length; i++) {
- wchar c = charsW[i];
- if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) {
- offsetCount++;
- }
- }
- invalidOffsets = new int[offsetCount];
- offsetCount = 0;
- for (int i = 0; i < charsW.length; i++) {
- wchar c = charsW[i];
- if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) {
- invalidOffsets[offsetCount++] = i;
- }
- }
- int slen = strlen(ptr);
- for (int i = 0; i < styles.length - 1; i++) {
- StyleItem styleItem = styles[i];
- TextStyle style = styleItem.style;
- if (style == null) continue;
- int start = translateOffset(styleItem.start);
- int end = translateOffset(styles[i+1].start - 1);
- int byteStart = (OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
- int byteEnd = (OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
- byteStart = Math.min(byteStart, slen);
- byteEnd = Math.min(byteEnd, slen);
- Font font = style.font;
- if (font != null && !font.isDisposed()) {
- auto attr = OS.pango_attr_font_desc_new (font.handle);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- if (style.underline) {
- auto attr = OS.pango_attr_underline_new(OS.PANGO_UNDERLINE_SINGLE);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- if (style.strikeout) {
- auto attr = OS.pango_attr_strikethrough_new(true);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- Color foreground = style.foreground;
- if (foreground != null && !foreground.isDisposed()) {
- GdkColor* fg = foreground.handle;
- auto attr = OS.pango_attr_foreground_new(fg.red, fg.green, fg.blue);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- Color background = style.background;
- if (background != null && !background.isDisposed()) {
- GdkColor* bg = background.handle;
- auto attr = OS.pango_attr_background_new(bg.red, bg.green, bg.blue);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- GlyphMetrics metrics = style.metrics;
- if (metrics != null) {
- PangoRectangle* rect = new PangoRectangle();
- rect.y = -(metrics.ascent * OS.PANGO_SCALE);
- rect.height = (metrics.ascent + metrics.descent) * OS.PANGO_SCALE;
- rect.width = metrics.width * OS.PANGO_SCALE;
- auto attr = OS.pango_attr_shape_new (rect, rect);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- int rise = style.rise;
- if (rise != 0) {
- auto attr = OS.pango_attr_rise_new (rise * OS.PANGO_SCALE);
- attr.start_index = byteStart;
- attr.end_index = byteEnd;
- OS.pango_attr_list_insert(attrList, attr);
- }
- }
- OS.pango_layout_set_attributes(layout, attrList);
+ //segmentsTextW.getChars(oldPos, segementsWLength, chars, oldPos + count * 2);
+ char[] buffer = .toString( charsW );// Converter.wcsToMbcs(null, chars, false);
+ OS.pango_layout_set_text (layout, buffer.ptr, buffer.length);
+ ptr = OS.pango_layout_get_text(layout);
+ } else {
+ charsW = segmentsTextW.dup;
+ }
+ int offsetCount = 0;
+ for (int i = 0; i < charsW.length; i++) {
+ wchar c = charsW[i];
+ if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) {
+ offsetCount++;
+ }
+ }
+ invalidOffsets = new int[offsetCount];
+ offsetCount = 0;
+ for (int i = 0; i < charsW.length; i++) {
+ wchar c = charsW[i];
+ if (c == LTR_MARK || c == RTL_MARK || c == ZWNBS || c == ZWS) {
+ invalidOffsets[offsetCount++] = i;
+ }
+ }
+ int slen = strlen(ptr);
+ for (int i = 0; i < styles.length - 1; i++) {
+ StyleItem styleItem = styles[i];
+ TextStyle style = styleItem.style;
+ if (style == null) continue;
+ int start = translateOffset(styleItem.start);
+ int end = translateOffset(styles[i+1].start - 1);
+ int byteStart = (OS.g_utf8_offset_to_pointer(ptr, start) - ptr);
+ int byteEnd = (OS.g_utf8_offset_to_pointer(ptr, end + 1) - ptr);
+ byteStart = Math.min(byteStart, slen);
+ byteEnd = Math.min(byteEnd, slen);
+ Font font = style.font;
+ if (font != null && !font.isDisposed()) {
+ auto attr = OS.pango_attr_font_desc_new (font.handle);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ if (style.underline) {
+ auto attr = OS.pango_attr_underline_new(OS.PANGO_UNDERLINE_SINGLE);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ if (style.strikeout) {
+ auto attr = OS.pango_attr_strikethrough_new(true);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ Color foreground = style.foreground;
+ if (foreground != null && !foreground.isDisposed()) {
+ GdkColor* fg = foreground.handle;
+ auto attr = OS.pango_attr_foreground_new(fg.red, fg.green, fg.blue);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ Color background = style.background;
+ if (background != null && !background.isDisposed()) {
+ GdkColor* bg = background.handle;
+ auto attr = OS.pango_attr_background_new(bg.red, bg.green, bg.blue);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ GlyphMetrics metrics = style.metrics;
+ if (metrics != null) {
+ PangoRectangle* rect = new PangoRectangle();
+ rect.y = -(metrics.ascent * OS.PANGO_SCALE);
+ rect.height = (metrics.ascent + metrics.descent) * OS.PANGO_SCALE;
+ rect.width = metrics.width * OS.PANGO_SCALE;
+ auto attr = OS.pango_attr_shape_new (rect, rect);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ int rise = style.rise;
+ if (rise != 0) {
+ auto attr = OS.pango_attr_rise_new (rise * OS.PANGO_SCALE);
+ attr.start_index = byteStart;
+ attr.end_index = byteEnd;
+ OS.pango_attr_list_insert(attrList, attr);
+ }
+ }
+ OS.pango_layout_set_attributes(layout, attrList);
}
/**
@@ -252,17 +252,17 @@
* the text layout. Applications must dispose of all allocated text layouts.
*/
public void dispose() {
- if (layout is null) return;
- font = null;
- text = null;
- styles = null;
- freeRuns();
- if (layout !is null) OS.g_object_unref(layout);
- layout = null;
- if (context !is null) OS.g_object_unref(context);
- context = null;
- if (device.tracking) device.dispose_Object(this);
- device = null;
+ if (layout is null) return;
+ font = null;
+ text = null;
+ styles = null;
+ freeRuns();
+ if (layout !is null) OS.g_object_unref(layout);
+ layout = null;
+ if (context !is null) OS.g_object_unref(context);
+ context = null;
+ if (device.tracking) device.dispose_Object(this);
+ device = null;
}
/**
@@ -281,7 +281,7 @@
*
*/
public void draw(GC gc, int x, int y) {
- draw(gc, x, y, -1, -1, null, null);
+ draw(gc, x, y, -1, -1, null, null);
}
/**
@@ -304,7 +304,7 @@
*
*/
public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground) {
- draw(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0);
+ draw(gc, x, y, selectionStart, selectionEnd, selectionForeground, selectionBackground, 0);
}
/**
@@ -335,160 +335,160 @@
* @since 3.3
*/
public void draw(GC gc, int x, int y, int selectionStart, int selectionEnd, Color selectionForeground, Color selectionBackground, int flags) {
- checkLayout ();
- computeRuns();
- if (gc is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (selectionForeground !is null && selectionForeground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (selectionBackground !is null && selectionBackground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- gc.checkGC(GC.FOREGROUND);
- int length = text.length;
- bool hasSelection = selectionStart <= selectionEnd && selectionStart != -1 && selectionEnd != -1;
- GCData data = gc.data;
- auto cairo = data.cairo;
- if (flags != 0 && (hasSelection || (flags & SWT.LAST_LINE_SELECTION) != 0)) {
- PangoLogAttr* attrs;
- int nAttrs;
- PangoLogAttr* logAttr = new PangoLogAttr();
- PangoRectangle* rect = new PangoRectangle();
- int lineCount = OS.pango_layout_get_line_count(layout);
- auto ptr = OS.pango_layout_get_text(layout);
- auto iter = OS.pango_layout_get_iter(layout);
- if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- Cairo.cairo_save(cairo);
- GdkColor* color = selectionBackground.handle;
- Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / cast(float)0xFFFF, (color.green & 0xFFFF) / cast(float)0xFFFF, (color.blue & 0xFFFF) / cast(float)0xFFFF, data.alpha / cast(float)0xFF);
- } else {
- OS.gdk_gc_set_foreground(gc.handle, selectionBackground.handle);
- }
- int lineIndex = 0;
- do {
- int lineEnd;
- OS.pango_layout_iter_get_line_extents(iter, null, rect);
- if (OS.pango_layout_iter_next_line(iter)) {
- int bytePos = OS.pango_layout_iter_get_index(iter);
- lineEnd = OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
- } else {
- lineEnd = OS.g_utf8_strlen(ptr, -1);
- }
- bool extent = false;
- if (lineIndex == lineCount - 1 && (flags & SWT.LAST_LINE_SELECTION) != 0) {
- extent = true;
- } else {
- if (attrs is null) OS.pango_layout_get_log_attrs(layout, &attrs, &nAttrs);
- *logAttr = attrs[lineEnd];
- if (!( logAttr.bitfield0 & 0x01 /* PangoLogAttr.is_line_break is Bit0 */)) {
- if (selectionStart <= lineEnd && lineEnd <= selectionEnd) extent = true;
- } else {
- if (selectionStart <= lineEnd && lineEnd < selectionEnd && (flags & SWT.FULL_SELECTION) != 0) {
- extent = true;
- }
- }
- }
- if (extent) {
- int lineX = x + OS.PANGO_PIXELS(rect.x) + OS.PANGO_PIXELS(rect.width);
- int lineY = y + OS.PANGO_PIXELS(rect.y);
- int height = OS.PANGO_PIXELS(rect.height);
- if (ascent != -1 && descent != -1) {
- height = Math.max (height, ascent + descent);
- }
- int width = (flags & SWT.FULL_SELECTION) != 0 ? 0x7fffffff : height / 3;
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- Cairo.cairo_rectangle(cairo, lineX, lineY, width, height);
- Cairo.cairo_fill(cairo);
- } else {
- OS.gdk_draw_rectangle(data.drawable, gc.handle, 1, lineX, lineY, width, height);
- }
- }
- lineIndex++;
- } while (lineIndex < lineCount);
- OS.pango_layout_iter_free(iter);
- if (attrs !is null) OS.g_free(attrs);
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- Cairo.cairo_restore(cairo);
- } else {
- OS.gdk_gc_set_foreground(gc.handle, data.foreground);
- }
- }
- if (length == 0) return;
- if (!hasSelection) {
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- Cairo.cairo_move_to(cairo, x, y);
- OS.pango_cairo_show_layout(cairo, layout);
- } else {
- OS.gdk_draw_layout(data.drawable, gc.handle, x, y, layout);
- }
- } else {
- selectionStart = Math.min(Math.max(0, selectionStart), length - 1);
- selectionEnd = Math.min(Math.max(0, selectionEnd), length - 1);
- length = OS.g_utf8_strlen(OS.pango_layout_get_text(layout), -1);
- selectionStart = translateOffset(selectionStart);
- selectionEnd = translateOffset(selectionEnd);
- if (selectionForeground == null) selectionForeground = device.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
- if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
- bool fullSelection = selectionStart == 0 && selectionEnd == length - 1;
- if (fullSelection) {
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- auto ptr = OS.pango_layout_get_text(layout);
- drawWithCairo(cairo, x, y, 0, strlen(ptr), fullSelection, selectionBackground.handle, selectionForeground.handle);
- } else {
- OS.gdk_draw_layout_with_colors(data.drawable, gc.handle, x, y, layout, selectionForeground.handle, selectionBackground.handle);
- }
- } else {
- auto ptr = OS.pango_layout_get_text(layout);
- int byteSelStart = (OS.g_utf8_offset_to_pointer(ptr, selectionStart) - ptr);
- int byteSelEnd = (OS.g_utf8_offset_to_pointer(ptr, selectionEnd + 1) - ptr);
- int slen = strlen(ptr);
- byteSelStart = Math.min(byteSelStart, slen);
- byteSelEnd = Math.min(byteSelEnd, slen);
- if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
- drawWithCairo(cairo, x, y, byteSelStart, byteSelEnd, fullSelection, selectionBackground.handle, selectionForeground.handle);
- } else {
- Region clipping = new Region();
- gc.getClipping(clipping);
- OS.gdk_draw_layout(data.drawable, gc.handle, x, y, layout);
- int[] ranges = [byteSelStart, byteSelEnd];
- auto rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges.ptr, ranges.length / 2);
- if (rgn !is null) {
- OS.gdk_gc_set_clip_region(gc.handle, rgn);
- OS.gdk_region_destroy(rgn);
- }
- OS.gdk_draw_layout_with_colors(data.drawable, gc.handle, x, y, layout, selectionForeground.handle, selectionBackground.handle);
- gc.setClipping(clipping);
- clipping.dispose();
- }
- }
- }
+ checkLayout ();
+ computeRuns();
+ if (gc is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (gc.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (selectionForeground !is null && selectionForeground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (selectionBackground !is null && selectionBackground.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ gc.checkGC(GC.FOREGROUND);
+ int length = text.length;
+ bool hasSelection = selectionStart <= selectionEnd && selectionStart != -1 && selectionEnd != -1;
+ GCData data = gc.data;
+ auto cairo = data.cairo;
+ if (flags != 0 && (hasSelection || (flags & SWT.LAST_LINE_SELECTION) != 0)) {
+ PangoLogAttr* attrs;
+ int nAttrs;
+ PangoLogAttr* logAttr = new PangoLogAttr();
+ PangoRectangle* rect = new PangoRectangle();
+ int lineCount = OS.pango_layout_get_line_count(layout);
+ auto ptr = OS.pango_layout_get_text(layout);
+ auto iter = OS.pango_layout_get_iter(layout);
+ if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ Cairo.cairo_save(cairo);
+ GdkColor* color = selectionBackground.handle;
+ Cairo.cairo_set_source_rgba(cairo, (color.red & 0xFFFF) / cast(float)0xFFFF, (color.green & 0xFFFF) / cast(float)0xFFFF, (color.blue & 0xFFFF) / cast(float)0xFFFF, data.alpha / cast(float)0xFF);
+ } else {
+ OS.gdk_gc_set_foreground(gc.handle, selectionBackground.handle);
+ }
+ int lineIndex = 0;
+ do {
+ int lineEnd;
+ OS.pango_layout_iter_get_line_extents(iter, null, rect);
+ if (OS.pango_layout_iter_next_line(iter)) {
+ int bytePos = OS.pango_layout_iter_get_index(iter);
+ lineEnd = OS.g_utf8_pointer_to_offset(ptr, ptr + bytePos);
+ } else {
+ lineEnd = OS.g_utf8_strlen(ptr, -1);
+ }
+ bool extent = false;
+ if (lineIndex == lineCount - 1 && (flags & SWT.LAST_LINE_SELECTION) != 0) {
+ extent = true;
+ } else {
+ if (attrs is null) OS.pango_layout_get_log_attrs(layout, &attrs, &nAttrs);
+ *logAttr = attrs[lineEnd];
+ if (!( logAttr.bitfield0 & 0x01 /* PangoLogAttr.is_line_break is Bit0 */)) {
+ if (selectionStart <= lineEnd && lineEnd <= selectionEnd) extent = true;
+ } else {
+ if (selectionStart <= lineEnd && lineEnd < selectionEnd && (flags & SWT.FULL_SELECTION) != 0) {
+ extent = true;
+ }
+ }
+ }
+ if (extent) {
+ int lineX = x + OS.PANGO_PIXELS(rect.x) + OS.PANGO_PIXELS(rect.width);
+ int lineY = y + OS.PANGO_PIXELS(rect.y);
+ int height = OS.PANGO_PIXELS(rect.height);
+ if (ascent != -1 && descent != -1) {
+ height = Math.max (height, ascent + descent);
+ }
+ int width = (flags & SWT.FULL_SELECTION) != 0 ? 0x7fffffff : height / 3;
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ Cairo.cairo_rectangle(cairo, lineX, lineY, width, height);
+ Cairo.cairo_fill(cairo);
+ } else {
+ OS.gdk_draw_rectangle(data.drawable, gc.handle, 1, lineX, lineY, width, height);
+ }
+ }
+ lineIndex++;
+ } while (lineIndex < lineCount);
+ OS.pango_layout_iter_free(iter);
+ if (attrs !is null) OS.g_free(attrs);
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ Cairo.cairo_restore(cairo);
+ } else {
+ OS.gdk_gc_set_foreground(gc.handle, data.foreground);
+ }
+ }
+ if (length == 0) return;
+ if (!hasSelection) {
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ Cairo.cairo_move_to(cairo, x, y);
+ OS.pango_cairo_show_layout(cairo, layout);
+ } else {
+ OS.gdk_draw_layout(data.drawable, gc.handle, x, y, layout);
+ }
+ } else {
+ selectionStart = Math.min(Math.max(0, selectionStart), length - 1);
+ selectionEnd = Math.min(Math.max(0, selectionEnd), length - 1);
+ length = OS.g_utf8_strlen(OS.pango_layout_get_text(layout), -1);
+ selectionStart = translateOffset(selectionStart);
+ selectionEnd = translateOffset(selectionEnd);
+ if (selectionForeground == null) selectionForeground = device.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
+ if (selectionBackground == null) selectionBackground = device.getSystemColor(SWT.COLOR_LIST_SELECTION);
+ bool fullSelection = selectionStart == 0 && selectionEnd == length - 1;
+ if (fullSelection) {
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ auto ptr = OS.pango_layout_get_text(layout);
+ drawWithCairo(cairo, x, y, 0, strlen(ptr), fullSelection, selectionBackground.handle, selectionForeground.handle);
+ } else {
+ OS.gdk_draw_layout_with_colors(data.drawable, gc.handle, x, y, layout, selectionForeground.handle, selectionBackground.handle);
+ }
+ } else {
+ auto ptr = OS.pango_layout_get_text(layout);
+ int byteSelStart = (OS.g_utf8_offset_to_pointer(ptr, selectionStart) - ptr);
+ int byteSelEnd = (OS.g_utf8_offset_to_pointer(ptr, selectionEnd + 1) - ptr);
+ int slen = strlen(ptr);
+ byteSelStart = Math.min(byteSelStart, slen);
+ byteSelEnd = Math.min(byteSelEnd, slen);
+ if (cairo !is null && OS.GTK_VERSION >= OS.buildVERSION(2, 8, 0)) {
+ drawWithCairo(cairo, x, y, byteSelStart, byteSelEnd, fullSelection, selectionBackground.handle, selectionForeground.handle);
+ } else {
+ Region clipping = new Region();
+ gc.getClipping(clipping);
+ OS.gdk_draw_layout(data.drawable, gc.handle, x, y, layout);
+ int[] ranges = [byteSelStart, byteSelEnd];
+ auto rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges.ptr, ranges.length / 2);
+ if (rgn !is null) {
+ OS.gdk_gc_set_clip_region(gc.handle, rgn);
+ OS.gdk_region_destroy(rgn);
+ }
+ OS.gdk_draw_layout_with_colors(data.drawable, gc.handle, x, y, layout, selectionForeground.handle, selectionBackground.handle);
+ gc.setClipping(clipping);
+ clipping.dispose();
+ }
+ }
+ }
}
void drawWithCairo(cairo_t* cairo, int x, int y, int byteSelStart, int byteSelEnd, bool fullSelection, GdkColor* selectionBackground, GdkColor* selectionForeground) {
- Cairo.cairo_save(cairo);
- if (!fullSelection) {
- Cairo.cairo_move_to(cairo, x, y);
- OS.pango_cairo_show_layout(cairo, layout);
- }
- int[] ranges = [byteSelStart, byteSelEnd];
- auto rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges.ptr, ranges.length / 2);
- if (rgn !is null) {
- OS.gdk_cairo_region(cairo, rgn);
- Cairo.cairo_clip(cairo);
- OS.gdk_cairo_set_source_color(cairo, selectionBackground);
- Cairo.cairo_paint(cairo);
- OS.gdk_region_destroy(rgn);
- }
- OS.gdk_cairo_set_source_color(cairo, selectionForeground);
- Cairo.cairo_move_to(cairo, x, y);
- OS.pango_cairo_show_layout(cairo, layout);
- Cairo.cairo_restore(cairo);
+ Cairo.cairo_save(cairo);
+ if (!fullSelection) {
+ Cairo.cairo_move_to(cairo, x, y);
+ OS.pango_cairo_show_layout(cairo, layout);
+ }
+ int[] ranges = [byteSelStart, byteSelEnd];
+ auto rgn = OS.gdk_pango_layout_get_clip_region(layout, x, y, ranges.ptr, ranges.length / 2);
+ if (rgn !is null) {
+ OS.gdk_cairo_region(cairo, rgn);
+ Cairo.cairo_clip(cairo);
+ OS.gdk_cairo_set_source_color(cairo, selectionBackground);
+ Cairo.cairo_paint(cairo);
+ OS.gdk_region_destroy(rgn);
+ }
+ OS.gdk_cairo_set_source_color(cairo, selectionForeground);
+ Cairo.cairo_move_to(cairo, x, y);
+ OS.pango_cairo_show_layout(cairo, layout);
+ Cairo.cairo_restore(cairo);
}
void freeRuns() {
- if (attrList is null) return;
- OS.pango_layout_set_attributes(layout, null );
- OS.pango_attr_list_unref(attrList);
- attrList = null;
- invalidOffsets = null;
+ if (attrList is null) return;
+ OS.pango_layout_set_attributes(layout, null );
+ OS.pango_attr_list_unref(attrList);
+ attrList = null;
+ invalidOffsets = null;
}
/**
@@ -503,14 +503,14 @@
*
*/
public int getAlignment() {
- checkLayout();
- auto alignment = OS.pango_layout_get_alignment(layout);
- switch ( cast(int)alignment) {
- case OS.PANGO_ALIGN_CENTER: return SWT.CENTER;
- case OS.PANGO_ALIGN_RIGHT: return SWT.RIGHT;
+ checkLayout();
+ auto alignment = OS.pango_layout_get_alignment(layout);
+ switch ( cast(int)alignment) {
+ case OS.PANGO_ALIGN_CENTER: return SWT.CENTER;
+ case OS.PANGO_ALIGN_RIGHT: return SWT.RIGHT;
default:
- }
- return SWT.LEFT;
+ }
+ return SWT.LEFT;
}
/**
@@ -528,8 +528,8 @@
* @see #getLineMetrics(int)
*/
public int getAscent () {
- checkLayout();
- return ascent;
+ checkLayout();
+ return ascent;
}
/**
@@ -542,17 +542,17 @@
*
*/
public Rectangle getBounds() {
- checkLayout();
- computeRuns();
- int w, h;
- OS.pango_layout_get_size(layout, &w, &h);
- int wrapWidth = OS.pango_layout_get_width(layout);
- int width = OS.PANGO_PIXELS(wrapWidth != -1 ? wrapWidth : w);
- int height = OS.PANGO_PIXELS(h);
- if (ascent != -1 && descent != -1) {
- height = Math.max (height, ascent + descent);
- }
- return new Rectangle(0, 0, width, height);
+ checkLayout();
+ computeRuns();
+ int w, h;
+ OS.pango_layout_get_size(layout, &w, &h);
+ int wrapWidth = OS.pango_layout_get_width(layout);
+ int width = OS.PANGO_PIXELS(wrapWidth != -1 ? wrapWidth : w);
+ int height = OS.PANGO_PIXELS(h);
+ if (ascent != -1 && descent != -1) {
+ height = Math.max (height, ascent + descent);
+ }
+ return new Rectangle(0, 0, width, height);
}
/**
@@ -570,58 +570,58 @@
*
*/
public Rectangle getBounds(int start, int end) {
- checkLayout();
- computeRuns();
- int length = text.length;
- if (length == 0) return new Rectangle(0, 0, 0, 0);
- if (start > end) return new Rectangle(0, 0, 0, 0);
- start = Math.min(Math.max(0, start), length - 1);
- end = Math.min(Math.max(0, end), length - 1);
- start = translateOffset(start);
- end = translateOffset(end);
- auto ptr = OS.pango_layout_get_text(layout);
- int byteStart = (OS.g_utf8_offset_to_pointer (ptr, start) - ptr);
- int byteEnd = (OS.g_utf8_offset_to_pointer (ptr, end + 1) - ptr);
- int slen = strlen(ptr);
- byteStart = Math.min(byteStart, slen);
- byteEnd = Math.min(byteEnd, slen);
- int[] ranges = [byteStart, byteEnd];
- auto clipRegion = OS.gdk_pango_layout_get_clip_region(layout, 0, 0, ranges.ptr, 1);
- if (clipRegion is null) return new Rectangle(0, 0, 0, 0);
- GdkRectangle* rect = new GdkRectangle();
+ checkLayout();
+ computeRuns();
+ int length = text.length;
+ if (length == 0) return new Rectangle(0, 0, 0, 0);
+ if (start > end) return new Rectangle(0, 0, 0, 0);
+ start = Math.min(Math.max(0, start), length - 1);
+ end = Math.min(Math.max(0, end), length - 1);
+ start = translateOffset(start);
+ end = translateOffset(end);
+ auto ptr = OS.pango_layout_get_text(layout);
+ int byteStart = (OS.g_utf8_offset_to_pointer (ptr, start) - ptr);
+ int byteEnd = (OS.g_utf8_offset_to_pointer (ptr, end + 1) - ptr);
+ int slen = strlen(ptr);
+ byteStart = Math.min(byteStart, slen);
+ byteEnd = Math.min(byteEnd, slen);
+ int[] ranges = [byteStart, byteEnd];
+ auto clipRegion = OS.gdk_pango_layout_get_clip_region(layout, 0, 0, ranges.ptr, 1);
+ if (clipRegion is null) return new Rectangle(0, 0, 0, 0);
+ GdkRectangle* rect = new GdkRectangle();
- /*
- * Bug in Pango. The region returned by gdk_pango_layout_get_clip_region()
- * includes areas from lines outside of the requested range. The fix
- * is to subtract these areas from the clip region.
- */
- PangoRectangle* pangoRect = new PangoRectangle();
- auto iter = OS.pango_layout_get_iter(layout);
- if (iter is null) SWT.error(SWT.ERROR_NO_HANDLES);
- auto linesRegion = OS.gdk_region_new();
- if (linesRegion is null) SWT.error(SWT.ERROR_NO_HANDLES);
- int lineEnd = 0;
- do {
- OS.pango_layout_iter_get_line_extents(iter, null, pangoRect);
- if (OS.pango_layout_iter_next_line(iter)) {
- lineEnd = OS.pango_layout_iter_get_index(iter) - 1;
- } else {
- lineEnd = slen;
- }
- if (byteStart > lineEnd) continue;
- rect.x = OS.PANGO_PIXELS(pangoRect.x);
- rect.y = OS.PANGO_PIXELS(pangoRect.y);
- rect.width = OS.PANGO_PIXELS(pangoRect.width);
- rect.height = OS.PANGO_PIXELS(pangoRect.height);
- OS.gdk_region_union_with_rect(linesRegion, rect);
- } while (lineEnd + 1 <= byteEnd);
- OS.gdk_region_intersect(clipRegion, linesRegion);
- OS.gdk_region_destroy(linesRegion);
- OS.pango_layout_iter_free(iter);
+ /*
+ * Bug in Pango. The region returned by gdk_pango_layout_get_clip_region()
+ * includes areas from lines outside of the requested range. The fix
+ * is to subtract these areas from the clip region.
+ */
+ PangoRectangle* pangoRect = new PangoRectangle();
+ auto iter = OS.pango_layout_get_iter(layout);
+ if (iter is null) SWT.error(SWT.ERROR_NO_HANDLES);
+ auto linesRegion = OS.gdk_region_new();
+ if (linesRegion is null) SWT.error(SWT.ERROR_NO_HANDLES);
+ int lineEnd = 0;
+ do {
+ OS.pango_layout_iter_get_line_extents(iter, null, pangoRect);
+ if (OS.pango_layout_iter_next_line(iter)) {
+ lineEnd = OS.pango_layout_iter_get_index(iter) - 1;
+ } else {
+ lineEnd = slen;
+ }
+ if (byteStart > lineEnd) continue;
+ rect.x = OS.PANGO_PIXELS(pangoRect.x);
+ rect.y = OS.PANGO_PIXELS(pangoRect.y);
+ rect.width = OS.PANGO_PIXELS(pangoRect.width);
+ rect.height = OS.PANGO_PIXELS(pangoRect.height);
+ OS.gdk_region_union_with_rect(linesRegion, rect);
+ } while (lineEnd + 1 <= byteEnd);
+ OS.gdk_region_intersect(clipRegion, linesRegion);
+ OS.gdk_region_destroy(linesRegion);
+ OS.pango_layout_iter_free(iter);
- OS.gdk_region_get_clipbox(clipRegion, rect);
- OS.gdk_region_destroy(clipRegion);
- return new Rectangle(rect.x, rect.y, rect.width, rect.height);
+ OS.gdk_region_get_clipbox(clipRegion, rect);
+ OS.gdk_region_destroy(clipRegion);
+ return new Rectangle(rect.x, rect.y, rect.width, rect.height);
}
/**
@@ -639,8 +639,8 @@
* @see #getLineMetrics(int)
*/
public int getDescent () {
- checkLayout();
- return descent;
+ checkLayout();
+ return descent;
}
/**
@@ -654,8 +654,8 @@
*
*/
public Font getFont () {
- checkLayout();
- return font;
+ checkLayout();
+ return font;
}
/**
@@ -670,8 +670,8 @@
* @since 3.2
*/
public int getIndent () {
- checkLayout();
- return OS.PANGO_PIXELS(OS.pango_layout_get_indent(layout));
+ checkLayout();
+ return OS.PANGO_PIXELS(OS.pango_layout_get_indent(layout));
}
/**
@@ -686,8 +686,8 @@
* @since 3.2
*/
public bool getJustify () {
- checkLayout();
- return cast(bool) OS.pango_layout_get_justify(layout);
+ checkLayout();
+ return cast(bool) OS.pango_layout_get_justify(layout);
}
/**
@@ -705,33 +705,33 @@
* true
when the text layout is disposed and false
otherwise
*/
public bool isDisposed () {
- return layout is null;
+ return layout is null;
}
/**
@@ -1335,19 +1335,19 @@
* @see #setWidth(int)
*/
public void setAlignment (int alignment) {
- checkLayout();
- int mask = SWT.LEFT | SWT.CENTER | SWT.RIGHT;
- alignment &= mask;
- if (alignment == 0) return;
- if ((alignment & SWT.LEFT) != 0) alignment = SWT.LEFT;
- if ((alignment & SWT.RIGHT) != 0) alignment = SWT.RIGHT;
- int al = OS.PANGO_ALIGN_LEFT;
- switch (alignment) {
- case SWT.CENTER: al = OS.PANGO_ALIGN_CENTER; break;
- case SWT.RIGHT: al = OS.PANGO_ALIGN_RIGHT; break;
+ checkLayout();
+ int mask = SWT.LEFT | SWT.CENTER | SWT.RIGHT;
+ alignment &= mask;
+ if (alignment == 0) return;
+ if ((alignment & SWT.LEFT) != 0) alignment = SWT.LEFT;
+ if ((alignment & SWT.RIGHT) != 0) alignment = SWT.RIGHT;
+ int al = OS.PANGO_ALIGN_LEFT;
+ switch (alignment) {
+ case SWT.CENTER: al = OS.PANGO_ALIGN_CENTER; break;
+ case SWT.RIGHT: al = OS.PANGO_ALIGN_RIGHT; break;
default:
- }
- OS.pango_layout_set_alignment(layout, al);
+ }
+ OS.pango_layout_set_alignment(layout, al);
}
/**
@@ -1369,11 +1369,11 @@
* @see #getLineMetrics(int)
*/
public void setAscent (int ascent) {
- checkLayout();
- if (ascent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (this.ascent == ascent) return;
- freeRuns();
- this.ascent = ascent;
+ checkLayout();
+ if (ascent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (this.ascent == ascent) return;
+ freeRuns();
+ this.ascent = ascent;
}
/**
@@ -1395,11 +1395,11 @@
* @see #getLineMetrics(int)
*/
public void setDescent (int descent) {
- checkLayout();
- if (descent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (this.descent == descent) return;
- freeRuns();
- this.descent = descent;
+ checkLayout();
+ if (descent < -1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (this.descent == descent) return;
+ freeRuns();
+ this.descent = descent;
}
/**
@@ -1419,12 +1419,12 @@
*
*/
public void setFont (Font font) {
- checkLayout ();
- if (font !is null && font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- if (this.font is font) return;
- if (font !is null && font == this.font ) return;
- this.font = font;
- OS.pango_layout_set_font_description(layout, font !is null ? font.handle : null);
+ checkLayout ();
+ if (font !is null && font.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (this.font is font) return;
+ if (font !is null && font == this.font ) return;
+ this.font = font;
+ OS.pango_layout_set_font_description(layout, font !is null ? font.handle : null);
}
@@ -1441,9 +1441,9 @@
* @since 3.2
*/
public void setIndent (int indent) {
- checkLayout();
- if (indent < 0) return;
- OS.pango_layout_set_indent(layout, indent * OS.PANGO_SCALE);
+ checkLayout();
+ if (indent < 0) return;
+ OS.pango_layout_set_indent(layout, indent * OS.PANGO_SCALE);
}
/**
@@ -1459,8 +1459,8 @@
* @since 3.2
*/
public void setJustify (bool justify) {
- checkLayout();
- OS.pango_layout_set_justify(layout, justify);
+ checkLayout();
+ OS.pango_layout_set_justify(layout, justify);
}
/**
@@ -1474,15 +1474,15 @@
*
*/
public void setOrientation(int orientation) {
- checkLayout();
- int mask = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
- orientation &= mask;
- if (orientation == 0) return;
- if ((orientation & SWT.LEFT_TO_RIGHT) != 0) orientation = SWT.LEFT_TO_RIGHT;
- int baseDir = orientation == SWT.RIGHT_TO_LEFT ? OS.PANGO_DIRECTION_RTL : OS.PANGO_DIRECTION_LTR;
- if (OS.pango_context_get_base_dir(context) == baseDir) return;
- OS.pango_context_set_base_dir(context, baseDir);
- OS.pango_layout_context_changed(layout);
+ checkLayout();
+ int mask = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT;
+ orientation &= mask;
+ if (orientation == 0) return;
+ if ((orientation & SWT.LEFT_TO_RIGHT) != 0) orientation = SWT.LEFT_TO_RIGHT;
+ int baseDir = orientation == SWT.RIGHT_TO_LEFT ? OS.PANGO_DIRECTION_RTL : OS.PANGO_DIRECTION_LTR;
+ if (OS.pango_context_get_base_dir(context) == baseDir) return;
+ OS.pango_context_set_base_dir(context, baseDir);
+ OS.pango_layout_context_changed(layout);
}
/**
@@ -1499,9 +1499,9 @@
*
*/
public void setSpacing (int spacing) {
- checkLayout();
- if (spacing < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- OS.pango_layout_set_spacing(layout, spacing * OS.PANGO_SCALE);
+ checkLayout();
+ if (spacing < 0) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ OS.pango_layout_set_spacing(layout, spacing * OS.PANGO_SCALE);
}
/**
@@ -1523,19 +1523,19 @@
*
*/
public void setSegments(int[] segments) {
- checkLayout();
- if (this.segments == null && segments == null) return;
- if (this.segments != null && segments !=null) {
- if (this.segments.length == segments.length) {
- int i;
- for (i = 0; i null
if none
*/
public this (Font font, Color foreground, Color background) {
- if (font !is null && font.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- if (foreground !is null && foreground.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- if (background !is null && background.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
- this.font = font;
- this.foreground = foreground;
- this.background = background;
+ if (font !is null && font.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ if (foreground !is null && foreground.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ if (background !is null && background.isDisposed()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
+ this.font = font;
+ this.foreground = foreground;
+ this.background = background;
}
/**
@@ -110,24 +110,24 @@
* @see #hashCode()
*/
public override int opEquals(Object object) {
- if (object is this) return true;
- if (object is null) return false;
- if (!(cast(TextStyle)object)) return false;
- TextStyle style = cast(TextStyle)object;
- if (foreground !is null) {
- if ( foreground != style.foreground ) return false;
- } else if (style.foreground !is null) return false;
- if (background !is null) {
- if ( background != style.background ) return false;
- } else if (style.background !is null) return false;
- if (font !is null) {
- if (font != style.font) return false;
- } else if (style.font != null) return false;
- if (metrics != null || style.metrics !is null) return false;
- if (underline !is style.underline) return false;
- if (strikeout !is style.strikeout) return false;
- if (rise !is style.rise) return false;
- return true;
+ if (object is this) return true;
+ if (object is null) return false;
+ if (!(cast(TextStyle)object)) return false;
+ TextStyle style = cast(TextStyle)object;
+ if (foreground !is null) {
+ if ( foreground != style.foreground ) return false;
+ } else if (style.foreground !is null) return false;
+ if (background !is null) {
+ if ( background != style.background ) return false;
+ } else if (style.background !is null) return false;
+ if (font !is null) {
+ if (font != style.font) return false;
+ } else if (style.font != null) return false;
+ if (metrics != null || style.metrics !is null) return false;
+ if (underline !is style.underline) return false;
+ if (strikeout !is style.strikeout) return false;
+ if (rise !is style.rise) return false;
+ return true;
}
/**
@@ -141,15 +141,15 @@
* @see #equals(Object)
*/
public override hash_t toHash() {
- int hash = 0;
- if (foreground !is null) hash ^= foreground.toHash();
- if (background !is null) hash ^= background.toHash();
- if (font !is null) hash ^= font.toHash();
- if (metrics !is null) hash ^= metrics.toHash();
- if (underline) hash ^= hash;
- if (strikeout) hash ^= hash;
- hash ^= rise;
- return hash;
+ int hash = 0;
+ if (foreground !is null) hash ^= foreground.toHash();
+ if (background !is null) hash ^= background.toHash();
+ if (font !is null) hash ^= font.toHash();
+ if (metrics !is null) hash ^= metrics.toHash();
+ if (underline) hash ^= hash;
+ if (strikeout) hash ^= hash;
+ hash ^= rise;
+ return hash;
}
/**
@@ -159,43 +159,43 @@
* @return a string representation of the TextStyle
*/
public char[] toString () {
- char[] buffer = "TextStyle {";
- int startLength = buffer.length;
- if (font != null) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "font=";
- buffer ~= font.toString;
- }
- if (foreground != null) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "foreground=";
- buffer ~= foreground.toString;
- }
- if (background != null) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "background=";
- buffer ~= background.toString;
- }
- if (underline) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "underlined";
- }
- if (strikeout) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "striked out";
- }
- if (rise != 0) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "rise=";
- buffer ~= to!(char[])(rise);
- }
- if (metrics != null) {
- if (buffer.length > startLength) buffer ~= ", ";
- buffer ~= "metrics=";
- buffer ~= metrics.toString;
- }
- buffer ~= "}";
- return buffer;
+ char[] buffer = "TextStyle {";
+ int startLength = buffer.length;
+ if (font != null) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "font=";
+ buffer ~= font.toString;
+ }
+ if (foreground != null) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "foreground=";
+ buffer ~= foreground.toString;
+ }
+ if (background != null) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "background=";
+ buffer ~= background.toString;
+ }
+ if (underline) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "underlined";
+ }
+ if (strikeout) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "striked out";
+ }
+ if (rise != 0) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "rise=";
+ buffer ~= to!(char[])(rise);
+ }
+ if (metrics != null) {
+ if (buffer.length > startLength) buffer ~= ", ";
+ buffer ~= "metrics=";
+ buffer ~= metrics.toString;
+ }
+ buffer ~= "}";
+ return buffer;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/graphics/Transform.d
--- a/dwt/graphics/Transform.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/graphics/Transform.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -34,17 +34,17 @@
* @since 3.1
*/
public class Transform : Resource {
- /**
- * the OS resource for the Transform
- * (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 double[] handle; + /** + * the OS resource for the Transform + * (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 double[] handle; /** * Constructs a new identity Transform. @@ -69,7 +69,7 @@ * @see #dispose() */ public this (Device device) { - this(device, 1, 0, 0, 1, 0, 0); + this(device, 1, 0, 0, 1, 0, 0); } /** @@ -98,7 +98,7 @@ * @see #dispose() */ public this(Device device, float[] elements) { - this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]); + this (device, checkTransform(elements)[0], elements[1], elements[2], elements[3], elements[4], elements[5]); } /** @@ -131,20 +131,20 @@ * @see #dispose() */ public this (Device device, float m11, float m12, float m21, float m22, float dx, float dy) { - if (device is null) device = Device.getDevice(); - if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - this.device = device; - device.checkCairo(); - handle = new double[6]; - if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); - Cairo.cairo_matrix_init( cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy); - if (device.tracking) device.new_Object(this); + if (device is null) device = Device.getDevice(); + if (device is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.device = device; + device.checkCairo(); + handle = new double[6]; + if (handle is null) SWT.error(SWT.ERROR_NO_HANDLES); + Cairo.cairo_matrix_init( cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy); + if (device.tracking) device.new_Object(this); } static float[] checkTransform(float[] elements) { - if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - return elements; + if (elements == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + return elements; } /** @@ -153,11 +153,11 @@ * they allocate. */ public void dispose() { - if (handle is null) return; - if (device.isDisposed()) return; - handle = null; - if (device.tracking) device.dispose_Object(this); - device = null; + if (handle is null) return; + if (device.isDisposed()) return; + handle = null; + if (device.tracking) device.dispose_Object(this); + device = null; } /** @@ -175,15 +175,15 @@ * */ public void getElements(float[] elements) { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (elements is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); - if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT); - elements[0] = cast(float)handle[0]; - elements[1] = cast(float)handle[1]; - elements[2] = cast(float)handle[2]; - elements[3] = cast(float)handle[3]; - elements[4] = cast(float)handle[4]; - elements[5] = cast(float)handle[5]; + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (elements is null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (elements.length < 6) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + elements[0] = cast(float)handle[0]; + elements[1] = cast(float)handle[1]; + elements[2] = cast(float)handle[2]; + elements[3] = cast(float)handle[3]; + elements[4] = cast(float)handle[4]; + elements[5] = cast(float)handle[5]; } /** @@ -196,10 +196,10 @@ * */ public void invert() { - if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); - if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) != 0) { - SWT.error(SWT.ERROR_CANNOT_INVERT_MATRIX); - } + if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED); + if (Cairo.cairo_matrix_invert(cast(cairo_matrix_t*)handle.ptr) != 0) { + SWT.error(SWT.ERROR_CANNOT_INVERT_MATRIX); + } } /** @@ -213,7 +213,7 @@ * @returntrue
when the Transform is disposed, and false
otherwise
*/
public bool isDisposed() {
- return handle is null;
+ return handle is null;
}
/**
@@ -223,10 +223,10 @@
* @return true
if the receiver is an identity Transform, and false
otherwise
*/
public bool isIdentity() {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- float[] m = new float[6];
- getElements(m);
- return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0;
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ float[] m = new float[6];
+ getElements(m);
+ return m[0] == 1 && m[1] == 0 && m[2] == 0 && m[3] == 1 && m[4] == 0 && m[5] == 0;
}
/**
@@ -245,10 +245,10 @@
*
*/
public void multiply(Transform matrix) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (matrix == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- if (matrix.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr,cast(cairo_matrix_t*)matrix.handle.ptr, cast(cairo_matrix_t*)handle.ptr);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (matrix == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ if (matrix.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ Cairo.cairo_matrix_multiply(cast(cairo_matrix_t*)handle.ptr,cast(cairo_matrix_t*)matrix.handle.ptr, cast(cairo_matrix_t*)handle.ptr);
}
/**
@@ -265,8 +265,8 @@
*
*/
public void rotate(float angle) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_rotate(cast(cairo_matrix_t*)handle.ptr, angle * cast(float)Compatibility.PI / 180);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_rotate(cast(cairo_matrix_t*)handle.ptr, angle * cast(float)Compatibility.PI / 180);
}
/**
@@ -281,8 +281,8 @@
*
*/
public void scale(float scaleX, float scaleY) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_scale(cast(cairo_matrix_t*)handle.ptr, scaleX, scaleY);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_scale(cast(cairo_matrix_t*)handle.ptr, scaleX, scaleY);
}
/**
@@ -301,8 +301,8 @@
*
*/
public void setElements(float m11, float m12, float m21, float m22, float dx, float dy) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_init(cast(cairo_matrix_t*)handle.ptr, m11, m12, m21, m22, dx, dy);
}
/**
@@ -320,17 +320,17 @@
*
*/
public void transform(float[] pointArray) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
- double dx, dy;
- int length = pointArray.length / 2;
- for (int i = 0, j = 0; i < length; i++, j += 2) {
- dx = pointArray[j];
- dy = pointArray[j + 1];
- Cairo.cairo_matrix_transform_point(cast(cairo_matrix_t*)handle.ptr, &dx, &dy);
- pointArray[j] = cast(float)dx;
- pointArray[j + 1] = cast(float)dy;
- }
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ double dx, dy;
+ int length = pointArray.length / 2;
+ for (int i = 0, j = 0; i < length; i++, j += 2) {
+ dx = pointArray[j];
+ dy = pointArray[j + 1];
+ Cairo.cairo_matrix_transform_point(cast(cairo_matrix_t*)handle.ptr, &dx, &dy);
+ pointArray[j] = cast(float)dx;
+ pointArray[j + 1] = cast(float)dy;
+ }
}
/**
@@ -345,8 +345,8 @@
*
*/
public void translate(float offsetX, float offsetY) {
- if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
- Cairo.cairo_matrix_translate(cast(cairo_matrix_t*)handle.ptr, offsetX, offsetY);
+ if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
+ Cairo.cairo_matrix_translate(cast(cairo_matrix_t*)handle.ptr, offsetX, offsetY);
}
/**
@@ -356,10 +356,10 @@
* @return a string representation of the receiver
*/
public char[] toString() {
- if (isDisposed()) return "Transform {*DISPOSED*}";
- float[] elements = new float[6];
- getElements(elements);
- return Format( "Transform {{{}}", elements );
+ if (isDisposed()) return "Transform {*DISPOSED*}";
+ float[] elements = new float[6];
+ getElements(elements);
+ return Format( "Transform {{{}}", elements );
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/BidiUtil.d
--- a/dwt/internal/BidiUtil.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/BidiUtil.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -21,25 +21,25 @@
* emulated platforms.
*/
public class BidiUtil {
- // Keyboard language types
- public static const int KEYBOARD_NON_BIDI = 0;
- public static const int KEYBOARD_BIDI = 1;
+ // 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 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;
+ // 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.
@@ -57,19 +57,19 @@
*
*/
public static bool isBidiPlatform() {
- return false;
+ return false;
}
/*
* Not implemented.
*/
public static bool isKeyboardBidi() {
- return false;
+ return false;
}
/*
* Not implemented.
*/
public static int getFontBidiAttributes(GC gc) {
- return 0;
+ return 0;
}
/*
* Not implemented.
@@ -82,13 +82,13 @@
*
*/
public static char[] getRenderInfo(GC gc, char[] text, int[] order, byte[] classBuffer, int[] dx, int flags, int[] offsets) {
- return null;
+ return null;
}
/*
* Not implemented. Returns 0.
*/
public static int getKeyboardLanguage() {
- return 0;
+ return 0;
}
/*
* Not implemented.
@@ -104,6 +104,6 @@
* Not implemented.
*/
public static bool setOrientation(int /*long*/ hwnd, int orientation) {
- return false;
+ return false;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/Compatibility.d
--- a/dwt/internal/Compatibility.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/Compatibility.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -72,7 +72,7 @@
* @return the integer conversion of length * cos (angle)
*/
public static int cos(int angle, int length) {
- return cast(int)(Math.cos(angle * toRadians) * length);
+ return cast(int)(Math.cos(angle * toRadians) * length);
}
/**
@@ -89,7 +89,7 @@
* @return the integer conversion of length * sin (angle)
*/
public static int sin(int angle, int length) {
- return cast(int)(Math.sin(angle * toRadians) * length);
+ return cast(int)(Math.sin(angle * toRadians) * length);
}
/**
@@ -102,7 +102,7 @@
* @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);
+ return cast(int)Math.ceil(cast(float)p / q);
}
/**
@@ -115,7 +115,7 @@
* @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);
+ return cast(int)Math.floor(cast(double)p / q);
}
/**
@@ -132,7 +132,7 @@
* @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);
+ return cast(int)Math.round(cast(float)p / q);
}
/**
@@ -146,12 +146,12 @@
*
*/
public static int pow2(int n) {
- if (n >= 1 && n <= 30)
- return 2 << (n - 1);
- else if (n != 0) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- return 1;
+ if (n >= 1 && n <= 30)
+ return 2 << (n - 1);
+ else if (n != 0) {
+ SWT.error(SWT.ERROR_INVALID_RANGE);
+ }
+ return 1;
}
/**
@@ -162,7 +162,7 @@
* @exception IOException
*/
public static InputStream newFileInputStream(char[] filename) {
- return new FileInputStream(filename);
+ return new FileInputStream(filename);
}
/**
@@ -173,7 +173,7 @@
* @exception IOException
*/
public static OutputStream newFileOutputStream(char[] filename) {
- return new FileOutputStream(filename);
+ return new FileOutputStream(filename);
}
/**
@@ -186,7 +186,7 @@
* @since 3.3
*/
public static InflaterInputStream newInflaterInputStream(InputStream stream) {
- return new InflaterInputStream(stream);
+ return new InflaterInputStream(stream);
}
/**
@@ -196,7 +196,7 @@
* @return true when the character is a letter
*/
public static bool isLetter(dchar c) {
- return Unicode.isLetter(c);
+ return Unicode.isLetter(c);
}
/**
@@ -206,17 +206,17 @@
* @return true when the character is a letter or a digit
*/
public static bool isLetterOrDigit(dchar c) {
- return Unicode.isLetterOrDigit(c);
+ return Unicode.isLetterOrDigit(c);
}
/**
* Answers whether the character is a Unicode space character.
*
- * @param c the 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);
+ return Unicode.isSpace(c);
}
/**
@@ -226,7 +226,7 @@
* @return true if the character is whitespace
*/
public static bool isWhitespace(dchar c) {
- return Unicode.isWhitespace(c);
+ return Unicode.isWhitespace(c);
}
/**
@@ -275,47 +275,47 @@
* @see SWT#getMessage(String)
*/
public static String getMessage(String key) {
- String answer = key;
+ String answer = key;
- if (key == null) {
- SWT.error (SWT.ERROR_NULL_ARGUMENT);
- }
- if (msgs == null) {
- try {
- msgs = ResourceBundle.getBundle("dwt.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;
+ if (key == null) {
+ SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ }
+ if (msgs == null) {
+ try {
+ msgs = ResourceBundle.getBundle("dwt.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;
+ String answer = key;
- if (key == null || args == null) {
- SWT.error (SWT.ERROR_NULL_ARGUMENT);
- }
- if (msgs == null) {
- try {
- msgs = ResourceBundle.getBundle("dwt.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;
+ if (key == null || args == null) {
+ SWT.error (SWT.ERROR_NULL_ARGUMENT);
+ }
+ if (msgs == null) {
+ try {
+ msgs = ResourceBundle.getBundle("dwt.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;
}
++/
@@ -328,7 +328,7 @@
*/
public static void interrupt() {
//PORTING_FIXME: how to implement??
- //Thread.currentThread().interrupt();
+ //Thread.currentThread().interrupt();
}
/**
@@ -348,7 +348,7 @@
}
char[] s1c = Unicode.toFold( s1, s1b );
char[] s2c = Unicode.toFold( s2, s2b );
- return s1c == s2c;
+ return s1c == s2c;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/Converter.d
--- a/dwt/internal/Converter.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/Converter.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -38,9 +38,9 @@
*
*/
public final class Converter {
- public static const char [] NullByteArray = "\0";
- public static const char [] EmptyByteArray = "";
- public static const wchar [] EmptyCharArray = "";
+ 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
@@ -49,46 +49,46 @@
* @return the default code page
*/
public static char[] defaultCodePage () {
- return "UTF8";
+ 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){
+ 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;
+ 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);
+ 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) {
+ 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)];
+ 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;
+ g_free (ptr);
+ return bytes;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/LONG.d
--- a/dwt/internal/LONG.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/LONG.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -11,23 +11,23 @@
module dwt.internal.LONG;
public class LONG {
- public int /*long*/ value;
+ public int /*long*/ value;
- public this (int /*long*/ value) {
- this.value = value;
- }
+ public this (int /*long*/ value) {
+ this.value = value;
+ }
- public int opEquals (Object object) {
- if (object is this){
+ public int opEquals (Object object) {
+ if (object is this){
return true;
}
- if ( auto obj = cast(LONG)object ) {
+ if ( auto obj = cast(LONG)object ) {
return obj.value == this.value;
}
return false;
- }
+ }
- public int hashCode () {
- return /*64*/value;
- }
+ public int hashCode () {
+ return /*64*/value;
+ }
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/Library.d
--- a/dwt/internal/Library.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/Library.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -14,27 +14,27 @@
public class Library {
- /* SWT Version - Mmmm (M=major, mmm=minor) */
+ /* SWT Version - Mmmm (M=major, mmm=minor) */
- /**
- * SWT Major version number (must be >= 0)
- */
+ /**
+ * SWT Major version number (must be >= 0)
+ */
static const int MAJOR_VERSION = 3;
- /**
- * SWT Minor version number (must be in the range 0..999)
- */
+ /**
+ * 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;
+ /**
+ * SWT revision number (must be >= 0)
+ */
+ static const int REVISION = 0;
- /**
- * The JAVA and SWT versions
- */
- //public static const int JAVA_VERSION;
+ /**
+ * The JAVA and SWT versions
+ */
+ //public static const int JAVA_VERSION;
public static /*const*/ int SWT_VERSION;
version( linux ){
@@ -46,33 +46,33 @@
public static void static_this() {
- //SEPARATOR = System.getProperty("file.separator");
- //JAVA_VERSION = parseVersion(System.getProperty("java.version"));
- SWT_VERSION = buildSWT_VERSION(MAJOR_VERSION, MINOR_VERSION);
+ //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;
+ 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);
+ 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);
}
/**
@@ -84,7 +84,7 @@
* @return the version
*/
public static int buildJAVA_VERSION (int major, int minor, int micro) {
- return (major << 16) + (minor << 8) + micro;
+ return (major << 16) + (minor << 8) + micro;
}
/**
@@ -95,55 +95,55 @@
* @return the version
*/
public static int buildSWT_VERSION (int major, int minor) {
- return major * 1000 + 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;
+ 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;
+ try {
+ if (libName.indexOf (SEPARATOR) != -1) {
+ System.load (libName);
+ } else {
+ System.loadLibrary (libName);
+ }
+ return true;
+ } catch (UnsatisfiedLinkError e) {}
+ return false;
}
/**
@@ -158,7 +158,7 @@
* @param name the name of the library to load
*/
public static void loadLibrary (char[] name) {
- loadLibrary (name, true);
+ loadLibrary (name, true);
}
/**
@@ -175,58 +175,58 @@
*/
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;
- }
+ /* 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 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 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 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;
- }
+ /* 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$
+ /* 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 a5c274fa5af9 -r 8cec8f536af3 dwt/internal/Lock.d
--- a/dwt/internal/Lock.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/Lock.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -18,8 +18,8 @@
* Instance of this represent a recursive monitor.
*/
public class Lock {
- int count, waitCount;
- Thread owner;
+ int count, waitCount;
+ Thread owner;
Mutex mutex;
Condition cond;
@@ -35,22 +35,22 @@
* @return the lock count
*/
public int lock() {
- synchronized (mutex) {
- Thread current = Thread.getThis();
- if (owner !is current) {
- waitCount++;
- while (count > 0) {
- try {
- cond.wait();
- } catch (SyncException e) {
- /* Wait forever, just like synchronized blocks */
- }
- }
- --waitCount;
- owner = current;
- }
- return ++count;
- }
+ synchronized (mutex) {
+ Thread current = Thread.getThis();
+ if (owner !is current) {
+ waitCount++;
+ while (count > 0) {
+ try {
+ cond.wait();
+ } catch (SyncException e) {
+ /* Wait forever, just like synchronized blocks */
+ }
+ }
+ --waitCount;
+ owner = current;
+ }
+ return ++count;
+ }
}
/**
@@ -58,14 +58,14 @@
* the monitor owner, do nothing.
*/
public void unlock() {
- synchronized (mutex) {
- Thread current = Thread.getThis();
- if (owner is current) {
- if (--count is 0) {
- owner = null;
- if (waitCount > 0) cond.notifyAll();
- }
- }
- }
+ synchronized (mutex) {
+ Thread current = Thread.getThis();
+ if (owner is current) {
+ if (--count is 0) {
+ owner = null;
+ if (waitCount > 0) cond.notifyAll();
+ }
+ }
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/Platform.d
--- a/dwt/internal/Platform.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/Platform.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -17,8 +17,8 @@
import dwt.internal.Lock;
public class Platform {
- public static const char[] PLATFORM = "gtk"; //$NON-NLS-1$
- public static /*const*/ Lock lock;
+ public static const char[] PLATFORM = "gtk"; //$NON-NLS-1$
+ public static /*const*/ Lock lock;
public static void static_this() {
lock = new Lock();
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/SWTEventObject.d
--- a/dwt/internal/SWTEventObject.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/SWTEventObject.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -50,7 +50,7 @@
*/
public class SWTEventObject : EventObject {
- //static final long serialVersionUID = 3258125873411470903L;
+ //static final long serialVersionUID = 3258125873411470903L;
/**
* Constructs a new instance of this class.
@@ -58,6 +58,6 @@
* @param source the object which fired the event
*/
public this(Object source) {
- super(source);
+ super(source);
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/accessibility/gtk/ATK.d
--- a/dwt/internal/accessibility/gtk/ATK.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/accessibility/gtk/ATK.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* Copyright (c) 2000, 2006 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
@@ -87,67 +87,67 @@
public class ATK : OS {
- /** Constants */
- public static const int ATK_RELATION_LABELLED_BY = 4;
- public static const int ATK_ROLE_CHECK_BOX = 7;
- public static const int ATK_ROLE_COMBO_BOX = 11;
- public static const int ATK_ROLE_DIALOG = 16;
- public static const int ATK_ROLE_DRAWING_AREA = 18;
- public static const int ATK_ROLE_WINDOW = 68;
- public static const int ATK_ROLE_LABEL = 28;
- public static const int ATK_ROLE_LIST = 30;
- public static const int ATK_ROLE_LIST_ITEM = 31;
- public static const int ATK_ROLE_MENU = 32;
- public static const int ATK_ROLE_MENU_BAR = 33;
- public static const int ATK_ROLE_MENU_ITEM = 34;
- public static const int ATK_ROLE_PAGE_TAB = 36;
- public static const int ATK_ROLE_PAGE_TAB_LIST = 37;
- public static const int ATK_ROLE_PROGRESS_BAR = 41;
- public static const int ATK_ROLE_PUSH_BUTTON = 42;
- public static const int ATK_ROLE_RADIO_BUTTON = 43;
- public static const int ATK_ROLE_SCROLL_BAR = 47;
- public static const int ATK_ROLE_SEPARATOR = 49;
- public static const int ATK_ROLE_SLIDER = 50;
- public static const int ATK_ROLE_TABLE = 54;
- public static const int ATK_ROLE_TABLE_CELL = 55;
- public static const int ATK_ROLE_TABLE_COLUMN_HEADER = 56;
- public static const int ATK_ROLE_TABLE_ROW_HEADER = 57;
- public static const int ATK_ROLE_TEXT = 60;
- public static const int ATK_ROLE_TOOL_BAR = 62;
- public static const int ATK_ROLE_TOOL_TIP = 63;
- public static const int ATK_ROLE_TREE = 64;
- public static const int ATK_STATE_ARMED = 2;
- public static const int ATK_STATE_BUSY = 3;
- public static const int ATK_STATE_CHECKED = 4;
- public static const int ATK_STATE_DEFUNCT = 5;
- public static const int ATK_STATE_EDITABLE = 6;
- public static const int ATK_STATE_ENABLED = 7;
- public static const int ATK_STATE_EXPANDED = 9;
- public static const int ATK_STATE_FOCUSABLE = 10;
- public static const int ATK_STATE_FOCUSED = 11;
- public static const int ATK_STATE_MULTISELECTABLE = 16;
- public static const int ATK_STATE_PRESSED = 18;
- public static const int ATK_STATE_RESIZABLE = 19;
- public static const int ATK_STATE_SELECTABLE = 20;
- public static const int ATK_STATE_SELECTED = 21;
- public static const int ATK_STATE_SHOWING = 23;
- public static const int ATK_STATE_TRANSIENT = 26;
- public static const int ATK_STATE_VISIBLE = 28;
- public static const int ATK_TEXT_BOUNDARY_CHAR = 0;
- public static const int ATK_TEXT_BOUNDARY_WORD_START = 1;
- public static const int ATK_TEXT_BOUNDARY_WORD_END = 2;
- public static const int ATK_TEXT_BOUNDARY_SENTENCE_START = 3;
- public static const int ATK_TEXT_BOUNDARY_SENTENCE_END = 4;
- public static const int ATK_TEXT_BOUNDARY_LINE_START = 5;
- public static const int ATK_TEXT_BOUNDARY_LINE_END = 6;
- public static const int ATK_XY_WINDOW = 1;
+ /** Constants */
+ public static const int ATK_RELATION_LABELLED_BY = 4;
+ public static const int ATK_ROLE_CHECK_BOX = 7;
+ public static const int ATK_ROLE_COMBO_BOX = 11;
+ public static const int ATK_ROLE_DIALOG = 16;
+ public static const int ATK_ROLE_DRAWING_AREA = 18;
+ public static const int ATK_ROLE_WINDOW = 68;
+ public static const int ATK_ROLE_LABEL = 28;
+ public static const int ATK_ROLE_LIST = 30;
+ public static const int ATK_ROLE_LIST_ITEM = 31;
+ public static const int ATK_ROLE_MENU = 32;
+ public static const int ATK_ROLE_MENU_BAR = 33;
+ public static const int ATK_ROLE_MENU_ITEM = 34;
+ public static const int ATK_ROLE_PAGE_TAB = 36;
+ public static const int ATK_ROLE_PAGE_TAB_LIST = 37;
+ public static const int ATK_ROLE_PROGRESS_BAR = 41;
+ public static const int ATK_ROLE_PUSH_BUTTON = 42;
+ public static const int ATK_ROLE_RADIO_BUTTON = 43;
+ public static const int ATK_ROLE_SCROLL_BAR = 47;
+ public static const int ATK_ROLE_SEPARATOR = 49;
+ public static const int ATK_ROLE_SLIDER = 50;
+ public static const int ATK_ROLE_TABLE = 54;
+ public static const int ATK_ROLE_TABLE_CELL = 55;
+ public static const int ATK_ROLE_TABLE_COLUMN_HEADER = 56;
+ public static const int ATK_ROLE_TABLE_ROW_HEADER = 57;
+ public static const int ATK_ROLE_TEXT = 60;
+ public static const int ATK_ROLE_TOOL_BAR = 62;
+ public static const int ATK_ROLE_TOOL_TIP = 63;
+ public static const int ATK_ROLE_TREE = 64;
+ public static const int ATK_STATE_ARMED = 2;
+ public static const int ATK_STATE_BUSY = 3;
+ public static const int ATK_STATE_CHECKED = 4;
+ public static const int ATK_STATE_DEFUNCT = 5;
+ public static const int ATK_STATE_EDITABLE = 6;
+ public static const int ATK_STATE_ENABLED = 7;
+ public static const int ATK_STATE_EXPANDED = 9;
+ public static const int ATK_STATE_FOCUSABLE = 10;
+ public static const int ATK_STATE_FOCUSED = 11;
+ public static const int ATK_STATE_MULTISELECTABLE = 16;
+ public static const int ATK_STATE_PRESSED = 18;
+ public static const int ATK_STATE_RESIZABLE = 19;
+ public static const int ATK_STATE_SELECTABLE = 20;
+ public static const int ATK_STATE_SELECTED = 21;
+ public static const int ATK_STATE_SHOWING = 23;
+ public static const int ATK_STATE_TRANSIENT = 26;
+ public static const int ATK_STATE_VISIBLE = 28;
+ public static const int ATK_TEXT_BOUNDARY_CHAR = 0;
+ public static const int ATK_TEXT_BOUNDARY_WORD_START = 1;
+ public static const int ATK_TEXT_BOUNDARY_WORD_END = 2;
+ public static const int ATK_TEXT_BOUNDARY_SENTENCE_START = 3;
+ public static const int ATK_TEXT_BOUNDARY_SENTENCE_END = 4;
+ public static const int ATK_TEXT_BOUNDARY_LINE_START = 5;
+ public static const int ATK_TEXT_BOUNDARY_LINE_END = 6;
+ public static const int ATK_XY_WINDOW = 1;
- /** Signals */
- public static const char[] selection_changed = "selection_changed";
- public static const char[] text_changed_insert = "text_changed::insert";
- public static const char[] text_changed_delete = "text_changed::delete";
- public static const char[] text_caret_moved = "text_caret_moved";
- public static const char[] text_selection_changed = "text_selection_changed";
+ /** Signals */
+ public static const char[] selection_changed = "selection_changed";
+ public static const char[] text_changed_insert = "text_changed::insert";
+ public static const char[] text_changed_delete = "text_changed::delete";
+ public static const char[] text_caret_moved = "text_caret_moved";
+ public static const char[] text_selection_changed = "text_selection_changed";
mixin ForwardGtkAtkCFunc!(.ATK_ACTION_GET_IFACE );
mixin ForwardGtkAtkCFunc!(.ATK_COMPONENT_GET_IFACE);
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/cairo/Cairo.d
--- a/dwt/internal/cairo/Cairo.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/cairo/Cairo.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/* ***** BEGIN LICENSE BLOCK *****
+/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
@@ -71,52 +71,52 @@
public class Cairo : Platform {
- /** Constants */
- public static const int CAIRO_ANTIALIAS_DEFAULT = 0;
- public static const int CAIRO_ANTIALIAS_NONE = 1;
- public static const int CAIRO_ANTIALIAS_GRAY = 2;
- public static const int CAIRO_ANTIALIAS_SUBPIXEL = 3;
- public static const int CAIRO_FORMAT_ARGB32 = 0;
- public static const int CAIRO_FORMAT_RGB24 = 1;
- public static const int CAIRO_FORMAT_A8 = 2;
- public static const int CAIRO_FORMAT_A1 = 3;
- public static const int CAIRO_OPERATOR_CLEAR = 0;
- public static const int CAIRO_OPERATOR_SRC = 1;
- public static const int CAIRO_OPERATOR_DST = 2;
- public static const int CAIRO_OPERATOR_OVER = 3;
- public static const int CAIRO_OPERATOR_OVER_REVERSE = 4;
- public static const int CAIRO_OPERATOR_IN = 5;
- public static const int CAIRO_OPERATOR_IN_REVERSE = 6;
- public static const int CAIRO_OPERATOR_OUT = 7;
- public static const int CAIRO_OPERATOR_OUT_REVERSE = 8;
- public static const int CAIRO_OPERATOR_ATOP = 9;
- public static const int CAIRO_OPERATOR_ATOP_REVERSE = 10;
- public static const int CAIRO_OPERATOR_XOR = 11;
- public static const int CAIRO_OPERATOR_ADD = 12;
- public static const int CAIRO_OPERATOR_SATURATE = 13;
- public static const int CAIRO_FILL_RULE_WINDING = 0;
- public static const int CAIRO_FILL_RULE_EVEN_ODD = 1;
- public static const int CAIRO_LINE_CAP_BUTT = 0;
- public static const int CAIRO_LINE_CAP_ROUND = 1;
- public static const int CAIRO_LINE_CAP_SQUARE = 2;
- public static const int CAIRO_LINE_JOIN_MITER = 0;
- public static const int CAIRO_LINE_JOIN_ROUND = 1;
- public static const int CAIRO_LINE_JOIN_BEVEL = 2;
- public static const int CAIRO_FONT_SLANT_NORMAL = 0;
- public static const int CAIRO_FONT_SLANT_ITALIC = 1;
- public static const int CAIRO_FONT_SLANT_OBLIQUE = 2;
- public static const int CAIRO_FONT_WEIGHT_NORMAL = 0;
- public static const int CAIRO_FONT_WEIGHT_BOLD = 1;
- public static const int CAIRO_STATUS_SUCCESS = 0;
- public static const int CAIRO_STATUS_NO_MEMORY = 1;
- public static const int CAIRO_STATUS_INVALID_RESTORE = 2;
- public static const int CAIRO_STATUS_INVALID_POP_GROUP = 3;
- public static const int CAIRO_STATUS_NO_CURRENT_POINT = 4;
- public static const int CAIRO_STATUS_INVALID_MATRIX = 5;
- public static const int CAIRO_STATUS_NO_TARGET_SURFACE = 6;
- public static const int CAIRO_STATUS_NULL_POINTER =7;
- public static const int CAIRO_SURFACE_TYPE_IMAGE = 0;
- public static const int CAIRO_SURFACE_TYPE_PDF = 1;
+ /** Constants */
+ public static const int CAIRO_ANTIALIAS_DEFAULT = 0;
+ public static const int CAIRO_ANTIALIAS_NONE = 1;
+ public static const int CAIRO_ANTIALIAS_GRAY = 2;
+ public static const int CAIRO_ANTIALIAS_SUBPIXEL = 3;
+ public static const int CAIRO_FORMAT_ARGB32 = 0;
+ public static const int CAIRO_FORMAT_RGB24 = 1;
+ public static const int CAIRO_FORMAT_A8 = 2;
+ public static const int CAIRO_FORMAT_A1 = 3;
+ public static const int CAIRO_OPERATOR_CLEAR = 0;
+ public static const int CAIRO_OPERATOR_SRC = 1;
+ public static const int CAIRO_OPERATOR_DST = 2;
+ public static const int CAIRO_OPERATOR_OVER = 3;
+ public static const int CAIRO_OPERATOR_OVER_REVERSE = 4;
+ public static const int CAIRO_OPERATOR_IN = 5;
+ public static const int CAIRO_OPERATOR_IN_REVERSE = 6;
+ public static const int CAIRO_OPERATOR_OUT = 7;
+ public static const int CAIRO_OPERATOR_OUT_REVERSE = 8;
+ public static const int CAIRO_OPERATOR_ATOP = 9;
+ public static const int CAIRO_OPERATOR_ATOP_REVERSE = 10;
+ public static const int CAIRO_OPERATOR_XOR = 11;
+ public static const int CAIRO_OPERATOR_ADD = 12;
+ public static const int CAIRO_OPERATOR_SATURATE = 13;
+ public static const int CAIRO_FILL_RULE_WINDING = 0;
+ public static const int CAIRO_FILL_RULE_EVEN_ODD = 1;
+ public static const int CAIRO_LINE_CAP_BUTT = 0;
+ public static const int CAIRO_LINE_CAP_ROUND = 1;
+ public static const int CAIRO_LINE_CAP_SQUARE = 2;
+ public static const int CAIRO_LINE_JOIN_MITER = 0;
+ public static const int CAIRO_LINE_JOIN_ROUND = 1;
+ public static const int CAIRO_LINE_JOIN_BEVEL = 2;
+ public static const int CAIRO_FONT_SLANT_NORMAL = 0;
+ public static const int CAIRO_FONT_SLANT_ITALIC = 1;
+ public static const int CAIRO_FONT_SLANT_OBLIQUE = 2;
+ public static const int CAIRO_FONT_WEIGHT_NORMAL = 0;
+ public static const int CAIRO_FONT_WEIGHT_BOLD = 1;
+ public static const int CAIRO_STATUS_SUCCESS = 0;
+ public static const int CAIRO_STATUS_NO_MEMORY = 1;
+ public static const int CAIRO_STATUS_INVALID_RESTORE = 2;
+ public static const int CAIRO_STATUS_INVALID_POP_GROUP = 3;
+ public static const int CAIRO_STATUS_NO_CURRENT_POINT = 4;
+ public static const int CAIRO_STATUS_INVALID_MATRIX = 5;
+ public static const int CAIRO_STATUS_NO_TARGET_SURFACE = 6;
+ public static const int CAIRO_STATUS_NULL_POINTER =7;
+ public static const int CAIRO_SURFACE_TYPE_IMAGE = 0;
+ public static const int CAIRO_SURFACE_TYPE_PDF = 1;
public static const int CAIRO_SURFACE_TYPE_PS = 2;
public static const int CAIRO_SURFACE_TYPE_XLIB = 3;
public static const int CAIRO_SURFACE_TYPE_XCB = 4;
@@ -126,20 +126,20 @@
public static const int CAIRO_SURFACE_TYPE_BEOS = 8;
public static const int CAIRO_SURFACE_TYPE_DIRECTFB = 9;
public static const int CAIRO_SURFACE_TYPE_SVG = 10;
- public static const int CAIRO_FILTER_FAST = 0;
- public static const int CAIRO_FILTER_GOOD = 1;
- public static const int CAIRO_FILTER_BEST = 2;
- public static const int CAIRO_FILTER_NEAREST = 3;
- public static const int CAIRO_FILTER_BILINEAR = 4;
- public static const int CAIRO_FILTER_GAUSSIAN = 5;
- public static const int CAIRO_EXTEND_NONE = 0;
- public static const int CAIRO_EXTEND_REPEAT = 1;
- public static const int CAIRO_EXTEND_REFLECT = 2;
- public static const int CAIRO_EXTEND_PAD = 3;
- public static const int CAIRO_PATH_MOVE_TO = 0;
- public static const int CAIRO_PATH_LINE_TO = 1;
- public static const int CAIRO_PATH_CURVE_TO = 2;
- public static const int CAIRO_PATH_CLOSE_PATH = 3;
+ public static const int CAIRO_FILTER_FAST = 0;
+ public static const int CAIRO_FILTER_GOOD = 1;
+ public static const int CAIRO_FILTER_BEST = 2;
+ public static const int CAIRO_FILTER_NEAREST = 3;
+ public static const int CAIRO_FILTER_BILINEAR = 4;
+ public static const int CAIRO_FILTER_GAUSSIAN = 5;
+ public static const int CAIRO_EXTEND_NONE = 0;
+ public static const int CAIRO_EXTEND_REPEAT = 1;
+ public static const int CAIRO_EXTEND_REFLECT = 2;
+ public static const int CAIRO_EXTEND_PAD = 3;
+ public static const int CAIRO_PATH_MOVE_TO = 0;
+ public static const int CAIRO_PATH_LINE_TO = 1;
+ public static const int CAIRO_PATH_CURVE_TO = 2;
+ public static const int CAIRO_PATH_CLOSE_PATH = 3;
mixin ForwardGtkCairoCFunc!(.CAIRO_VERSION_ENCODE);
mixin ForwardGtkCairoCFunc!(.cairo_append_path);
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/gtk/OS.d
--- a/dwt/internal/gtk/OS.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/gtk/OS.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -245,470 +245,470 @@
public class OS : Platform {
/** OS Constants */
- public static /*const*/ bool IsAIX, IsSunOS, IsLinux, IsHPUX;
- public static void 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;
+ public static /*const*/ bool IsAIX, IsSunOS, IsLinux, IsHPUX;
+ public static void 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 = 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;
+ /** 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";
+ /** 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";
+ /** 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());
+ public static /*const*/ int GTK_VERSION;// see static ctor = buildVERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version());
public static int buildVERSION(int major, int minor, int micro) {
- return (major << 16) + (minor << 8) + micro;
+ return (major << 16) + (minor << 8) + micro;
}
/++
@@ -908,7 +908,7 @@
mixin ForwardGtkOsCFunc!(.g_malloc);
mixin ForwardGtkOsCFunc!(.g_object_get1);
mixin ForwardGtkOsCFunc!(.g_object_get_qdata);
- mixin ForwardGtkOsCFunc!(.g_object_new );
+ mixin ForwardGtkOsCFunc!(.g_object_new);
mixin ForwardGtkOsCFunc!(.g_object_ref);
mixin ForwardGtkOsCFunc!(.g_object_set);
mixin ForwardGtkOsCFunc!(.g_object_set);
@@ -2084,7 +2084,7 @@
{
lock.lock();
scope(exit) lock.unlock();
- return cast(bool)g_type_check_instance_is_a( arg0, gtk_button_get_type() );
+ return cast(bool)g_type_check_instance_is_a( arg0, gtk_button_get_type() );
}
static bool GTK_IS_WINDOW( GTypeInstance* arg0 )
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/gtk/runtime/Loader.d
--- a/dwt/internal/gtk/runtime/Loader.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/gtk/runtime/Loader.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,20 +1,20 @@
-/*****************************************************************************
+/*****************************************************************************
- license:
+ license:
- version:
+ version:
- Dynamic loader for gtk symbol names
+ Dynamic loader for gtk symbol names
- History: 2004-12-11 initial version by John Reimer
- 2005-02-21 class and symbol names change; versioning modification
- 2005-05-05 linux fixes
- 2007-12-23 source cleanup
- 2007-12-30 merge Paths.d into Loader.d
+ History: 2004-12-11 initial version by John Reimer
+ 2005-02-21 class and symbol names change; versioning modification
+ 2005-05-05 linux fixes
+ 2007-12-23 source cleanup
+ 2007-12-30 merge Paths.d into Loader.d
2008-01-05 Tango only version using tango.sys.SharedLib
- Note: Design inspired by Kris Bell's ICU.d, the dynamic loader from
- an early version of mango
+ Note: Design inspired by Kris Bell's ICU.d, the dynamic loader from
+ an early version of mango
******************************************************************************/
@@ -29,26 +29,26 @@
enum LIBRARY
{
- ATK,
- CAIRO,
- GDK,
- GDKPIXBUF,
- GLIB,
- GMODULE,
- GOBJECT,
- GTHREAD,
- GTK,
- PANGO,
- GLGDK,
- GLGTK,
- GL,
- GLU,
- GLEXT,
- GDA,
- GLADE,
- GSV,
- GSTREAMER,
- GSTINTERFACES
+ ATK,
+ CAIRO,
+ GDK,
+ GDKPIXBUF,
+ GLIB,
+ GMODULE,
+ GOBJECT,
+ GTHREAD,
+ GTK,
+ PANGO,
+ GLGDK,
+ GLGTK,
+ GL,
+ GLU,
+ GLEXT,
+ GDA,
+ GLADE,
+ GSV,
+ GSTREAMER,
+ GSTINTERFACES
}
/*****************************************************************************
@@ -57,27 +57,27 @@
version (Windows)
{
- const char[][LIBRARY.max+1] importLibs = [
- LIBRARY.ATK: "libatk-1.0-0.dll",
- LIBRARY.CAIRO: "libcairo-2.dll",
- LIBRARY.GDK: "libgdk-win32-2.0-0.dll",
- LIBRARY.GDKPIXBUF: "libgdk_pixbuf-2.0-0.dll",
- LIBRARY.GLIB: "libglib-2.0-0.dll",
- LIBRARY.GMODULE: "libgmodule-2.0-0.dll",
- LIBRARY.GOBJECT: "libgobject-2.0-0.dll",
- LIBRARY.GTHREAD: "libgthread-2.0-0.dll",
- LIBRARY.GTK: "libgtk-win32-2.0-0.dll",
- LIBRARY.PANGO: "libpango-1.0-0.dll",
- LIBRARY.GLGDK: "libgdkglext-win32-1.0-0.dll",
- LIBRARY.GLGTK: "libgtkglext-win32-1.0-0.dll",
- LIBRARY.GL: "opengl32.dll",
- LIBRARY.GLU: "glu32.dll",
- LIBRARY.GDA: "libgda-2.dll",
- LIBRARY.GLADE: "libglade-2.0.dll",
- LIBRARY.GSV: "libgtksourceview-1.0-0.dll",
- LIBRARY.GSTREAMER: "libgstreamer-0.10.dll",
- LIBRARY.GSTINTERFACES: "libgstinterfaces-0.10.dll"
- ];
+ const char[][LIBRARY.max+1] importLibs = [
+ LIBRARY.ATK: "libatk-1.0-0.dll",
+ LIBRARY.CAIRO: "libcairo-2.dll",
+ LIBRARY.GDK: "libgdk-win32-2.0-0.dll",
+ LIBRARY.GDKPIXBUF: "libgdk_pixbuf-2.0-0.dll",
+ LIBRARY.GLIB: "libglib-2.0-0.dll",
+ LIBRARY.GMODULE: "libgmodule-2.0-0.dll",
+ LIBRARY.GOBJECT: "libgobject-2.0-0.dll",
+ LIBRARY.GTHREAD: "libgthread-2.0-0.dll",
+ LIBRARY.GTK: "libgtk-win32-2.0-0.dll",
+ LIBRARY.PANGO: "libpango-1.0-0.dll",
+ LIBRARY.GLGDK: "libgdkglext-win32-1.0-0.dll",
+ LIBRARY.GLGTK: "libgtkglext-win32-1.0-0.dll",
+ LIBRARY.GL: "opengl32.dll",
+ LIBRARY.GLU: "glu32.dll",
+ LIBRARY.GDA: "libgda-2.dll",
+ LIBRARY.GLADE: "libglade-2.0.dll",
+ LIBRARY.GSV: "libgtksourceview-1.0-0.dll",
+ LIBRARY.GSTREAMER: "libgstreamer-0.10.dll",
+ LIBRARY.GSTINTERFACES: "libgstinterfaces-0.10.dll"
+ ];
}
/*****************************************************************************
@@ -86,28 +86,28 @@
version(linux)
{
- const char[][LIBRARY.max+1] importLibs = [
- LIBRARY.ATK: "libatk-1.0.so",
- LIBRARY.CAIRO: "libcairo.so.2",
- LIBRARY.GDK: "libgdk-x11-2.0.so",
- LIBRARY.GDKPIXBUF: "libgdk_pixbuf-2.0.so",
- LIBRARY.GLIB: "libglib-2.0.so",
- LIBRARY.GMODULE: "libgmodule-2.0.so",
- LIBRARY.GOBJECT: "libgobject-2.0.so",
- LIBRARY.GTHREAD: "libgthread-2.0.so",
- LIBRARY.GTK: "libgtk-x11-2.0.so",
- LIBRARY.PANGO: "libpango-1.0.so",
- LIBRARY.GLGDK: "libgdkglext-x11-1.0.so",
- LIBRARY.GLGTK: "libgtkglext-x11-1.0.so",
- LIBRARY.GL: "libGL.so",
- LIBRARY.GLU: "libGLU.so",
- LIBRARY.GLEXT: "libGL.so",
- LIBRARY.GDA: "libgda-2.so.3",
- LIBRARY.GLADE: "libglade-2.0.so",
- LIBRARY.GSV: "libgtksourceview-1.0.so",
- LIBRARY.GSTREAMER: "libgstreamer-0.10.so",
- LIBRARY.GSTINTERFACES: "libgstinterfaces-0.10.so"
- ];
+ const char[][LIBRARY.max+1] importLibs = [
+ LIBRARY.ATK: "libatk-1.0.so",
+ LIBRARY.CAIRO: "libcairo.so.2",
+ LIBRARY.GDK: "libgdk-x11-2.0.so",
+ LIBRARY.GDKPIXBUF: "libgdk_pixbuf-2.0.so",
+ LIBRARY.GLIB: "libglib-2.0.so",
+ LIBRARY.GMODULE: "libgmodule-2.0.so",
+ LIBRARY.GOBJECT: "libgobject-2.0.so",
+ LIBRARY.GTHREAD: "libgthread-2.0.so",
+ LIBRARY.GTK: "libgtk-x11-2.0.so",
+ LIBRARY.PANGO: "libpango-1.0.so",
+ LIBRARY.GLGDK: "libgdkglext-x11-1.0.so",
+ LIBRARY.GLGTK: "libgtkglext-x11-1.0.so",
+ LIBRARY.GL: "libGL.so",
+ LIBRARY.GLU: "libGLU.so",
+ LIBRARY.GLEXT: "libGL.so",
+ LIBRARY.GDA: "libgda-2.so.3",
+ LIBRARY.GLADE: "libglade-2.0.so",
+ LIBRARY.GSV: "libgtksourceview-1.0.so",
+ LIBRARY.GSTREAMER: "libgstreamer-0.10.so",
+ LIBRARY.GSTINTERFACES: "libgstinterfaces-0.10.so"
+ ];
}
/*****************************************************************************
@@ -119,206 +119,206 @@
version(Windows)
{
- char[] getLibraryPath()
- {
- return "\\Program Files\\GTK2-Runtime\\lib\\";
- }
+ char[] getLibraryPath()
+ {
+ return "\\Program Files\\GTK2-Runtime\\lib\\";
+ }
}
/*****************************************************************************
- getLibraryPath is empty for linux because default path is known by ld
+ getLibraryPath is empty for linux because default path is known by ld
******************************************************************************/
version(linux)
{
- char[] getLibraryPath() { return ""; }
+ char[] getLibraryPath() { return ""; }
}
/*****************************************************************************
- ProcLink is used to record the library, function, and function name
- that will be loaded by the dynamic loader.
+ ProcLink is used to record the library, function, and function name
+ that will be loaded by the dynamic loader.
******************************************************************************/
public struct Symbol
{
- char[] name;
- void** pointer;
+ char[] name;
+ void** pointer;
}
/*****************************************************************************
- The Linker class: handles loading of the library and exported functions
+ The Linker class: handles loading of the library and exported functions
******************************************************************************/
public class Linker
{
- static char[][][char[]] loadFailures;
+ static char[][][char[]] loadFailures;
- /*************************************************************************
+ /*************************************************************************
- Gets all the failed loads for a specific library. This is filled in
- only if the default onFailure method is used during load.
+ Gets all the failed loads for a specific library. This is filled in
+ only if the default onFailure method is used during load.
- returns: an array of the names that failed to load for a specific
- library or null if none was found.
+ returns: an array of the names that failed to load for a specific
+ library or null if none was found.
- **************************************************************************/
+ **************************************************************************/
- public static char[][] getLoadFailures(char[] libName)
- {
- if ( libName in loadFailures )
- {
- return loadFailures[libName];
- }
- else
- {
- return null;
- }
- }
+ public static char[][] getLoadFailures(char[] libName)
+ {
+ if ( libName in loadFailures )
+ {
+ return loadFailures[libName];
+ }
+ else
+ {
+ return null;
+ }
+ }
- /*************************************************************************
+ /*************************************************************************
- Loads all libraries. This is filled in only if the default onFailure
- method is used during load.
+ Loads all libraries. This is filled in only if the default onFailure
+ method is used during load.
- returns: an array of the library names.
+ returns: an array of the library names.
- **************************************************************************/
+ **************************************************************************/
- public static char[][] getLoadLibraries()
- {
- return loadFailures.keys;
- }
+ public static char[][] getLoadLibraries()
+ {
+ return loadFailures.keys;
+ }
- /*************************************************************************
+ /*************************************************************************
- isPerfectLoad -- Checks if any symbol failed to load.
- Returns: true if ALL symbols loaded.
+ isPerfectLoad -- Checks if any symbol failed to load.
+ Returns: true if ALL symbols loaded.
- **************************************************************************/
+ **************************************************************************/
- public static bool isPerfectLoad()
- {
- return loadFailures.keys.length == 0;
- }
+ public static bool isPerfectLoad()
+ {
+ return loadFailures.keys.length == 0;
+ }
- /*************************************************************************
+ /*************************************************************************
- **************************************************************************/
+ **************************************************************************/
- public static void dumpFailedLoads()
- {
- foreach ( char[] lib ; Linker.getLoadLibraries() )
- {
- foreach ( char[] symbol ; Linker.getLoadFailures(lib) )
- {
- version(Tango)
- Stdout.formatln("failed ({}) {}", lib, symbol).newline;
- }
- }
- }
+ public static void dumpFailedLoads()
+ {
+ foreach ( char[] lib ; Linker.getLoadLibraries() )
+ {
+ foreach ( char[] symbol ; Linker.getLoadFailures(lib) )
+ {
+ version(Tango)
+ Stdout.formatln("failed ({}) {}", lib, symbol).newline;
+ }
+ }
+ }
- /*************************************************************************
+ /*************************************************************************
- **************************************************************************/
+ **************************************************************************/
- private SharedLib primaryLib;
- private SharedLib alternateLib;
+ private SharedLib primaryLib;
+ private SharedLib alternateLib;
- private char[] libraryName;
- private char[] alternateLibraryName;
+ private char[] libraryName;
+ private char[] alternateLibraryName;
- alias void function( char[] libraryName, char[] symbolName, char[] message=null) FailureCallback;
+ alias void function( char[] libraryName, char[] symbolName, char[] message=null) FailureCallback;
- private FailureCallback onLoadFailure;
+ private FailureCallback onLoadFailure;
- /*************************************************************************
+ /*************************************************************************
- **************************************************************************/
+ **************************************************************************/
- this( char[] libraryName, char[] alternateLibraryName=null )
- {
- this(libraryName, alternateLibraryName, &(Linker.defaultFail));
- }
+ this( char[] libraryName, char[] alternateLibraryName=null )
+ {
+ this(libraryName, alternateLibraryName, &(Linker.defaultFail));
+ }
- /*************************************************************************
+ /*************************************************************************
- **************************************************************************/
+ **************************************************************************/
- this (char[] libraryName, char[] alternateLibraryName, FailureCallback fn )
- {
- this.libraryName = libraryName;
- this.alternateLibraryName = alternateLibraryName;
- onLoadFailure = fn;
+ this (char[] libraryName, char[] alternateLibraryName, FailureCallback fn )
+ {
+ this.libraryName = libraryName;
+ this.alternateLibraryName = alternateLibraryName;
+ onLoadFailure = fn;
SharedLib.throwExceptions = false;
- primaryLib = SharedLib.load( this.libraryName );
+ primaryLib = SharedLib.load( this.libraryName );
version(linux)
{
if (this.primaryLib is null)
primaryLib = SharedLib.load( this.libraryName ~ ".0\0" );
}
-
+
if ( alternateLibraryName !is null )
- {
- alternateLib = SharedLib.load( this.alternateLibraryName );
- }
-
- if (primaryLib is null)
- {
- throw new Exception("Library load failed: " ~ libraryName);
- }
- }
+ {
+ alternateLib = SharedLib.load( this.alternateLibraryName );
+ }
+
+ if (primaryLib is null)
+ {
+ throw new Exception("Library load failed: " ~ libraryName);
+ }
+ }
- /*************************************************************************
+ /*************************************************************************
- Default load failure callback. Logs the symbols that failed to load.
+ Default load failure callback. Logs the symbols that failed to load.
- **************************************************************************/
+ **************************************************************************/
- static void defaultFail( char[] libraryName, char[] symbolName, char[] message=null )
- {
- if ( !(libraryName in loadFailures) )
- {
- char[][] cc;
- loadFailures[libraryName] = cc;
- }
+ static void defaultFail( char[] libraryName, char[] symbolName, char[] message=null )
+ {
+ if ( !(libraryName in loadFailures) )
+ {
+ char[][] cc;
+ loadFailures[libraryName] = cc;
+ }
- loadFailures[libraryName] ~= symbolName.dup;
- }
+ loadFailures[libraryName] ~= symbolName.dup;
+ }
- /*************************************************************************
+ /*************************************************************************
- Loads all the symbols for this library.
+ Loads all the symbols for this library.
- **************************************************************************/
+ **************************************************************************/
- void link( inout Symbol[] symbols )
- {
- foreach( Symbol link; symbols )
- {
- *link.pointer = primaryLib.getSymbol ( (link.name~"\0").ptr);
+ void link( inout Symbol[] symbols )
+ {
+ foreach( Symbol link; symbols )
+ {
+ *link.pointer = primaryLib.getSymbol ( (link.name~"\0").ptr);
- if (*link.pointer is null)
- {
- if ( alternateLib !is null )
- {
- *link.pointer = alternateLib.getSymbol( (link.name~"\0").ptr);
+ if (*link.pointer is null)
+ {
+ if ( alternateLib !is null )
+ {
+ *link.pointer = alternateLib.getSymbol( (link.name~"\0").ptr);
Stdout("Loader.Linker.link trying alternate lib: ", link.name).newline;
}
- if (*link.pointer is null)
- {
- onLoadFailure( libraryName, link.name );
- }
- }
- }
- }
+ if (*link.pointer is null)
+ {
+ onLoadFailure( libraryName, link.name );
+ }
+ }
+ }
+ }
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/image/FileFormat.d
--- a/dwt/internal/image/FileFormat.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/image/FileFormat.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -37,14 +37,14 @@
*
*/
public abstract class FileFormat {
- static const char[] FORMAT_PACKAGE = "dwt.internal.image"; //$NON-NLS-1$
- static const char[] FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$
- static const char[][] FORMATS = [ "WinBMP"[], "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP" ]; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$
+ static const char[] FORMAT_PACKAGE = "dwt.internal.image"; //$NON-NLS-1$
+ static const char[] FORMAT_SUFFIX = "FileFormat"; //$NON-NLS-1$
+ static const char[][] FORMATS = [ "WinBMP"[], "WinBMP", "GIF", "WinICO", "JPEG", "PNG", "TIFF", "OS2BMP" ]; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$
alias Tuple!( WinBMPFileFormat, WinBMPFileFormat, GIFFileFormat, WinICOFileFormat, JPEGFileFormat, PNGFileFormat, TIFFFileFormat, OS2BMPFileFormat ) TFormats;
- LEDataInputStream inputStream;
- LEDataOutputStream outputStream;
- ImageLoader loader;
- int compression;
+ LEDataInputStream inputStream;
+ LEDataOutputStream outputStream;
+ ImageLoader loader;
+ int compression;
/**
* Return whether or not the specified input stream
@@ -59,16 +59,16 @@
* device independent image array represented by the stream.
*/
public ImageData[] loadFromStream(LEDataInputStream stream) {
- try {
- inputStream = stream;
- return loadFromByteStream();
+ try {
+ inputStream = stream;
+ return loadFromByteStream();
} catch (IOException e) {
SWT.error(SWT.ERROR_IO, e);
return null;
} catch (TracedException e) {
SWT.error(SWT.ERROR_INVALID_IMAGE, e);
- return null;
- }
+ return null;
+ }
}
/**
@@ -76,9 +76,9 @@
* return the device independent image array represented by the stream.
*/
public static ImageData[] load(InputStream istr, ImageLoader loader) {
- FileFormat fileFormat = null;
- LEDataInputStream stream = new LEDataInputStream(istr);
- bool isSupported = false;
+ FileFormat fileFormat = null;
+ LEDataInputStream stream = new LEDataInputStream(istr);
+ bool isSupported = false;
foreach( TFormat; TFormats ){
try{
fileFormat = new TFormat();
@@ -89,9 +89,9 @@
} catch (TracedException e) {
}
}
- if (!isSupported) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- fileFormat.loader = loader;
- return fileFormat.loadFromStream(stream);
+ if (!isSupported) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
+ fileFormat.loader = loader;
+ return fileFormat.loadFromStream(stream);
}
/**
@@ -99,29 +99,29 @@
* to the specified output stream using the specified file format.
*/
public static void save(OutputStream os, int format, ImageLoader loader) {
- if (format < 0 || format >= FORMATS.length) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- if (FORMATS[format] == null) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- if (loader.data == null || loader.data.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ if (format < 0 || format >= FORMATS.length) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
+ if (FORMATS[format] == null) SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
+ if (loader.data == null || loader.data.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- LEDataOutputStream stream = new LEDataOutputStream(os);
- FileFormat fileFormat = null;
- try {
+ LEDataOutputStream stream = new LEDataOutputStream(os);
+ FileFormat fileFormat = null;
+ try {
foreach( idx, TFormat; TFormats ){
if( idx == format ){
fileFormat = new TFormat();
}
}
- } catch (TracedException e) {
- SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
- }
- if (format == SWT.IMAGE_BMP_RLE) {
- switch (loader.data[0].depth) {
- case 8: fileFormat.compression = 1; break;
- case 4: fileFormat.compression = 2; break;
+ } catch (TracedException e) {
+ SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT);
+ }
+ if (format == SWT.IMAGE_BMP_RLE) {
+ switch (loader.data[0].depth) {
+ case 8: fileFormat.compression = 1; break;
+ case 4: fileFormat.compression = 2; break;
default:
- }
- }
- fileFormat.unloadIntoStream(loader, stream);
+ }
+ }
+ fileFormat.unloadIntoStream(loader, stream);
}
abstract void unloadIntoByteStream(ImageLoader loader);
@@ -131,13 +131,13 @@
* to the specified output stream.
*/
public void unloadIntoStream(ImageLoader loader, LEDataOutputStream stream) {
- try {
- outputStream = stream;
- unloadIntoByteStream(loader);
- outputStream.flush();
- } catch (TracedException e) {
- try {outputStream.flush();} catch (Exception f) {}
- SWT.error(SWT.ERROR_IO, e);
- }
+ try {
+ outputStream = stream;
+ unloadIntoByteStream(loader);
+ outputStream.flush();
+ } catch (TracedException e) {
+ try {outputStream.flush();} catch (Exception f) {}
+ SWT.error(SWT.ERROR_IO, e);
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/internal/image/GIFFileFormat.d
--- a/dwt/internal/image/GIFFileFormat.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/internal/image/GIFFileFormat.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -25,597 +25,597 @@
class Image{}
final class GIFFileFormat : FileFormat {
- char[] signature;
- int screenWidth, screenHeight, backgroundPixel, bitsPerPixel, defaultDepth;
- int disposalMethod = 0;
- int delayTime = 0;
- int transparentPixel = -1;
- int repeatCount = 1;
+ char[] signature;
+ int screenWidth, screenHeight, backgroundPixel, bitsPerPixel, defaultDepth;
+ int disposalMethod = 0;
+ int delayTime = 0;
+ int transparentPixel = -1;
+ int repeatCount = 1;
- static final int GIF_APPLICATION_EXTENSION_BLOCK_ID = 0xFF;
- static final int GIF_GRAPHICS_CONTROL_BLOCK_ID = 0xF9;
- static final int GIF_PLAIN_TEXT_BLOCK_ID = 0x01;
- static final int GIF_COMMENT_BLOCK_ID = 0xFE;
- static final int GIF_EXTENSION_BLOCK_ID = 0x21;
- static final int GIF_IMAGE_BLOCK_ID = 0x2C;
- static final int GIF_TRAILER_ID = 0x3B;
- static final byte[] GIF89a = cast(byte[])"GIF89a";
- static final byte[] NETSCAPE2_0 = cast(byte[])"NETSCAPE2.0";
+ static final int GIF_APPLICATION_EXTENSION_BLOCK_ID = 0xFF;
+ static final int GIF_GRAPHICS_CONTROL_BLOCK_ID = 0xF9;
+ static final int GIF_PLAIN_TEXT_BLOCK_ID = 0x01;
+ static final int GIF_COMMENT_BLOCK_ID = 0xFE;
+ static final int GIF_EXTENSION_BLOCK_ID = 0x21;
+ static final int GIF_IMAGE_BLOCK_ID = 0x2C;
+ static final int GIF_TRAILER_ID = 0x3B;
+ static final byte[] GIF89a = cast(byte[])"GIF89a";
+ static final byte[] NETSCAPE2_0 = cast(byte[])"NETSCAPE2.0";
- /**
- * Answer a palette containing numGrays
- * shades of gray, ranging from black to white.
- */
- static PaletteData grayRamp(int numGrays) {
- int n = numGrays - 1;
- RGB[] colors = new RGB[numGrays];
- for (int i = 0; i < numGrays; i++) {
- int intensity = cast(byte)((i * 3) * 256 / n);
- colors[i] = new RGB(intensity, intensity, intensity);
- }
- return new PaletteData(colors);
- }
+ /**
+ * Answer a palette containing numGrays
+ * shades of gray, ranging from black to white.
+ */
+ static PaletteData grayRamp(int numGrays) {
+ int n = numGrays - 1;
+ RGB[] colors = new RGB[numGrays];
+ for (int i = 0; i < numGrays; i++) {
+ int intensity = cast(byte)((i * 3) * 256 / n);
+ colors[i] = new RGB(intensity, intensity, intensity);
+ }
+ return new PaletteData(colors);
+ }
- bool isFileFormat(LEDataInputStream stream) {
- try {
- byte[3] signature;
- stream.read(signature);
- stream.unread(signature);
- return signature == cast(byte[])"GIF"; //$NON-NLS-1$
- } catch (Exception e) {
- return false;
- }
- }
+ bool isFileFormat(LEDataInputStream stream) {
+ try {
+ byte[3] signature;
+ stream.read(signature);
+ stream.unread(signature);
+ return signature == cast(byte[])"GIF"; //$NON-NLS-1$
+ } catch (Exception e) {
+ return false;
+ }
+ }
- /**
- * Load the GIF image(s) stored in the input stream.
- * Return an array of ImageData representing the image(s).
- */
- ImageData[] loadFromByteStream() {
- byte[3] signatureBytes;
- byte[3] versionBytes;
- byte[7] block;
- try {
- inputStream.read(signatureBytes);
- signature = cast(char[])signatureBytes.dup;
- if (signature != "GIF") //$NON-NLS-1$
- SWT.error(SWT.ERROR_INVALID_IMAGE);
+ /**
+ * Load the GIF image(s) stored in the input stream.
+ * Return an array of ImageData representing the image(s).
+ */
+ ImageData[] loadFromByteStream() {
+ byte[3] signatureBytes;
+ byte[3] versionBytes;
+ byte[7] block;
+ try {
+ inputStream.read(signatureBytes);
+ signature = cast(char[])signatureBytes.dup;
+ if (signature != "GIF") //$NON-NLS-1$
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
- inputStream.read(versionBytes);
+ inputStream.read(versionBytes);
- inputStream.read(block);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- screenWidth = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
- loader.logicalScreenWidth = screenWidth;
- screenHeight = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
- loader.logicalScreenHeight = screenHeight;
- byte bitField = block[4];
- backgroundPixel = block[5] & 0xFF;
- //aspect = block[6] & 0xFF;
- bitsPerPixel = ((bitField >> 4) & 0x07) + 1;
- defaultDepth = (bitField & 0x7) + 1;
- PaletteData palette = null;
- if ((bitField & 0x80) != 0) {
- // Global palette.
- //sorted = (bitField & 0x8) != 0;
- palette = readPalette(1 << defaultDepth);
- } else {
- // No global palette.
- //sorted = false;
- backgroundPixel = -1;
- defaultDepth = bitsPerPixel;
- }
- loader.backgroundPixel = backgroundPixel;
+ inputStream.read(block);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ screenWidth = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
+ loader.logicalScreenWidth = screenWidth;
+ screenHeight = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
+ loader.logicalScreenHeight = screenHeight;
+ byte bitField = block[4];
+ backgroundPixel = block[5] & 0xFF;
+ //aspect = block[6] & 0xFF;
+ bitsPerPixel = ((bitField >> 4) & 0x07) + 1;
+ defaultDepth = (bitField & 0x7) + 1;
+ PaletteData palette = null;
+ if ((bitField & 0x80) != 0) {
+ // Global palette.
+ //sorted = (bitField & 0x8) != 0;
+ palette = readPalette(1 << defaultDepth);
+ } else {
+ // No global palette.
+ //sorted = false;
+ backgroundPixel = -1;
+ defaultDepth = bitsPerPixel;
+ }
+ loader.backgroundPixel = backgroundPixel;
- getExtensions();
- int id = readID();
- ImageData[] images = new ImageData[0];
- while (id == GIF_IMAGE_BLOCK_ID) {
- ImageData image = readImageBlock(palette);
- if (loader.hasListeners()) {
- loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true));
- }
+ getExtensions();
+ int id = readID();
+ ImageData[] images = new ImageData[0];
+ while (id == GIF_IMAGE_BLOCK_ID) {
+ ImageData image = readImageBlock(palette);
+ if (loader.hasListeners()) {
+ loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true));
+ }
ImageData[] oldImages = images;
images = new ImageData[oldImages.length + 1];
System.arraycopy(oldImages, 0, images, 0, oldImages.length);
images[images.length - 1] = image;
//images ~= image;
- try {
- /* Read the 0-byte terminator at the end of the image. */
- id = inputStream.read();
- if (id > 0) {
- /* We read the terminator earlier. */
+ try {
+ /* Read the 0-byte terminator at the end of the image. */
+ id = inputStream.read();
+ if (id > 0) {
+ /* We read the terminator earlier. */
byte[1] arr;
arr[0] = id;
- inputStream.unread( arr );
- }
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- getExtensions();
- id = readID();
- }
- return images;
- }
+ inputStream.unread( arr );
+ }
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ getExtensions();
+ id = readID();
+ }
+ return images;
+ }
- /**
- * Read and return the next block or extension identifier from the file.
- */
- int readID() {
- try {
- return inputStream.read();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- return -1;
- }
+ /**
+ * Read and return the next block or extension identifier from the file.
+ */
+ int readID() {
+ try {
+ return inputStream.read();
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ return -1;
+ }
- /**
- * Read extensions until an image descriptor appears.
- * In the future, if we care about the extensions, they
- * should be properly grouped with the image data before
- * which they appeared. Right now, the interesting parts
- * of some extensions are kept, but the rest is discarded.
- * Throw an error if an error occurs.
- */
- void getExtensions() {
- int id = readID();
- while (id != GIF_IMAGE_BLOCK_ID && id != GIF_TRAILER_ID && id > 0) {
- if (id == GIF_EXTENSION_BLOCK_ID) {
- readExtension();
- } else {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- id = readID();
- }
- if (id == GIF_IMAGE_BLOCK_ID || id == GIF_TRAILER_ID) {
- try {
+ /**
+ * Read extensions until an image descriptor appears.
+ * In the future, if we care about the extensions, they
+ * should be properly grouped with the image data before
+ * which they appeared. Right now, the interesting parts
+ * of some extensions are kept, but the rest is discarded.
+ * Throw an error if an error occurs.
+ */
+ void getExtensions() {
+ int id = readID();
+ while (id != GIF_IMAGE_BLOCK_ID && id != GIF_TRAILER_ID && id > 0) {
+ if (id == GIF_EXTENSION_BLOCK_ID) {
+ readExtension();
+ } else {
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ }
+ id = readID();
+ }
+ if (id == GIF_IMAGE_BLOCK_ID || id == GIF_TRAILER_ID) {
+ try {
byte[1] arr;
arr[0] = id;
- inputStream.unread(arr);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- }
- }
+ inputStream.unread(arr);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ }
+ }
- /**
- * Read a control extension.
- * Return the extension block data.
- */
- byte[] readExtension() {
- int extensionID = readID();
- if (extensionID == GIF_COMMENT_BLOCK_ID)
- return readCommentExtension();
- if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID)
- return readPlainTextExtension();
- if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID)
- return readGraphicsControlExtension();
- if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID)
- return readApplicationExtension();
- // Otherwise, we don't recognize the block. If the
- // field size is correct, we can just skip over
- // the block contents.
- try {
- int extSize = inputStream.read();
- if (extSize < 0) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- byte[] ext = new byte[extSize];
- inputStream.read(ext, 0, extSize);
- return ext;
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
+ /**
+ * Read a control extension.
+ * Return the extension block data.
+ */
+ byte[] readExtension() {
+ int extensionID = readID();
+ if (extensionID == GIF_COMMENT_BLOCK_ID)
+ return readCommentExtension();
+ if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID)
+ return readPlainTextExtension();
+ if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID)
+ return readGraphicsControlExtension();
+ if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID)
+ return readApplicationExtension();
+ // Otherwise, we don't recognize the block. If the
+ // field size is correct, we can just skip over
+ // the block contents.
+ try {
+ int extSize = inputStream.read();
+ if (extSize < 0) {
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ }
+ byte[] ext = new byte[extSize];
+ inputStream.read(ext, 0, extSize);
+ return ext;
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
- /**
- * We have just read the Comment extension identifier
- * from the input stream. Read in the rest of the comment
- * and return it. GIF comment blocks are variable size.
- */
- byte[] readCommentExtension() {
- try {
- byte[] comment = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
+ /**
+ * We have just read the Comment extension identifier
+ * from the input stream. Read in the rest of the comment
+ * and return it. GIF comment blocks are variable size.
+ */
+ byte[] readCommentExtension() {
+ try {
+ byte[] comment = new byte[0];
+ byte[] block = new byte[255];
+ int size = inputStream.read();
+ while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
byte[] oldComment = comment;
comment = new byte[oldComment.length + size];
System.arraycopy(oldComment, 0, comment, 0, oldComment.length);
System.arraycopy(block, 0, comment, oldComment.length, size);
//comment ~= block[ 0 .. size ];
- size = inputStream.read();
- }
- return comment;
- } catch (TracedException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
+ size = inputStream.read();
+ }
+ return comment;
+ } catch (TracedException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
- /**
- * We have just read the PlainText extension identifier
- * from the input stream. Read in the plain text info and text,
- * and return the text. GIF plain text blocks are variable size.
- */
- byte[] readPlainTextExtension() {
- try {
- // Read size of block = 0x0C.
- inputStream.read();
- // Read the text information (x, y, width, height, colors).
- byte[] info = new byte[12];
- inputStream.read(info);
- // Read the text.
- byte[] text = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
+ /**
+ * We have just read the PlainText extension identifier
+ * from the input stream. Read in the plain text info and text,
+ * and return the text. GIF plain text blocks are variable size.
+ */
+ byte[] readPlainTextExtension() {
+ try {
+ // Read size of block = 0x0C.
+ inputStream.read();
+ // Read the text information (x, y, width, height, colors).
+ byte[] info = new byte[12];
+ inputStream.read(info);
+ // Read the text.
+ byte[] text = new byte[0];
+ byte[] block = new byte[255];
+ int size = inputStream.read();
+ while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
byte[] oldText = text;
text = new byte[oldText.length + size];
System.arraycopy(oldText, 0, text, 0, oldText.length);
System.arraycopy(block, 0, text, oldText.length, size);
//text ~= block[ 0 .. size ];
- size = inputStream.read();
- }
- return text;
- } catch (TracedException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
+ size = inputStream.read();
+ }
+ return text;
+ } catch (TracedException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
- /**
- * We have just read the GraphicsControl extension identifier
- * from the input stream. Read in the control information, store
- * it, and return it.
- */
- byte[] readGraphicsControlExtension() {
- try {
- // Read size of block = 0x04.
- inputStream.read();
- // Read the control block.
- byte[] controlBlock = new byte[4];
- inputStream.read(controlBlock);
- byte bitField = controlBlock[0];
- // Store the user input field.
- //userInput = (bitField & 0x02) != 0;
- // Store the disposal method.
- disposalMethod = (bitField >> 2) & 0x07;
- // Store the delay time.
- delayTime = (controlBlock[1] & 0xFF) | ((controlBlock[2] & 0xFF) << 8);
- // Store the transparent color.
- if ((bitField & 0x01) != 0) {
- transparentPixel = controlBlock[3] & 0xFF;
- } else {
- transparentPixel = -1;
- }
- // Read block terminator.
- inputStream.read();
- return controlBlock;
- } catch (TracedException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
+ /**
+ * We have just read the GraphicsControl extension identifier
+ * from the input stream. Read in the control information, store
+ * it, and return it.
+ */
+ byte[] readGraphicsControlExtension() {
+ try {
+ // Read size of block = 0x04.
+ inputStream.read();
+ // Read the control block.
+ byte[] controlBlock = new byte[4];
+ inputStream.read(controlBlock);
+ byte bitField = controlBlock[0];
+ // Store the user input field.
+ //userInput = (bitField & 0x02) != 0;
+ // Store the disposal method.
+ disposalMethod = (bitField >> 2) & 0x07;
+ // Store the delay time.
+ delayTime = (controlBlock[1] & 0xFF) | ((controlBlock[2] & 0xFF) << 8);
+ // Store the transparent color.
+ if ((bitField & 0x01) != 0) {
+ transparentPixel = controlBlock[3] & 0xFF;
+ } else {
+ transparentPixel = -1;
+ }
+ // Read block terminator.
+ inputStream.read();
+ return controlBlock;
+ } catch (TracedException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
- /**
- * We have just read the Application extension identifier
- * from the input stream. Read in the rest of the extension,
- * look for and store 'number of repeats', and return the data.
- */
- byte[] readApplicationExtension() {
- try {
- // Read size of block = 0x0B.
- inputStream.read();
- // Read application identifier.
- byte[] applicationBytes = new byte[8];
- inputStream.read(applicationBytes);
- char[] application = cast(char[])(applicationBytes.dup);
- // Read authentication code.
- byte[] authenticationBytes = new byte[3];
- inputStream.read(authenticationBytes);
- char[] authentication = cast(char[])(authenticationBytes.dup);
- // Read application data.
- byte[] data = new byte[0];
- byte[] block = new byte[255];
- int size = inputStream.read();
- while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
+ /**
+ * We have just read the Application extension identifier
+ * from the input stream. Read in the rest of the extension,
+ * look for and store 'number of repeats', and return the data.
+ */
+ byte[] readApplicationExtension() {
+ try {
+ // Read size of block = 0x0B.
+ inputStream.read();
+ // Read application identifier.
+ byte[] applicationBytes = new byte[8];
+ inputStream.read(applicationBytes);
+ char[] application = cast(char[])(applicationBytes.dup);
+ // Read authentication code.
+ byte[] authenticationBytes = new byte[3];
+ inputStream.read(authenticationBytes);
+ char[] authentication = cast(char[])(authenticationBytes.dup);
+ // Read application data.
+ byte[] data = new byte[0];
+ byte[] block = new byte[255];
+ int size = inputStream.read();
+ while ((size > 0) && (inputStream.read(block, 0, size) != -1)) {
byte[] oldData = data;
data = new byte[oldData.length + size];
System.arraycopy(oldData, 0, data, 0, oldData.length);
System.arraycopy(block, 0, data, oldData.length, size);
//data ~= block[ 0 .. size ];
- size = inputStream.read();
- }
- // Look for the NETSCAPE 'repeat count' field for an animated GIF.
- if (application=="NETSCAPE" && authentication=="2.0" && data[0] == 01) { //$NON-NLS-1$ //$NON-NLS-2$
- repeatCount = (data[1] & 0xFF) | ((data[2] & 0xFF) << 8);
- loader.repeatCount = repeatCount;
- }
- return data;
- } catch (TracedException e) {
- SWT.error(SWT.ERROR_IO, e);
- return null;
- }
- }
+ size = inputStream.read();
+ }
+ // Look for the NETSCAPE 'repeat count' field for an animated GIF.
+ if (application=="NETSCAPE" && authentication=="2.0" && data[0] == 01) { //$NON-NLS-1$ //$NON-NLS-2$
+ repeatCount = (data[1] & 0xFF) | ((data[2] & 0xFF) << 8);
+ loader.repeatCount = repeatCount;
+ }
+ return data;
+ } catch (TracedException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ return null;
+ }
+ }
- /**
- * Return a DeviceIndependentImage representing the
- * image block at the current position in the input stream.
- * Throw an error if an error occurs.
- */
- ImageData readImageBlock(PaletteData defaultPalette) {
- int depth;
- PaletteData palette;
- byte[] block = new byte[9];
- try {
- inputStream.read(block);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- int left = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
- int top = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
- int width = (block[4] & 0xFF) | ((block[5] & 0xFF) << 8);
- int height = (block[6] & 0xFF) | ((block[7] & 0xFF) << 8);
- byte bitField = block[8];
- bool interlaced = (bitField & 0x40) != 0;
- //bool sorted = (bitField & 0x20) != 0;
- if ((bitField & 0x80) != 0) {
- // Local palette.
- depth = (bitField & 0x7) + 1;
- palette = readPalette(1 << depth);
- } else {
- // No local palette.
- depth = defaultDepth;
- palette = defaultPalette;
- }
- /* Work around: Ignore the case where a GIF specifies an
- * invalid index for the transparent pixel that is larger
- * than the number of entries in the palette. */
- if (transparentPixel > 1 << depth) {
- transparentPixel = -1;
- }
- // Promote depth to next highest supported value.
- if (!(depth == 1 || depth == 4 || depth == 8)) {
- if (depth < 4)
- depth = 4;
- else
- depth = 8;
- }
- if (palette == null) {
- palette = grayRamp(1 << depth);
- }
- int initialCodeSize = -1;
- try {
- initialCodeSize = inputStream.read();
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- if (initialCodeSize < 0) {
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- }
- ImageData image = ImageData.internal_new(
- width,
- height,
- depth,
- palette,
- 4,
- null,
- 0,
- null,
- null,
- -1,
- transparentPixel,
- SWT.IMAGE_GIF,
- left,
- top,
- disposalMethod,
- delayTime);
- LZWCodec codec = new LZWCodec();
- codec.decode(inputStream, loader, image, interlaced, initialCodeSize);
- return image;
- }
+ /**
+ * Return a DeviceIndependentImage representing the
+ * image block at the current position in the input stream.
+ * Throw an error if an error occurs.
+ */
+ ImageData readImageBlock(PaletteData defaultPalette) {
+ int depth;
+ PaletteData palette;
+ byte[] block = new byte[9];
+ try {
+ inputStream.read(block);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ int left = (block[0] & 0xFF) | ((block[1] & 0xFF) << 8);
+ int top = (block[2] & 0xFF) | ((block[3] & 0xFF) << 8);
+ int width = (block[4] & 0xFF) | ((block[5] & 0xFF) << 8);
+ int height = (block[6] & 0xFF) | ((block[7] & 0xFF) << 8);
+ byte bitField = block[8];
+ bool interlaced = (bitField & 0x40) != 0;
+ //bool sorted = (bitField & 0x20) != 0;
+ if ((bitField & 0x80) != 0) {
+ // Local palette.
+ depth = (bitField & 0x7) + 1;
+ palette = readPalette(1 << depth);
+ } else {
+ // No local palette.
+ depth = defaultDepth;
+ palette = defaultPalette;
+ }
+ /* Work around: Ignore the case where a GIF specifies an
+ * invalid index for the transparent pixel that is larger
+ * than the number of entries in the palette. */
+ if (transparentPixel > 1 << depth) {
+ transparentPixel = -1;
+ }
+ // Promote depth to next highest supported value.
+ if (!(depth == 1 || depth == 4 || depth == 8)) {
+ if (depth < 4)
+ depth = 4;
+ else
+ depth = 8;
+ }
+ if (palette == null) {
+ palette = grayRamp(1 << depth);
+ }
+ int initialCodeSize = -1;
+ try {
+ initialCodeSize = inputStream.read();
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ if (initialCodeSize < 0) {
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ }
+ ImageData image = ImageData.internal_new(
+ width,
+ height,
+ depth,
+ palette,
+ 4,
+ null,
+ 0,
+ null,
+ null,
+ -1,
+ transparentPixel,
+ SWT.IMAGE_GIF,
+ left,
+ top,
+ disposalMethod,
+ delayTime);
+ LZWCodec codec = new LZWCodec();
+ codec.decode(inputStream, loader, image, interlaced, initialCodeSize);
+ return image;
+ }
- /**
- * Read a palette from the input stream.
- */
- PaletteData readPalette(int numColors) {
- byte[] bytes = new byte[numColors * 3];
- try {
- if (inputStream.read(bytes) != bytes.length)
- SWT.error(SWT.ERROR_INVALID_IMAGE);
- } catch (IOException e) {
- SWT.error(SWT.ERROR_IO, e);
- }
- RGB[] colors = new RGB[numColors];
- for (int i = 0; i < numColors; i++)
- colors[i] = new RGB(bytes[i*3] & 0xFF,
- bytes[i*3+1] & 0xFF, bytes[i*3+2] & 0xFF);
- return new PaletteData(colors);
- }
+ /**
+ * Read a palette from the input stream.
+ */
+ PaletteData readPalette(int numColors) {
+ byte[] bytes = new byte[numColors * 3];
+ try {
+ if (inputStream.read(bytes) != bytes.length)
+ SWT.error(SWT.ERROR_INVALID_IMAGE);
+ } catch (IOException e) {
+ SWT.error(SWT.ERROR_IO, e);
+ }
+ RGB[] colors = new RGB[numColors];
+ for (int i = 0; i < numColors; i++)
+ colors[i] = new RGB(bytes[i*3] & 0xFF,
+ bytes[i*3+1] & 0xFF, bytes[i*3+2] & 0xFF);
+ return new PaletteData(colors);
+ }
- void unloadIntoByteStream(ImageLoader loader) {
+ void unloadIntoByteStream(ImageLoader loader) {
- /* Step 1: Acquire GIF parameters. */
- ImageData[] data = loader.data;
- int frameCount = data.length;
- bool multi = frameCount > 1;
- ImageData firstImage = data[0];
- int logicalScreenWidth = multi ? loader.logicalScreenWidth : firstImage.width;
- int logicalScreenHeight = multi ? loader.logicalScreenHeight : firstImage.height;
- int backgroundPixel = loader.backgroundPixel;
- int depth = firstImage.depth;
- PaletteData palette = firstImage.palette;
- RGB[] colors = palette.getRGBs();
- short globalTable = 1;
+ /* Step 1: Acquire GIF parameters. */
+ ImageData[] data = loader.data;
+ int frameCount = data.length;
+ bool multi = frameCount > 1;
+ ImageData firstImage = data[0];
+ int logicalScreenWidth = multi ? loader.logicalScreenWidth : firstImage.width;
+ int logicalScreenHeight = multi ? loader.logicalScreenHeight : firstImage.height;
+ int backgroundPixel = loader.backgroundPixel;
+ int depth = firstImage.depth;
+ PaletteData palette = firstImage.palette;
+ RGB[] colors = palette.getRGBs();
+ short globalTable = 1;
- /* Step 2: Check for validity and global/local color map. */
- if (!(depth == 1 || depth == 4 || depth == 8)) {
- SWT.error(SWT.ERROR_UNSUPPORTED_DEPTH);
- }
- for (int i=0; ibuf
. A value
- * equal to buf.length indicates no bytes available. A value of
- * 0 indicates the buffer is full.
- */
- protected int pos;
+ /**
+ * The current position within the byte array buf
. A value
+ * equal to buf.length indicates no bytes available. A value of
+ * 0 indicates the buffer is full.
+ */
+ protected int pos;
- public this(InputStream input) {
- this(input, 512);
- }
+ public this(InputStream input) {
+ this(input, 512);
+ }
- public this(InputStream input, int bufferSize) {
+ public this(InputStream input, int bufferSize) {
host = input;
- if (bufferSize > 0) {
- buf = new byte[bufferSize];
- pos = bufferSize;
- }
- else throw new IllegalArgumentException("bufferSize must be greater zero" );
- }
+ if (bufferSize > 0) {
+ buf = new byte[bufferSize];
+ pos = bufferSize;
+ }
+ else throw new IllegalArgumentException("bufferSize must be greater zero" );
+ }
- public void close() {
+ public void close() {
buf = null;
- if (host !is null) {
- host.close();
+ if (host !is null) {
+ host.close();
host = null;
- }
- }
+ }
+ }
- /**
- * Answer how many bytes were read.
- */
- public int getPosition() {
- return position;
- }
+ /**
+ * Answer how many bytes were read.
+ */
+ public int getPosition() {
+ return position;
+ }
- /**
- * Answers how many bytes are available for reading without blocking
- */
- public int available() {
- if (buf is null) throw new IOException("buf is null");
- return (buf.length - pos) + host.available();
- }
+ /**
+ * Answers how many bytes are available for reading without blocking
+ */
+ public int available() {
+ if (buf is null) throw new IOException("buf is null");
+ return (buf.length - pos) + host.available();
+ }
- /**
- * Answer the next byte of the input stream.
- */
- public int read() {
- if (buf is null) throw new IOException("buf is null");
- if (pos < buf.length) {
- position++;
- return (buf[pos++] & 0xFF);
- }
+ /**
+ * Answer the next byte of the input stream.
+ */
+ public int read() {
+ if (buf is null) throw new IOException("buf is null");
+ if (pos < buf.length) {
+ position++;
+ return (buf[pos++] & 0xFF);
+ }
int c = host.read();
- if (c != -1 ) position++;
- return c;
- }
+ if (c != -1 ) position++;
+ return c;
+ }
- /**
- * Don't imitate the JDK behaviour of reading a random number
- * of bytes when you can actually read them all.
- */
- public int read(byte b[], int off, int len) {
- int read = 0, count;
- while (read != len && (count = readData(b, off, len - read)) != -1) {
- off += count;
- read += count;
- }
- position += read;
- if (read == 0 && read != len) return -1;
- return read;
- }
+ /**
+ * Don't imitate the JDK behaviour of reading a random number
+ * of bytes when you can actually read them all.
+ */
+ public int read(byte b[], int off, int len) {
+ int read = 0, count;
+ while (read != len && (count = readData(b, off, len - read)) != -1) {
+ off += count;
+ read += count;
+ }
+ position += read;
+ if (read == 0 && read != len) return -1;
+ return read;
+ }
- /**
- * Reads at most length
bytes from this LEDataInputStream and
- * stores them in byte array buffer
starting at offset
.
- *
- * Answer the number of bytes actually read or -1 if no bytes were read and
- * end of stream was encountered. This implementation reads bytes from
- * the pushback buffer first, then the target stream if more bytes are required
- * to satisfy count
.
- *
buffer
to store the read bytes.
- * @param length the maximum number of bytes to store in buffer
.
- *
- * @return int the number of bytes actually read or -1 if end of stream.
- *
- * @exception java.io.IOException if an IOException occurs.
- */
- private int readData(byte[] buffer, int offset, int len) {
- if (buf is null) throw new IOException("buf is null");
- if (offset < 0 || offset > buffer.length ||
- len < 0 || (len > buffer.length - offset)) {
- throw new ArrayBoundsException(__FILE__,__LINE__);
- }
+ /**
+ * Reads at most length
bytes from this LEDataInputStream and
+ * stores them in byte array buffer
starting at offset
.
+ *
+ * Answer the number of bytes actually read or -1 if no bytes were read and
+ * end of stream was encountered. This implementation reads bytes from
+ * the pushback buffer first, then the target stream if more bytes are required
+ * to satisfy count
.
+ *
buffer
to store the read bytes.
+ * @param length the maximum number of bytes to store in buffer
.
+ *
+ * @return int the number of bytes actually read or -1 if end of stream.
+ *
+ * @exception java.io.IOException if an IOException occurs.
+ */
+ private int readData(byte[] buffer, int offset, int len) {
+ if (buf is null) throw new IOException("buf is null");
+ if (offset < 0 || offset > buffer.length ||
+ len < 0 || (len > buffer.length - offset)) {
+ throw new ArrayBoundsException(__FILE__,__LINE__);
+ }
- int cacheCopied = 0;
- int newOffset = offset;
+ int cacheCopied = 0;
+ int newOffset = offset;
- // Are there pushback bytes available?
- int available = buf.length - pos;
- if (available > 0) {
- cacheCopied = (available >= len) ? len : available;
+ // Are there pushback bytes available?
+ int available = buf.length - pos;
+ if (available > 0) {
+ cacheCopied = (available >= len) ? len : available;
System.arraycopy(buf, pos, buffer, newOffset, cacheCopied);
- newOffset += cacheCopied;
- pos += cacheCopied;
- }
+ newOffset += cacheCopied;
+ pos += cacheCopied;
+ }
- // Have we copied enough?
- if (cacheCopied == len) return len;
+ // Have we copied enough?
+ if (cacheCopied == len) return len;
- int inCopied = host.read( buffer, newOffset, len - cacheCopied );
+ int inCopied = host.read( buffer, newOffset, len - cacheCopied );
if( inCopied == -1 ) inCopied = -1;
- if (inCopied > 0 ) return inCopied + cacheCopied;
- if (cacheCopied == 0) return inCopied;
- return cacheCopied;
- }
+ if (inCopied > 0 ) return inCopied + cacheCopied;
+ if (cacheCopied == 0) return inCopied;
+ return cacheCopied;
+ }
- /**
- * Answer an integer comprised of the next
- * four bytes of the input stream.
- */
- public int readInt() {
- byte[4] buf = void;
- host.read(buf);
- return ((((((buf[3] & 0xFF) << 24) |
- (buf[2] & 0xFF)) << 16) |
- (buf[1] & 0xFF)) << 8) |
- (buf[0] & 0xFF);
- }
+ /**
+ * Answer an integer comprised of the next
+ * four bytes of the input stream.
+ */
+ public int readInt() {
+ byte[4] buf = void;
+ host.read(buf);
+ return ((((((buf[3] & 0xFF) << 24) |
+ (buf[2] & 0xFF)) << 16) |
+ (buf[1] & 0xFF)) << 8) |
+ (buf[0] & 0xFF);
+ }
- /**
- * Answer a short comprised of the next
- * two bytes of the input stream.
- */
- public short readShort() {
- byte[2] buf = void;
- host.read(buf);
- return cast(short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
- }
+ /**
+ * Answer a short comprised of the next
+ * two bytes of the input stream.
+ */
+ public short readShort() {
+ byte[2] buf = void;
+ host.read(buf);
+ return cast(short)(((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
+ }
- /**
- * Push back the entire content of the given buffer b
.
- *
- * The bytes are pushed so that they would be read back b[0], b[1], etc.
- * If the push back buffer cannot handle the bytes copied from b
,
- * an IOException will be thrown and no byte will be pushed back.
- *
b
.
+ *
+ * The bytes are pushed so that they would be read back b[0], b[1], etc.
+ * If the push back buffer cannot handle the bytes copied from b
,
+ * an IOException will be thrown and no byte will be pushed back.
+ *
Composite
. Note that in a FillLayout
,
* children are always the same size, and they fill all available space.
* - * FillLayout fillLayout = new FillLayout(); - * fillLayout.type = SWT.VERTICAL; - * shell.setLayout(fillLayout); + * FillLayout fillLayout = new FillLayout(); + * fillLayout.type = SWT.VERTICAL; + * shell.setLayout(fillLayout); ** */ public final class FillLayout : Layout { - /** - * type specifies how controls will be positioned - * within the layout. - * - * The default value is HORIZONTAL. - * - * Possible values are:
- * FormData data = new FormData(); - * data.top = new FormAttachment(0,5); - * data.bottom = new FormAttachment(100,-5); - * data.left = new FormAttachment(0,5); - * data.right = new FormAttachment(100,-5); - * button.setLayoutData(data); + * FormData data = new FormData(); + * data.top = new FormAttachment(0,5); + * data.bottom = new FormAttachment(100,-5); + * data.left = new FormAttachment(0,5); + * data.right = new FormAttachment(100,-5); + * button.setLayoutData(data); ** *
@@ -42,7 +42,7 @@ * is set to 100. The "b" term in the equation represents an offset, in * pixels, from the attachment position. For example: *
- * FormAttachment attach = new FormAttachment (20, -5); + * FormAttachment attach = new FormAttachment (20, -5); ** specifies that the side to which the
FormAttachment
* object belongs will lie at 20% of the parent composite, minus 5 pixels.
@@ -51,7 +51,7 @@
* Control sides can also be attached to another control.
* For example:
* - * FormAttachment attach = new FormAttachment (button, 10); + * FormAttachment attach = new FormAttachment (button, 10); ** specifies that the side to which the
FormAttachment
* object belongs will lie in the same position as the adjacent side of
@@ -59,15 +59,15 @@
* also be attached to the opposite side of the specified control.
* For example:
* - * FormData data = new FormData (); - * data.left = new FormAttachment (button, 0, SWT.LEFT); + * FormData data = new FormData (); + * data.left = new FormAttachment (button, 0, SWT.LEFT); ** specifies that the left side of the control will lie in the same position * as the left side of the
button
control. The control can also
* be attached in a position that will center the control on the specified
* control. For example:
* - * data.left = new FormAttachment (button, 0, SWT.CENTER); + * data.left = new FormAttachment (button, 0, SWT.CENTER); ** specifies that the left side of the control will be positioned so that it is * centered between the left and right sides of the
button
control.
@@ -80,58 +80,58 @@
* @since 2.0
*/
public final class FormAttachment {
- /**
- * numerator specifies the numerator of the "a" term in the
- * equation, y = ax + b, which defines the attachment.
- */
- public int numerator;
+ /**
+ * numerator specifies the numerator of the "a" term in the
+ * equation, y = ax + b, which defines the attachment.
+ */
+ public int numerator;
- /**
- * denominator specifies the denominator of the "a" term in the
- * equation, y = ax + b, which defines the attachment.
- *
- * The default value is 100.
- */
- public int denominator = 100;
+ /**
+ * denominator specifies the denominator of the "a" term in the
+ * equation, y = ax + b, which defines the attachment.
+ *
+ * The default value is 100.
+ */
+ public int denominator = 100;
- /**
- * offset specifies the offset, in pixels, of the control side
- * from the attachment position.
- * If the offset is positive, then the control side is offset
- * to the right of or below the attachment position. If it is
- * negative, then the control side is offset to the left of or
- * above the attachment position.
- *
- * This is equivalent to the "b" term in the equation y = ax + b.
- * The default value is 0.
- */
- public int offset;
+ /**
+ * offset specifies the offset, in pixels, of the control side
+ * from the attachment position.
+ * If the offset is positive, then the control side is offset
+ * to the right of or below the attachment position. If it is
+ * negative, then the control side is offset to the left of or
+ * above the attachment position.
+ *
+ * This is equivalent to the "b" term in the equation y = ax + b.
+ * The default value is 0.
+ */
+ public int offset;
- /**
- * control specifies the control to which the control side is
- * attached.
- */
- public Control control;
+ /**
+ * control specifies the control to which the control side is
+ * attached.
+ */
+ public Control control;
- /**
- * alignment specifies the alignment of the control side that is
- * attached to a control.
- * - * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left - * and right attachments, LEFT, RIGHT and CENTER are used. If any other case - * occurs, the default will be used instead. - *
- * - *+ * For top and bottom attachments, TOP, BOTTOM and CENTER are used. For left + * and right attachments, LEFT, RIGHT and CENTER are used. If any other case + * occurs, the default will be used instead. + *
+ * + *setLayoutData ()
method. To define attachments for the
* FormData
, set the fields directly, like this:
* - * FormData data = new FormData(); - * data.left = new FormAttachment(0,5); - * data.right = new FormAttachment(100,-5); - * button.setLayoutData(formData); + * FormData data = new FormData(); + * data.left = new FormAttachment(0,5); + * data.right = new FormAttachment(100,-5); + * button.setLayoutData(formData); ** *
@@ -48,51 +48,51 @@
* @since 2.0
*/
public final class FormData {
- /**
- * width specifies the preferred width in pixels. This value
- * is the wHint passed into Control.computeSize(int, int, bool)
- * to determine the preferred size of the control.
- *
- * The default value is SWT.DEFAULT.
- *
- * @see Control#computeSize(int, int, bool)
- */
- public int width = SWT.DEFAULT;
- /**
- * height specifies the preferred height in pixels. This value
- * is the hHint passed into Control.computeSize(int, int, bool)
- * to determine the preferred size of the control.
- *
- * The default value is SWT.DEFAULT.
- *
- * @see Control#computeSize(int, int, bool)
- */
- public int height = SWT.DEFAULT;
- /**
- * left specifies the attachment of the left side of
- * the control.
- */
- public FormAttachment left;
- /**
- * right specifies the attachment of the right side of
- * the control.
- */
- public FormAttachment right;
- /**
- * top specifies the attachment of the top of the control.
- */
- public FormAttachment top;
- /**
- * bottom specifies the attachment of the bottom of the
- * control.
- */
- public FormAttachment bottom;
+ /**
+ * width specifies the preferred width in pixels. This value
+ * is the wHint passed into Control.computeSize(int, int, bool)
+ * to determine the preferred size of the control.
+ *
+ * The default value is SWT.DEFAULT.
+ *
+ * @see Control#computeSize(int, int, bool)
+ */
+ public int width = SWT.DEFAULT;
+ /**
+ * height specifies the preferred height in pixels. This value
+ * is the hHint passed into Control.computeSize(int, int, bool)
+ * to determine the preferred size of the control.
+ *
+ * The default value is SWT.DEFAULT.
+ *
+ * @see Control#computeSize(int, int, bool)
+ */
+ public int height = SWT.DEFAULT;
+ /**
+ * left specifies the attachment of the left side of
+ * the control.
+ */
+ public FormAttachment left;
+ /**
+ * right specifies the attachment of the right side of
+ * the control.
+ */
+ public FormAttachment right;
+ /**
+ * top specifies the attachment of the top of the control.
+ */
+ public FormAttachment top;
+ /**
+ * bottom specifies the attachment of the bottom of the
+ * control.
+ */
+ public FormAttachment bottom;
- int cacheWidth = -1, cacheHeight = -1;
- int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
- int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
- FormAttachment cacheLeft, cacheRight, cacheTop, cacheBottom;
- bool isVisited, needed;
+ int cacheWidth = -1, cacheHeight = -1;
+ int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
+ int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
+ FormAttachment cacheLeft, cacheRight, cacheTop, cacheBottom;
+ bool isVisited, needed;
/**
* Constructs a new instance of FormData using
@@ -110,131 +110,131 @@
* @param height a minimum height for the control
*/
public this (int width, int height) {
- this.width = width;
- this.height = height;
+ this.width = width;
+ this.height = height;
}
void computeSize (Control control, int wHint, int hHint, bool flushCache_) {
- if (cacheWidth !is -1 && cacheHeight !is -1) return;
- if (wHint is this.width && hHint is this.height) {
- if (defaultWidth is -1 || defaultHeight is -1 || wHint !is defaultWhint || hHint !is defaultHhint) {
- Point size = control.computeSize (wHint, hHint, flushCache_);
- defaultWhint = wHint;
- defaultHhint = hHint;
- defaultWidth = size.x;
- defaultHeight = size.y;
- }
- cacheWidth = defaultWidth;
- cacheHeight = defaultHeight;
- return;
- }
- if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
- Point size = control.computeSize (wHint, hHint, flushCache_);
- currentWhint = wHint;
- currentHhint = hHint;
- currentWidth = size.x;
- currentHeight = size.y;
- }
- cacheWidth = currentWidth;
- cacheHeight = currentHeight;
+ if (cacheWidth !is -1 && cacheHeight !is -1) return;
+ if (wHint is this.width && hHint is this.height) {
+ if (defaultWidth is -1 || defaultHeight is -1 || wHint !is defaultWhint || hHint !is defaultHhint) {
+ Point size = control.computeSize (wHint, hHint, flushCache_);
+ defaultWhint = wHint;
+ defaultHhint = hHint;
+ defaultWidth = size.x;
+ defaultHeight = size.y;
+ }
+ cacheWidth = defaultWidth;
+ cacheHeight = defaultHeight;
+ return;
+ }
+ if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
+ Point size = control.computeSize (wHint, hHint, flushCache_);
+ currentWhint = wHint;
+ currentHhint = hHint;
+ currentWidth = size.x;
+ currentHeight = size.y;
+ }
+ cacheWidth = currentWidth;
+ cacheHeight = currentHeight;
}
void flushCache () {
- cacheWidth = cacheHeight = -1;
- defaultHeight = defaultWidth = -1;
- currentHeight = currentWidth = -1;
+ cacheWidth = cacheHeight = -1;
+ defaultHeight = defaultWidth = -1;
+ currentHeight = currentWidth = -1;
}
int getWidth (Control control, bool flushCache) {
- needed = true;
- computeSize (control, width, height, flushCache);
- return cacheWidth;
+ needed = true;
+ computeSize (control, width, height, flushCache);
+ return cacheWidth;
}
int getHeight (Control control, bool flushCache) {
- computeSize (control, width, height, flushCache);
- return cacheHeight;
+ computeSize (control, width, height, flushCache);
+ return cacheHeight;
}
FormAttachment getBottomAttachment (Control control, int spacing, bool flushCache) {
- if (cacheBottom !is null) return cacheBottom;
- if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache));
- if (bottom is null) {
- if (top is null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache));
- return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache));
- }
- Control bottomControl = bottom.control;
- if (bottomControl !is null) {
- if (bottomControl.isDisposed ()) {
- bottom.control = bottomControl = null;
- } else {
- if (bottomControl.getParent () !is control.getParent ()) {
- bottomControl = null;
- }
- }
- }
- if (bottomControl is null) return cacheBottom = bottom;
- isVisited = true;
- FormData bottomData = cast(FormData) bottomControl.getLayoutData ();
- FormAttachment bottomAttachment = bottomData.getBottomAttachment (bottomControl, spacing, flushCache);
- switch (bottom.alignment) {
- case SWT.BOTTOM:
- cacheBottom = bottomAttachment.plus (bottom.offset);
- break;
- case SWT.CENTER: {
- FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache);
- FormAttachment bottomHeight = bottomAttachment.minus (topAttachment);
- cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2));
- break;
- }
- default: {
- FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache);
- cacheBottom = topAttachment.plus (bottom.offset - spacing);
- break;
- }
- }
- isVisited = false;
- return cacheBottom;
+ if (cacheBottom !is null) return cacheBottom;
+ if (isVisited) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache));
+ if (bottom is null) {
+ if (top is null) return cacheBottom = new FormAttachment (0, getHeight (control, flushCache));
+ return cacheBottom = getTopAttachment (control, spacing, flushCache).plus (getHeight (control, flushCache));
+ }
+ Control bottomControl = bottom.control;
+ if (bottomControl !is null) {
+ if (bottomControl.isDisposed ()) {
+ bottom.control = bottomControl = null;
+ } else {
+ if (bottomControl.getParent () !is control.getParent ()) {
+ bottomControl = null;
+ }
+ }
+ }
+ if (bottomControl is null) return cacheBottom = bottom;
+ isVisited = true;
+ FormData bottomData = cast(FormData) bottomControl.getLayoutData ();
+ FormAttachment bottomAttachment = bottomData.getBottomAttachment (bottomControl, spacing, flushCache);
+ switch (bottom.alignment) {
+ case SWT.BOTTOM:
+ cacheBottom = bottomAttachment.plus (bottom.offset);
+ break;
+ case SWT.CENTER: {
+ FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache);
+ FormAttachment bottomHeight = bottomAttachment.minus (topAttachment);
+ cacheBottom = bottomAttachment.minus (bottomHeight.minus (getHeight (control, flushCache)).divide (2));
+ break;
+ }
+ default: {
+ FormAttachment topAttachment = bottomData.getTopAttachment (bottomControl, spacing, flushCache);
+ cacheBottom = topAttachment.plus (bottom.offset - spacing);
+ break;
+ }
+ }
+ isVisited = false;
+ return cacheBottom;
}
FormAttachment getLeftAttachment (Control control, int spacing, bool flushCache) {
- if (cacheLeft !is null) return cacheLeft;
- if (isVisited) return cacheLeft = new FormAttachment (0, 0);
- if (left is null) {
- if (right is null) return cacheLeft = new FormAttachment (0, 0);
- return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache));
- }
- Control leftControl = left.control;
- if (leftControl !is null) {
- if (leftControl.isDisposed ()) {
- left.control = leftControl = null;
- } else {
- if (leftControl.getParent () !is control.getParent ()) {
- leftControl = null;
- }
- }
- }
- if (leftControl is null) return cacheLeft = left;
- isVisited = true;
- FormData leftData = cast(FormData) leftControl.getLayoutData ();
- FormAttachment leftAttachment = leftData.getLeftAttachment (leftControl, spacing, flushCache);
- switch (left.alignment) {
- case SWT.LEFT:
- cacheLeft = leftAttachment.plus (left.offset);
- break;
- case SWT.CENTER: {
- FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache);
- FormAttachment leftWidth = rightAttachment.minus (leftAttachment);
- cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2));
- break;
- }
- default: {
- FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache);
- cacheLeft = rightAttachment.plus (left.offset + spacing);
- }
- }
- isVisited = false;
- return cacheLeft;
+ if (cacheLeft !is null) return cacheLeft;
+ if (isVisited) return cacheLeft = new FormAttachment (0, 0);
+ if (left is null) {
+ if (right is null) return cacheLeft = new FormAttachment (0, 0);
+ return cacheLeft = getRightAttachment (control, spacing, flushCache).minus (getWidth (control, flushCache));
+ }
+ Control leftControl = left.control;
+ if (leftControl !is null) {
+ if (leftControl.isDisposed ()) {
+ left.control = leftControl = null;
+ } else {
+ if (leftControl.getParent () !is control.getParent ()) {
+ leftControl = null;
+ }
+ }
+ }
+ if (leftControl is null) return cacheLeft = left;
+ isVisited = true;
+ FormData leftData = cast(FormData) leftControl.getLayoutData ();
+ FormAttachment leftAttachment = leftData.getLeftAttachment (leftControl, spacing, flushCache);
+ switch (left.alignment) {
+ case SWT.LEFT:
+ cacheLeft = leftAttachment.plus (left.offset);
+ break;
+ case SWT.CENTER: {
+ FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache);
+ FormAttachment leftWidth = rightAttachment.minus (leftAttachment);
+ cacheLeft = leftAttachment.plus (leftWidth.minus (getWidth (control, flushCache)).divide (2));
+ break;
+ }
+ default: {
+ FormAttachment rightAttachment = leftData.getRightAttachment (leftControl, spacing, flushCache);
+ cacheLeft = rightAttachment.plus (left.offset + spacing);
+ }
+ }
+ isVisited = false;
+ return cacheLeft;
}
char[] getName () {
@@ -245,85 +245,85 @@
}
FormAttachment getRightAttachment (Control control, int spacing, bool flushCache) {
- if (cacheRight !is null) return cacheRight;
- if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache));
- if (right is null) {
- if (left is null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache));
- return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache));
- }
- Control rightControl = right.control;
- if (rightControl !is null) {
- if (rightControl.isDisposed ()) {
- right.control = rightControl = null;
- } else {
- if (rightControl.getParent () !is control.getParent ()) {
- rightControl = null;
- }
- }
- }
- if (rightControl is null) return cacheRight = right;
- isVisited = true;
- FormData rightData = cast(FormData) rightControl.getLayoutData ();
- FormAttachment rightAttachment = rightData.getRightAttachment (rightControl, spacing, flushCache);
- switch (right.alignment) {
- case SWT.RIGHT:
- cacheRight = rightAttachment.plus (right.offset);
- break;
- case SWT.CENTER: {
- FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache);
- FormAttachment rightWidth = rightAttachment.minus (leftAttachment);
- cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2));
- break;
- }
- default: {
- FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache);
- cacheRight = leftAttachment.plus (right.offset - spacing);
- break;
- }
- }
- isVisited = false;
- return cacheRight;
+ if (cacheRight !is null) return cacheRight;
+ if (isVisited) return cacheRight = new FormAttachment (0, getWidth (control, flushCache));
+ if (right is null) {
+ if (left is null) return cacheRight = new FormAttachment (0, getWidth (control, flushCache));
+ return cacheRight = getLeftAttachment (control, spacing, flushCache).plus (getWidth (control, flushCache));
+ }
+ Control rightControl = right.control;
+ if (rightControl !is null) {
+ if (rightControl.isDisposed ()) {
+ right.control = rightControl = null;
+ } else {
+ if (rightControl.getParent () !is control.getParent ()) {
+ rightControl = null;
+ }
+ }
+ }
+ if (rightControl is null) return cacheRight = right;
+ isVisited = true;
+ FormData rightData = cast(FormData) rightControl.getLayoutData ();
+ FormAttachment rightAttachment = rightData.getRightAttachment (rightControl, spacing, flushCache);
+ switch (right.alignment) {
+ case SWT.RIGHT:
+ cacheRight = rightAttachment.plus (right.offset);
+ break;
+ case SWT.CENTER: {
+ FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache);
+ FormAttachment rightWidth = rightAttachment.minus (leftAttachment);
+ cacheRight = rightAttachment.minus (rightWidth.minus (getWidth (control, flushCache)).divide (2));
+ break;
+ }
+ default: {
+ FormAttachment leftAttachment = rightData.getLeftAttachment (rightControl, spacing, flushCache);
+ cacheRight = leftAttachment.plus (right.offset - spacing);
+ break;
+ }
+ }
+ isVisited = false;
+ return cacheRight;
}
FormAttachment getTopAttachment (Control control, int spacing, bool flushCache) {
- if (cacheTop !is null) return cacheTop;
- if (isVisited) return cacheTop = new FormAttachment (0, 0);
- if (top is null) {
- if (bottom is null) return cacheTop = new FormAttachment (0, 0);
- return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache));
- }
- Control topControl = top.control;
- if (topControl !is null) {
- if (topControl.isDisposed ()) {
- top.control = topControl = null;
- } else {
- if (topControl.getParent () !is control.getParent ()) {
- topControl = null;
- }
- }
- }
- if (topControl is null) return cacheTop = top;
- isVisited = true;
- FormData topData = cast(FormData) topControl.getLayoutData ();
- FormAttachment topAttachment = topData.getTopAttachment (topControl, spacing, flushCache);
- switch (top.alignment) {
- case SWT.TOP:
- cacheTop = topAttachment.plus (top.offset);
- break;
- case SWT.CENTER: {
- FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache);
- FormAttachment topHeight = bottomAttachment.minus (topAttachment);
- cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2));
- break;
- }
- default: {
- FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache);
- cacheTop = bottomAttachment.plus (top.offset + spacing);
- break;
- }
- }
- isVisited = false;
- return cacheTop;
+ if (cacheTop !is null) return cacheTop;
+ if (isVisited) return cacheTop = new FormAttachment (0, 0);
+ if (top is null) {
+ if (bottom is null) return cacheTop = new FormAttachment (0, 0);
+ return cacheTop = getBottomAttachment (control, spacing, flushCache).minus (getHeight (control, flushCache));
+ }
+ Control topControl = top.control;
+ if (topControl !is null) {
+ if (topControl.isDisposed ()) {
+ top.control = topControl = null;
+ } else {
+ if (topControl.getParent () !is control.getParent ()) {
+ topControl = null;
+ }
+ }
+ }
+ if (topControl is null) return cacheTop = top;
+ isVisited = true;
+ FormData topData = cast(FormData) topControl.getLayoutData ();
+ FormAttachment topAttachment = topData.getTopAttachment (topControl, spacing, flushCache);
+ switch (top.alignment) {
+ case SWT.TOP:
+ cacheTop = topAttachment.plus (top.offset);
+ break;
+ case SWT.CENTER: {
+ FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache);
+ FormAttachment topHeight = bottomAttachment.minus (topAttachment);
+ cacheTop = topAttachment.plus (topHeight.minus (getHeight (control, flushCache)).divide (2));
+ break;
+ }
+ default: {
+ FormAttachment bottomAttachment = topData.getBottomAttachment (topControl, spacing, flushCache);
+ cacheTop = bottomAttachment.plus (top.offset + spacing);
+ break;
+ }
+ }
+ isVisited = false;
+ return cacheTop;
}
/**
@@ -333,16 +333,16 @@
* @return a string representation of the FormData object
*/
public char[] toString () {
- char[] string = getName()~" {";
- if (width !is SWT.DEFAULT) string ~= "width="~to!(char[])(width)~" ";
- if (height !is SWT.DEFAULT) string ~= "height="~to!(char[])(height)~" ";
- if (left !is null) string ~= "left="~to!(char[])(left)~" ";
- if (right !is null) string ~= "right="~to!(char[])(right)~" ";
- if (top !is null) string ~= "top="~to!(char[])(top)~" ";
- if (bottom !is null) string ~= "bottom="~to!(char[])(bottom)~" ";
- string = trim( string );
- string ~= "}";
- return string;
+ char[] string = getName()~" {";
+ if (width !is SWT.DEFAULT) string ~= "width="~to!(char[])(width)~" ";
+ if (height !is SWT.DEFAULT) string ~= "height="~to!(char[])(height)~" ";
+ if (left !is null) string ~= "left="~to!(char[])(left)~" ";
+ if (right !is null) string ~= "right="~to!(char[])(right)~" ";
+ if (top !is null) string ~= "top="~to!(char[])(top)~" ";
+ if (bottom !is null) string ~= "bottom="~to!(char[])(bottom)~" ";
+ string = trim( string );
+ string ~= "}";
+ return string;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/layout/FormLayout.d
--- a/dwt/layout/FormLayout.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/layout/FormLayout.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -33,12 +33,12 @@
* The following example code creates a FormLayout
and then sets
* it into a Shell
:
*
- * Display display = new Display (); - * Shell shell = new Shell(display); - * FormLayout layout = new FormLayout(); - * layout.marginWidth = 3; - * layout.marginHeight = 3; - * shell.setLayout(layout); + * Display display = new Display (); + * Shell shell = new Shell(display); + * FormLayout layout = new FormLayout(); + * layout.marginWidth = 3; + * layout.marginHeight = 3; + * shell.setLayout(layout); ** *
@@ -49,15 +49,15 @@
* edge of button1
and the top and right edges of the
* composite:
*
- * FormData data1 = new FormData(); - * data1.left = new FormAttachment(0, 0); - * data1.top = new FormAttachment(0, 0); - * button1.setLayoutData(data1); - * FormData data2 = new FormData(); - * data2.left = new FormAttachment(button1); - * data2.top = new FormAttachment(0, 0); - * data2.right = new FormAttachment(100, 0); - * button2.setLayoutData(data2); + * FormData data1 = new FormData(); + * data1.left = new FormAttachment(0, 0); + * data1.top = new FormAttachment(0, 0); + * button1.setLayoutData(data1); + * FormData data2 = new FormData(); + * data2.left = new FormAttachment(button1); + * data2.top = new FormAttachment(0, 0); + * data2.right = new FormAttachment(100, 0); + * button2.setLayoutData(data2); ** *
@@ -74,10 +74,10 @@
* The following code positions button1
and button2
* but relies on default attachments:
*
- * FormData data2 = new FormData(); - * data2.left = new FormAttachment(button1); - * data2.right = new FormAttachment(100, 0); - * button2.setLayoutData(data2); + * FormData data2 = new FormData(); + * data2.left = new FormAttachment(button1); + * data2.right = new FormAttachment(100, 0); + * button2.setLayoutData(data2); ** *
@@ -96,72 +96,72 @@
*/
public final class FormLayout : Layout {
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the layout.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
+ /**
+ * marginWidth specifies the number of pixels of horizontal margin
+ * that will be placed along the left and right edges of the layout.
+ *
+ * The default value is 0.
+ */
+ public int marginWidth = 0;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the layout.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
+ /**
+ * marginHeight specifies the number of pixels of vertical margin
+ * that will be placed along the top and bottom edges of the layout.
+ *
+ * The default value is 0.
+ */
+ public int marginHeight = 0;
- /**
- * marginLeft specifies the number of pixels of horizontal margin
- * that will be placed along the left edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginLeft = 0;
+ /**
+ * marginLeft specifies the number of pixels of horizontal margin
+ * that will be placed along the left edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginLeft = 0;
- /**
- * marginTop specifies the number of pixels of vertical margin
- * that will be placed along the top edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginTop = 0;
+ /**
+ * marginTop specifies the number of pixels of vertical margin
+ * that will be placed along the top edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginTop = 0;
- /**
- * marginRight specifies the number of pixels of horizontal margin
- * that will be placed along the right edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginRight = 0;
+ /**
+ * marginRight specifies the number of pixels of horizontal margin
+ * that will be placed along the right edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginRight = 0;
- /**
- * marginBottom specifies the number of pixels of vertical margin
- * that will be placed along the bottom edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginBottom = 0;
+ /**
+ * marginBottom specifies the number of pixels of vertical margin
+ * that will be placed along the bottom edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginBottom = 0;
- /**
- * spacing specifies the number of pixels between the edge of one control
- * and the edge of its neighbouring control.
- *
- * The default value is 0.
- *
- * @since 3.0
- */
- public int spacing = 0;
+ /**
+ * spacing specifies the number of pixels between the edge of one control
+ * and the edge of its neighbouring control.
+ *
+ * The default value is 0.
+ *
+ * @since 3.0
+ */
+ public int spacing = 0;
/**
* Constructs a new instance of this class.
@@ -176,17 +176,17 @@
* Given that the equations for top (T) and bottom (B)
* of the control in terms of the height of the form (X)
* are:
- * T = AX + B
- * B = CX + D
+ * T = AX + B
+ * B = CX + D
*
* The equation for the height of the control (H)
* is bottom (B) minus top (T) or (H = B - T) or:
*
- * H = (CX + D) - (AX + B)
+ * H = (CX + D) - (AX + B)
*
* Solving for (X), the height of the form, we get:
*
- * X = (H + B - D) / (C - A)
+ * X = (H + B - D) / (C - A)
*
* When (A = C), (C - A = 0) and the equation has no
* solution for X. This is a special case meaning that
@@ -196,73 +196,73 @@
*
* Case 1: A = C, A = 0, C = 0
*
- * Let X = D, the distance from the top of the form
- * to the bottom edge of the control. In this case,
- * the control was attached to the top of the form
- * and the form needs to be large enough to show the
- * bottom edge of the control.
+ * Let X = D, the distance from the top of the form
+ * to the bottom edge of the control. In this case,
+ * the control was attached to the top of the form
+ * and the form needs to be large enough to show the
+ * bottom edge of the control.
*
* Case 2: A = C, A = 1, C = 1
*
- * Let X = -B, the distance from the bottom of the
- * form to the top edge of the control. In this case,
- * the control was attached to the bottom of the form
- * and the only way that the control would be visible
- * is if the offset is negative. If the offset is
- * positive, there is no possible height for the form
- * that will show the control as it will always be
- * below the bottom edge of the form.
+ * Let X = -B, the distance from the bottom of the
+ * form to the top edge of the control. In this case,
+ * the control was attached to the bottom of the form
+ * and the only way that the control would be visible
+ * is if the offset is negative. If the offset is
+ * positive, there is no possible height for the form
+ * that will show the control as it will always be
+ * below the bottom edge of the form.
*
* Case 3: A = C, A !is 0, C !is 0 and A !is 1, C !is 0
*
- * Let X = D / (1 - C), the distance from the top of the
- * form to the bottom edge of the control. In this case,
- * since C is not 0 or 1, it must be a fraction, U / V.
- * The offset D is the distance from CX to the bottom edge
- * of the control. This represents a fraction of the form
- * (1 - C)X. Since the height of a fraction of the form is
- * known, the height of the entire form can be found by setting
- * (1 - C)X = D. We solve this equation for X in terms of U
- * and V, giving us X = (U * D) / (U - V). Similarly, if the
- * offset D is negative, the control is positioned above CX.
- * The offset -B is the distance from the top edge of the control
- * to CX. We can find the height of the entire form by setting
- * CX = -B. Solving in terms of U and V gives us X = (-B * V) / U.
+ * Let X = D / (1 - C), the distance from the top of the
+ * form to the bottom edge of the control. In this case,
+ * since C is not 0 or 1, it must be a fraction, U / V.
+ * The offset D is the distance from CX to the bottom edge
+ * of the control. This represents a fraction of the form
+ * (1 - C)X. Since the height of a fraction of the form is
+ * known, the height of the entire form can be found by setting
+ * (1 - C)X = D. We solve this equation for X in terms of U
+ * and V, giving us X = (U * D) / (U - V). Similarly, if the
+ * offset D is negative, the control is positioned above CX.
+ * The offset -B is the distance from the top edge of the control
+ * to CX. We can find the height of the entire form by setting
+ * CX = -B. Solving in terms of U and V gives us X = (-B * V) / U.
*/
int computeHeight (Control control, FormData data, bool flushCache) {
- FormAttachment top = data.getTopAttachment (control, spacing, flushCache);
- FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache);
- FormAttachment height = bottom.minus (top);
- if (height.numerator is 0) {
- if (bottom.numerator is 0) return bottom.offset;
- if (bottom.numerator is bottom.denominator) return -top.offset;
- if (bottom.offset <= 0) {
- return -top.offset * top.denominator / bottom.numerator;
- }
- int divider = bottom.denominator - bottom.numerator;
- return bottom.denominator * bottom.offset / divider;
- }
- return height.solveY (data.getHeight (control, flushCache));
+ FormAttachment top = data.getTopAttachment (control, spacing, flushCache);
+ FormAttachment bottom = data.getBottomAttachment (control, spacing, flushCache);
+ FormAttachment height = bottom.minus (top);
+ if (height.numerator is 0) {
+ if (bottom.numerator is 0) return bottom.offset;
+ if (bottom.numerator is bottom.denominator) return -top.offset;
+ if (bottom.offset <= 0) {
+ return -top.offset * top.denominator / bottom.numerator;
+ }
+ int divider = bottom.denominator - bottom.numerator;
+ return bottom.denominator * bottom.offset / divider;
+ }
+ return height.solveY (data.getHeight (control, flushCache));
}
protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache) {
- Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache);
- if (wHint !is SWT.DEFAULT) size.x = wHint;
- if (hHint !is SWT.DEFAULT) size.y = hHint;
- return size;
+ Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache);
+ if (wHint !is SWT.DEFAULT) size.x = wHint;
+ if (hHint !is SWT.DEFAULT) size.y = hHint;
+ return size;
}
protected bool flushCache (Control control) {
- Object data = control.getLayoutData ();
- if (data !is null) (cast(FormData) data).flushCache ();
- return true;
+ Object data = control.getLayoutData ();
+ if (data !is null) (cast(FormData) data).flushCache ();
+ return true;
}
char[] getName () {
- char[] string = this.classinfo.name;
- int index = locatePrior( string, '.');
- if (index is string.length ) return string;
- return string[ index + 1 .. string.length ];
+ char[] string = this.classinfo.name;
+ int index = locatePrior( string, '.');
+ if (index is string.length ) return string;
+ return string[ index + 1 .. string.length ];
}
/*
@@ -270,105 +270,105 @@
* respect to the preferred height of the control.
*/
int computeWidth (Control control, FormData data, bool flushCache) {
- FormAttachment left = data.getLeftAttachment (control, spacing, flushCache);
- FormAttachment right = data.getRightAttachment (control, spacing, flushCache);
- FormAttachment width = right.minus (left);
- if (width.numerator is 0) {
- if (right.numerator is 0) return right.offset;
- if (right.numerator is right.denominator) return -left.offset;
- if (right.offset <= 0) {
- return -left.offset * left.denominator / left.numerator;
- }
- int divider = right.denominator - right.numerator;
- return right.denominator * right.offset / divider;
- }
- return width.solveY (data.getWidth (control, flushCache));
+ FormAttachment left = data.getLeftAttachment (control, spacing, flushCache);
+ FormAttachment right = data.getRightAttachment (control, spacing, flushCache);
+ FormAttachment width = right.minus (left);
+ if (width.numerator is 0) {
+ if (right.numerator is 0) return right.offset;
+ if (right.numerator is right.denominator) return -left.offset;
+ if (right.offset <= 0) {
+ return -left.offset * left.denominator / left.numerator;
+ }
+ int divider = right.denominator - right.numerator;
+ return right.denominator * right.offset / divider;
+ }
+ return width.solveY (data.getWidth (control, flushCache));
}
protected void layout (Composite composite, bool flushCache) {
- Rectangle rect = composite.getClientArea ();
- int x = rect.x + marginLeft + marginWidth;
- int y = rect.y + marginTop + marginHeight;
- int width = Math.max (0, rect.width - marginLeft - 2 * marginWidth - marginRight);
- int height = Math.max (0, rect.height - marginTop - 2 * marginHeight - marginBottom);
- layout (composite, true, x, y, width, height, flushCache);
+ Rectangle rect = composite.getClientArea ();
+ int x = rect.x + marginLeft + marginWidth;
+ int y = rect.y + marginTop + marginHeight;
+ int width = Math.max (0, rect.width - marginLeft - 2 * marginWidth - marginRight);
+ int height = Math.max (0, rect.height - marginTop - 2 * marginHeight - marginBottom);
+ layout (composite, true, x, y, width, height, flushCache);
}
Point layout (Composite composite, bool move, int x, int y, int width, int height, bool flushCache) {
- Control [] children = composite.getChildren ();
- for (int i=0; i grabExcessHorizontalSpace specifies whether the width of the cell
- * changes depending on the size of the parent Composite. If
- * grabExcessHorizontalSpace is The default value is false. grabExcessHorizontalSpace specifies whether the width of the cell
+ * changes depending on the size of the parent Composite. If
+ * grabExcessHorizontalSpace is The default value is false. grabExcessVerticalSpace specifies whether the height of the cell
- * changes depending on the size of the parent Composite. If
- * grabExcessVerticalSpace is The default value is false. grabExcessVerticalSpace specifies whether the height of the cell
+ * changes depending on the size of the parent Composite. If
+ * grabExcessVerticalSpace is The default value is false.
- * GridData gridData = new GridData();
- * gridData.horizontalAlignment = GridData.FILL;
- * gridData.grabExcessHorizontalSpace = true;
- * button1.setLayoutData(gridData);
+ * GridData gridData = new GridData();
+ * gridData.horizontalAlignment = GridData.FILL;
+ * gridData.grabExcessHorizontalSpace = true;
+ * button1.setLayoutData(gridData);
*
* The second is to take advantage of convenience style bits defined
* by GridData
:
@@ -48,351 +48,351 @@
* @see Control#setLayoutData
*/
public final class GridData {
- /**
- * verticalAlignment specifies how controls will be positioned
- * vertically within a cell.
- *
- * The default value is CENTER.
- *
- * Possible values are:
- *
- */
- public int verticalAlignment = CENTER;
+ /**
+ * verticalAlignment specifies how controls will be positioned
+ * vertically within a cell.
+ *
+ * The default value is CENTER.
+ *
+ * Possible values are:
+ *
+ */
+ public int verticalAlignment = CENTER;
- /**
- * horizontalAlignment specifies how controls will be positioned
- * horizontally within a cell.
- *
- * The default value is BEGINNING.
- *
- * Possible values are:
- *
- */
- public int horizontalAlignment = BEGINNING;
+ /**
+ * horizontalAlignment specifies how controls will be positioned
+ * horizontally within a cell.
+ *
+ * The default value is BEGINNING.
+ *
+ * Possible values are:
+ *
+ */
+ public int horizontalAlignment = BEGINNING;
- /**
- * widthHint specifies the preferred width in pixels. This value
- * is the wHint passed into Control.computeSize(int, int, bool)
- * to determine the preferred size of the control.
- *
- * The default value is SWT.DEFAULT.
- *
- * @see Control#computeSize(int, int, bool)
- */
- public int widthHint = SWT.DEFAULT;
+ /**
+ * widthHint specifies the preferred width in pixels. This value
+ * is the wHint passed into Control.computeSize(int, int, bool)
+ * to determine the preferred size of the control.
+ *
+ * The default value is SWT.DEFAULT.
+ *
+ * @see Control#computeSize(int, int, bool)
+ */
+ public int widthHint = SWT.DEFAULT;
- /**
- * heightHint specifies the preferred height in pixels. This value
- * is the hHint passed into Control.computeSize(int, int, bool)
- * to determine the preferred size of the control.
- *
- * The default value is SWT.DEFAULT.
- *
- * @see Control#computeSize(int, int, bool)
- */
- public int heightHint = SWT.DEFAULT;
+ /**
+ * heightHint specifies the preferred height in pixels. This value
+ * is the hHint passed into Control.computeSize(int, int, bool)
+ * to determine the preferred size of the control.
+ *
+ * The default value is SWT.DEFAULT.
+ *
+ * @see Control#computeSize(int, int, bool)
+ */
+ public int heightHint = SWT.DEFAULT;
- /**
- * horizontalIndent specifies the number of pixels of indentation
- * that will be placed along the left side of the cell.
- *
- * The default value is 0.
- */
- public int horizontalIndent = 0;
+ /**
+ * horizontalIndent specifies the number of pixels of indentation
+ * that will be placed along the left side of the cell.
+ *
+ * The default value is 0.
+ */
+ public int horizontalIndent = 0;
- /**
- * verticalIndent specifies the number of pixels of indentation
- * that will be placed along the top side of the cell.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int verticalIndent = 0;
+ /**
+ * verticalIndent specifies the number of pixels of indentation
+ * that will be placed along the top side of the cell.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int verticalIndent = 0;
- /**
- * horizontalSpan specifies the number of column cells that the control
- * will take up.
- *
- * The default value is 1.
- */
- public int horizontalSpan = 1;
+ /**
+ * horizontalSpan specifies the number of column cells that the control
+ * will take up.
+ *
+ * The default value is 1.
+ */
+ public int horizontalSpan = 1;
- /**
- * verticalSpan specifies the number of row cells that the control
- * will take up.
- *
- * The default value is 1.
- */
- public int verticalSpan = 1;
+ /**
+ * verticalSpan specifies the number of row cells that the control
+ * will take up.
+ *
+ * The default value is 1.
+ */
+ public int verticalSpan = 1;
- /**
- * true
, the following rules
- * apply to the width of the cell:
- *
- *
- * true
, the following rules
+ * apply to the width of the cell:
+ *
+ *
+ * true
, the following rules
- * apply to the height of the cell:
- *
- *
- * true
, the following rules
+ * apply to the height of the cell:
+ *
+ *
+ * true
,
- * the size and position of the control will not be managed by the
- * layout. If this value is false
, the size and
- * position of the control will be computed and assigned.
- *
- * The default value is false
.
- *
- * @since 3.1
- */
- public bool exclude = false;
+ /**
+ * exclude informs the layout to ignore this control when sizing
+ * and positioning controls. If this value is true
,
+ * the size and position of the control will not be managed by the
+ * layout. If this value is false
, the size and
+ * position of the control will be computed and assigned.
+ *
+ * The default value is false
.
+ *
+ * @since 3.1
+ */
+ public bool exclude = false;
- /**
- * Value for horizontalAlignment or verticalAlignment.
- * Position the control at the top or left of the cell.
- * Not recommended. Use SWT.BEGINNING, SWT.TOP or SWT.LEFT instead.
- */
- public static const int BEGINNING = SWT.BEGINNING;
+ /**
+ * Value for horizontalAlignment or verticalAlignment.
+ * Position the control at the top or left of the cell.
+ * Not recommended. Use SWT.BEGINNING, SWT.TOP or SWT.LEFT instead.
+ */
+ public static const int BEGINNING = SWT.BEGINNING;
- /**
- * Value for horizontalAlignment or verticalAlignment.
- * Position the control in the vertical or horizontal center of the cell
- * Not recommended. Use SWT.CENTER instead.
- */
- public static const int CENTER = 2;
+ /**
+ * Value for horizontalAlignment or verticalAlignment.
+ * Position the control in the vertical or horizontal center of the cell
+ * Not recommended. Use SWT.CENTER instead.
+ */
+ public static const int CENTER = 2;
- /**
- * Value for horizontalAlignment or verticalAlignment.
- * Position the control at the bottom or right of the cell
- * Not recommended. Use SWT.END, SWT.BOTTOM or SWT.RIGHT instead.
- */
- public static const int END = 3;
+ /**
+ * Value for horizontalAlignment or verticalAlignment.
+ * Position the control at the bottom or right of the cell
+ * Not recommended. Use SWT.END, SWT.BOTTOM or SWT.RIGHT instead.
+ */
+ public static const int END = 3;
- /**
- * Value for horizontalAlignment or verticalAlignment.
- * Resize the control to fill the cell horizontally or vertically.
- * Not recommended. Use SWT.FILL instead.
- */
- public static const int FILL = SWT.FILL;
+ /**
+ * Value for horizontalAlignment or verticalAlignment.
+ * Resize the control to fill the cell horizontally or vertically.
+ * Not recommended. Use SWT.FILL instead.
+ */
+ public static const int FILL = SWT.FILL;
- /**
- * Style bit for new GridData(int)
.
- * Position the control at the top of the cell.
- * Not recommended. Use
- * new GridData(int, SWT.BEGINNING, bool, bool)
- * instead.
- */
- public static const int VERTICAL_ALIGN_BEGINNING = 1 << 1;
+ /**
+ * Style bit for new GridData(int)
.
+ * Position the control at the top of the cell.
+ * Not recommended. Use
+ * new GridData(int, SWT.BEGINNING, bool, bool)
+ * instead.
+ */
+ public static const int VERTICAL_ALIGN_BEGINNING = 1 << 1;
- /**
- * Style bit for new GridData(int)
to position the
- * control in the vertical center of the cell.
- * Not recommended. Use
- * new GridData(int, SWT.CENTER, bool, bool)
- * instead.
- */
- public static const int VERTICAL_ALIGN_CENTER = 1 << 2;
+ /**
+ * Style bit for new GridData(int)
to position the
+ * control in the vertical center of the cell.
+ * Not recommended. Use
+ * new GridData(int, SWT.CENTER, bool, bool)
+ * instead.
+ */
+ public static const int VERTICAL_ALIGN_CENTER = 1 << 2;
- /**
- * Style bit for new GridData(int)
to position the
- * control at the bottom of the cell.
- * Not recommended. Use
- * new GridData(int, SWT.END, bool, bool)
- * instead.
- */
- public static const int VERTICAL_ALIGN_END = 1 << 3;
+ /**
+ * Style bit for new GridData(int)
to position the
+ * control at the bottom of the cell.
+ * Not recommended. Use
+ * new GridData(int, SWT.END, bool, bool)
+ * instead.
+ */
+ public static const int VERTICAL_ALIGN_END = 1 << 3;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell vertically.
- * Not recommended. Use
- * new GridData(int, SWT.FILL, bool, bool)
- * instead
- */
- public static const int VERTICAL_ALIGN_FILL = 1 << 4;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fill the cell vertically.
+ * Not recommended. Use
+ * new GridData(int, SWT.FILL, bool, bool)
+ * instead
+ */
+ public static const int VERTICAL_ALIGN_FILL = 1 << 4;
- /**
- * Style bit for new GridData(int)
to position the
- * control at the left of the cell.
- * Not recommended. Use
- * new GridData(SWT.BEGINNING, int, bool, bool)
- * instead.
- */
- public static const int HORIZONTAL_ALIGN_BEGINNING = 1 << 5;
+ /**
+ * Style bit for new GridData(int)
to position the
+ * control at the left of the cell.
+ * Not recommended. Use
+ * new GridData(SWT.BEGINNING, int, bool, bool)
+ * instead.
+ */
+ public static const int HORIZONTAL_ALIGN_BEGINNING = 1 << 5;
- /**
- * Style bit for new GridData(int)
to position the
- * control in the horizontal center of the cell.
- * Not recommended. Use
- * new GridData(SWT.CENTER, int, bool, bool)
- * instead.
- */
- public static const int HORIZONTAL_ALIGN_CENTER = 1 << 6;
+ /**
+ * Style bit for new GridData(int)
to position the
+ * control in the horizontal center of the cell.
+ * Not recommended. Use
+ * new GridData(SWT.CENTER, int, bool, bool)
+ * instead.
+ */
+ public static const int HORIZONTAL_ALIGN_CENTER = 1 << 6;
- /**
- * Style bit for new GridData(int)
to position the
- * control at the right of the cell.
- * Not recommended. Use
- * new GridData(SWT.END, int, bool, bool)
- * instead.
- */
- public static const int HORIZONTAL_ALIGN_END = 1 << 7;
+ /**
+ * Style bit for new GridData(int)
to position the
+ * control at the right of the cell.
+ * Not recommended. Use
+ * new GridData(SWT.END, int, bool, bool)
+ * instead.
+ */
+ public static const int HORIZONTAL_ALIGN_END = 1 << 7;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell horizontally.
- * Not recommended. Use
- * new GridData(SWT.FILL, int, bool, bool)
- * instead.
- */
- public static const int HORIZONTAL_ALIGN_FILL = 1 << 8;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fill the cell horizontally.
+ * Not recommended. Use
+ * new GridData(SWT.FILL, int, bool, bool)
+ * instead.
+ */
+ public static const int HORIZONTAL_ALIGN_FILL = 1 << 8;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fit the remaining horizontal space.
- * Not recommended. Use
- * new GridData(int, int, true, bool)
- * instead.
- */
- public static const int GRAB_HORIZONTAL = 1 << 9;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fit the remaining horizontal space.
+ * Not recommended. Use
+ * new GridData(int, int, true, bool)
+ * instead.
+ */
+ public static const int GRAB_HORIZONTAL = 1 << 9;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fit the remaining vertical space.
- * Not recommended. Use
- * new GridData(int, int, bool, true)
- * instead.
- */
- public static const int GRAB_VERTICAL = 1 << 10;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fit the remaining vertical space.
+ * Not recommended. Use
+ * new GridData(int, int, bool, true)
+ * instead.
+ */
+ public static const int GRAB_VERTICAL = 1 << 10;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell vertically and to fit the remaining
- * vertical space.
- * FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL
- * Not recommended. Use
- * new GridData(int, SWT.FILL, bool, true)
- * instead.
- */
- public static const int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fill the cell vertically and to fit the remaining
+ * vertical space.
+ * FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL
+ * Not recommended. Use
+ * new GridData(int, SWT.FILL, bool, true)
+ * instead.
+ */
+ public static const int FILL_VERTICAL = VERTICAL_ALIGN_FILL | GRAB_VERTICAL;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell horizontally and to fit the remaining
- * horizontal space.
- * FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL
- * Not recommended. Use
- * new GridData(SWT.FILL, int, true, bool)
- * instead.
- */
- public static const int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fill the cell horizontally and to fit the remaining
+ * horizontal space.
+ * FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL
+ * Not recommended. Use
+ * new GridData(SWT.FILL, int, true, bool)
+ * instead.
+ */
+ public static const int FILL_HORIZONTAL = HORIZONTAL_ALIGN_FILL | GRAB_HORIZONTAL;
- /**
- * Style bit for new GridData(int)
to resize the
- * control to fill the cell horizontally and vertically and
- * to fit the remaining horizontal and vertical space.
- * FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL
- * Not recommended. Use
- * new GridData(SWT.FILL, SWT.FILL, true, true)
- * instead.
- */
- public static const int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL;
+ /**
+ * Style bit for new GridData(int)
to resize the
+ * control to fill the cell horizontally and vertically and
+ * to fit the remaining horizontal and vertical space.
+ * FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL
+ * Not recommended. Use
+ * new GridData(SWT.FILL, SWT.FILL, true, true)
+ * instead.
+ */
+ public static const int FILL_BOTH = FILL_VERTICAL | FILL_HORIZONTAL;
- int cacheWidth = -1, cacheHeight = -1;
- int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
- int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
+ int cacheWidth = -1, cacheHeight = -1;
+ int defaultWhint, defaultHhint, defaultWidth = -1, defaultHeight = -1;
+ int currentWhint, currentHhint, currentWidth = -1, currentHeight = -1;
/**
* Constructs a new instance of GridData using
@@ -408,16 +408,16 @@
* @param style the GridData style
*/
public this (int style) {
- if ((style & VERTICAL_ALIGN_BEGINNING) !is 0) verticalAlignment = BEGINNING;
- if ((style & VERTICAL_ALIGN_CENTER) !is 0) verticalAlignment = CENTER;
- if ((style & VERTICAL_ALIGN_FILL) !is 0) verticalAlignment = FILL;
- if ((style & VERTICAL_ALIGN_END) !is 0) verticalAlignment = END;
- if ((style & HORIZONTAL_ALIGN_BEGINNING) !is 0) horizontalAlignment = BEGINNING;
- if ((style & HORIZONTAL_ALIGN_CENTER) !is 0) horizontalAlignment = CENTER;
- if ((style & HORIZONTAL_ALIGN_FILL) !is 0) horizontalAlignment = FILL;
- if ((style & HORIZONTAL_ALIGN_END) !is 0) horizontalAlignment = END;
- grabExcessHorizontalSpace = (style & GRAB_HORIZONTAL) !is 0;
- grabExcessVerticalSpace = (style & GRAB_VERTICAL) !is 0;
+ if ((style & VERTICAL_ALIGN_BEGINNING) !is 0) verticalAlignment = BEGINNING;
+ if ((style & VERTICAL_ALIGN_CENTER) !is 0) verticalAlignment = CENTER;
+ if ((style & VERTICAL_ALIGN_FILL) !is 0) verticalAlignment = FILL;
+ if ((style & VERTICAL_ALIGN_END) !is 0) verticalAlignment = END;
+ if ((style & HORIZONTAL_ALIGN_BEGINNING) !is 0) horizontalAlignment = BEGINNING;
+ if ((style & HORIZONTAL_ALIGN_CENTER) !is 0) horizontalAlignment = CENTER;
+ if ((style & HORIZONTAL_ALIGN_FILL) !is 0) horizontalAlignment = FILL;
+ if ((style & HORIZONTAL_ALIGN_END) !is 0) horizontalAlignment = END;
+ grabExcessHorizontalSpace = (style & GRAB_HORIZONTAL) !is 0;
+ grabExcessVerticalSpace = (style & GRAB_VERTICAL) !is 0;
}
/**
@@ -431,7 +431,7 @@
* @since 3.0
*/
public this (int horizontalAlignment, int verticalAlignment, bool grabExcessHorizontalSpace, bool grabExcessVerticalSpace) {
- this (horizontalAlignment, verticalAlignment, grabExcessHorizontalSpace, grabExcessVerticalSpace, 1, 1);
+ this (horizontalAlignment, verticalAlignment, grabExcessHorizontalSpace, grabExcessVerticalSpace, 1, 1);
}
/**
@@ -448,11 +448,11 @@
*/
public this (int horizontalAlignment, int verticalAlignment, bool grabExcessHorizontalSpace, bool grabExcessVerticalSpace, int horizontalSpan, int verticalSpan) {
this.horizontalAlignment = horizontalAlignment;
- this.verticalAlignment = verticalAlignment;
- this.grabExcessHorizontalSpace = grabExcessHorizontalSpace;
- this.grabExcessVerticalSpace = grabExcessVerticalSpace;
- this.horizontalSpan = horizontalSpan;
- this.verticalSpan = verticalSpan;
+ this.verticalAlignment = verticalAlignment;
+ this.grabExcessHorizontalSpace = grabExcessHorizontalSpace;
+ this.grabExcessVerticalSpace = grabExcessVerticalSpace;
+ this.horizontalSpan = horizontalSpan;
+ this.verticalSpan = verticalSpan;
}
/**
@@ -466,39 +466,39 @@
* @since 3.0
*/
public this (int width, int height) {
- this.widthHint = width;
- this.heightHint = height;
+ this.widthHint = width;
+ this.heightHint = height;
}
void computeSize (Control control, int wHint, int hHint, bool flushCache) {
- if (cacheWidth !is -1 && cacheHeight !is -1) return;
- if (wHint is this.widthHint && hHint is this.heightHint) {
- if (defaultWidth is -1 || defaultHeight is -1 || wHint !is defaultWhint || hHint !is defaultHhint) {
- Point size = control.computeSize (wHint, hHint, flushCache);
- defaultWhint = wHint;
- defaultHhint = hHint;
- defaultWidth = size.x;
- defaultHeight = size.y;
- }
- cacheWidth = defaultWidth;
- cacheHeight = defaultHeight;
- return;
- }
- if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
- Point size = control.computeSize (wHint, hHint, flushCache);
- currentWhint = wHint;
- currentHhint = hHint;
- currentWidth = size.x;
- currentHeight = size.y;
- }
- cacheWidth = currentWidth;
- cacheHeight = currentHeight;
+ if (cacheWidth !is -1 && cacheHeight !is -1) return;
+ if (wHint is this.widthHint && hHint is this.heightHint) {
+ if (defaultWidth is -1 || defaultHeight is -1 || wHint !is defaultWhint || hHint !is defaultHhint) {
+ Point size = control.computeSize (wHint, hHint, flushCache);
+ defaultWhint = wHint;
+ defaultHhint = hHint;
+ defaultWidth = size.x;
+ defaultHeight = size.y;
+ }
+ cacheWidth = defaultWidth;
+ cacheHeight = defaultHeight;
+ return;
+ }
+ if (currentWidth is -1 || currentHeight is -1 || wHint !is currentWhint || hHint !is currentHhint) {
+ Point size = control.computeSize (wHint, hHint, flushCache);
+ currentWhint = wHint;
+ currentHhint = hHint;
+ currentWidth = size.x;
+ currentHeight = size.y;
+ }
+ cacheWidth = currentWidth;
+ cacheHeight = currentHeight;
}
void flushCache () {
- cacheWidth = cacheHeight = -1;
- defaultWidth = defaultHeight = -1;
- currentWidth = currentHeight = -1;
+ cacheWidth = cacheHeight = -1;
+ defaultWidth = defaultHeight = -1;
+ currentWidth = currentHeight = -1;
}
char[] getName () {
@@ -515,46 +515,46 @@
* @return a string representation of the GridData object
*/
public char[] toString () {
- char[] hAlign = "";
- switch (horizontalAlignment) {
- case SWT.FILL: hAlign = "SWT.FILL"; break;
- case SWT.BEGINNING: hAlign = "SWT.BEGINNING"; break;
- case SWT.LEFT: hAlign = "SWT.LEFT"; break;
- case SWT.END: hAlign = "SWT.END"; break;
- case END: hAlign = "GridData.END"; break;
- case SWT.RIGHT: hAlign = "SWT.RIGHT"; break;
- case SWT.CENTER: hAlign = "SWT.CENTER"; break;
- case CENTER: hAlign = "GridData.CENTER"; break;
- default: hAlign = "Undefined "~to!(char[])(horizontalAlignment); break;
- }
- char[] vAlign = "";
- switch (verticalAlignment) {
- case SWT.FILL: vAlign = "SWT.FILL"; break;
- case SWT.BEGINNING: vAlign = "SWT.BEGINNING"; break;
- case SWT.TOP: vAlign = "SWT.TOP"; break;
- case SWT.END: vAlign = "SWT.END"; break;
- case END: vAlign = "GridData.END"; break;
- case SWT.BOTTOM: vAlign = "SWT.BOTTOM"; break;
- case SWT.CENTER: vAlign = "SWT.CENTER"; break;
- case CENTER: vAlign = "GridData.CENTER"; break;
- default: vAlign = "Undefined "~to!(char[])(verticalAlignment); break;
- }
- char[] string = getName()~" {";
- string ~= "horizontalAlignment="~to!(char[])(hAlign)~" ";
- if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(char[])(horizontalIndent)~" ";
- if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(char[])(horizontalSpan)~" ";
- if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(char[])(grabExcessHorizontalSpace)~" ";
- if (widthHint !is SWT.DEFAULT) string ~= "widthHint="~to!(char[])(widthHint)~" ";
- if (minimumWidth !is 0) string ~= "minimumWidth="~to!(char[])(minimumWidth)~" ";
- string ~= "verticalAlignment="~vAlign~" ";
- if (verticalIndent !is 0) string ~= "verticalIndent="~to!(char[])(verticalIndent)~" ";
- if (verticalSpan !is 1) string ~= "verticalSpan="~to!(char[])(verticalSpan)~" ";
- if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(char[])(grabExcessVerticalSpace)~" ";
- if (heightHint !is SWT.DEFAULT) string ~= "heightHint="~to!(char[])(heightHint)~" ";
- if (minimumHeight !is 0) string ~= "minimumHeight="~to!(char[])(minimumHeight)~" ";
- if (exclude) string ~= "exclude="~to!(char[])(exclude)~" ";
- string = string.trim();
- string ~= "}";
- return string;
+ char[] hAlign = "";
+ switch (horizontalAlignment) {
+ case SWT.FILL: hAlign = "SWT.FILL"; break;
+ case SWT.BEGINNING: hAlign = "SWT.BEGINNING"; break;
+ case SWT.LEFT: hAlign = "SWT.LEFT"; break;
+ case SWT.END: hAlign = "SWT.END"; break;
+ case END: hAlign = "GridData.END"; break;
+ case SWT.RIGHT: hAlign = "SWT.RIGHT"; break;
+ case SWT.CENTER: hAlign = "SWT.CENTER"; break;
+ case CENTER: hAlign = "GridData.CENTER"; break;
+ default: hAlign = "Undefined "~to!(char[])(horizontalAlignment); break;
+ }
+ char[] vAlign = "";
+ switch (verticalAlignment) {
+ case SWT.FILL: vAlign = "SWT.FILL"; break;
+ case SWT.BEGINNING: vAlign = "SWT.BEGINNING"; break;
+ case SWT.TOP: vAlign = "SWT.TOP"; break;
+ case SWT.END: vAlign = "SWT.END"; break;
+ case END: vAlign = "GridData.END"; break;
+ case SWT.BOTTOM: vAlign = "SWT.BOTTOM"; break;
+ case SWT.CENTER: vAlign = "SWT.CENTER"; break;
+ case CENTER: vAlign = "GridData.CENTER"; break;
+ default: vAlign = "Undefined "~to!(char[])(verticalAlignment); break;
+ }
+ char[] string = getName()~" {";
+ string ~= "horizontalAlignment="~to!(char[])(hAlign)~" ";
+ if (horizontalIndent !is 0) string ~= "horizontalIndent="~to!(char[])(horizontalIndent)~" ";
+ if (horizontalSpan !is 1) string ~= "horizontalSpan="~to!(char[])(horizontalSpan)~" ";
+ if (grabExcessHorizontalSpace) string ~= "grabExcessHorizontalSpace="~to!(char[])(grabExcessHorizontalSpace)~" ";
+ if (widthHint !is SWT.DEFAULT) string ~= "widthHint="~to!(char[])(widthHint)~" ";
+ if (minimumWidth !is 0) string ~= "minimumWidth="~to!(char[])(minimumWidth)~" ";
+ string ~= "verticalAlignment="~vAlign~" ";
+ if (verticalIndent !is 0) string ~= "verticalIndent="~to!(char[])(verticalIndent)~" ";
+ if (verticalSpan !is 1) string ~= "verticalSpan="~to!(char[])(verticalSpan)~" ";
+ if (grabExcessVerticalSpace) string ~= "grabExcessVerticalSpace="~to!(char[])(grabExcessVerticalSpace)~" ";
+ if (heightHint !is SWT.DEFAULT) string ~= "heightHint="~to!(char[])(heightHint)~" ";
+ if (minimumHeight !is 0) string ~= "minimumHeight="~to!(char[])(minimumHeight)~" ";
+ if (exclude) string ~= "exclude="~to!(char[])(exclude)~" ";
+ string = string.trim();
+ string ~= "}";
+ return string;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/layout/GridLayout.d
--- a/dwt/layout/GridLayout.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/layout/GridLayout.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -40,11 +40,11 @@
* The following code creates a shell managed by a GridLayout
* with 3 columns:
*
- * Display display = new Display();
- * Shell shell = new Shell(display);
- * GridLayout gridLayout = new GridLayout();
- * gridLayout.numColumns = 3;
- * shell.setLayout(gridLayout);
+ * Display display = new Display();
+ * Shell shell = new Shell(display);
+ * GridLayout gridLayout = new GridLayout();
+ * gridLayout.numColumns = 3;
+ * shell.setLayout(gridLayout);
*
* The numColumns
field is the most important field in a
* GridLayout
. Widgets are laid out in columns from left
@@ -56,95 +56,95 @@
*/
public final class GridLayout : Layout {
- /**
- * numColumns specifies the number of cell columns in the layout.
- * If numColumns has a value less than 1, the layout will not
- * set the size and position of any controls.
- *
- * The default value is 1.
- */
- public int numColumns = 1;
+ /**
+ * numColumns specifies the number of cell columns in the layout.
+ * If numColumns has a value less than 1, the layout will not
+ * set the size and position of any controls.
+ *
+ * The default value is 1.
+ */
+ public int numColumns = 1;
- /**
- * makeColumnsEqualWidth specifies whether all columns in the layout
- * will be forced to have the same width.
- *
- * The default value is false.
- */
- public bool makeColumnsEqualWidth = false;
+ /**
+ * makeColumnsEqualWidth specifies whether all columns in the layout
+ * will be forced to have the same width.
+ *
+ * The default value is false.
+ */
+ public bool makeColumnsEqualWidth = false;
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the layout.
- *
- * The default value is 5.
- */
- public int marginWidth = 5;
+ /**
+ * marginWidth specifies the number of pixels of horizontal margin
+ * that will be placed along the left and right edges of the layout.
+ *
+ * The default value is 5.
+ */
+ public int marginWidth = 5;
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the layout.
- *
- * The default value is 5.
- */
- public int marginHeight = 5;
+ /**
+ * marginHeight specifies the number of pixels of vertical margin
+ * that will be placed along the top and bottom edges of the layout.
+ *
+ * The default value is 5.
+ */
+ public int marginHeight = 5;
- /**
- * marginLeft specifies the number of pixels of horizontal margin
- * that will be placed along the left edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginLeft = 0;
+ /**
+ * marginLeft specifies the number of pixels of horizontal margin
+ * that will be placed along the left edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginLeft = 0;
- /**
- * marginTop specifies the number of pixels of vertical margin
- * that will be placed along the top edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginTop = 0;
+ /**
+ * marginTop specifies the number of pixels of vertical margin
+ * that will be placed along the top edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginTop = 0;
- /**
- * marginRight specifies the number of pixels of horizontal margin
- * that will be placed along the right edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginRight = 0;
+ /**
+ * marginRight specifies the number of pixels of horizontal margin
+ * that will be placed along the right edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginRight = 0;
- /**
- * marginBottom specifies the number of pixels of vertical margin
- * that will be placed along the bottom edge of the layout.
- *
- * The default value is 0.
- *
- * @since 3.1
- */
- public int marginBottom = 0;
+ /**
+ * marginBottom specifies the number of pixels of vertical margin
+ * that will be placed along the bottom edge of the layout.
+ *
+ * The default value is 0.
+ *
+ * @since 3.1
+ */
+ public int marginBottom = 0;
- /**
- * horizontalSpacing specifies the number of pixels between the right
- * edge of one cell and the left edge of its neighbouring cell to
- * the right.
- *
- * The default value is 5.
- */
- public int horizontalSpacing = 5;
+ /**
+ * horizontalSpacing specifies the number of pixels between the right
+ * edge of one cell and the left edge of its neighbouring cell to
+ * the right.
+ *
+ * The default value is 5.
+ */
+ public int horizontalSpacing = 5;
- /**
- * verticalSpacing specifies the number of pixels between the bottom
- * edge of one cell and the top edge of its neighbouring cell underneath.
- *
- * The default value is 5.
- */
- public int verticalSpacing = 5;
+ /**
+ * verticalSpacing specifies the number of pixels between the bottom
+ * edge of one cell and the top edge of its neighbouring cell underneath.
+ *
+ * The default value is 5.
+ */
+ public int verticalSpacing = 5;
/**
* Constructs a new instance of this class.
@@ -164,565 +164,565 @@
* @since 2.0
*/
public this (int numColumns, bool makeColumnsEqualWidth) {
- this.numColumns = numColumns;
- this.makeColumnsEqualWidth = makeColumnsEqualWidth;
+ this.numColumns = numColumns;
+ this.makeColumnsEqualWidth = makeColumnsEqualWidth;
}
protected Point computeSize (Composite composite, int wHint, int hHint, bool flushCache_) {
- Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache_);
- if (wHint !is SWT.DEFAULT) size.x = wHint;
- if (hHint !is SWT.DEFAULT) size.y = hHint;
- return size;
+ Point size = layout (composite, false, 0, 0, wHint, hHint, flushCache_);
+ if (wHint !is SWT.DEFAULT) size.x = wHint;
+ if (hHint !is SWT.DEFAULT) size.y = hHint;
+ return size;
}
protected bool flushCache (Control control) {
- Object data = control.getLayoutData ();
- if (data !is null) (cast(GridData) data).flushCache ();
- return true;
+ Object data = control.getLayoutData ();
+ if (data !is null) (cast(GridData) data).flushCache ();
+ return true;
}
GridData getData (Control [][] grid, int row, int column, int rowCount, int columnCount, bool first) {
- Control control = grid [row] [column];
- if (control !is null) {
- GridData data = cast(GridData) control.getLayoutData ();
- int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
- int vSpan = Math.max (1, data.verticalSpan);
- int i = first ? row + vSpan - 1 : row - vSpan + 1;
- int j = first ? column + hSpan - 1 : column - hSpan + 1;
- if (0 <= i && i < rowCount) {
- if (0 <= j && j < columnCount) {
- if (control is grid [i][j]) return data;
- }
- }
- }
- return null;
+ Control control = grid [row] [column];
+ if (control !is null) {
+ GridData data = cast(GridData) control.getLayoutData ();
+ int hSpan = Math.max (1, Math.min (data.horizontalSpan, columnCount));
+ int vSpan = Math.max (1, data.verticalSpan);
+ int i = first ? row + vSpan - 1 : row - vSpan + 1;
+ int j = first ? column + hSpan - 1 : column - hSpan + 1;
+ if (0 <= i && i < rowCount) {
+ if (0 <= j && j < columnCount) {
+ if (control is grid [i][j]) return data;
+ }
+ }
+ }
+ return null;
}
protected void layout (Composite composite, bool flushCache_) {
- Rectangle rect = composite.getClientArea ();
- layout (composite, true, rect.x, rect.y, rect.width, rect.height, flushCache_);
+ Rectangle rect = composite.getClientArea ();
+ layout (composite, true, rect.x, rect.y, rect.width, rect.height, flushCache_);
}
Point layout (Composite composite, bool move, int x, int y, int width, int height, bool flushCache_) {
- if (numColumns < 1) {
- return new Point (marginLeft + marginWidth * 2 + marginRight, marginTop + marginHeight * 2 + marginBottom);
- }
- Control [] children = composite.getChildren ();
- int count = 0;
- for (int i=0; iButton
in a Shell
:
*
- * Display display = new Display();
- * Shell shell = new Shell(display);
- * shell.setLayout(new RowLayout());
- * Button button1 = new Button(shell, SWT.PUSH);
- * button1.setText("Button 1");
- * button1.setLayoutData(new RowData(50, 40));
+ * Display display = new Display();
+ * Shell shell = new Shell(display);
+ * shell.setLayout(new RowLayout());
+ * Button button1 = new Button(shell, SWT.PUSH);
+ * button1.setText("Button 1");
+ * button1.setLayoutData(new RowData(50, 40));
*
*
true
,
- * the size and position of the control will not be managed by the
- * layout. If this value is false
, the size and
- * position of the control will be computed and assigned.
- *
- * The default value is false
.
- *
- * @since 3.1
- */
- public bool exclude = false;
+ /**
+ * exclude informs the layout to ignore this control when sizing
+ * and positioning controls. If this value is true
,
+ * the size and position of the control will not be managed by the
+ * layout. If this value is false
, the size and
+ * position of the control will be computed and assigned.
+ *
+ * The default value is false
.
+ *
+ * @since 3.1
+ */
+ public bool exclude = false;
/**
* Constructs a new instance of RowData using
@@ -87,8 +87,8 @@
* @param height a minimum height for the control
*/
public this (int width, int height) {
- this.width = width;
- this.height = height;
+ this.width = width;
+ this.height = height;
}
/**
@@ -100,7 +100,7 @@
* and y coordinate specifies a minimum height for the control
*/
public this (Point point) {
- this (point.x, point.y);
+ this (point.x, point.y);
}
char[] getName () {
@@ -117,12 +117,12 @@
* @return a string representation of the RowData object
*/
public char[] toString () {
- char[] string = getName ()~" {";
- if (width !is SWT.DEFAULT) string ~= "width="~to!(char[])(width)~" ";
- if (height !is SWT.DEFAULT) string ~= "height="~to!(char[])(height)~" ";
- if (exclude) string ~= "exclude="~to!(char[])(exclude)~" ";
- string = trim( string );
- string ~= "}";
- return string;
+ char[] string = getName ()~" {";
+ if (width !is SWT.DEFAULT) string ~= "width="~to!(char[])(width)~" ";
+ if (height !is SWT.DEFAULT) string ~= "height="~to!(char[])(height)~" ";
+ if (exclude) string ~= "exclude="~to!(char[])(exclude)~" ";
+ string = trim( string );
+ string ~= "}";
+ return string;
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/layout/RowLayout.d
--- a/dwt/layout/RowLayout.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/layout/RowLayout.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -40,21 +40,21 @@
* of its fields to non-default values, and then sets it into a
* Shell
.
* - * RowLayout rowLayout = new RowLayout(); - * rowLayout.wrap = false; - * rowLayout.pack = false; - * rowLayout.justify = true; - * rowLayout.type = SWT.VERTICAL; - * rowLayout.marginLeft = 5; - * rowLayout.marginTop = 5; - * rowLayout.marginRight = 5; - * rowLayout.marginBottom = 5; - * rowLayout.spacing = 0; - * shell.setLayout(rowLayout); + * RowLayout rowLayout = new RowLayout(); + * rowLayout.wrap = false; + * rowLayout.pack = false; + * rowLayout.justify = true; + * rowLayout.type = SWT.VERTICAL; + * rowLayout.marginLeft = 5; + * rowLayout.marginTop = 5; + * rowLayout.marginRight = 5; + * rowLayout.marginBottom = 5; + * rowLayout.spacing = 0; + * shell.setLayout(rowLayout); ** If you are using the default field values, you only need one line of code: *
- * shell.setLayout(new RowLayout()); + * shell.setLayout(new RowLayout()); ** * @@ -62,118 +62,118 @@ */ public final class RowLayout : Layout { - /** - * type specifies whether the layout places controls in rows or - * columns. - * - * The default value is HORIZONTAL. - * - * Possible values are:
true
if the receiver is visible, and
@@ -2328,379 +2328,379 @@
*
*/
public bool getVisible () {
- checkWidget();
- return (state & HIDDEN) is 0;
+ checkWidget();
+ return (state & HIDDEN) is 0;
}
override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* gdkEvent) {
- if (gdkEvent.type is OS.GDK_3BUTTON_PRESS) return 0;
- /*
- * When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
- * do not activate the shell when the user clicks on the
- * the client area or on the border or a control within the
- * shell that does not take focus.
- */
- Shell shell = _getShell ();
- if (((shell.style & SWT.ON_TOP) !is 0) && (((shell.style & SWT.NO_FOCUS) is 0) || ((style & SWT.NO_FOCUS) is 0))) {
- shell.forceActive();
- }
- int /*long*/ result = 0;
- if (gdkEvent.type is OS.GDK_BUTTON_PRESS) {
- display.clickCount = 1;
- auto nextEvent = OS.gdk_event_peek ();
- if (nextEvent !is null) {
- int eventType = OS.GDK_EVENT_TYPE (nextEvent);
- if (eventType is OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
- if (eventType is OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
- OS.gdk_event_free (nextEvent);
- }
- bool dragging = false;
- if ((state & DRAG_DETECT) !is 0 && hooks (SWT.DragDetect)) {
- if (gdkEvent.button is 1) {
- bool consume = false;
- if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, &consume)) {
- dragging = true;
- if (consume ) result = 1;
- }
- if (isDisposed ()) return 1;
- }
- }
- if (!sendMouseEvent (SWT.MouseDown, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state)) {
- result = 1;
- }
- if (isDisposed ()) return 1;
- if (dragging) {
- sendDragEvent (gdkEvent.button, gdkEvent.state, cast(int) gdkEvent.x, cast(int) gdkEvent.y, false);
- if (isDisposed ()) return 1;
- }
- /*
- * Pop up the context menu in the button press event for widgets
- * that have default operating system menus in order to stop the
- * operating system from displaying the menu if necessary.
- */
- if ((state & MENU) !is 0) {
- if (gdkEvent.button is 3) {
- if (showMenu (cast(int)gdkEvent.x_root, cast(int)gdkEvent.y_root)) {
- result = 1;
- }
- }
- }
- } else {
- display.clickCount = 2;
- result = sendMouseEvent (SWT.MouseDoubleClick, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- if (isDisposed ()) return 1;
- }
- if (!shell.isDisposed ()) shell.setActiveControl (this);
- return result;
+ if (gdkEvent.type is OS.GDK_3BUTTON_PRESS) return 0;
+ /*
+ * When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
+ * do not activate the shell when the user clicks on the
+ * the client area or on the border or a control within the
+ * shell that does not take focus.
+ */
+ Shell shell = _getShell ();
+ if (((shell.style & SWT.ON_TOP) !is 0) && (((shell.style & SWT.NO_FOCUS) is 0) || ((style & SWT.NO_FOCUS) is 0))) {
+ shell.forceActive();
+ }
+ int /*long*/ result = 0;
+ if (gdkEvent.type is OS.GDK_BUTTON_PRESS) {
+ display.clickCount = 1;
+ auto nextEvent = OS.gdk_event_peek ();
+ if (nextEvent !is null) {
+ int eventType = OS.GDK_EVENT_TYPE (nextEvent);
+ if (eventType is OS.GDK_2BUTTON_PRESS) display.clickCount = 2;
+ if (eventType is OS.GDK_3BUTTON_PRESS) display.clickCount = 3;
+ OS.gdk_event_free (nextEvent);
+ }
+ bool dragging = false;
+ if ((state & DRAG_DETECT) !is 0 && hooks (SWT.DragDetect)) {
+ if (gdkEvent.button is 1) {
+ bool consume = false;
+ if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, &consume)) {
+ dragging = true;
+ if (consume ) result = 1;
+ }
+ if (isDisposed ()) return 1;
+ }
+ }
+ if (!sendMouseEvent (SWT.MouseDown, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state)) {
+ result = 1;
+ }
+ if (isDisposed ()) return 1;
+ if (dragging) {
+ sendDragEvent (gdkEvent.button, gdkEvent.state, cast(int) gdkEvent.x, cast(int) gdkEvent.y, false);
+ if (isDisposed ()) return 1;
+ }
+ /*
+ * Pop up the context menu in the button press event for widgets
+ * that have default operating system menus in order to stop the
+ * operating system from displaying the menu if necessary.
+ */
+ if ((state & MENU) !is 0) {
+ if (gdkEvent.button is 3) {
+ if (showMenu (cast(int)gdkEvent.x_root, cast(int)gdkEvent.y_root)) {
+ result = 1;
+ }
+ }
+ }
+ } else {
+ display.clickCount = 2;
+ result = sendMouseEvent (SWT.MouseDoubleClick, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ if (isDisposed ()) return 1;
+ }
+ if (!shell.isDisposed ()) shell.setActiveControl (this);
+ return result;
}
override int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* gdkEvent) {
- /*
- * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK
- * does not deliver a corresponding GTK event. Button 6 and 7
- * are mapped to buttons 4 and 5 in SWT. The fix is to change
- * the button number of the event to a negative number so that
- * it gets dispatched by GTK. SWT has been modified to look
- * for negative button numbers.
- */
- int button = gdkEvent.button;
- switch (button) {
- case -6: button = 4; break;
- case -7: button = 5; break;
+ /*
+ * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK
+ * does not deliver a corresponding GTK event. Button 6 and 7
+ * are mapped to buttons 4 and 5 in SWT. The fix is to change
+ * the button number of the event to a negative number so that
+ * it gets dispatched by GTK. SWT has been modified to look
+ * for negative button numbers.
+ */
+ int button = gdkEvent.button;
+ switch (button) {
+ case -6: button = 4; break;
+ case -7: button = 5; break;
default:
- }
- return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ }
+ return sendMouseEvent (SWT.MouseUp, button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
}
override int /*long*/ gtk_commit (GtkIMContext* imcontext, char* text) {
- char [] chars = fromUtf8z( text );
+ char [] chars = fromUtf8z( text );
if (chars.length is 0) return 0;
- sendIMKeyEvent (SWT.KeyDown, null, chars);
- return 0;
+ sendIMKeyEvent (SWT.KeyDown, null, chars);
+ return 0;
}
override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) {
- if (display.currentControl is this) return 0;
- if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
- if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
- if (display.currentControl !is null && !display.currentControl.isDisposed ()) {
- display.removeMouseHoverTimeout (display.currentControl.handle);
- display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state);
- }
- if (!isDisposed ()) {
- display.currentControl = this;
- return sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- }
- return 0;
+ if (display.currentControl is this) return 0;
+ if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
+ if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
+ if (display.currentControl !is null && !display.currentControl.isDisposed ()) {
+ display.removeMouseHoverTimeout (display.currentControl.handle);
+ display.currentControl.sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state);
+ }
+ if (!isDisposed ()) {
+ display.currentControl = this;
+ return sendMouseEvent (SWT.MouseEnter, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ }
+ return 0;
}
override int /*long*/ gtk_event_after (GtkWidget* widget, GdkEvent* gdkEvent) {
- switch (cast(int)gdkEvent.type) {
- case OS.GDK_BUTTON_PRESS: {
- if (widget !is eventHandle ()) break;
- /*
- * Pop up the context menu in the event_after signal to allow
- * the widget to process the button press. This allows widgets
- * such as GtkTreeView to select items before a menu is shown.
- */
- if ((state & MENU) is 0) {
- GdkEventButton* gdkEventButton = cast(GdkEventButton*)gdkEvent;
- if (gdkEventButton.button is 3) {
- showMenu (cast(int) gdkEventButton.x_root, cast(int) gdkEventButton.y_root);
- }
- }
- break;
- }
- case OS.GDK_FOCUS_CHANGE: {
- if (widget !is focusHandle ()) break;
- GdkEventFocus* gdkEventFocus = cast(GdkEventFocus*)gdkEvent;
-
- /*
- * Feature in GTK. The GTK combo box popup under some window managers
- * is implemented as a GTK_MENU. When it pops up, it causes the combo
- * box to lose focus when focus is received for the menu. The
- * fix is to check the current grab handle and see if it is a GTK_MENU
- * and ignore the focus event when the menu is both shown and hidden.
- */
- Display display = this.display;
- if (gdkEventFocus.in_ !is 0) {
- if (display.ignoreFocus) {
- display.ignoreFocus = false;
- break;
- }
- } else {
- display.ignoreFocus = false;
- auto grabHandle = OS.gtk_grab_get_current ();
- if (grabHandle !is null) {
- if (OS.G_OBJECT_TYPE ( cast(GTypeInstance*)grabHandle) is OS.GTK_TYPE_MENU ()) {
- display.ignoreFocus = true;
- break;
- }
- }
- }
-
- sendFocusEvent (gdkEventFocus.in_ !is 0 ? SWT.FocusIn : SWT.FocusOut);
- break;
+ switch (cast(int)gdkEvent.type) {
+ case OS.GDK_BUTTON_PRESS: {
+ if (widget !is eventHandle ()) break;
+ /*
+ * Pop up the context menu in the event_after signal to allow
+ * the widget to process the button press. This allows widgets
+ * such as GtkTreeView to select items before a menu is shown.
+ */
+ if ((state & MENU) is 0) {
+ GdkEventButton* gdkEventButton = cast(GdkEventButton*)gdkEvent;
+ if (gdkEventButton.button is 3) {
+ showMenu (cast(int) gdkEventButton.x_root, cast(int) gdkEventButton.y_root);
+ }
+ }
+ break;
+ }
+ case OS.GDK_FOCUS_CHANGE: {
+ if (widget !is focusHandle ()) break;
+ GdkEventFocus* gdkEventFocus = cast(GdkEventFocus*)gdkEvent;
+
+ /*
+ * Feature in GTK. The GTK combo box popup under some window managers
+ * is implemented as a GTK_MENU. When it pops up, it causes the combo
+ * box to lose focus when focus is received for the menu. The
+ * fix is to check the current grab handle and see if it is a GTK_MENU
+ * and ignore the focus event when the menu is both shown and hidden.
+ */
+ Display display = this.display;
+ if (gdkEventFocus.in_ !is 0) {
+ if (display.ignoreFocus) {
+ display.ignoreFocus = false;
+ break;
+ }
+ } else {
+ display.ignoreFocus = false;
+ auto grabHandle = OS.gtk_grab_get_current ();
+ if (grabHandle !is null) {
+ if (OS.G_OBJECT_TYPE ( cast(GTypeInstance*)grabHandle) is OS.GTK_TYPE_MENU ()) {
+ display.ignoreFocus = true;
+ break;
+ }
+ }
+ }
+
+ sendFocusEvent (gdkEventFocus.in_ !is 0 ? SWT.FocusIn : SWT.FocusOut);
+ break;
default:
- }
- }
- return 0;
+ }
+ }
+ return 0;
}
override int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* gdkEvent) {
- if ((state & OBSCURED) !is 0) return 0;
- if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0;
- Event event = new Event ();
- event.count = gdkEvent.count;
- event.x = gdkEvent.area.x;
- event.y = gdkEvent.area.y;
- event.width = gdkEvent.area.width;
- event.height = gdkEvent.area.height;
- GCData data = new GCData ();
- data.damageRgn = gdkEvent.region;
- GC gc = event.gc = GC.gtk_new (this, data);
- OS.gdk_gc_set_clip_region (gc.handle, gdkEvent.region);
- sendEvent (SWT.Paint, event);
- gc.dispose ();
- event.gc = null;
- return 0;
+ if ((state & OBSCURED) !is 0) return 0;
+ if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0;
+ Event event = new Event ();
+ event.count = gdkEvent.count;
+ event.x = gdkEvent.area.x;
+ event.y = gdkEvent.area.y;
+ event.width = gdkEvent.area.width;
+ event.height = gdkEvent.area.height;
+ GCData data = new GCData ();
+ data.damageRgn = gdkEvent.region;
+ GC gc = event.gc = GC.gtk_new (this, data);
+ OS.gdk_gc_set_clip_region (gc.handle, gdkEvent.region);
+ sendEvent (SWT.Paint, event);
+ gc.dispose ();
+ event.gc = null;
+ return 0;
}
override int /*long*/ gtk_focus (GtkWidget* widget, int directionType) {
- /* Stop GTK traversal for every widget */
- return 1;
+ /* Stop GTK traversal for every widget */
+ return 1;
}
override int /*long*/ gtk_focus_in_event (GtkWidget* widget, GdkEventFocus* event) {
- // widget could be disposed at this point
- if (handle !is null) {
- Control oldControl = display.imControl;
- if (oldControl !is this) {
- if (oldControl !is null && !oldControl.isDisposed ()) {
- auto oldIMHandle = oldControl.imHandle ();
- if (oldIMHandle !is null) OS.gtk_im_context_reset (oldIMHandle);
- }
- }
- if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
- auto imHandle = imHandle ();
- if (imHandle !is null) OS.gtk_im_context_focus_in (imHandle);
- }
- }
- return 0;
+ // widget could be disposed at this point
+ if (handle !is null) {
+ Control oldControl = display.imControl;
+ if (oldControl !is this) {
+ if (oldControl !is null && !oldControl.isDisposed ()) {
+ auto oldIMHandle = oldControl.imHandle ();
+ if (oldIMHandle !is null) OS.gtk_im_context_reset (oldIMHandle);
+ }
+ }
+ if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) OS.gtk_im_context_focus_in (imHandle);
+ }
+ }
+ return 0;
}
override int /*long*/ gtk_focus_out_event (GtkWidget* widget, GdkEventFocus* event) {
- // widget could be disposed at this point
- if (handle !is null) {
- if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
- auto imHandle = imHandle ();
- if (imHandle !is null) {
- OS.gtk_im_context_focus_out (imHandle);
- }
- }
- }
- return 0;
+ // widget could be disposed at this point
+ if (handle !is null) {
+ if (hooks (SWT.KeyDown) || hooks (SWT.KeyUp)) {
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ OS.gtk_im_context_focus_out (imHandle);
+ }
+ }
+ }
+ return 0;
}
override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* gdkEvent) {
- if (!hasFocus ()) return 0;
-
- if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1;
- // widget could be disposed at this point
- if (isDisposed ()) return 0;
-
- if (filterKey (gdkEvent.keyval, gdkEvent)) return 1;
- // widget could be disposed at this point
- if (isDisposed ()) return 0;
-
- if (translateTraversal (gdkEvent)) return 1;
- // widget could be disposed at this point
- if (isDisposed ()) return 0;
- return super.gtk_key_press_event (widget, gdkEvent);
+ if (!hasFocus ()) return 0;
+
+ if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1;
+ // widget could be disposed at this point
+ if (isDisposed ()) return 0;
+
+ if (filterKey (gdkEvent.keyval, gdkEvent)) return 1;
+ // widget could be disposed at this point
+ if (isDisposed ()) return 0;
+
+ if (translateTraversal (gdkEvent)) return 1;
+ // widget could be disposed at this point
+ if (isDisposed ()) return 0;
+ return super.gtk_key_press_event (widget, gdkEvent);
}
override int /*long*/ gtk_key_release_event (GtkWidget* widget, GdkEventKey* event) {
- if (!hasFocus ()) return 0;
- auto imHandle = imHandle ();
- if (imHandle !is null) {
- if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
- }
- return super.gtk_key_release_event (widget, event);
+ if (!hasFocus ()) return 0;
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ if (OS.gtk_im_context_filter_keypress (imHandle, event)) return 1;
+ }
+ return super.gtk_key_release_event (widget, event);
}
override int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) {
- if (display.currentControl !is this) return 0;
- display.removeMouseHoverTimeout (handle);
- int result = 0;
- if (sendLeaveNotify () || display.getCursorControl () is null) {
- if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
- if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
- result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- display.currentControl = null;
- }
- return result;
+ if (display.currentControl !is this) return 0;
+ display.removeMouseHoverTimeout (handle);
+ int result = 0;
+ if (sendLeaveNotify () || display.getCursorControl () is null) {
+ if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0;
+ if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0;
+ result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ display.currentControl = null;
+ }
+ return result;
}
override int /*long*/ gtk_mnemonic_activate (GtkWidget* widget, int /*long*/ arg1) {
- int result = 0;
- auto eventPtr = OS.gtk_get_current_event ();
- if (eventPtr !is null) {
- GdkEventKey* keyEvent = cast(GdkEventKey*)eventPtr;
- if (keyEvent.type is OS.GDK_KEY_PRESS) {
- Control focusControl = display.getFocusControl ();
- auto focusHandle = focusControl !is null ? focusControl.focusHandle () : null;
- if (focusHandle !is null) {
- display.mnemonicControl = this;
- OS.gtk_widget_event (focusHandle, eventPtr);
- display.mnemonicControl = null;
- }
- result = 1;
- }
- OS.gdk_event_free (eventPtr);
- }
- return result;
+ int result = 0;
+ auto eventPtr = OS.gtk_get_current_event ();
+ if (eventPtr !is null) {
+ GdkEventKey* keyEvent = cast(GdkEventKey*)eventPtr;
+ if (keyEvent.type is OS.GDK_KEY_PRESS) {
+ Control focusControl = display.getFocusControl ();
+ auto focusHandle = focusControl !is null ? focusControl.focusHandle () : null;
+ if (focusHandle !is null) {
+ display.mnemonicControl = this;
+ OS.gtk_widget_event (focusHandle, eventPtr);
+ display.mnemonicControl = null;
+ }
+ result = 1;
+ }
+ OS.gdk_event_free (eventPtr);
+ }
+ return result;
}
override int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* gdkEvent) {
- if (this is display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
- display.addMouseHoverTimeout (handle);
- }
- double x = gdkEvent.x_root, y = gdkEvent.y_root;
- int state = gdkEvent.state;
- if (gdkEvent.is_hint !is 0) {
- int pointer_x, pointer_y;
+ if (this is display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) {
+ display.addMouseHoverTimeout (handle);
+ }
+ double x = gdkEvent.x_root, y = gdkEvent.y_root;
+ int state = gdkEvent.state;
+ if (gdkEvent.is_hint !is 0) {
+ int pointer_x, pointer_y;
int mask;
- auto window = eventWindow ();
- OS.gdk_window_get_pointer (window, &pointer_x, &pointer_y, &mask);
- x = pointer_x;
- y = pointer_y;
- state = mask;
- }
- int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint !is 0, state) ? 0 : 1;
- return result;
+ auto window = eventWindow ();
+ OS.gdk_window_get_pointer (window, &pointer_x, &pointer_y, &mask);
+ x = pointer_x;
+ y = pointer_y;
+ state = mask;
+ }
+ int result = sendMouseEvent (SWT.MouseMove, 0, gdkEvent.time, x, y, gdkEvent.is_hint !is 0, state) ? 0 : 1;
+ return result;
}
override int /*long*/ gtk_popup_menu (GtkWidget* widget) {
- if (!hasFocus()) return 0;
- int x, y ;
- OS.gdk_window_get_pointer (null, &x, &y, null);
- return showMenu (x, y) ? 1 : 0;
+ if (!hasFocus()) return 0;
+ int x, y ;
+ OS.gdk_window_get_pointer (null, &x, &y, null);
+ return showMenu (x, y) ? 1 : 0;
}
override int /*long*/ gtk_preedit_changed (GtkIMContext* imcontext) {
- display.showIMWindow (this);
- return 0;
+ display.showIMWindow (this);
+ return 0;
}
override int /*long*/ gtk_realize (GtkWidget* widget) {
- auto imHandle = imHandle ();
- if (imHandle !is null) {
- auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
- OS.gtk_im_context_set_client_window (imHandle, window);
- }
- if (backgroundImage !is null) {
- auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
- if (window !is null) OS.gdk_window_set_back_pixmap (window, cast(GdkPixmap*)backgroundImage.pixmap, false);
- }
- return 0;
+ auto imHandle = imHandle ();
+ if (imHandle !is null) {
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ OS.gtk_im_context_set_client_window (imHandle, window);
+ }
+ if (backgroundImage !is null) {
+ auto window = OS.GTK_WIDGET_WINDOW (paintHandle ());
+ if (window !is null) OS.gdk_window_set_back_pixmap (window, cast(GdkPixmap*)backgroundImage.pixmap, false);
+ }
+ return 0;
}
override int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* gdkEvent) {
- switch (cast(int)gdkEvent.direction) {
- case OS.GDK_SCROLL_UP:
- return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- case OS.GDK_SCROLL_DOWN:
- return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- case OS.GDK_SCROLL_LEFT:
- return sendMouseEvent (SWT.MouseDown, 4, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
- case OS.GDK_SCROLL_RIGHT:
- return sendMouseEvent (SWT.MouseDown, 5, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ switch (cast(int)gdkEvent.direction) {
+ case OS.GDK_SCROLL_UP:
+ return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ case OS.GDK_SCROLL_DOWN:
+ return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ case OS.GDK_SCROLL_LEFT:
+ return sendMouseEvent (SWT.MouseDown, 4, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ case OS.GDK_SCROLL_RIGHT:
+ return sendMouseEvent (SWT.MouseDown, 5, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
default:
- }
- return 0;
+ }
+ return 0;
}
override int /*long*/ gtk_show_help (GtkWidget* widget, int /*long*/ helpType) {
- if (!hasFocus ()) return 0;
- return sendHelpEvent (helpType) ? 1 : 0;
+ if (!hasFocus ()) return 0;
+ return sendHelpEvent (helpType) ? 1 : 0;
}
override int /*long*/ gtk_style_set (GtkWidget* widget, int /*long*/ previousStyle) {
- if (backgroundImage !is null) {
- setBackgroundPixmap (backgroundImage.pixmap);
- }
- return 0;
+ if (backgroundImage !is null) {
+ setBackgroundPixmap (backgroundImage.pixmap);
+ }
+ return 0;
}
override int /*long*/ gtk_unrealize (GtkWidget* widget) {
- auto imHandle = imHandle ();
- if (imHandle !is null) OS.gtk_im_context_set_client_window (imHandle, null);
- return 0;
+ auto imHandle = imHandle ();
+ if (imHandle !is null) OS.gtk_im_context_set_client_window (imHandle, null);
+ return 0;
}
override int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* gdkEvent) {
- auto paintWindow = paintWindow();
- auto window = gdkEvent.window;
- if (window is paintWindow) {
- if (gdkEvent.state is OS.GDK_VISIBILITY_FULLY_OBSCURED) {
- state |= OBSCURED;
- } else {
- if ((state & OBSCURED) !is 0) {
- int width, height;
- OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &width, &height);
- GdkRectangle rect;
- rect.width = width;
- rect.height = height;
- OS.gdk_window_invalidate_rect (window, &rect, false);
- }
- state &= ~OBSCURED;
- }
- }
- return 0;
+ auto paintWindow = paintWindow();
+ auto window = gdkEvent.window;
+ if (window is paintWindow) {
+ if (gdkEvent.state is OS.GDK_VISIBILITY_FULLY_OBSCURED) {
+ state |= OBSCURED;
+ } else {
+ if ((state & OBSCURED) !is 0) {
+ int width, height;
+ OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &width, &height);
+ GdkRectangle rect;
+ rect.width = width;
+ rect.height = height;
+ OS.gdk_window_invalidate_rect (window, &rect, false);
+ }
+ state &= ~OBSCURED;
+ }
+ }
+ return 0;
}
/*no override*/ void gtk_widget_size_request (GtkWidget* widget, GtkRequisition* requisition) {
- OS.gtk_widget_size_request (widget, requisition);
+ OS.gtk_widget_size_request (widget, requisition);
}
/**
@@ -2717,29 +2717,29 @@
* @return the platform specific GC handle
*/
public GdkGC* internal_new_GC (GCData data) {
- checkWidget ();
- auto window = paintWindow ();
- if (window is null) SWT.error (SWT.ERROR_NO_HANDLES);
- auto gdkGC = OS.gdk_gc_new (cast(GdkDrawable*)window);
- if (gdkGC is null) error (SWT.ERROR_NO_HANDLES);
- if (data !is null) {
- int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- if ((data.style & mask) is 0) {
- data.style |= style & (mask | SWT.MIRRORED);
- }
- data.drawable = cast(GdkDrawable*)window;
- data.device = display;
- data.foreground = getForegroundColor ();
- Control control = findBackgroundControl ();
- if (control is null) control = this;
- data.background = control.getBackgroundColor ();
- data.font = font !is null ? font.handle : defaultFont ();
- }
- return gdkGC;
+ checkWidget ();
+ auto window = paintWindow ();
+ if (window is null) SWT.error (SWT.ERROR_NO_HANDLES);
+ auto gdkGC = OS.gdk_gc_new (cast(GdkDrawable*)window);
+ if (gdkGC is null) error (SWT.ERROR_NO_HANDLES);
+ if (data !is null) {
+ int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
+ if ((data.style & mask) is 0) {
+ data.style |= style & (mask | SWT.MIRRORED);
+ }
+ data.drawable = cast(GdkDrawable*)window;
+ data.device = display;
+ data.foreground = getForegroundColor ();
+ Control control = findBackgroundControl ();
+ if (control is null) control = this;
+ data.background = control.getBackgroundColor ();
+ data.font = font !is null ? font.handle : defaultFont ();
+ }
+ return gdkGC;
}
GtkIMContext* imHandle () {
- return null;
+ return null;
}
/**
@@ -2756,8 +2756,8 @@
* @param data the platform specific GC data
*/
public void internal_dispose_GC (GdkGC* gdkGC, GCData data) {
- checkWidget ();
- OS.g_object_unref (gdkGC);
+ checkWidget ();
+ OS.g_object_unref (gdkGC);
}
/**
@@ -2772,45 +2772,45 @@
*
*/
public bool isReparentable () {
- checkWidget();
- return true;
+ checkWidget();
+ return true;
}
bool isShowing () {
- /*
- * This is not complete. Need to check if the
- * widget is obscurred by a parent or sibling.
- */
- if (!isVisible ()) return false;
- Control control = this;
- while (control !is null) {
- Point size = control.getSize ();
- if (size.x is 0 || size.y is 0) {
- return false;
- }
- control = control.parent;
- }
- return true;
+ /*
+ * This is not complete. Need to check if the
+ * widget is obscurred by a parent or sibling.
+ */
+ if (!isVisible ()) return false;
+ Control control = this;
+ while (control !is null) {
+ Point size = control.getSize ();
+ if (size.x is 0 || size.y is 0) {
+ return false;
+ }
+ control = control.parent;
+ }
+ return true;
}
bool isTabGroup () {
- Control [] tabList = parent._getTabList ();
- if (tabList !is null) {
- for (int i=0; iSWT
+ *
+ * @see dwt.SWT
+ */
+ public int type;
- /**
- * the event specific detail field, as defined by the detail constants
- * in class SWT
- *
- * @see dwt.SWT
- */
- public int detail;
+ /**
+ * the event specific detail field, as defined by the detail constants
+ * in class SWT
+ *
+ * @see dwt.SWT
+ */
+ public int detail;
- /**
- * the item that the event occurred in (can be null)
- */
- public Widget item;
+ /**
+ * 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 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;
+ /**
+ * 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 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;
+ /**
+ * 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 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;
+ /**
+ * 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;
+ /**
+ * 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 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;
+ /**
+ * 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 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 dwt.SWT
- */
- public int keyCode;
+ /**
+ * 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 dwt.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 dwt.SWT
- */
- public int stateMask;
+ /**
+ * depending on the event, the state of the keyboard modifier
+ * keys and mouse masks at the time the event was generated.
+ *
+ * @see dwt.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 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, 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;
+ /**
+ * 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;
+ /**
+ * a field for application use
+ */
+ public Object data;
/**
* Gets the bounds.
@@ -198,7 +198,7 @@
* @return a rectangle that is the bounds.
*/
public Rectangle getBounds () {
- return new Rectangle (x, y, width, height);
+ return new Rectangle (x, y, width, height);
}
/**
@@ -207,10 +207,10 @@
* @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;
+ this.x = rect.x;
+ this.y = rect.y;
+ this.width = rect.width;
+ this.height = rect.height;
}
/**
diff -r a5c274fa5af9 -r 8cec8f536af3 dwt/widgets/EventTable.d
--- a/dwt/widgets/EventTable.d Sat Jan 12 07:02:08 2008 +0100
+++ b/dwt/widgets/EventTable.d Sat Jan 12 08:44:23 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
* 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
@@ -40,114 +40,114 @@
*/
class EventTable {
- int [] types;
- Listener [] listeners;
- int level;
+ int [] types;
+ Listener [] listeners;
+ int level;
public void hook (int eventType, Listener listener) {
- if (types is null) types = new int [4];
- if (listeners is null) listeners = new Listener [4];
- int length = types.length, index = length - 1;
- while (index >= 0) {
- if (types [index] !is 0) break;
- --index;
- }
- index++;
- if (index is length) {
- int [] newTypes = new int [length + 4];
- System.arraycopy (types, 0, newTypes, 0, length);
- types = newTypes;
- Listener [] newListeners = new Listener [length + 4];
- SimpleType!(Listener).arraycopy (listeners, 0, newListeners, 0, length);
- listeners = newListeners;
- }
- types [index] = eventType;
- listeners [index] = listener;
+ if (types is null) types = new int [4];
+ if (listeners is null) listeners = new Listener [4];
+ int length = types.length, index = length - 1;
+ while (index >= 0) {
+ if (types [index] !is 0) break;
+ --index;
+ }
+ index++;
+ if (index is length) {
+ int [] newTypes = new int [length + 4];
+ System.arraycopy (types, 0, newTypes, 0, length);
+ types = newTypes;
+ Listener [] newListeners = new Listener [length + 4];
+ SimpleType!(Listener).arraycopy (listeners, 0, newListeners, 0, length);
+ listeners = newListeners;
+ }
+ types [index] = eventType;
+ listeners [index] = listener;
}
public bool hooks (int eventType) {
- if (types is null) return false;
- for (int i=0; i- * 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 GtkWidget* handle; - int style, state; - Display display; - EventTable eventTable; - Object data; + /** + * the handle to the OS resource + * (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 GtkWidget* handle; + int style, state; + Display display; + EventTable eventTable; + Object data; - /* Global state flags */ - static const int DISPOSED = 1<<0; - static const int CANVAS = 1<<1; - static const int KEYED_DATA = 1<<2; - static const int HANDLE = 1<<3; - static const int DISABLED = 1<<4; - static const int MENU = 1<<5; - static const int OBSCURED = 1<<6; - static const int MOVED = 1<<7; - static const int RESIZED = 1<<8; - static const int ZERO_WIDTH = 1<<9; - static const int ZERO_HEIGHT = 1<<10; - static const int HIDDEN = 1<<11; - static const int FOREGROUND = 1<<12; - static const int BACKGROUND = 1<<13; - static const int FONT = 1<<14; - static const int PARENT_BACKGROUND = 1<<15; - static const int THEME_BACKGROUND = 1<<16; + /* Global state flags */ + static const int DISPOSED = 1<<0; + static const int CANVAS = 1<<1; + static const int KEYED_DATA = 1<<2; + static const int HANDLE = 1<<3; + static const int DISABLED = 1<<4; + static const int MENU = 1<<5; + static const int OBSCURED = 1<<6; + static const int MOVED = 1<<7; + static const int RESIZED = 1<<8; + static const int ZERO_WIDTH = 1<<9; + static const int ZERO_HEIGHT = 1<<10; + static const int HIDDEN = 1<<11; + static const int FOREGROUND = 1<<12; + static const int BACKGROUND = 1<<13; + static const int FONT = 1<<14; + static const int PARENT_BACKGROUND = 1<<15; + static const int THEME_BACKGROUND = 1<<16; - /* A layout was requested on this widget */ - static const int LAYOUT_NEEDED = 1<<17; + /* A layout was requested on this widget */ + static const int LAYOUT_NEEDED = 1<<17; - /* The preferred size of a child has changed */ - static const int LAYOUT_CHANGED = 1<<18; + /* The preferred size of a child has changed */ + static const int LAYOUT_CHANGED = 1<<18; - /* A layout was requested in this widget hierachy */ - static const int LAYOUT_CHILD = 1<<19; + /* A layout was requested in this widget hierachy */ + static const int LAYOUT_CHILD = 1<<19; - /* More global state flags */ - static const int RELEASED = 1<<20; - static const int DISPOSE_SENT = 1<<21; - static const int FOREIGN_HANDLE = 1<<22; - static const int DRAG_DETECT = 1<<23; + /* More global state flags */ + static const int RELEASED = 1<<20; + static const int DISPOSE_SENT = 1<<21; + static const int FOREIGN_HANDLE = 1<<22; + static const int DRAG_DETECT = 1<<23; - /* Default size for widgets */ - static const int DEFAULT_WIDTH = 64; - static const int DEFAULT_HEIGHT = 64; + /* Default size for widgets */ + static const int DEFAULT_WIDTH = 64; + static const int DEFAULT_HEIGHT = 64; - /* GTK signals data */ - static const int ACTIVATE = 1; - static const int BUTTON_PRESS_EVENT = 2; - static const int BUTTON_PRESS_EVENT_INVERSE = 3; - static const int BUTTON_RELEASE_EVENT = 4; - static const int BUTTON_RELEASE_EVENT_INVERSE = 5; - static const int CHANGED = 6; - static const int CHANGE_VALUE = 7; - static const int CLICKED = 8; - static const int COMMIT = 9; - static const int CONFIGURE_EVENT = 10; - static const int DELETE_EVENT = 11; - static const int DELETE_RANGE = 12; - static const int DELETE_TEXT = 13; - static const int ENTER_NOTIFY_EVENT = 14; - static const int EVENT = 15; - static const int EVENT_AFTER = 16; - static const int EXPAND_COLLAPSE_CURSOR_ROW = 17; - static const int EXPOSE_EVENT = 18; - static const int EXPOSE_EVENT_INVERSE = 19; - static const int FOCUS = 20; - static const int FOCUS_IN_EVENT = 21; - static const int FOCUS_OUT_EVENT = 22; - static const int GRAB_FOCUS = 23; - static const int HIDE = 24; - static const int INPUT = 25; - static const int INSERT_TEXT = 26; - static const int KEY_PRESS_EVENT = 27; - static const int KEY_RELEASE_EVENT = 28; - static const int LEAVE_NOTIFY_EVENT = 29; - static const int MAP = 30; - static const int MAP_EVENT = 31; - static const int MNEMONIC_ACTIVATE = 32; - static const int MOTION_NOTIFY_EVENT = 33; - static const int MOTION_NOTIFY_EVENT_INVERSE = 34; - static const int MOVE_FOCUS = 35; - static const int OUTPUT = 36; - static const int POPUP_MENU = 37; - static const int PREEDIT_CHANGED = 38; - static const int REALIZE = 39; - static const int ROW_ACTIVATED = 40; - static const int SCROLL_CHILD = 41; - static const int SCROLL_EVENT = 42; - static const int SELECT = 43; - static const int SHOW = 44; - static const int SHOW_HELP = 45; - static const int SIZE_ALLOCATE = 46; - static const int STYLE_SET = 47; - static const int SWITCH_PAGE = 48; - static const int TEST_COLLAPSE_ROW = 49; - static const int TEST_EXPAND_ROW = 50; - static const int TEXT_BUFFER_INSERT_TEXT = 51; - static const int TOGGLED = 52; - static const int UNMAP = 53; - static const int UNMAP_EVENT = 54; - static const int UNREALIZE = 55; - static const int VALUE_CHANGED = 56; - static const int VISIBILITY_NOTIFY_EVENT = 57; - static const int WINDOW_STATE_EVENT = 58; - static const int ACTIVATE_INVERSE = 59; - static const int DAY_SELECTED = 60; - static const int MONTH_CHANGED = 61; - static const int LAST_SIGNAL = 62; + /* GTK signals data */ + static const int ACTIVATE = 1; + static const int BUTTON_PRESS_EVENT = 2; + static const int BUTTON_PRESS_EVENT_INVERSE = 3; + static const int BUTTON_RELEASE_EVENT = 4; + static const int BUTTON_RELEASE_EVENT_INVERSE = 5; + static const int CHANGED = 6; + static const int CHANGE_VALUE = 7; + static const int CLICKED = 8; + static const int COMMIT = 9; + static const int CONFIGURE_EVENT = 10; + static const int DELETE_EVENT = 11; + static const int DELETE_RANGE = 12; + static const int DELETE_TEXT = 13; + static const int ENTER_NOTIFY_EVENT = 14; + static const int EVENT = 15; + static const int EVENT_AFTER = 16; + static const int EXPAND_COLLAPSE_CURSOR_ROW = 17; + static const int EXPOSE_EVENT = 18; + static const int EXPOSE_EVENT_INVERSE = 19; + static const int FOCUS = 20; + static const int FOCUS_IN_EVENT = 21; + static const int FOCUS_OUT_EVENT = 22; + static const int GRAB_FOCUS = 23; + static const int HIDE = 24; + static const int INPUT = 25; + static const int INSERT_TEXT = 26; + static const int KEY_PRESS_EVENT = 27; + static const int KEY_RELEASE_EVENT = 28; + static const int LEAVE_NOTIFY_EVENT = 29; + static const int MAP = 30; + static const int MAP_EVENT = 31; + static const int MNEMONIC_ACTIVATE = 32; + static const int MOTION_NOTIFY_EVENT = 33; + static const int MOTION_NOTIFY_EVENT_INVERSE = 34; + static const int MOVE_FOCUS = 35; + static const int OUTPUT = 36; + static const int POPUP_MENU = 37; + static const int PREEDIT_CHANGED = 38; + static const int REALIZE = 39; + static const int ROW_ACTIVATED = 40; + static const int SCROLL_CHILD = 41; + static const int SCROLL_EVENT = 42; + static const int SELECT = 43; + static const int SHOW = 44; + static const int SHOW_HELP = 45; + static const int SIZE_ALLOCATE = 46; + static const int STYLE_SET = 47; + static const int SWITCH_PAGE = 48; + static const int TEST_COLLAPSE_ROW = 49; + static const int TEST_EXPAND_ROW = 50; + static const int TEXT_BUFFER_INSERT_TEXT = 51; + static const int TOGGLED = 52; + static const int UNMAP = 53; + static const int UNMAP_EVENT = 54; + static const int UNREALIZE = 55; + static const int VALUE_CHANGED = 56; + static const int VISIBILITY_NOTIFY_EVENT = 57; + static const int WINDOW_STATE_EVENT = 58; + static const int ACTIVATE_INVERSE = 59; + static const int DAY_SELECTED = 60; + static const int MONTH_CHANGED = 61; + static const int LAST_SIGNAL = 62; /** * Prevents uninitialized instances from being created outside the package. @@ -207,15 +207,15 @@ * @see #getStyle */ public this (Widget parent, int style) { - checkSubclass (); - checkParent (parent); - this.style = style; - display = parent.display; + checkSubclass (); + checkParent (parent); + this.style = style; + display = parent.display; } void _addListener (int eventType, Listener listener) { - if (eventTable is null) eventTable = new EventTable (); - eventTable.hook (eventType, listener); + if (eventTable is null) eventTable = new EventTable (); + eventTable.hook (eventType, listener); } /** @@ -242,9 +242,9 @@ * @see #notifyListeners */ public void addListener (int eventType, Listener listener) { - checkWidget (); - if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); - _addListener (eventType, listener); + checkWidget (); + if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); + _addListener (eventType, listener); } /** @@ -267,45 +267,45 @@ * @see #removeDisposeListener */ public void addDisposeListener (DisposeListener listener) { - checkWidget (); - if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); - TypedListener typedListener = new TypedListener (listener); - addListener (SWT.Dispose, typedListener); + checkWidget (); + if (listener is null) error (SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener (listener); + addListener (SWT.Dispose, typedListener); } GdkWindow* paintWindow () { - return null; + return null; } static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) { - int mask = int0 | int1 | int2 | int3 | int4 | int5; - if ((style & mask) is 0) style |= int0; - if ((style & int0) !is 0) style = (style & ~mask) | int0; - if ((style & int1) !is 0) style = (style & ~mask) | int1; - if ((style & int2) !is 0) style = (style & ~mask) | int2; - if ((style & int3) !is 0) style = (style & ~mask) | int3; - if ((style & int4) !is 0) style = (style & ~mask) | int4; - if ((style & int5) !is 0) style = (style & ~mask) | int5; - return style; + int mask = int0 | int1 | int2 | int3 | int4 | int5; + if ((style & mask) is 0) style |= int0; + if ((style & int0) !is 0) style = (style & ~mask) | int0; + if ((style & int1) !is 0) style = (style & ~mask) | int1; + if ((style & int2) !is 0) style = (style & ~mask) | int2; + if ((style & int3) !is 0) style = (style & ~mask) | int3; + if ((style & int4) !is 0) style = (style & ~mask) | int4; + if ((style & int5) !is 0) style = (style & ~mask) | int5; + return style; } int /*long*/ cellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, GtkWidget* data) { - return 0; + return 0; } void checkOpen () { - /* Do nothing */ + /* Do nothing */ } void checkOrientation (Widget parent) { - style &= ~SWT.MIRRORED; - if ((style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT)) is 0) { - if (parent !is null) { - if ((parent.style & SWT.LEFT_TO_RIGHT) !is 0) style |= SWT.LEFT_TO_RIGHT; - if ((parent.style & SWT.RIGHT_TO_LEFT) !is 0) style |= SWT.RIGHT_TO_LEFT; - } - } - style = checkBits (style, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT, 0, 0, 0, 0); + style &= ~SWT.MIRRORED; + if ((style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT)) is 0) { + if (parent !is null) { + if ((parent.style & SWT.LEFT_TO_RIGHT) !is 0) style |= SWT.LEFT_TO_RIGHT; + if ((parent.style & SWT.RIGHT_TO_LEFT) !is 0) style |= SWT.RIGHT_TO_LEFT; + } + } + style = checkBits (style, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT, 0, 0, 0, 0); } /** @@ -321,10 +321,10 @@ * */ void checkParent (Widget parent) { - if (parent is null) error (SWT.ERROR_NULL_ARGUMENT); - if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); - parent.checkWidget (); - parent.checkOpen (); + if (parent is null) error (SWT.ERROR_NULL_ARGUMENT); + if (parent.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); + parent.checkWidget (); + parent.checkOpen (); } /** @@ -357,7 +357,7 @@ * */ protected void checkSubclass () { - if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); + if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS); } /** @@ -383,33 +383,33 @@ * */ protected void checkWidget () { - Display display = this.display; - if (display is null) error (SWT.ERROR_WIDGET_DISPOSED); - if (display.thread !is Thread.getThis ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); - if ((state & DISPOSED) !is 0) error (SWT.ERROR_WIDGET_DISPOSED); + Display display = this.display; + if (display is null) error (SWT.ERROR_WIDGET_DISPOSED); + if (display.thread !is Thread.getThis ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); + if ((state & DISPOSED) !is 0) error (SWT.ERROR_WIDGET_DISPOSED); } void createHandle (int index) { } void createWidget (int index) { - createHandle (index); - setOrientation (); - hookEvents (); - register (); + createHandle (index); + setOrientation (); + hookEvents (); + register (); } void deregister () { - if (handle is null) return; - if ((state & HANDLE) !is 0) display.removeWidget (handle); + if (handle is null) return; + if ((state & HANDLE) !is 0) display.removeWidget (handle); } void destroyWidget () { - GtkWidget* h = topHandle (); - releaseHandle (); - if (h !is null && (state & HANDLE) !is 0) { - OS.gtk_widget_destroy (h); - } + GtkWidget* h = topHandle (); + releaseHandle (); + if (h !is null && (state & HANDLE) !is 0) { + OS.gtk_widget_destroy (h); + } } /** @@ -436,17 +436,17 @@ * @see #checkWidget */ public void dispose () { - /* - * Note: It is valid to attempt to dispose a widget - * more than once. If this happens, fail silently. - */ - if (isDisposed ()) return; - if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); - release (true); + /* + * Note: It is valid to attempt to dispose a widget + * more than once. If this happens, fail silently. + */ + if (isDisposed ()) return; + if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS); + release (true); } void error (int code) { - SWT.error (code); + SWT.error (code); } /** @@ -472,8 +472,8 @@ * @see #setData(Object) */ public Object getData () { - checkWidget(); - return (state & KEYED_DATA) !is 0 ? (cast(ArrayWrapperObject)data).array[0] : data; + checkWidget(); + return (state & KEYED_DATA) !is 0 ? (cast(ArrayWrapperObject)data).array[0] : data; } /** * Returns the application defined property of the receiver @@ -486,7 +486,7 @@ * Dispose event on the widget and do so. * * - * @param key the name of the property + * @param key the name of the property * @return the value of the property or null if it has not been set * * @exception IllegalArgumentExceptiontrue
when the widget is disposed and false
otherwise
*/
public bool isDisposed () {
- return (state & DISPOSED) !is 0;
+ return (state & DISPOSED) !is 0;
}
/**
@@ -879,16 +879,16 @@
* @see SWT
*/
public bool isListening (int eventType) {
- checkWidget ();
- return hooks (eventType);
+ checkWidget ();
+ return hooks (eventType);
}
bool isValidThread () {
- return getDisplay ().isValidThread ();
+ return getDisplay ().isValidThread ();
}
bool isValidSubclass() {
- return true;//Display.isValidClass(getClass());
+ return true;//Display.isValidClass(getClass());
}
void hookEvents () {
@@ -908,29 +908,29 @@
* @see #isListening
*/
bool hooks (int eventType) {
- if (eventTable is null) return false;
- return eventTable.hooks (eventType);
+ if (eventTable is null) return false;
+ return eventTable.hooks (eventType);
}
int /*long*/ hoverProc (GtkWidget* widget) {
- return 0;
+ return 0;
}
void menuPositionProc (GtkMenu* menu, int* x, int* y, int* push_in, void* user_data) {
}
bool mnemonicHit (GtkWidget* mnemonicHandle, char key) {
- if (!mnemonicMatch (mnemonicHandle, key)) return false;
- OS.g_signal_handlers_block_matched ( cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
- bool result = cast(bool)OS.gtk_widget_mnemonic_activate (cast(GtkWidget*)mnemonicHandle, false);
- OS.g_signal_handlers_unblock_matched (cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
- return result;
+ if (!mnemonicMatch (mnemonicHandle, key)) return false;
+ OS.g_signal_handlers_block_matched ( cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
+ bool result = cast(bool)OS.gtk_widget_mnemonic_activate (cast(GtkWidget*)mnemonicHandle, false);
+ OS.g_signal_handlers_unblock_matched (cast(void*)mnemonicHandle, OS.G_SIGNAL_MATCH_DATA, 0, 0, null, null, cast(void*)MNEMONIC_ACTIVATE);
+ return result;
}
bool mnemonicMatch (GtkWidget* mnemonicHandle, char key) {
- int keyval1 = OS.gdk_keyval_to_lower (OS.gdk_unicode_to_keyval (key));
- int keyval2 = OS.gdk_keyval_to_lower (OS.gtk_label_get_mnemonic_keyval (cast(GtkLabel*)mnemonicHandle));
- return keyval1 is keyval2;
+ int keyval1 = OS.gdk_keyval_to_lower (OS.gdk_unicode_to_keyval (key));
+ int keyval2 = OS.gdk_keyval_to_lower (OS.gtk_label_get_mnemonic_keyval (cast(GtkLabel*)mnemonicHandle));
+ return keyval1 is keyval2;
}
/**
@@ -953,62 +953,62 @@
* @see #removeListener(int, Listener)
*/
public void notifyListeners (int eventType, Event event) {
- checkWidget();
- if (event is null) event = new Event ();
- sendEvent (eventType, event);
+ checkWidget();
+ if (event is null) event = new Event ();
+ sendEvent (eventType, event);
}
void postEvent (int eventType) {
- sendEvent (eventType, null, false);
+ sendEvent (eventType, null, false);
}
void postEvent (int eventType, Event event) {
- sendEvent (eventType, event, false);
+ sendEvent (eventType, event, false);
}
void register () {
- if (handle is null) return;
- if ((state & HANDLE) !is 0) display.addWidget (handle, this);
+ if (handle is null) return;
+ if ((state & HANDLE) !is 0) display.addWidget (handle, this);
}
void release (bool destroy) {
- if ((state & DISPOSE_SENT) is 0) {
- state |= DISPOSE_SENT;
- sendEvent (SWT.Dispose);
- }
- if ((state & DISPOSED) is 0) {
- releaseChildren (destroy);
- }
- if ((state & RELEASED) is 0) {
- state |= RELEASED;
- if (destroy) {
- releaseParent ();
- releaseWidget ();
- destroyWidget ();
- } else {
- releaseWidget ();
- releaseHandle ();
- }
- }
+ if ((state & DISPOSE_SENT) is 0) {
+ state |= DISPOSE_SENT;
+ sendEvent (SWT.Dispose);
+ }
+ if ((state & DISPOSED) is 0) {
+ releaseChildren (destroy);
+ }
+ if ((state & RELEASED) is 0) {
+ state |= RELEASED;
+ if (destroy) {
+ releaseParent ();
+ releaseWidget ();
+ destroyWidget ();
+ } else {
+ releaseWidget ();
+ releaseHandle ();
+ }
+ }
}
void releaseChildren (bool destroy) {
}
void releaseHandle () {
- handle = null;
- state |= DISPOSED;
- display = null;
+ handle = null;
+ state |= DISPOSED;
+ display = null;
}
void releaseParent () {
- /* Do nothing */
+ /* Do nothing */
}
void releaseWidget () {
- deregister ();
- eventTable = null;
- data = null;
+ deregister ();
+ eventTable = null;
+ data = null;
}
/**
@@ -1033,10 +1033,10 @@
* @see #notifyListeners
*/
public void removeListener (int eventType, Listener handler) {
- checkWidget ();
- if (handler is null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable is null) return;
- eventTable.unhook (eventType, handler);
+ checkWidget ();
+ if (handler is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
+ eventTable.unhook (eventType, handler);
}
/**
@@ -1064,18 +1064,18 @@
* @see #addListener
*/
protected void removeListener (int eventType, SWTEventListener handler) {
- checkWidget ();
- if (handler is null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable is null) return;
- eventTable.unhook (eventType, handler);
+ checkWidget ();
+ if (handler is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
+ eventTable.unhook (eventType, handler);
}
void rendererGetSizeProc(GtkCellRenderer *cell, GtkWidget *handle, GdkRectangle *cell_area, int *x_offset, int *y_offset, int *width, int *height) {
- return 0;
+ return 0;
}
void rendererRenderProc (GtkCellRenderer * cell, GdkDrawable * window, GtkWidget * handle, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, int flags){
- return 0;
+ return 0;
}
/**
@@ -1096,122 +1096,122 @@
* @see #addDisposeListener
*/
public void removeDisposeListener (DisposeListener listener) {
- checkWidget ();
- if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
- if (eventTable is null) return;
- eventTable.unhook (SWT.Dispose, listener);
+ checkWidget ();
+ if (listener is null) error (SWT.ERROR_NULL_ARGUMENT);
+ if (eventTable is null) return;
+ eventTable.unhook (SWT.Dispose, listener);
}
void sendEvent (Event event) {
- Display display = event.display;
- if (!display.filterEvent (event)) {
- if (eventTable !is null) eventTable.sendEvent (event);
- }
+ Display display = event.display;
+ if (!display.filterEvent (event)) {
+ if (eventTable !is null) eventTable.sendEvent (event);
+ }
}
void sendEvent (int eventType) {
- sendEvent (eventType, null, true);
+ sendEvent (eventType, null, true);
}
void sendEvent (int eventType, Event event) {
- sendEvent (eventType, event, true);
+ sendEvent (eventType, event, true);
}
void sendEvent (int eventType, Event event, bool send) {
- if (eventTable is null && !display.filters (eventType)) {
- return;
- }
- if (event is null) event = new Event ();
- event.type = eventType;
- event.display = display;
- event.widget = this;
- if (event.time is 0) {
- event.time = display.getLastEventTime ();
- }
- if (send) {
- sendEvent (event);
- } else {
- display.postEvent (event);
- }
+ if (eventTable is null && !display.filters (eventType)) {
+ return;
+ }
+ if (event is null) event = new Event ();
+ event.type = eventType;
+ event.display = display;
+ event.widget = this;
+ if (event.time is 0) {
+ event.time = display.getLastEventTime ();
+ }
+ if (send) {
+ sendEvent (event);
+ } else {
+ display.postEvent (event);
+ }
}
bool sendKeyEvent (int type, GdkEventKey* keyEvent) {
- int len = keyEvent.length;
- if (keyEvent.string is null || OS.g_utf8_strlen (keyEvent.string, len) <= 1) {
- Event event = new Event ();
- event.time = keyEvent.time;
- if (!setKeyState (event, keyEvent)) return true;
- sendEvent (type, event);
- // widget could be disposed at this point
+ int len = keyEvent.length;
+ if (keyEvent.string is null || OS.g_utf8_strlen (keyEvent.string, len) <= 1) {
+ Event event = new Event ();
+ event.time = keyEvent.time;
+ if (!setKeyState (event, keyEvent)) return true;
+ sendEvent (type, event);
+ // widget could be disposed at this point
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the key
- * events. If this happens, end the processing of
- * the key by returning false.
- */
- if (isDisposed ()) return false;
- return event.doit;
- }
- char [] chars = fromUtf8z( keyEvent.string );
- return sendIMKeyEvent (type, keyEvent, chars) !is null;
+ /*
+ * It is possible (but unlikely), that application
+ * code could have disposed the widget in the key
+ * events. If this happens, end the processing of
+ * the key by returning false.
+ */
+ if (isDisposed ()) return false;
+ return event.doit;
+ }
+ char [] chars = fromUtf8z( keyEvent.string );
+ return sendIMKeyEvent (type, keyEvent, chars) !is null;
}
char [] sendIMKeyEvent (int type, GdkEventKey* keyEvent, char [] chars) {
- int index = 0, count = 0, state = 0;
- GdkEvent* ptr = null;
- if (keyEvent is null) {
- ptr = OS.gtk_get_current_event ();
- if (ptr !is null) {
- keyEvent = new GdkEventKey ();
- memmove (keyEvent, ptr, GdkEventKey.sizeof);
- switch (cast(int)keyEvent.type) {
- case OS.GDK_KEY_PRESS:
- case OS.GDK_KEY_RELEASE:
- state = keyEvent.state;
- break;
- default:
- keyEvent = null;
- break;
- }
- }
- }
- if (keyEvent is null) {
- int buffer;
- OS.gtk_get_current_event_state (&buffer);
- state = buffer;
- }
- while (index < chars.length) {
- Event event = new Event ();
- if (keyEvent !is null && chars.length <= 1) {
- setKeyState (event, keyEvent);
- } else {
- setInputState (event, state);
- }
- event.character = chars [index];
- sendEvent (type, event);
+ int index = 0, count = 0, state = 0;
+ GdkEvent* ptr = null;
+ if (keyEvent is null) {
+ ptr = OS.gtk_get_current_event ();
+ if (ptr !is null) {
+ keyEvent = new GdkEventKey ();
+ memmove (keyEvent, ptr, GdkEventKey.sizeof);
+ switch (cast(int)keyEvent.type) {
+ case OS.GDK_KEY_PRESS:
+ case OS.GDK_KEY_RELEASE:
+ state = keyEvent.state;
+ break;
+ default:
+ keyEvent = null;
+ break;
+ }
+ }
+ }
+ if (keyEvent is null) {
+ int buffer;
+ OS.gtk_get_current_event_state (&buffer);
+ state = buffer;
+ }
+ while (index < chars.length) {
+ Event event = new Event ();
+ if (keyEvent !is null && chars.length <= 1) {
+ setKeyState (event, keyEvent);
+ } else {
+ setInputState (event, state);
+ }
+ event.character = chars [index];
+ sendEvent (type, event);
- /*
- * It is possible (but unlikely), that application
- * code could have disposed the widget in the key
- * events. If this happens, end the processing of
- * the key by returning null.
- */
- if (isDisposed ()) {
- if (ptr !is null) OS.gdk_event_free (ptr);
- return null;
- }
- if (event.doit) chars [count++] = chars [index];
- index++;
- }
- if (ptr !is null) OS.gdk_event_free (ptr);
- if (count is 0) return null;
- if (index !is count) {
- char [] result = new char [count];
- System.arraycopy (chars, 0, result, 0, count);
- return result;
- }
- return chars;
+ /*
+ * It is possible (but unlikely), that application
+ * code could have disposed the widget in the key
+ * events. If this happens, end the processing of
+ * the key by returning null.
+ */
+ if (isDisposed ()) {
+ if (ptr !is null) OS.gdk_event_free (ptr);
+ return null;
+ }
+ if (event.doit) chars [count++] = chars [index];
+ index++;
+ }
+ if (ptr !is null) OS.gdk_event_free (ptr);
+ if (count is 0) return null;
+ if (index !is count) {
+ char [] result = new char [count];
+ System.arraycopy (chars, 0, result, 0, count);
+ return result;
+ }
+ return chars;
}
/**
@@ -1237,12 +1237,12 @@
* @see #getData()
*/
public void setData (Object data) {
- checkWidget();
- if ((state & KEYED_DATA) !is 0) {
- (cast(ArrayWrapperObject) this.data).array[0] = data;
- } else {
- this.data = data;
- }
+ checkWidget();
+ if ((state & KEYED_DATA) !is 0) {
+ (cast(ArrayWrapperObject) this.data).array[0] = data;
+ } else {
+ this.data = data;
+ }
}
/**
@@ -1270,149 +1270,149 @@
* @see #getData(String)
*/
public void setData (char[] key, Object value) {
- checkWidget();
- if (key is null) error (SWT.ERROR_NULL_ARGUMENT);
- int index = 1;
- Object [] table = null;
- if ((state & KEYED_DATA) !is 0) {
- auto arr = (cast(ArrayWrapperString2) data).array;
+ checkWidget();
+ if (key is null) error (SWT.ERROR_NULL_ARGUMENT);
+ int index = 1;
+ Object [] table = null;
+ if ((state & KEYED_DATA) !is 0) {
+ auto arr = (cast(ArrayWrapperString2) data).array;
ArrayWrapperString[] strtable;
foreach( str; arr ){
strtable ~= new ArrayWrapperString( str );
}
- while (index < strtable.length) {
- if (key ==/*eq*/ strtable [index].array ) break;
- index += 2;
- }
+ while (index < strtable.length) {
+ if (key ==/*eq*/ strtable [index].array ) break;
+ index += 2;
+ }
table = cast(Object[])strtable;
- }
- if (value !is null) {
- if ((state & KEYED_DATA) !is 0) {
- if (index is table.length) {
- Object [] newTable = new Object [table.length + 2];
- System.arraycopy (table, 0, newTable, 0, table.length);
+ }
+ if (value !is null) {
+ if ((state & KEYED_DATA) !is 0) {
+ if (index is table.length) {
+ Object [] newTable = new Object [table.length + 2];
+ System.arraycopy (table, 0, newTable, 0, table.length);
table = newTable;
data = new ArrayWrapperObject( table );
- }
- } else {
- table = new Object [3];
- table [0] = data;
+ }
+ } else {
+ table = new Object [3];
+ table [0] = data;
data = new ArrayWrapperObject( table );
- state |= KEYED_DATA;
- }
- table [index] = new ArrayWrapperString( key );
- table [index + 1] = value;
- } else {
- if ((state & KEYED_DATA) !is 0) {
- if (index !is table.length) {
- int len = table.length - 2;
- if (len is 1) {
- data = table [0];
- state &= ~KEYED_DATA;
- } else {
- Object [] newTable = new Object [len];
- System.arraycopy (table, 0, newTable, 0, index);
- System.arraycopy (table, index + 2, newTable, index, len - index);
- data = new ArrayWrapperObject( newTable );
- }
- }
- }
- }
+ state |= KEYED_DATA;
+ }
+ table [index] = new ArrayWrapperString( key );
+ table [index + 1] = value;
+ } else {
+ if ((state & KEYED_DATA) !is 0) {
+ if (index !is table.length) {
+ int len = table.length - 2;
+ if (len is 1) {
+ data = table [0];
+ state &= ~KEYED_DATA;
+ } else {
+ Object [] newTable = new Object [len];
+ System.arraycopy (table, 0, newTable, 0, index);
+ System.arraycopy (table, index + 2, newTable, index, len - index);
+ data = new ArrayWrapperObject( newTable );
+ }
+ }
+ }
+ }
}
void setForegroundColor (GtkWidget* handle, GdkColor* color) {
auto style = OS.gtk_widget_get_modifier_style (handle);
- OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
- OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
- OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
- int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
- flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
- flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
- flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
- flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
- flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_NORMAL, color);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_ACTIVE, color);
+ OS.gtk_rc_style_set_fg (style, OS.GTK_STATE_PRELIGHT, color);
+ int flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+ flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+ flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+ flags = (color is null) ? flags & ~OS.GTK_RC_FG: flags | OS.GTK_RC_FG;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
- OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
- OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
- OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
- flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
- flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
- flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
- flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
- flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
- flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
- OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
- OS.gtk_widget_modify_style (handle, style);
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_NORMAL, color);
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_ACTIVE, color);
+ OS.gtk_rc_style_set_text (style, OS.GTK_STATE_PRELIGHT, color);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_NORMAL);
+ flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_NORMAL, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_PRELIGHT);
+ flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_PRELIGHT, flags);
+ flags = OS.gtk_rc_style_get_color_flags (style, OS.GTK_STATE_ACTIVE);
+ flags = (color is null) ? flags & ~OS.GTK_RC_TEXT: flags | OS.GTK_RC_TEXT;
+ OS.gtk_rc_style_set_color_flags (style, OS.GTK_STATE_ACTIVE, flags);
+ OS.gtk_widget_modify_style (handle, style);
}
bool setInputState (Event event, int state) {
- if ((state & OS.GDK_MOD1_MASK) !is 0) event.stateMask |= SWT.ALT;
- if ((state & OS.GDK_SHIFT_MASK) !is 0) event.stateMask |= SWT.SHIFT;
- if ((state & OS.GDK_CONTROL_MASK) !is 0) event.stateMask |= SWT.CONTROL;
- if ((state & OS.GDK_BUTTON1_MASK) !is 0) event.stateMask |= SWT.BUTTON1;
- if ((state & OS.GDK_BUTTON2_MASK) !is 0) event.stateMask |= SWT.BUTTON2;
- if ((state & OS.GDK_BUTTON3_MASK) !is 0) event.stateMask |= SWT.BUTTON3;
- return true;
+ if ((state & OS.GDK_MOD1_MASK) !is 0) event.stateMask |= SWT.ALT;
+ if ((state & OS.GDK_SHIFT_MASK) !is 0) event.stateMask |= SWT.SHIFT;
+ if ((state & OS.GDK_CONTROL_MASK) !is 0) event.stateMask |= SWT.CONTROL;
+ if ((state & OS.GDK_BUTTON1_MASK) !is 0) event.stateMask |= SWT.BUTTON1;
+ if ((state & OS.GDK_BUTTON2_MASK) !is 0) event.stateMask |= SWT.BUTTON2;
+ if ((state & OS.GDK_BUTTON3_MASK) !is 0) event.stateMask |= SWT.BUTTON3;
+ return true;
}
bool setKeyState (Event event, GdkEventKey* keyEvent) {
- if (keyEvent.string !is null && OS.g_utf8_strlen (keyEvent.string, keyEvent.length) > 1) return false;
- bool isNull = false;
- event.keyCode = Display.translateKey (keyEvent.keyval);
- switch (keyEvent.keyval) {
- case OS.GDK_BackSpace: event.character = SWT.BS; break;
- case OS.GDK_Linefeed: event.character = SWT.LF; break;
- case OS.GDK_KP_Enter:
- case OS.GDK_Return: event.character = SWT.CR; break;
- case OS.GDK_KP_Delete:
- case OS.GDK_Delete: event.character = SWT.DEL; break;
- case OS.GDK_Escape: event.character = SWT.ESC; break;
- case OS.GDK_Tab:
- case OS.GDK_ISO_Left_Tab: event.character = SWT.TAB; break;
- default: {
- if (event.keyCode is 0) {
- uint keyval;
+ if (keyEvent.string !is null && OS.g_utf8_strlen (keyEvent.string, keyEvent.length) > 1) return false;
+ bool isNull = false;
+ event.keyCode = Display.translateKey (keyEvent.keyval);
+ switch (keyEvent.keyval) {
+ case OS.GDK_BackSpace: event.character = SWT.BS; break;
+ case OS.GDK_Linefeed: event.character = SWT.LF; break;
+ case OS.GDK_KP_Enter:
+ case OS.GDK_Return: event.character = SWT.CR; break;
+ case OS.GDK_KP_Delete:
+ case OS.GDK_Delete: event.character = SWT.DEL; break;
+ case OS.GDK_Escape: event.character = SWT.ESC; break;
+ case OS.GDK_Tab:
+ case OS.GDK_ISO_Left_Tab: event.character = SWT.TAB; break;
+ default: {
+ if (event.keyCode is 0) {
+ uint keyval;
int effective_group, level;
int consumed_modifiers;
- if (OS.gdk_keymap_translate_keyboard_state(OS.gdk_keymap_get_default (), keyEvent.hardware_keycode, 0, keyEvent.group, &keyval, &effective_group, &level, &consumed_modifiers)) {
- event.keyCode = OS.gdk_keyval_to_unicode (keyval );
- }
- }
- int key = keyEvent.keyval;
- if ((keyEvent.state & OS.GDK_CONTROL_MASK) !is 0 && (0 <= key && key <= 0x7F)) {
- if ('a' <= key && key <= 'z') key -= 'a' - 'A';
- if (64 <= key && key <= 95) key -= 64;
- event.character = cast(char) key;
- isNull = keyEvent.keyval is '@' && key is 0;
- } else {
- event.character = cast(char) OS.gdk_keyval_to_unicode (key);
- }
- }
- }
- if (event.keyCode is 0 && event.character is 0) {
- if (!isNull) return false;
- }
- return setInputState (event, keyEvent.state);
+ if (OS.gdk_keymap_translate_keyboard_state(OS.gdk_keymap_get_default (), keyEvent.hardware_keycode, 0, keyEvent.group, &keyval, &effective_group, &level, &consumed_modifiers)) {
+ event.keyCode = OS.gdk_keyval_to_unicode (keyval );
+ }
+ }
+ int key = keyEvent.keyval;
+ if ((keyEvent.state & OS.GDK_CONTROL_MASK) !is 0 && (0 <= key && key <= 0x7F)) {
+ if ('a' <= key && key <= 'z') key -= 'a' - 'A';
+ if (64 <= key && key <= 95) key -= 64;
+ event.character = cast(char) key;
+ isNull = keyEvent.keyval is '@' && key is 0;
+ } else {
+ event.character = cast(char) OS.gdk_keyval_to_unicode (key);
+ }
+ }
+ }
+ if (event.keyCode is 0 && event.character is 0) {
+ if (!isNull) return false;
+ }
+ return setInputState (event, keyEvent.state);
}
void setOrientation () {
}
int /*long*/ shellMapProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
- return 0;
+ return 0;
}
int /*long*/ sizeAllocateProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
- return 0;
+ return 0;
}
int /*long*/ sizeRequestProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
- return 0;
+ return 0;
}
/**
@@ -1422,120 +1422,120 @@
* @return a string representation of the receiver
*/
public char[] toString () {
- char[] str = "*Disposed*";
- if (!isDisposed ()) {
- str = "*Wrong Thread*";
- if (isValidThread ()) str = getNameText ();
- }
- return getName () ~ " {" ~ str ~ "}";
+ char[] str = "*Disposed*";
+ if (!isDisposed ()) {
+ str = "*Wrong Thread*";
+ if (isValidThread ()) str = getNameText ();
+ }
+ return getName () ~ " {" ~ str ~ "}";
}
GtkWidget* topHandle () {
- return handle;
+ return handle;
}
int /*long*/ timerProc (GtkWidget* widget) {
- return 0;
+ return 0;
}
int /*long*/ treeSelectionProc (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int [] selection, int length) {
- return 0;
+ return 0;
}
bool translateTraversal (int event) {
- return false;
+ return false;
}
int /*long*/ windowProc (GtkWidget* handle, int /*long*/ user_data) {
- switch (cast(int)/*64*/user_data) {
- case ACTIVATE: return gtk_activate (handle);
- case CHANGED: return gtk_changed (handle);
- case CLICKED: return gtk_clicked (handle);
- case DAY_SELECTED: return gtk_day_selected (handle);
- case HIDE: return gtk_hide (handle);
- case GRAB_FOCUS: return gtk_grab_focus (handle);
- case MAP: return gtk_map (handle);
- case MONTH_CHANGED: return gtk_month_changed (handle);
- case OUTPUT: return gtk_output (handle);
- case POPUP_MENU: return gtk_popup_menu (handle);
- case PREEDIT_CHANGED: return gtk_preedit_changed (cast(GtkIMContext*)handle);
- case REALIZE: return gtk_realize (handle);
- case SELECT: return gtk_select (cast(int)handle);
- case SHOW: return gtk_show (handle);
- case VALUE_CHANGED: return gtk_value_changed (cast(int)handle);
- case UNMAP: return gtk_unmap (handle);
- case UNREALIZE: return gtk_unrealize (handle);
- default: return 0;
- }
+ switch (cast(int)/*64*/user_data) {
+ case ACTIVATE: return gtk_activate (handle);
+ case CHANGED: return gtk_changed (handle);
+ case CLICKED: return gtk_clicked (handle);
+ case DAY_SELECTED: return gtk_day_selected (handle);
+ case HIDE: return gtk_hide (handle);
+ case GRAB_FOCUS: return gtk_grab_focus (handle);
+ case MAP: return gtk_map (handle);
+ case MONTH_CHANGED: return gtk_month_changed (handle);
+ case OUTPUT: return gtk_output (handle);
+ case POPUP_MENU: return gtk_popup_menu (handle);
+ case PREEDIT_CHANGED: return gtk_preedit_changed (cast(GtkIMContext*)handle);
+ case REALIZE: return gtk_realize (handle);
+ case SELECT: return gtk_select (cast(int)handle);
+ case SHOW: return gtk_show (handle);
+ case VALUE_CHANGED: return gtk_value_changed (cast(int)handle);
+ case UNMAP: return gtk_unmap (handle);
+ case UNREALIZE: return gtk_unrealize (handle);
+ default: return 0;
+ }
}
int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) {
- switch (cast(int)/*64*/user_data) {
- case EXPOSE_EVENT_INVERSE: {
- GdkEventExpose* gdkEvent = cast(GdkEventExpose*) arg0;
- auto paintWindow = paintWindow();
- auto window = gdkEvent.window;
- if (window !is paintWindow) return 0;
- return (state & OBSCURED) !is 0 ? 1 : 0;
- }
- case BUTTON_PRESS_EVENT_INVERSE:
- case BUTTON_RELEASE_EVENT_INVERSE:
- case MOTION_NOTIFY_EVENT_INVERSE: {
- return 1;
- }
- case BUTTON_PRESS_EVENT: return gtk_button_press_event (handle, cast(GdkEventButton*)arg0);
- case BUTTON_RELEASE_EVENT: return gtk_button_release_event (handle, cast(GdkEventButton*)arg0);
- case COMMIT: return gtk_commit (cast(GtkIMContext*)handle, cast(char*)arg0);
- case CONFIGURE_EVENT: return gtk_configure_event (handle, arg0);
- case DELETE_EVENT: return gtk_delete_event (handle, arg0);
- case ENTER_NOTIFY_EVENT: return gtk_enter_notify_event (handle, cast(GdkEventCrossing*)arg0);
- case EVENT: return gtk_event (handle, cast(GdkEvent*)arg0);
- case EVENT_AFTER: return gtk_event_after (handle, cast(GdkEvent*)arg0);
- case EXPOSE_EVENT: return gtk_expose_event (handle, cast(GdkEventExpose*)arg0);
- case FOCUS: return gtk_focus (handle, arg0);
- case FOCUS_IN_EVENT: return gtk_focus_in_event (handle, cast(GdkEventFocus*)arg0);
- case FOCUS_OUT_EVENT: return gtk_focus_out_event (handle, cast(GdkEventFocus*)arg0);
- case KEY_PRESS_EVENT: return gtk_key_press_event (handle, cast(GdkEventKey*)arg0);
- case KEY_RELEASE_EVENT: return gtk_key_release_event (handle, cast(GdkEventKey*)arg0);
- case INPUT: return gtk_input (handle, arg0);
- case LEAVE_NOTIFY_EVENT: return gtk_leave_notify_event (handle, cast(GdkEventCrossing*)arg0);
- case MAP_EVENT: return gtk_map_event (handle, arg0);
- case MNEMONIC_ACTIVATE: return gtk_mnemonic_activate (handle, arg0);
- case MOTION_NOTIFY_EVENT: return gtk_motion_notify_event (handle, cast(GdkEventMotion*)arg0);
- case MOVE_FOCUS: return gtk_move_focus (handle, arg0);
- case SCROLL_EVENT: return gtk_scroll_event (handle, cast(GdkEventScroll*)arg0);
- case SHOW_HELP: return gtk_show_help (handle, arg0);
- case SIZE_ALLOCATE: return gtk_size_allocate (handle, arg0);
- case STYLE_SET: return gtk_style_set (handle, arg0);
- case TOGGLED: return gtk_toggled (cast(int)handle, arg0);
- case UNMAP_EVENT: return gtk_unmap_event (handle, arg0);
- case VISIBILITY_NOTIFY_EVENT: return gtk_visibility_notify_event (handle, cast(GdkEventVisibility*)arg0);
- case WINDOW_STATE_EVENT: return gtk_window_state_event (handle, cast(GdkEventWindowState*)arg0);
- default: return 0;
- }
+ switch (cast(int)/*64*/user_data) {
+ case EXPOSE_EVENT_INVERSE: {
+ GdkEventExpose* gdkEvent = cast(GdkEventExpose*) arg0;
+ auto paintWindow = paintWindow();
+ auto window = gdkEvent.window;
+ if (window !is paintWindow) return 0;
+ return (state & OBSCURED) !is 0 ? 1 : 0;
+ }
+ case BUTTON_PRESS_EVENT_INVERSE:
+ case BUTTON_RELEASE_EVENT_INVERSE:
+ case MOTION_NOTIFY_EVENT_INVERSE: {
+ return 1;
+ }
+ case BUTTON_PRESS_EVENT: return gtk_button_press_event (handle, cast(GdkEventButton*)arg0);
+ case BUTTON_RELEASE_EVENT: return gtk_button_release_event (handle, cast(GdkEventButton*)arg0);
+ case COMMIT: return gtk_commit (cast(GtkIMContext*)handle, cast(char*)arg0);
+ case CONFIGURE_EVENT: return gtk_configure_event (handle, arg0);
+ case DELETE_EVENT: return gtk_delete_event (handle, arg0);
+ case ENTER_NOTIFY_EVENT: return gtk_enter_notify_event (handle, cast(GdkEventCrossing*)arg0);
+ case EVENT: return gtk_event (handle, cast(GdkEvent*)arg0);
+ case EVENT_AFTER: return gtk_event_after (handle, cast(GdkEvent*)arg0);
+ case EXPOSE_EVENT: return gtk_expose_event (handle, cast(GdkEventExpose*)arg0);
+ case FOCUS: return gtk_focus (handle, arg0);
+ case FOCUS_IN_EVENT: return gtk_focus_in_event (handle, cast(GdkEventFocus*)arg0);
+ case FOCUS_OUT_EVENT: return gtk_focus_out_event (handle, cast(GdkEventFocus*)arg0);
+ case KEY_PRESS_EVENT: return gtk_key_press_event (handle, cast(GdkEventKey*)arg0);
+ case KEY_RELEASE_EVENT: return gtk_key_release_event (handle, cast(GdkEventKey*)arg0);
+ case INPUT: return gtk_input (handle, arg0);
+ case LEAVE_NOTIFY_EVENT: return gtk_leave_notify_event (handle, cast(GdkEventCrossing*)arg0);
+ case MAP_EVENT: return gtk_map_event (handle, arg0);
+ case MNEMONIC_ACTIVATE: return gtk_mnemonic_activate (handle, arg0);
+ case MOTION_NOTIFY_EVENT: return gtk_motion_notify_event (handle, cast(GdkEventMotion*)arg0);
+ case MOVE_FOCUS: return gtk_move_focus (handle, arg0);
+ case SCROLL_EVENT: return gtk_scroll_event (handle, cast(GdkEventScroll*)arg0);
+ case SHOW_HELP: return gtk_show_help (handle, arg0);
+ case SIZE_ALLOCATE: return gtk_size_allocate (handle, arg0);
+ case STYLE_SET: return gtk_style_set (handle, arg0);
+ case TOGGLED: return gtk_toggled (cast(int)handle, arg0);
+ case UNMAP_EVENT: return gtk_unmap_event (handle, arg0);
+ case VISIBILITY_NOTIFY_EVENT: return gtk_visibility_notify_event (handle, cast(GdkEventVisibility*)arg0);
+ case WINDOW_STATE_EVENT: return gtk_window_state_event (handle, cast(GdkEventWindowState*)arg0);
+ default: return 0;
+ }
}
int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ user_data) {
- switch (cast(int)/*64*/user_data) {
- case DELETE_RANGE: return gtk_delete_range (handle, arg0, arg1);
- case DELETE_TEXT: return gtk_delete_text (handle, arg0, arg1);
- case ROW_ACTIVATED: return gtk_row_activated (cast(int)handle, arg0, arg1);
- case SCROLL_CHILD: return gtk_scroll_child (handle, arg0, arg1);
- case SWITCH_PAGE: return gtk_switch_page (handle, arg0, arg1);
- case TEST_COLLAPSE_ROW: return gtk_test_collapse_row (cast(int)handle, arg0, arg1);
- case TEST_EXPAND_ROW: return gtk_test_expand_row(cast(int)handle, arg0, arg1);
- default: return 0;
- }
+ switch (cast(int)/*64*/user_data) {
+ case DELETE_RANGE: return gtk_delete_range (handle, arg0, arg1);
+ case DELETE_TEXT: return gtk_delete_text (handle, arg0, arg1);
+ case ROW_ACTIVATED: return gtk_row_activated (cast(int)handle, arg0, arg1);
+ case SCROLL_CHILD: return gtk_scroll_child (handle, arg0, arg1);
+ case SWITCH_PAGE: return gtk_switch_page (handle, arg0, arg1);
+ case TEST_COLLAPSE_ROW: return gtk_test_collapse_row (cast(int)handle, arg0, arg1);
+ case TEST_EXPAND_ROW: return gtk_test_expand_row(cast(int)handle, arg0, arg1);
+ default: return 0;
+ }
}
int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ arg1, int /*long*/ arg2, int /*long*/ user_data) {
- switch (cast(int)/*64*/user_data) {
- case CHANGE_VALUE: return gtk_change_value (handle, arg0, arg1, arg2);
- case EXPAND_COLLAPSE_CURSOR_ROW: return gtk_expand_collapse_cursor_row (handle, arg0, arg1, arg2);
- case INSERT_TEXT: return gtk_insert_text (handle, arg0, arg1, arg2);
- case TEXT_BUFFER_INSERT_TEXT: return gtk_text_buffer_insert_text (handle, arg0, arg1, arg2);
- default: return 0;
- }
+ switch (cast(int)/*64*/user_data) {
+ case CHANGE_VALUE: return gtk_change_value (handle, arg0, arg1, arg2);
+ case EXPAND_COLLAPSE_CURSOR_ROW: return gtk_expand_collapse_cursor_row (handle, arg0, arg1, arg2);
+ case INSERT_TEXT: return gtk_insert_text (handle, arg0, arg1, arg2);
+ case TEXT_BUFFER_INSERT_TEXT: return gtk_text_buffer_insert_text (handle, arg0, arg1, arg2);
+ default: return 0;
+ }
}
}
diff -r a5c274fa5af9 -r 8cec8f536af3 helloworld.d
--- a/helloworld.d Sat Jan 12 07:02:08 2008 +0100
+++ b/helloworld.d Sat Jan 12 08:44:23 2008 +0100
@@ -55,8 +55,8 @@
Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); shell.setSize(200, 200);
Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); shell.setText("Simple SWT Sample");
//Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); auto comp = new Composite( shell, SWT.NONE );
- Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); auto btn = new Button( shell, SWT.TOGGLE );
- Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); btn.setBounds(40, 50, 50, 20);
+ Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); auto btn = new Button( shell, SWT.PUSH );
+ Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); btn.setBounds(40, 50, 100, 50);
Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); btn.setText( "hey" );
Stdout.formatln( "trc {}:{}", __LINE__, __FILE__ ); shell.open();
Stdout.formatln( "loop entered" );