diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT')
10 files changed, 46 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 8a1d466bc9..b4a341f417 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -302,7 +302,7 @@ void createHandle (int index) { default: handle = OS.gtk_button_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_DEFAULT); + gtk_widget_set_can_default (handle, true); break; } if ((style & SWT.ARROW) != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index 84c8a8e26e..35c0369518 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -277,7 +277,7 @@ void createHandle (int index, boolean fixed, boolean scrolled) { handle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); gtk_widget_set_has_window (handle, true); - OS.GTK_WIDGET_SET_FLAGS(handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); if ((style & SWT.EMBEDDED) == 0) { if ((state & CANVAS) != 0) { /* Prevent an input method context from being created for the Browser widget */ @@ -530,7 +530,7 @@ int /*long*/ focusHandle () { } boolean forceFocus (int /*long*/ focusHandle) { - if (socketHandle != 0) OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); + if (socketHandle != 0) gtk_widget_set_can_focus (focusHandle, true); boolean result = super.forceFocus (focusHandle); if (socketHandle != 0) OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index 27e8a5be3f..6e57710576 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -191,7 +191,7 @@ void fixFocus (Control focusControl) { } shell.setSavedFocus (focusControl); int /*long*/ focusHandle = shell.vboxHandle; - OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (focusHandle, true); OS.gtk_widget_grab_focus (focusHandle); // widget could be disposed at this point if (isDisposed ()) return; @@ -843,7 +843,7 @@ void moveHandle (int x, int y) { OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE); OS.gtk_fixed_move (parentHandle, topHandle, x, y); if (visible) { - OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE); + gtk_widget_set_visible (parentHandle, true); } } @@ -2368,7 +2368,7 @@ void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, De } int /*long*/ fixedMapProc (int /*long*/ widget) { - OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED); + gtk_widget_set_mapped (widget, true); int /*long*/ widgetList = OS.gtk_container_get_children (widget); if (widgetList != 0) { int /*long*/ widgets = widgetList; @@ -4567,7 +4567,7 @@ public void setVisible (boolean visible) { OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE); fixFocus (control); if (isDisposed ()) return; - OS.GTK_WIDGET_SET_FLAGS (topHandle, OS.GTK_VISIBLE); + gtk_widget_set_visible (topHandle, true); } OS.gtk_widget_hide (topHandle); if (isDisposed ()) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 62ac399ec3..05d4dcec64 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -136,7 +136,7 @@ void createHandle (int index) { OS.gtk_container_add (boxHandle, imageHandle); OS.gtk_container_add (boxHandle, labelHandle); OS.gtk_expander_set_label_widget (handle, boxHandle); - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); } void createWidget (int index) { @@ -509,7 +509,7 @@ public void setExpanded (boolean expanded) { boolean setFocus () { if (!OS.gtk_widget_get_child_visible (handle)) return false; - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); OS.gtk_widget_grab_focus (handle); // widget could be disposed at this point if (isDisposed ()) return false; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java index d45f7c2273..9afefbb3ef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java @@ -146,7 +146,7 @@ void createHandle(int index) { handle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); gtk_widget_set_has_window (handle, true); - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); layout = new TextLayout (display); linkColor = new Color (display, LINK_FOREGROUND); disabledColor = new Color (display, LINK_DISABLED_FOREGROUND); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java index 65c035644f..072dd38538 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java @@ -961,7 +961,7 @@ public void setDefaultItem (MenuItem item) { public void setEnabled (boolean enabled) { checkWidget(); if (enabled) { - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_SENSITIVE); + OS.gtk_widget_set_sensitive (handle, true); } else { OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_SENSITIVE); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java index ee8915ea35..87f0b0a3fd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java @@ -276,7 +276,7 @@ void createHandle (int index) { } int /*long*/ parentHandle = parent.handle; boolean enabled = gtk_widget_get_sensitive (parentHandle); - if (!enabled) OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_SENSITIVE); + if (!enabled) OS.gtk_widget_set_sensitive (parentHandle, true); OS.gtk_menu_shell_insert (parentHandle, handle, index); if (!enabled) OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_SENSITIVE); OS.gtk_widget_show (handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java index 036c84cb51..7485d194c6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java @@ -137,7 +137,7 @@ void createHandle (int index) { handle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); gtk_widget_set_has_window (handle, true); - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); int type = (style & SWT.VERTICAL) != 0 ? OS.GDK_SB_H_DOUBLE_ARROW : OS.GDK_SB_V_DOUBLE_ARROW; defaultCursor = OS.gdk_cursor_new (type); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java index e2386d1aed..fb26b7dc08 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java @@ -170,7 +170,7 @@ void createHandle (int index) { * (http://bugzilla.gnome.org/show_bug.cgi?id=475909) */ if (OS.GTK_VERSION < OS.VERSION (2, 10, 0) || (style & SWT.VERTICAL) != 0) { - OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); + gtk_widget_set_can_focus (handle, true); } OS.gtk_container_add (fixedHandle, handle); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index 0c8ec24ccd..eb1b4e8b87 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -1746,6 +1746,38 @@ int /*long*/ gtk_widget_get_window (int /*long*/ widget){ } } +void gtk_widget_set_can_default (int /*long*/ widget, boolean can_default) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_can_default (widget, can_default); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_CAN_DEFAULT); + } +} + +void gtk_widget_set_can_focus (int /*long*/ widget, boolean can_focus) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_can_focus (widget, can_focus); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_CAN_FOCUS); + } +} + +void gtk_widget_set_mapped (int /*long*/ widget, boolean mapped) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + OS.gtk_widget_set_mapped (widget, mapped); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED); + } +} + +void gtk_widget_set_visible (int /*long*/ widget, boolean visible) { + if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { + OS.gtk_widget_set_visible (widget,visible); + } else { + OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_VISIBLE); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |