[Gtk-sharp-list] RadioButton api

John Luke jluke@users.sourceforge.net
Tue, 06 Jan 2004 16:50:27 -0500


--=-0qiemBcinkJZNnIih7+s
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello,
	I recently needed to use some RadioButton's in the MonoDevelop port and
ran accross some api nastiness, at least in my opinion. It seems most
commonly you would want to create a new RadioButton with a label and its
own group, and secondly a new RadioButton with labels for that group.

Attached is a patch that hides most of the generated ctors (that were
becoming static methods anyways), and adds a custom file with the two
cases from above.  Is this ok to commit?

--=-0qiemBcinkJZNnIih7+s
Content-Disposition: attachment; filename=radiobutton.diff
Content-Type: text/x-patch; name=radiobutton.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit

? button.diff
? gdk_key.diff
? radiobutton.diff
? test.diff
? widget_gtkaccelkey.diff
Index: Gtk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Gtk.metadata,v
retrieving revision 1.19
diff -u -r1.19 Gtk.metadata
--- Gtk.metadata	6 Jan 2004 20:40:04 -0000	1.19
+++ Gtk.metadata	6 Jan 2004 21:24:34 -0000
@@ -135,10 +135,12 @@
   <attr path="/api/namespace/object[@cname='GtkPixmap']/method[@name='Set']/*/*[@type='GdkBitmap*']" name="null_ok">1</attr>
   <attr path="/api/namespace/object[@cname='GtkProgressBar']/constructor[@cname='gtk_progress_bar_new_with_adjustment']/*/*[@type='GtkAdjustment*']" name="null_ok">1</attr>
   <attr path="/api/namespace/object[@cname='GtkProgressBar']" name="parent">GtkWidget</attr>
-  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new']/*/*[@type='GSList*']" name="null_ok">1</attr>
-  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_label']/*/*[@type='GSList*']" name="null_ok">1</attr>
-  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_mnemonic']" name="preferred">1</attr>
-  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_mnemonic']/*/*[@type='GSList*']" name="null_ok">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new']/*/*[@type='GSList*']" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_label_from_widget']" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_mnemonic_from_widget']" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_label']/*/*[@type='GSList*']" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_mnemonic']" name="hidden">1</attr>
+  <attr path="/api/namespace/object[@cname='GtkRadioButton']/constructor[@cname='gtk_radio_button_new_with_mnemonic']/*/*[@type='GSList*']" name="hidden">1</attr>
   <attr path="/api/namespace/object[@cname='GtkRadioButton']/property[@name='Group']" name="hidden">1</attr>
   <attr path="/api/namespace/object[@cname='GtkRadioMenuItem']/constructor[@cname='gtk_radio_menu_item_new_with_label']/*/*[@type='GSList*']" name="null_ok">1</attr>
   <attr path="/api/namespace/object[@cname='GtkRadioMenuItem']/constructor[@cname='gtk_radio_menu_item_new_with_mnemonic']" name="preferred">1</attr>
Index: RadioButton.custom
===================================================================
RCS file: RadioButton.custom
diff -N RadioButton.custom
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ RadioButton.custom	6 Jan 2004 21:24:34 -0000
@@ -0,0 +1,22 @@
+//
+//  RadioButton.custom
+//
+//	Author:  John Luke  <jluke@cfl.rr.com>
+//
+
+	[DllImport("libgtk-win32-2.0-0.dll")]
+	static extern IntPtr gtk_radio_button_new_with_mnemonic (IntPtr group, string label);
+
+	// creates a new group for this RadioButton
+	public RadioButton (string label)
+	{
+		Raw = gtk_radio_button_new_with_mnemonic (IntPtr.Zero, label);
+	}
+	
+	[DllImport("libgtk-win32-2.0-0.dll")]
+	static extern IntPtr gtk_radio_button_new_with_mnemonic_from_widget (IntPtr group, string label);
+	
+	public RadioButton (RadioButton group, string label)
+	{
+		Raw = gtk_radio_button_new_with_mnemonic_from_widget (group.Handle, label);
+	}
Index: gtk-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/gtk-api.xml,v
retrieving revision 1.27
diff -u -r1.27 gtk-api.xml
--- gtk-api.xml	6 Jan 2004 20:40:04 -0000	1.27
+++ gtk-api.xml	6 Jan 2004 21:24:35 -0000
@@ -5413,7 +5413,7 @@
       </method>
       <constructor cname="gtk_radio_button_new">
         <parameters>
-          <parameter type="GSList*" name="group" null_ok="1" />
+          <parameter type="GSList*" name="group" null_ok="1" hidden="1" />
         </parameters>
       </constructor>
       <constructor cname="gtk_radio_button_new_from_widget">
@@ -5423,23 +5423,23 @@
       </constructor>
       <constructor cname="gtk_radio_button_new_with_label">
         <parameters>
-          <parameter type="GSList*" name="group" null_ok="1" />
+          <parameter type="GSList*" name="group" null_ok="1" hidden="1" />
           <parameter type="const-gchar*" name="label" />
         </parameters>
       </constructor>
-      <constructor cname="gtk_radio_button_new_with_label_from_widget">
+      <constructor cname="gtk_radio_button_new_with_label_from_widget" hidden="1">
         <parameters>
           <parameter type="GtkRadioButton*" name="group" />
           <parameter type="const-gchar*" name="label" />
         </parameters>
       </constructor>
-      <constructor cname="gtk_radio_button_new_with_mnemonic" preferred="1">
+      <constructor cname="gtk_radio_button_new_with_mnemonic" preferred="1" hidden="1">
         <parameters>
-          <parameter type="GSList*" name="group" null_ok="1" />
+          <parameter type="GSList*" name="group" null_ok="1" hidden="1" />
           <parameter type="const-gchar*" name="label" />
         </parameters>
       </constructor>
-      <constructor cname="gtk_radio_button_new_with_mnemonic_from_widget">
+      <constructor cname="gtk_radio_button_new_with_mnemonic_from_widget" hidden="1">
         <parameters>
           <parameter type="GtkRadioButton*" name="group" />
           <parameter type="const-gchar*" name="label" />
@@ -13294,4 +13294,4 @@
       <static-string cname="GTK_STOCK_ZOOM_OUT" name="ZoomOut" value="gtk-zoom-out" />
     </object>
   </namespace>
-</api>
+</api>
\ No newline at end of file

--=-0qiemBcinkJZNnIih7+s--