diff --git a/gtk/ActionGroup.cs b/gtk/ActionGroup.cs
index 420e5cef2..09306caf3 100644
--- a/gtk/ActionGroup.cs
+++ b/gtk/ActionGroup.cs
@@ -60,7 +60,7 @@ namespace Gtk {
public void Add (RadioActionEntry[] entries, int value, ChangedHandler changed)
{
- GLib.SList group = new GLib.SList (typeof (RadioAction));
+ RadioAction[] group = null;
RadioAction[] actions = new RadioAction[entries.Length];
for (int i = 0; i < entries.Length; i++) {
actions[i] = new RadioAction (entries[i].name, entries[i].label,
diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata
index 694a21b63..04bb7ea56 100644
--- a/gtk/Gtk.metadata
+++ b/gtk/Gtk.metadata
@@ -486,19 +486,30 @@
call
const-gfilename*
GtkWidget
+ 1
+ 1
+ 1
1
1
1
1
group
group
+ 1
+ 1
1
1
1
1
1
+ 1
+ 1
+ 1
1
1
+ 1
+ 1
+ 1
true
true
true
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 7deda33b2..5db750b22 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -66,6 +66,7 @@ sources = \
PaperSize.cs \
Plug.cs \
Printer.cs \
+ RadioAction.cs \
RadioActionEntry.cs \
RadioButton.cs \
RadioMenuItem.cs \
diff --git a/gtk/RadioAction.cs b/gtk/RadioAction.cs
new file mode 100644
index 000000000..7bc4826b2
--- /dev/null
+++ b/gtk/RadioAction.cs
@@ -0,0 +1,54 @@
+// Gtk.RadioAction.cs - Gtk RadioAction class customizations
+//
+// Author: Bertrand Lorentz
+//
+// Copyright (c) 2006 Bertrand Lorentz
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace Gtk
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ public partial class RadioAction
+ {
+ [DllImport("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr gtk_radio_action_get_group(IntPtr raw);
+
+ [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void gtk_radio_action_set_group(IntPtr raw, IntPtr list);
+
+ [GLib.Property ("group")]
+ public RadioAction[] Group {
+ get {
+ IntPtr raw_ret = gtk_radio_action_get_group(Handle);
+ RadioAction[] ret = (RadioAction[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.SList), false, false, typeof(RadioAction));
+ return ret;
+ }
+ set {
+ IntPtr native_group = IntPtr.Zero;
+ if (value != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioAction item in value) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ gtk_radio_action_set_group(Handle, native_group);
+ }
+ }
+ }
+}
diff --git a/gtk/RadioButton.cs b/gtk/RadioButton.cs
index 7a21be305..38c0e6553 100644
--- a/gtk/RadioButton.cs
+++ b/gtk/RadioButton.cs
@@ -35,5 +35,31 @@ namespace Gtk {
Raw = gtk_radio_button_new_with_mnemonic (IntPtr.Zero, native);
GLib.Marshaller.Free (native);
}
+
+ [DllImport("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr gtk_radio_button_get_group(IntPtr raw);
+
+ [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void gtk_radio_button_set_group(IntPtr raw, IntPtr list);
+
+ [GLib.Property ("group")]
+ public RadioButton[] Group {
+ get {
+ IntPtr raw_ret = gtk_radio_button_get_group(Handle);
+ RadioButton[] ret = (RadioButton[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.SList), false, false, typeof(RadioButton));
+ return ret;
+ }
+ set {
+ IntPtr native_group = IntPtr.Zero;
+ if (value != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioButton item in value) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ gtk_radio_button_set_group(Handle, native_group);
+ }
+ }
}
}
diff --git a/gtk/RadioMenuItem.cs b/gtk/RadioMenuItem.cs
index a4ef2aceb..094a44a21 100644
--- a/gtk/RadioMenuItem.cs
+++ b/gtk/RadioMenuItem.cs
@@ -43,11 +43,10 @@ namespace Gtk {
GLib.Marshaller.Free (label_as_native);
}
-
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_radio_menu_item_new_with_mnemonic(IntPtr group, IntPtr label);
- public RadioMenuItem (GLib.SList group, string label) : base (IntPtr.Zero)
+ public RadioMenuItem (RadioMenuItem[] group, string label) : base (IntPtr.Zero)
{
if (GetType () != typeof (RadioMenuItem)) {
CreateNativeObject (new string [0], new GLib.Value [0]);
@@ -60,8 +59,42 @@ namespace Gtk {
return;
}
IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
- Raw = gtk_radio_menu_item_new_with_mnemonic(group == null ? IntPtr.Zero : group.Handle, native_label);
+ IntPtr native_group = IntPtr.Zero;
+ if (group != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioMenuItem item in group) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ Raw = gtk_radio_menu_item_new_with_mnemonic(native_group, native_label);
GLib.Marshaller.Free (native_label);
}
+
+ [DllImport("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr gtk_radio_menu_item_get_group(IntPtr raw);
+
+ [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void gtk_radio_menu_item_set_group(IntPtr raw, IntPtr list);
+
+ [GLib.Property ("group")]
+ public RadioMenuItem[] Group {
+ get {
+ IntPtr raw_ret = gtk_radio_menu_item_get_group(Handle);
+ RadioMenuItem[] ret = (RadioMenuItem[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.SList), false, false, typeof(RadioMenuItem));
+ return ret;
+ }
+ set {
+ IntPtr native_group = IntPtr.Zero;
+ if (value != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioMenuItem item in value) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ gtk_radio_menu_item_set_group(Handle, native_group);
+ }
+ }
}
}
diff --git a/gtk/RadioToolButton.cs b/gtk/RadioToolButton.cs
index 56c314fd5..d70b04ae5 100644
--- a/gtk/RadioToolButton.cs
+++ b/gtk/RadioToolButton.cs
@@ -28,20 +28,28 @@ namespace Gtk {
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_radio_tool_button_new (IntPtr group);
- public RadioToolButton (GLib.SList group) : base (IntPtr.Zero)
+ public RadioToolButton (RadioToolButton[] group) : base (IntPtr.Zero)
{
if (GetType () != typeof (RadioToolButton)) {
CreateNativeObject (new string [0], new GLib.Value [0]);
Group = group;
return;
}
- Raw = gtk_radio_tool_button_new(group == null ? IntPtr.Zero : group.Handle);
+ IntPtr native_group = IntPtr.Zero;
+ if (group != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioToolButton item in group) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ Raw = gtk_radio_tool_button_new(native_group);
}
[DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gtk_radio_tool_button_new_from_stock (IntPtr group, IntPtr stock_id);
- public RadioToolButton (GLib.SList group, string stock_id) : base (IntPtr.Zero)
+ public RadioToolButton (RadioToolButton[] group, string stock_id) : base (IntPtr.Zero)
{
if (GetType () != typeof (RadioToolButton)) {
GLib.Value[] vals = new GLib.Value [1];
@@ -52,8 +60,42 @@ namespace Gtk {
return;
}
IntPtr stock_id_as_native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
- Raw = gtk_radio_tool_button_new_from_stock(group == null ? IntPtr.Zero : group.Handle, stock_id_as_native);
+ IntPtr native_group = IntPtr.Zero;
+ if (group != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioToolButton item in group) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ Raw = gtk_radio_tool_button_new_from_stock(native_group, stock_id_as_native);
GLib.Marshaller.Free (stock_id_as_native);
}
+
+ [DllImport("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern IntPtr gtk_radio_tool_button_get_group(IntPtr raw);
+
+ [DllImport ("libgtk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
+ static extern void gtk_radio_tool_button_set_group(IntPtr raw, IntPtr list);
+
+ [GLib.Property ("group")]
+ public RadioToolButton[] Group {
+ get {
+ IntPtr raw_ret = gtk_radio_tool_button_get_group(Handle);
+ RadioToolButton[] ret = (RadioToolButton[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.SList), false, false, typeof(RadioToolButton));
+ return ret;
+ }
+ set {
+ IntPtr native_group = IntPtr.Zero;
+ if (value != null) {
+ GLib.List list = new GLib.List(IntPtr.Zero);
+ foreach (RadioToolButton item in value) {
+ list.Append (item.Handle);
+ }
+ native_group = list.Handle;
+ }
+ gtk_radio_tool_button_set_group(Handle, native_group);
+ }
+ }
}
}
diff --git a/gtk/gtk.csproj b/gtk/gtk.csproj
index 098b897cf..bf5bf788f 100644
--- a/gtk/gtk.csproj
+++ b/gtk/gtk.csproj
@@ -935,6 +935,7 @@
+
diff --git a/sample/GtkDemo/DemoMenus.cs b/sample/GtkDemo/DemoMenus.cs
index 60f8bcb95..5b9cf02f7 100644
--- a/sample/GtkDemo/DemoMenus.cs
+++ b/sample/GtkDemo/DemoMenus.cs
@@ -76,7 +76,7 @@ namespace GtkDemo
return null;
Menu menu = new Menu ();
- GLib.SList group = new GLib.SList (IntPtr.Zero);
+ RadioMenuItem[] group = null;
if (tearoff) {
TearoffMenuItem menuitem = new TearoffMenuItem ();