24359
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
index 1dabd0d..56f840c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java
@@ -382,11 +382,13 @@
 }

 

 void selectRadio () {

+	int index = 0;

 	Control [] children = parent._getChildren ();

-	for (int i=0; i<children.length; i++) {

-		Control child = children [i];

-		if (this != child) child.setRadioSelection (false);

-	}

+	while (index < children.length && children [index] != this) index++;

+	int i = index - 1;

+	while (i >= 0 && children [i].setRadioSelection (false)) --i;

+	int j = index + 1;

+	while (j < children.length && children [j].setRadioSelection (false)) j++;

 	setSelection (true);

 }

 

@@ -496,11 +498,13 @@
 	return setFocus ();

 }

 

-void setRadioSelection (boolean value) {

-	if ((style & SWT.RADIO) == 0) return;

-	if (getSelection () == value) return;

-	setSelection (value);

-	postEvent (SWT.Selection);

+boolean setRadioSelection (boolean value) {

+	if ((style & SWT.RADIO) == 0) return false;

+	if (getSelection () != value) {

+		setSelection (value);

+		postEvent (SWT.Selection);

+	}

+	return true;

 }

 

 boolean setSavedFocus () {

diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
index 8cfe618..1995041 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java
Binary files differ
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
index 849bb3b..b59c2d3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java
@@ -16,7 +16,7 @@
  * menu items.

  * <dl>

  * <dt><b>Styles:</b></dt>

- * <dd>BAR, DROP_DOWN, POP_UP</dd>

+ * <dd>BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP</dd>

  * <dt><b>Events:</b></dt>

  * <dd>Help, Hide, Show </dd>

  * </dl>

diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
index 0c8e56b..2e2795e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/MenuItem.java
@@ -505,6 +505,17 @@
 	eventTable.unhook (SWT.DefaultSelection,listener);	

 }

 

+void selectRadio () {

+	int index = 0;

+	MenuItem [] items = parent.getItems ();

+	while (index < items.length && items [index] != this) index++;

+	int i = index - 1;

+	while (i >= 0 && items [i].setRadioSelection (false)) --i;

+	int j = index + 1;

+	while (j < items.length && items [j].setRadioSelection (false)) j++;

+	setSelection (true);

+}

+

 /**

  * Sets the widget accelerator.  An accelerator is the bit-wise

  * OR of zero or more modifier masks and a key. Examples:

@@ -731,6 +742,15 @@
 	parent.destroyAccelerators ();

 }

 

+boolean setRadioSelection (boolean value) {

+	if ((style & SWT.RADIO) == 0) return false;

+	if (getSelection () != value) {

+		setSelection (value);

+		postEvent (SWT.Selection);

+	}

+	return true;

+}

+

 /**

  * Sets the selection state of the receiver.

  * <p>

@@ -882,8 +902,16 @@
 }

 

 LRESULT wmCommandChild (int wParam, int lParam) {

-	if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {

+	if ((style & SWT.CHECK) != 0) {

 		setSelection (!getSelection ());

+	} else {

+		if ((style & SWT.RADIO) != 0) {

+			if ((parent.getStyle () & SWT.NO_RADIO_GROUP) != 0) {

+				setSelection (!getSelection ());

+			} else {

+				selectRadio ();

+			}

+		}

 	}

 	Event event = new Event ();

 	setInputState (event, SWT.Selection);

diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
index d8f0c4d..9b0d96c 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ToolItem.java
@@ -485,6 +485,17 @@
 	}

 }

 

+void selectRadio () {

+	int index = 0;

+	ToolItem [] items = parent.getItems ();

+	while (index < items.length && items [index] != this) index++;

+	int i = index - 1;

+	while (i >= 0 && items [i].setRadioSelection (false)) --i;

+	int j = index + 1;

+	while (j < items.length && items [j].setRadioSelection (false)) j++;

+	setSelection (true);

+}

+

 /**

  * Sets the control that is used to fill the bounds of

  * the item when the items is a <code>SEPARATOR</code>.

@@ -595,6 +606,15 @@
 	updateImages ();

 }

 

+boolean setRadioSelection (boolean value) {

+	if ((style & SWT.RADIO) == 0) return false;

+	if (getSelection () != value) {

+		setSelection (value);

+		postEvent (SWT.Selection);

+	}

+	return true;

+}

+

 /**

  * Sets the selection state of the receiver.

  * <p>

@@ -783,12 +803,23 @@
 	if ((style & SWT.DROP_DOWN) != 0) return OS.BTNS_DROPDOWN;

 	if ((style & SWT.PUSH) != 0) return OS.BTNS_BUTTON;

 	if ((style & SWT.CHECK) != 0) return OS.BTNS_CHECK;

-	if ((style & SWT.RADIO) != 0) return OS.BTNS_CHECKGROUP;

+	/*

+	* This code is intentionally commented.  In order to

+	* consistently support radio tool items across platforms,

+	* the platform radio behavior is not used.

+	*/

+//	if ((style & SWT.RADIO) != 0) return OS.BTNS_CHECKGROUP;

+	if ((style & SWT.RADIO) != 0) return OS.BTNS_CHECK;

 	if ((style & SWT.SEPARATOR) != 0) return OS.BTNS_SEP;

 	return OS.BTNS_BUTTON;

 }

 

 LRESULT wmCommandChild (int wParam, int lParam) {

+	if ((style & SWT.RADIO) != 0) {

+		if ((parent.getStyle () & SWT.NO_RADIO_GROUP) == 0) {

+			selectRadio ();

+		}

+	}

 	Event event = new Event ();

 	setInputState (event, SWT.Selection);

 	postEvent (SWT.Selection, event);