From d29a9ac78b9ed6462de983f003a794010dc4bd5d Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Tue, 13 Jul 2004 21:54:38 +0000 Subject: realize and map callbacks --- .../gtk/org/eclipse/swt/widgets/Button.java | 14 ++++++------ .../gtk/org/eclipse/swt/widgets/Combo.java | 4 ---- .../gtk/org/eclipse/swt/widgets/Composite.java | 22 ++++++------------ .../gtk/org/eclipse/swt/widgets/Control.java | 9 ++++++++ .../gtk/org/eclipse/swt/widgets/Group.java | 11 +++++---- .../gtk/org/eclipse/swt/widgets/Label.java | 13 +++++------ .../gtk/org/eclipse/swt/widgets/List.java | 5 ----- .../gtk/org/eclipse/swt/widgets/ProgressBar.java | 3 --- .../gtk/org/eclipse/swt/widgets/Sash.java | 5 ----- .../gtk/org/eclipse/swt/widgets/Scale.java | 4 ---- .../gtk/org/eclipse/swt/widgets/Scrollable.java | 5 +++++ .../gtk/org/eclipse/swt/widgets/Shell.java | 9 +++++++- .../gtk/org/eclipse/swt/widgets/Slider.java | 4 ---- .../gtk/org/eclipse/swt/widgets/TabFolder.java | 4 ---- .../gtk/org/eclipse/swt/widgets/Table.java | 5 ----- .../gtk/org/eclipse/swt/widgets/Text.java | 6 ----- .../gtk/org/eclipse/swt/widgets/ToolBar.java | 4 ---- .../gtk/org/eclipse/swt/widgets/ToolItem.java | 26 ++++++++++++++-------- .../gtk/org/eclipse/swt/widgets/Tree.java | 5 ----- 19 files changed, 63 insertions(+), 95 deletions(-) (limited to 'bundles/org.eclipse.swt/Eclipse SWT') 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 074d6cb8bc..6516767583 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 @@ -191,7 +191,6 @@ void createHandle (int index) { } if ((style & SWT.ARROW) != 0) { OS.gtk_container_add (handle, arrowHandle); - OS.gtk_widget_show (arrowHandle); } else { boxHandle = OS.gtk_hbox_new (false, 0); if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES); @@ -202,14 +201,8 @@ void createHandle (int index) { OS.gtk_container_add (handle, boxHandle); OS.gtk_container_add (boxHandle, labelHandle); OS.gtk_container_add (boxHandle, imageHandle); - OS.gtk_widget_show (boxHandle); - OS.gtk_widget_show (labelHandle); } - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (handle); if ((style & SWT.ARROW) != 0) return; if ((style & SWT.LEFT) != 0) { @@ -717,6 +710,13 @@ public void setText (String string) { OS.gtk_widget_size_request (handle, requisition); } +void showWidget () { + super.showWidget (); + if (boxHandle != 0) OS.gtk_widget_show (boxHandle); + if (labelHandle != 0) OS.gtk_widget_show (labelHandle); + if (arrowHandle != 0) OS.gtk_widget_show (arrowHandle); +} + int traversalCode (int key, GdkEventKey event) { int code = super.traversalCode (key, event); if ((style & SWT.RADIO) != 0) code |= SWT.TRAVERSE_ARROW_NEXT | SWT.TRAVERSE_ARROW_PREVIOUS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index c1f4f013a1..4fa729c4e1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -343,11 +343,7 @@ void createHandle (int index) { OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_combo_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (handle); GtkCombo combo = new GtkCombo (); OS.memmove (combo, handle); entryHandle = combo.entry; 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 50b4ae2683..fe3a858430 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 @@ -173,10 +173,10 @@ Control [] computeTabList () { void createHandle (int index) { state |= HANDLE | CANVAS; boolean scrolled = (style & (SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER)) != 0; - createHandle (index, parent.parentingHandle (), scrolled); + createHandle (index, scrolled); } -void createHandle (int index, int /*long*/ parentHandle, boolean scrolled) { +void createHandle (int index, boolean scrolled) { if (scrolled) { fixedHandle = OS.gtk_fixed_new (); if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES); @@ -199,7 +199,6 @@ void createHandle (int index, int /*long*/ parentHandle, boolean scrolled) { } } if (scrolled) { - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, scrolledHandle); /* * Force the scrolledWindow to have a single child that is @@ -211,8 +210,6 @@ void createHandle (int index, int /*long*/ parentHandle, boolean scrolled) { OS.gtk_container_add (scrolledHandle, handle); display.setWarnings (warnings); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (scrolledHandle); int hsp = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp); @@ -220,23 +217,13 @@ void createHandle (int index, int /*long*/ parentHandle, boolean scrolled) { if (hasBorder ()) { OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN); } - } else { - OS.gtk_container_add (parentHandle, handle); } - OS.gtk_widget_show (handle); if ((style & SWT.EMBEDDED) != 0) { socketHandle = OS.gtk_socket_new (); if (socketHandle == 0) SWT.error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (handle, socketHandle); - OS.gtk_widget_show (socketHandle); embeddedHandle = OS.gtk_socket_get_id (socketHandle); } - if (imHandle != 0) { - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - if (window != 0) { - OS.gtk_im_context_set_client_window (imHandle, window); - } - } if ((style & SWT.NO_REDRAW_RESIZE) != 0) { OS.gtk_widget_set_redraw_on_allocate (handle, false); } @@ -777,6 +764,11 @@ public void setTabList (Control [] tabList) { this.tabList = tabList; } +void showWidget () { + super.showWidget (); + if (socketHandle != 0) OS.gtk_widget_show (socketHandle); +} + boolean translateMnemonic (Event event, Control control) { if (super.translateMnemonic (event, control)) return true; if (control != null) { 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 4cc856b7ac..577d3d2314 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 @@ -307,6 +307,7 @@ Control computeTabRoot () { void createWidget (int index) { checkOrientation (parent); super.createWidget (index); + showWidget (); setInitialSize (); setZOrder (null, false); } @@ -3003,6 +3004,14 @@ boolean showMenu (int x, int y) { return false; } +void showWidget () { + int /*long*/ topHandle = topHandle (); + int /*long*/ parentHandle = parent.parentingHandle (); + OS.gtk_container_add (parentHandle, topHandle); + if (handle != 0) OS.gtk_widget_show (handle); + if (fixedHandle != 0) OS.gtk_widget_show (fixedHandle); +} + void sort (int [] items) { /* Shell Sort from K&R, pg 108 */ int length = items.length; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index 1683d02279..ef0e83d6d1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -123,14 +123,8 @@ void createHandle(int index) { OS.gtk_object_sink (labelHandle); clientHandle = OS.gtk_fixed_new(); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); OS.gtk_container_add (handle, clientHandle); - OS.gtk_widget_show (handle); - OS.gtk_widget_show (clientHandle); - OS.gtk_widget_show (labelHandle); - OS.gtk_widget_show (fixedHandle); if ((style & SWT.SHADOW_IN) != 0) { OS.gtk_frame_set_shadow_type (handle, OS.GTK_SHADOW_IN); } @@ -305,4 +299,9 @@ public void setText (String string) { fixGroup (); } +void showWidget () { + super.showWidget (); + if (clientHandle != 0) OS.gtk_widget_show (clientHandle); + if (labelHandle != 0) OS.gtk_widget_show (labelHandle); +} } 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 5c578e7a78..8ba6db6205 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 @@ -142,7 +142,6 @@ void createHandle (int index) { } else { handle = OS.gtk_vseparator_new (); } - OS.gtk_widget_show (handle); } else { handle = OS.gtk_hbox_new (false, 0); if (handle == 0) error (SWT.ERROR_NO_HANDLES); @@ -152,8 +151,6 @@ void createHandle (int index) { if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (handle, labelHandle); OS.gtk_container_add (handle, imageHandle); - OS.gtk_widget_show (handle); - OS.gtk_widget_show (labelHandle); } if (handle == 0) error (SWT.ERROR_NO_HANDLES); if ((style & SWT.BORDER) != 0) { @@ -161,15 +158,10 @@ void createHandle (int index) { if (frameHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, frameHandle); OS.gtk_container_add (frameHandle, handle); - OS.gtk_widget_show (frameHandle); - // CHECK THEME OS.gtk_frame_set_shadow_type (frameHandle, OS.GTK_SHADOW_ETCHED_IN); } else { OS.gtk_container_add (fixedHandle, handle); } - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); - OS.gtk_widget_show (fixedHandle); if ((style & SWT.SEPARATOR) != 0) return; if ((style & SWT.WRAP) != 0) OS.gtk_label_set_line_wrap (labelHandle, true); if ((style & SWT.LEFT) != 0) { @@ -524,4 +516,9 @@ public void setText (String string) { OS.gtk_widget_show (labelHandle); } +void showWidget () { + super.showWidget (); + if (frameHandle != 0) OS.gtk_widget_show (frameHandle); + if (labelHandle != 0) OS.gtk_widget_show (labelHandle); +} } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java index 089a9b2f49..6e76050e53 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java @@ -205,13 +205,8 @@ void createHandle (int index) { OS.gtk_tree_view_column_pack_start (columnHandle, textRenderer, true); OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, "text", TEXT_COLUMN); OS.gtk_tree_view_insert_column (handle, columnHandle, index); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, scrolledHandle); OS.gtk_container_add (scrolledHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (scrolledHandle); - OS.gtk_widget_show (handle); int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_MULTIPLE : OS.GTK_SELECTION_BROWSE; int /*long*/ selectionHandle = OS.gtk_tree_view_get_selection (handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index 8b5dbd948c..644213d21a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -78,9 +78,6 @@ void createHandle (int index) { state |= HANDLE; handle = OS.gtk_progress_bar_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, handle); - OS.gtk_widget_show (handle); int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_BOTTOM_TO_TOP : OS.GTK_PROGRESS_LEFT_TO_RIGHT; OS.gtk_progress_bar_set_orientation (handle, orientation); if ((style & SWT.INDETERMINATE) != 0) { 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 a54d161ffc..971a2ef527 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 @@ -132,13 +132,8 @@ void createHandle (int index) { handle = OS.gtk_drawing_area_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, handle); - OS.gtk_widget_show (handle); int type = (style & SWT.VERTICAL) != 0 ? OS.GDK_SB_H_DOUBLE_ARROW : OS.GDK_SB_V_DOUBLE_ARROW; defaultCursor = OS.gdk_cursor_new (type); - int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); - if (window != 0) OS.gdk_window_set_cursor (window, defaultCursor); } void drawBand (int x, int y, int width, int height) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index 661c9c3a15..8c3ecc8c38 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -126,11 +126,7 @@ void createHandle (int index) { handle = OS.gtk_vscale_new (hAdjustment); } if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (handle); OS.gtk_scale_set_digits (handle, 0); OS.gtk_scale_set_draw_value (handle, false); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java index afbd0cebfc..47511eee88 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java @@ -287,6 +287,11 @@ void resizeHandle (int width, int height) { } } +void showWidget () { + super.showWidget (); + if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle); +} + int /*long*/ topHandle () { if (fixedHandle != 0) return fixedHandle; if (scrolledHandle != 0) return scrolledHandle; 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 dbc6957c5e..ad9b733678 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 @@ -499,7 +499,7 @@ void createHandle (int index) { } else { OS.gtk_window_set_resizable (shellHandle, false); } - createHandle (index, shellHandle, true); + createHandle (index, true); OS.gtk_widget_realize (shellHandle); int /*long*/ window = OS.GTK_WIDGET_WINDOW (shellHandle); int decorations = 0; @@ -1232,6 +1232,13 @@ int /*long*/ shellMapProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ return 0; } +void showWidget () { + OS.gtk_container_add (shellHandle, fixedHandle); + if (scrolledHandle != 0) OS.gtk_widget_show (scrolledHandle); + if (handle != 0) OS.gtk_widget_show (handle); + if (fixedHandle != 0) OS.gtk_widget_show (fixedHandle); +} + boolean traverseEscape () { if (parent == null) return false; if (!isVisible () || !isEnabled ()) return false; 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 b6bba8f8f0..4abec07a6b 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 @@ -157,11 +157,7 @@ void createHandle (int index) { } if (handle == 0) error (SWT.ERROR_NO_HANDLES); OS.GTK_WIDGET_SET_FLAGS (handle, OS.GTK_CAN_FOCUS); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (handle); } int /*long*/ gtk_value_changed (int /*long*/ adjustment) { 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 4bc96e9599..65ee0ebc94 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 @@ -186,11 +186,7 @@ void createHandle (int index) { OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_notebook_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (handle); - OS.gtk_widget_show (fixedHandle); OS.gtk_notebook_set_scrollable (handle, true); OS.gtk_notebook_set_show_tabs (handle, true); if ((style & SWT.BOTTOM) != 0) { 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 b204e5f183..410f001dff 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 @@ -411,13 +411,8 @@ void createHandle (int index) { OS.g_object_ref (checkRenderer); } createColumn (null, 0); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, scrolledHandle); OS.gtk_container_add (scrolledHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (scrolledHandle); - OS.gtk_widget_show (handle); int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_MULTIPLE : OS.GTK_SELECTION_BROWSE; int /*long*/ selectionHandle = OS.gtk_tree_view_get_selection (handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java index 5b1f0e7c0a..770fa193f6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java @@ -111,11 +111,9 @@ static int checkStyle (int style) { void createHandle (int index) { state |= HANDLE | MENU; - int /*long*/ parentHandle = parent.parentingHandle (); if ((style & SWT.SINGLE) != 0) { handle = OS.gtk_entry_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - OS.gtk_container_add (parentHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); OS.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0); @@ -135,11 +133,8 @@ void createHandle (int index) { if (handle == 0) error (SWT.ERROR_NO_HANDLES); bufferHandle = OS.gtk_text_view_get_buffer (handle); if (bufferHandle == 0) error (SWT.ERROR_NO_HANDLES); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, scrolledHandle); OS.gtk_container_add (scrolledHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (scrolledHandle); OS.gtk_text_view_set_editable (handle, (style & SWT.READ_ONLY) == 0); if ((style & SWT.WRAP) != 0) OS.gtk_text_view_set_wrap_mode (handle, OS.GTK_WRAP_WORD); int hsp = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_ALWAYS : OS.GTK_POLICY_NEVER; @@ -153,7 +148,6 @@ void createHandle (int index) { if ((style & SWT.RIGHT) != 0) just = OS.GTK_JUSTIFY_RIGHT; OS.gtk_text_view_set_justification (handle, just); } - OS.gtk_widget_show (handle); /* * Bug in GTK. When the parent is realized before the GtkTextView * widget is created, the GTK_TEXT_WINDOW_TEXT window does not have diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index ea631f47cb..e2b3279bbf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -138,11 +138,7 @@ void createHandle (int index) { OS.gtk_fixed_set_has_window (fixedHandle, true); handle = OS.gtk_toolbar_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (handle); if ((style & SWT.FLAT) != 0) { byte [] swt_toolbar_flat = Converter.wcsToMbcs (null, "swt-toolbar-flat", true); OS.gtk_widget_set_name (handle, swt_toolbar_flat); 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 963aa668bd..fb0181d3b4 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 @@ -34,7 +34,7 @@ import org.eclipse.swt.events.*; *

*/ public class ToolItem extends Item { - int /*long*/ boxHandle, arrowHandle, separatorHandle, labelHandle, imageHandle; + int /*long*/ boxHandle, arrowHandle, arrowBoxHandle, separatorHandle, labelHandle, imageHandle; ToolBar parent; Control control; Image hotImage, disabledImage; @@ -159,6 +159,10 @@ public void addSelectionListener(SelectionListener listener) { addListener (SWT.DefaultSelection,typedListener); } +static int checkStyle (int style) { + return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0); +} + void createHandle (int index) { state |= HANDLE; if ((style & SWT.SEPARATOR) == 0) { @@ -170,7 +174,6 @@ void createHandle (int index) { if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (boxHandle, imageHandle); OS.gtk_container_add (boxHandle, labelHandle); - OS.gtk_widget_show (boxHandle); } int bits = SWT.SEPARATOR | SWT.RADIO | SWT.CHECK | SWT.PUSH | SWT.DROP_DOWN; switch (style & bits) { @@ -182,12 +185,11 @@ void createHandle (int index) { if (separatorHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_widget_set_size_request (separatorHandle, isVertical ? 15 : 6, isVertical ? 6 : 15); OS.gtk_container_add (handle, separatorHandle); - OS.gtk_widget_show (separatorHandle); break; case SWT.DROP_DOWN: handle = OS.gtk_button_new (); if (handle == 0) error (SWT.ERROR_NO_HANDLES); - int /*long*/ arrowBoxHandle = OS.gtk_hbox_new (false, 0); + arrowBoxHandle = OS.gtk_hbox_new (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); @@ -195,8 +197,6 @@ void createHandle (int index) { OS.gtk_container_add (handle, arrowBoxHandle); OS.gtk_container_add (arrowBoxHandle, boxHandle); OS.gtk_container_add (arrowBoxHandle, arrowHandle); - OS.gtk_widget_show (arrowBoxHandle); - OS.gtk_widget_show (arrowHandle); break; case SWT.RADIO: /* @@ -230,12 +230,16 @@ void createHandle (int index) { OS.gtk_button_set_relief (handle, relief [0]); } OS.GTK_WIDGET_UNSET_FLAGS (handle, OS.GTK_CAN_FOCUS); - OS.gtk_widget_show (handle); OS.gtk_toolbar_insert_widget (parent.handle, handle, null, null, index); setForegroundColor (parent.getForegroundColor ()); setFontDescription (parent.getFontDescription ()); } +void createWidget (int index) { + super.createWidget (index); + showWidget (); +} + void deregister() { super.deregister (); if (labelHandle != 0) display.removeWidget (labelHandle); @@ -893,7 +897,11 @@ public void setWidth (int width) { } } -static int checkStyle (int style) { - return checkBits (style, SWT.PUSH, SWT.CHECK, SWT.RADIO, SWT.SEPARATOR, SWT.DROP_DOWN, 0); +void showWidget () { + if (handle != 0) OS.gtk_widget_show (handle); + if (boxHandle != 0) OS.gtk_widget_show (boxHandle); + if (separatorHandle != 0) OS.gtk_widget_show (separatorHandle); + if (arrowBoxHandle != 0) OS.gtk_widget_show (arrowBoxHandle); + if (arrowHandle != 0) OS.gtk_widget_show (arrowHandle); } } 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 22e617a1f3..c796883816 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 @@ -243,13 +243,8 @@ void createHandle (int index) { OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, "foreground-gdk", FOREGROUND_COLUMN); OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, "background-gdk", BACKGROUND_COLUMN); OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, "font-desc", FONT_COLUMN); - int /*long*/ parentHandle = parent.parentingHandle (); - OS.gtk_container_add (parentHandle, fixedHandle); OS.gtk_container_add (fixedHandle, scrolledHandle); OS.gtk_container_add (scrolledHandle, handle); - OS.gtk_widget_show (fixedHandle); - OS.gtk_widget_show (scrolledHandle); - OS.gtk_widget_show (handle); int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_MULTIPLE : OS.GTK_SELECTION_BROWSE; int /*long*/ selectionHandle = OS.gtk_tree_view_get_selection (handle); -- cgit