diff options
author | Anatoly Spektor | 2012-08-28 19:19:54 +0000 |
---|---|---|
committer | Arun Thondapu | 2012-09-11 15:02:20 +0000 |
commit | 1ff5dc76daca83722cbc3a22652379df0452b7e8 (patch) | |
tree | d15aa6773af9fcff5254395d9d93530270af6da3 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets | |
parent | 2c1e3b3d7e8ee238ed9a1b0193fa5c0af85695fa (diff) | |
download | eclipse.platform.swt-1ff5dc76daca83722cbc3a22652379df0452b7e8.tar.gz eclipse.platform.swt-1ff5dc76daca83722cbc3a22652379df0452b7e8.tar.xz eclipse.platform.swt-1ff5dc76daca83722cbc3a22652379df0452b7e8.zip |
Bug 388265 Use gtk_box_new() and gtk_box_set_homogeneous() for GTK3
This patch implements Gtk 3 methods gtk_box_new() and
gtk_box_set_homogeneous() instead of deprecated gtk_hbox_new() and
gtk_vbox_new()
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets')
11 files changed, 36 insertions, 10 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 7649674a1a..6d1ba92794 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 @@ -308,7 +308,7 @@ void createHandle (int index) { if ((style & SWT.ARROW) != 0) { OS.gtk_container_add (handle, arrowHandle); } else { - boxHandle = OS.gtk_hbox_new (false, 4); + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 4); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new_with_mnemonic (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java index cd4060359a..1a28ecebdb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java @@ -159,7 +159,13 @@ String openChooserDialog () { } if (message.length () > 0) { byte [] buffer = Converter.wcsToMbcs (null, message, true); - int /*long*/ box = OS.gtk_hbox_new (false, 0); + int /*long*/ box = 0; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)){ + box = OS.gtk_box_new(OS.GTK_ORIENTATION_HORIZONTAL, 0); + OS.gtk_box_set_homogeneous(box, false); + } else { + box = OS.gtk_hbox_new (false, 0); + } if (box == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ label = OS.gtk_label_new (buffer); if (label == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java index 5b4887b7f9..cf156cb5c9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java @@ -130,7 +130,12 @@ void createHandle (int index) { fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); gtk_widget_set_has_window (fixedHandle, true); - handle = OS.gtk_vbox_new (false, 0); + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)){ + handle = OS.gtk_box_new(OS.GTK_ORIENTATION_VERTICAL, 0); + OS.gtk_box_set_homogeneous(handle, false); + } else { + handle = OS.gtk_vbox_new (false, 0); + } if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.V_SCROLL) != 0) { scrolledHandle = OS.gtk_scrolled_window_new (0, 0); 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 d312929e94..311e6b802b 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 @@ -127,7 +127,7 @@ void createHandle (int index) { clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (handle, clientHandle); - boxHandle = OS.gtk_hbox_new (false, 4); + boxHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 4); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index 4885a1b520..d4326cdebb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -211,7 +211,7 @@ void createHandle (int index) { } if (handle == 0) error (SWT.ERROR_NO_HANDLES); } else { - handle = OS.gtk_hbox_new (false, 0); + handle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); labelHandle = OS.gtk_label_new_with_mnemonic (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index 91bc955651..5f1a5416bc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -677,7 +677,7 @@ void createHandle (int index) { } else { OS.gtk_window_set_resizable (shellHandle, false); } - vboxHandle = OS.gtk_vbox_new (false, 0); + vboxHandle = gtk_box_new (OS.GTK_ORIENTATION_VERTICAL, false, 0); if (vboxHandle == 0) error (SWT.ERROR_NO_HANDLES); createHandle (index, false, true); OS.gtk_container_add (vboxHandle, scrolledHandle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java index 6e3cb9f984..232b05af5a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java @@ -217,7 +217,7 @@ void createItem (TabItem item, int index) { System.arraycopy (items, 0, newItems, 0, items.length); items = newItems; } - int /*long*/ boxHandle = OS.gtk_hbox_new (false, 0); + int /*long*/ boxHandle = gtk_box_new ( OS.GTK_ORIENTATION_HORIZONTAL, false, 0); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ labelHandle = OS.gtk_label_new_with_mnemonic (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 501a8ea17c..d859a2f916 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -658,7 +658,7 @@ void createItem (TableColumn column, int index) { } else { createColumn (column, index); } - int /*long*/ boxHandle = OS.gtk_hbox_new (false, 3); + int /*long*/ boxHandle = gtk_box_new ( OS.GTK_ORIENTATION_HORIZONTAL, false, 3); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ labelHandle = OS.gtk_label_new_with_mnemonic (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java index b6ae773f1f..6145bc6524 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java @@ -215,7 +215,7 @@ void createHandle (int index) { */ handle = OS.gtk_tool_button_new (0, null); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - arrowBoxHandle = OS.gtk_hbox_new (false, 0); + arrowBoxHandle = gtk_box_new ( OS.GTK_ORIENTATION_HORIZONTAL, false, 0);; if (arrowBoxHandle == 0) error(SWT.ERROR_NO_HANDLES); arrowHandle = OS.gtk_arrow_new (OS.GTK_ARROW_DOWN, OS.GTK_SHADOW_NONE); if (arrowHandle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 1b2b738e13..a105fefe3c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -769,7 +769,7 @@ void createItem (TreeColumn column, int index) { } else { createColumn (column, index); } - int /*long*/ boxHandle = OS.gtk_hbox_new (false, 3); + int /*long*/ boxHandle = gtk_box_new ( OS.GTK_ORIENTATION_HORIZONTAL, false, 3); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); int /*long*/ labelHandle = OS.gtk_label_new_with_mnemonic (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); 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 465a0f733e..e9db87b1ae 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 @@ -1834,6 +1834,21 @@ void gdk_window_get_size (int /*long*/ drawable, int[] width, int[] height) { } } +int /*long*/ gtk_box_new (int orientation, boolean homogeneous, int spacing) { + int /*long*/ box = 0; + if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) { + box = OS.gtk_box_new (orientation, spacing); + OS.gtk_box_set_homogeneous (box, homogeneous); + } else { + if (orientation == OS.GTK_ORIENTATION_HORIZONTAL) { + box = OS.gtk_hbox_new (homogeneous, spacing); + } else if (orientation == OS.GTK_ORIENTATION_VERTICAL) { + box = OS.gtk_vbox_new (homogeneous, spacing); + } + } + return box; +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |