diff options
author | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-08-01 17:27:45 -0400 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe@ca.ibm.com> | 2012-08-01 17:27:45 -0400 |
commit | 411d5c84cea2b7314a8d0505d6c9ba708e0cf255 (patch) | |
tree | 6a00abfc36df08ef1bca150108776f575d00351d /bundles/org.eclipse.swt/Eclipse SWT/gtk | |
parent | b454bc113a8533fb302edd8590066684b051dbde (diff) | |
download | eclipse.platform.swt-411d5c84cea2b7314a8d0505d6c9ba708e0cf255.tar.gz eclipse.platform.swt-411d5c84cea2b7314a8d0505d6c9ba708e0cf255.tar.xz eclipse.platform.swt-411d5c84cea2b7314a8d0505d6c9ba708e0cf255.zip |
Bug 377961 - A combo in a toolbar gets shrunk
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java | 22 |
1 files changed, 19 insertions, 3 deletions
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 03ba2a3113..a68418e7d7 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 @@ -832,7 +832,7 @@ void resizeControl () { */ Rectangle itemRect = getBounds (); control.setSize (itemRect.width, itemRect.height); - OS.gtk_widget_set_size_request (handle, itemRect.width, itemRect.height); + resizeHandle(itemRect.width, itemRect.height); Rectangle rect = control.getBounds (); rect.x = itemRect.x + (itemRect.width - rect.width) / 2; rect.y = itemRect.y + (itemRect.height - rect.height) / 2; @@ -840,6 +840,23 @@ void resizeControl () { } } +void resizeHandle(int width, int height) { + OS.gtk_widget_set_size_request (handle, width, height); + /* + * Cause a size allocation this widget's topHandle. Note that + * all calls to gtk_widget_size_allocate() must be preceded by + * a call to gtk_widget_size_request(). + */ + GtkRequisition requisition = new GtkRequisition (); + parent.gtk_widget_size_request (handle, requisition); + GtkAllocation allocation = new GtkAllocation (); + allocation.x = OS.GTK_WIDGET_X(handle); + allocation.y = OS.GTK_WIDGET_Y(handle); + allocation.width = width; + allocation.height = height; + OS.gtk_widget_size_allocate (handle, allocation); +} + void selectRadio () { int index = 0; ToolItem [] items = parent.getItems (); @@ -1197,8 +1214,7 @@ public void setWidth (int width) { checkWidget(); if ((style & SWT.SEPARATOR) == 0) return; if (width < 0) return; - boolean isVertical = (parent.style & SWT.VERTICAL) != 0; - OS.gtk_widget_set_size_request (handle, width, isVertical ? 6 : 15); + resizeHandle(width, (parent.style & SWT.VERTICAL) != 0 ? 6 : 15); parent.relayout (); } |