[Gtk-sharp-list] AccelKey and Widget.AddAccelerator
John Luke
jluke@users.sourceforge.net
Fri, 16 Jan 2004 22:41:16 -0500
--=-KUS6z/JxRel0o49LSIND
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello,
Attached is a patch that does the following:
1. sets the type of the Gtk.AccelKey fields to Gdk.Key, Gdk.
ModifierType, Gtk.AccelFlags, and adds a custom constructor with those
args. (For some reason the Gdk.Key field is not generated so I added it
to the custom file)
2. Add an overload for Gtk.Widget.AddAccelerator that uses Gtk.AccelKey
since it now contains some of the other info.
3. Removes the previous change to the original Gtk.AddAccelerator
method.
--=-KUS6z/JxRel0o49LSIND
Content-Disposition: attachment; filename=accelkey.diff
Content-Type: text/x-diff; name=accelkey.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
? accelkey.diff
? button.diff
? dialog.diff
? gdk_key.diff
? radiobutton.diff
? test.diff
? widget_gtkaccelkey.diff
Index: AccelKey.custom
===================================================================
RCS file: AccelKey.custom
diff -N AccelKey.custom
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AccelKey.custom 17 Jan 2004 02:57:41 -0000
@@ -0,0 +1,8 @@
+public Gdk.Key Key;
+
+public AccelKey (Gdk.Key key, Gdk.ModifierType mods, Gtk.AccelFlags flags)
+{
+ this.Key = key;
+ this.accel_mods = mods;
+ this.accel_flags = flags;
+}
Index: Gtk.metadata
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Gtk.metadata,v
retrieving revision 1.23
diff -u -r1.23 Gtk.metadata
--- Gtk.metadata 9 Jan 2004 20:52:27 -0000 1.23
+++ Gtk.metadata 17 Jan 2004 02:57:41 -0000
@@ -1,5 +1,8 @@
<?xml version="1.0"?>
<metadata>
+ <attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_key']" name="type">GdkKey</attr>
+ <attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_mods']" name="type">GdkModifierType</attr>
+ <attr path="/api/namespace/struct[@cname='GtkAccelKey']/field[@cname='accel_flags']" name="type">GtkAccelFlags</attr>
<attr path="/api/namespace/boxed[@cname='GtkBorder']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='GetSizes']" name="hidden">1</attr>
<attr path="/api/namespace/boxed[@cname='GtkSelectionData']" name="opaque">1</attr>
@@ -259,7 +262,6 @@
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='SizeRequest']" name="name">SizeRequested</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Unmap']" name="name">Unmapped</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Unrealize']" name="name">Unrealized</attr>
- <attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='AddAccelerator']/parameters/parameter[@name='accel_key']" name="type">GtkAccelKey</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetDefaultSize']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetPosition']/*/*[@type='gint*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetSize']/*/*[@type='gint*']" name="pass_as">out</attr>
Index: Widget.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Widget.custom,v
retrieving revision 1.4
diff -u -r1.4 Widget.custom
--- Widget.custom 23 Jul 2003 17:19:21 -0000 1.4
+++ Widget.custom 17 Jan 2004 02:57:41 -0000
@@ -44,3 +44,8 @@
}
}
+public void AddAccelerator (string accel_signal, AccelGroup accel_group, AccelKey accel_key)
+{
+ this.AddAccelerator (accel_signal, accel_group, (uint) accel_key.Key, accel_key.accel_mods, accel_key.accel_flags);
+
+}
Index: gtk-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/gtk-api.xml,v
retrieving revision 1.31
diff -u -r1.31 gtk-api.xml
--- gtk-api.xml 9 Jan 2004 20:52:27 -0000 1.31
+++ gtk-api.xml 17 Jan 2004 02:57:43 -0000
@@ -9893,7 +9893,7 @@
<parameters>
<parameter type="const-gchar*" name="accel_signal" />
<parameter type="GtkAccelGroup*" name="accel_group" />
- <parameter name="accel_key" type="GtkAccelKey" />
+ <parameter type="guint" name="accel_key" />
<parameter type="GdkModifierType" name="accel_mods" />
<parameter type="GtkAccelFlags" name="accel_flags" />
</parameters>
@@ -10970,9 +10970,9 @@
<field cname="accel_path_quark" type="GQuark" />
</struct>
<struct name="AccelKey" cname="GtkAccelKey">
- <field cname="accel_key" type="guint" />
+ <field cname="accel_key" type="GdkKey" />
<field cname="accel_mods" type="GdkModifierType" />
- <field cname="accel_flags" bits="16" type="guint" />
+ <field cname="accel_flags" bits="16" type="GtkAccelFlags" />
</struct>
<alias name="Allocation" cname="GtkAllocation" type="GdkRectangle" />
<struct name="Arg" cname="GtkArg" opaque="true">
--=-KUS6z/JxRel0o49LSIND--