BindingSet

Description GtkBinding provides a mechanism for configuring GTK+ key bindings through RC files. This eases key binding adjustments for application developers as well as users and provides GTK+ users or administrators with high key binding configurability which requires no application or toolkit side changes. Installing a key binding A resource file binding consists of a 'binding' definition and a match statement to apply the binding to specific widget types. Details on the matching mechanism are described under Pathnames and patterns. Inside the binding definition, key combinations are bound to specific signal emissions on the target widget. Key combinations are strings consisting of an optional GdkModifierType name and key names such as those defined in <gdk/gdkkeysyms.h> or returned from gdk_keyval_name(), they have to be parsable by gtk_accelerator_parse(). Specifications of signal emissions consist of a string identifying the signal name, and a list of signal specific arguments in parenthesis. For example for binding Control and the left or right cursor keys of a GtkEntry widget to the "move-cursor" signal, so movement occurs in 3 letter steps, the following binding can be used: GTK+ already defines a number of useful bindings for the widgets it provides. Because custom bindings set up in RC files take precedence over the default bindings shipped with GTK+, overriding existing bindings as demonstrated in Installing a key binding works as expected. The same mechanism can not be used to "unbind" existing bindings, however. The above example will not have the desired effect of causing "<Control>Right" and "<Control>Left" key presses to be ignored by GTK+. Instead, it just causes any existing bindings from the bindings set "MoveCursor3" to be deleted, so when "<Control>Right" or "<Control>Left" are pressed, no binding for these keys is found in binding set "MoveCursor3". GTK+ will thus continue to search for matching key bindings, and will eventually lookup and find the default GTK+ bindings for entries which implement word movement. To keep GTK+ from activating its default bindings, the "unbind" keyword can be used like this: Now, GTK+ will find a match when looking up "<Control>Right" and "<Control>Left" key presses before it resorts to its default bindings, and the match instructs it to abort ("unbind") the search, so the key presses are not consumed by this widget. As usual, further processing of the key presses, e.g. by an entry's parent widget, is now possible. The "unbind" functionality has been introduced in GTK+ 2.12.

Constructors

this
this(GtkBindingSet* gtkBindingSet)

Sets our main struct and passes it to the parent class

this
this(string setName)

GTK+ maintains a global list of binding sets. Each binding set has a unique name which needs to be specified upon creation.

Members

Functions

activate
int activate(uint keyval, GdkModifierType modifiers, ObjectGtk object)

Find a key binding matching keyval and modifiers within binding_set and activate the binding on object.

addPath
void addPath(GtkPathType pathType, string pathPattern, GtkPathPriorityType priority)

This function is used internally by the GtkRC parsing mechanism to assign match patterns to GtkBindingSet structures.

bindingEntryAddSignall
void bindingEntryAddSignall(uint keyval, GdkModifierType modifiers, string signalName, ListSG bindingArgs)

Override or install a new key binding for keyval with modifiers on binding_set.

bindingEntryClear
void bindingEntryClear(uint keyval, GdkModifierType modifiers)

Warning gtk_binding_entry_clear has been deprecated since version 2.12 and should not be used in newly-written code. Use gtk_binding_entry_remove() instead. Clears a binding entry.

bindingEntryRemove
void bindingEntryRemove(uint keyval, GdkModifierType modifiers)

Remove a binding previously installed via gtk_binding_entry_add_signal() on binding_set.

bindingEntrySkip
void bindingEntrySkip(uint keyval, GdkModifierType modifiers)

Install a binding on binding_set which causes key lookups to be aborted, to prevent bindings from lower priority sets to be activated. Since 2.12

getBindingSetStruct
GtkBindingSet* getBindingSetStruct()
Undocumented in source. Be warned that the author may not have intended to support it.
getStruct
void* getStruct()

the main Gtk struct as a void*

Static functions

activate
int activate(ObjectGtk object, uint keyval, GdkModifierType modifiers)

Find a key binding matching keyval and modifiers and activate the binding on object.

activateEvent
int activateEvent(ObjectGtk object, GdkEventKey* event)

Looks up key bindings for object to find one matching event, and if one was found, activate it. Since 2.4

bindingParseBinding
uint bindingParseBinding(ScannerG scanner)

Warning gtk_binding_parse_binding has been deprecated since version 2.12 and should not be used in newly-written code. There should be no need to call this function outside GTK+. Parse a binding entry from a gtkrc file.

byClass
BindingSet byClass(void* objectClass)

This function returns the binding set named after the type name of the passed in class structure. New binding sets are created on demand by this function.

find
BindingSet find(string setName)

Find a binding set by its globally unique name. The set_name can either be a name used for gtk_binding_set_new() or the type name of a class used in gtk_binding_set_by_class().

Variables

gtkBindingSet
GtkBindingSet* gtkBindingSet;

the main Gtk struct

Meta