summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT
diff options
context:
space:
mode:
authorBilly Biggs <bbiggs>2005-02-07 16:18:27 +0000
committerBilly Biggs <bbiggs>2005-02-07 16:18:27 +0000
commit9b0ccc5ced24e16f6b8b75ef174d7898cf5deb38 (patch)
tree0e819b3c04b60b89d744b2affaaf709f8077f1bf /bundles/org.eclipse.swt/Eclipse SWT
parent32debd3b792f6dea3cbde01bcd2ea792207752aa (diff)
downloadeclipse.platform.swt-9b0ccc5ced24e16f6b8b75ef174d7898cf5deb38.tar.gz
eclipse.platform.swt-9b0ccc5ced24e16f6b8b75ef174d7898cf5deb38.tar.xz
eclipse.platform.swt-9b0ccc5ced24e16f6b8b75ef174d7898cf5deb38.zip
84581
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java33
1 files changed, 16 insertions, 17 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 d5a1abb64f..59d04b87c1 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
@@ -137,7 +137,20 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
+ /*
+ * Feature in GTK, GtkCheckButton and GtkRadioButton allocate
+ * only the minimum size necessary for its child. This causes the child
+ * alignment to fail. The fix is to set the child size to the size
+ * of the button.
+ */
+ int width = OS.GTK_WIDGET_WIDTH (handle);
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ OS.gtk_widget_set_size_request (boxHandle, -1, -1);
+ }
Point size = computeNativeSize (handle, wHint, hHint, changed);
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
+ OS.gtk_widget_set_size_request (boxHandle, width, -1);
+ }
if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) {
int /*long*/ [] buffer = new int /*long*/ [1];
@@ -562,25 +575,11 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
/*
* Feature in GTK, GtkCheckButton and GtkRadioButton allocate
* only the minimum size necessary for its child. This causes the child
- * alignment to fail. The fix is to set the child size to all available space
- * excluding trimmings.
+ * alignment to fail. The fix is to set the child size to the size
+ * of the button.
*/
if ((result & RESIZED) != 0 && (style & (SWT.CHECK | SWT.RADIO)) != 0) {
- int childHeight = 0, buttonWidth = 0, buttonHeight = 0;
- GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (handle, requisition);
- buttonWidth = requisition.width;
- buttonHeight = requisition.height;
- OS.gtk_widget_size_request (boxHandle, requisition);
- childHeight = requisition.height;
- OS.gtk_widget_set_size_request (handle, -1, -1);
- OS.gtk_widget_set_size_request (boxHandle, -1, -1);
- OS.gtk_widget_size_request (handle, requisition);
- int trim = requisition.width;
- OS.gtk_widget_size_request (boxHandle, requisition);
- trim -= requisition.width;
- OS.gtk_widget_set_size_request (handle, buttonWidth, buttonHeight);
- OS.gtk_widget_set_size_request (boxHandle, Math.max (1, width - trim), childHeight);
+ OS.gtk_widget_set_size_request (boxHandle, width, -1);
}
return result;
}