// Connect is a wrapper around gtk_accel_group_connect(). func (v *AccelGroup) Connect(key uint, mods gdk.ModifierType, flags AccelFlags, f interface{}) { closure, _ := glib.ClosureNew(f) cl := (*C.struct__GClosure)(unsafe.Pointer(closure)) C.gtk_accel_group_connect( v.native(), C.guint(key), C.GdkModifierType(mods), C.GtkAccelFlags(flags), cl) }
// AddAccelerator is a wrapper around gtk_widget_add_accelerator(). func (v *Widget) AddAccelerator(signal string, group *AccelGroup, key uint, mods gdk.ModifierType, flags AccelFlags) { csignal := (*C.gchar)(C.CString(signal)) defer C.free(unsafe.Pointer(csignal)) C.gtk_widget_add_accelerator(v.native(), csignal, group.native(), C.guint(key), C.GdkModifierType(mods), C.GtkAccelFlags(flags)) }
package gtk /* #include <gtk/gtk.h> #include <gtk/gtkx.h> #include <glib.h> #include <stdlib.h> */ import "C" var ( // AccelFlags ACCEL_VISIBLE = C.GtkAccelFlags(C.GTK_ACCEL_VISIBLE) ACCEL_LOCKED = C.GtkAccelFlags(C.GTK_ACCEL_LOCKED) ACCEL_MASK = C.GtkAccelFlags(C.GTK_ACCEL_MASK) // ApplicationInhibitFlags APPLICATION_INHIBIT_LOGOUT = C.GtkApplicationInhibitFlags(C.GTK_APPLICATION_INHIBIT_LOGOUT) APPLICATION_INHIBIT_SWITCH = C.GtkApplicationInhibitFlags(C.GTK_APPLICATION_INHIBIT_SWITCH) APPLICATION_INHIBIT_SUSPEND = C.GtkApplicationInhibitFlags(C.GTK_APPLICATION_INHIBIT_SUSPEND) APPLICATION_INHIBIT_IDLE = C.GtkApplicationInhibitFlags(C.GTK_APPLICATION_INHIBIT_IDLE) // AttachOptions EXPAND = C.GtkAttachOptions(C.GTK_EXPAND) SHRINK = C.GtkAttachOptions(C.GTK_SHRINK) FILL = C.GtkAttachOptions(C.GTK_FILL) // CalendarDisplayOptions CALENDAR_SHOW_HEADING = C.GtkCalendarDisplayOptions(C.GTK_CALENDAR_SHOW_HEADING) CALENDAR_SHOW_DAY_NAMES = C.GtkCalendarDisplayOptions(C.GTK_CALENDAR_SHOW_DAY_NAMES) CALENDAR_NO_MONTH_CHANGE = C.GtkCalendarDisplayOptions(C.GTK_CALENDAR_NO_MONTH_CHANGE)