gtk.BindingSet.BindingSet Class Reference

List of all members.

Detailed Description

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 GtkEntry.move-cursor signal, so movement occurs in 3 letter steps, the following binding can be used: binding "MoveCursor3" { bind "<Control>Right" { "move-cursor" (visual-positions, 3, 0) } bind "<Control>Left" { "move-cursor" (visual-positions, -3, 0) } } class "GtkEntry" binding "MoveCursor3" Unbinding existing key bindings 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. binding "MoveCursor3" { bind "<Control>Right" { } bind "<Control>Left" { } } class "GtkEntry" binding "MoveCursor3" 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: binding "MoveCursor3" { unbind "<Control>Right" unbind "<Control>Left" } class "GtkEntry" binding "MoveCursor3" 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 entries parent widget, is now possible.


Public Member Functions

GtkBindingSetgetBindingSetStruct ()
 this (GtkBindingSet *gtkBindingSet)
 Sets our main struct and passes it to the parent class.
void bindingEntryAddSignall (uint keyval, GdkModifierType modifiers, char[] signalName, ListSG bindingArgs)
 Warning gtk_binding_entry_add_signall is deprecated and should not be used in newly-written code.
void bindingEntryClear (uint keyval, GdkModifierType modifiers)
 Warning gtk_binding_entry_clear is deprecated and should not be used in newly-written code.
 this (char[] setName)
 Gtk+ maintains a global list of binding sets.
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.
void bindingEntryAddSignal (uint keyval, GdkModifierType modifiers, char[] signalName, uint nArgs,...)
 Override or install a new key binding for keyval with modifiers on binding_set.
void bindingEntrySkip (uint keyval, GdkModifierType modifiers)
 binding_set: binding_set to skip an entry of keyval: key value of binding to skip modifiers: key modifier of binding to skip Since 2.12 Install a binding on which causes key lookups to be aborted, to prevent bindings from lower priority sets to be activated.
void bindingEntryRemove (uint keyval, GdkModifierType modifiers)
 Remove a binding previously installed via gtk_binding_entry_add_signal() on binding_set.
void addPath (GtkPathType pathType, char[] pathPattern, GtkPathPriorityType priority)
 This function is used internally by the GtkRC parsing mechanism to assign match patterns to GtkBindingSet structures.

Static Public Member Functions

static uint bindingParseBinding (GScanner *scanner)
 Warning gtk_binding_parse_binding is deprecated and should not be used in newly-written code.
static BindingSet byClass (void *objectClass)
 This function returns the binding set named after the type name of the passed in class structure.
static BindingSet find (char[] setName)
 Find a binding set by its globally unique name.
static int activate (ObjectGtk object, uint keyval, GdkModifierType modifiers)
 Find a key binding matching keyval and modifiers and activate the binding on object.
static int activateEvent (ObjectGtk object, GdkEventKey *event)
 Looks up key bindings for object to find one matching event, and if one was found, activate it.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GtkBindingSetgtkBindingSet
 the main Gtk struct


Constructor & Destructor Documentation

gtk.BindingSet.BindingSet.this ( GtkBindingSet gtkBindingSet  ) 

Sets our main struct and passes it to the parent class.

gtk.BindingSet.BindingSet.this ( char[]  setName  ) 

Gtk+ maintains a global list of binding sets.

Each binding set has a unique name which needs to be specified upon creation. set_name: unique name of this binding set Returns: new binding set


Member Function Documentation

int gtk.BindingSet.BindingSet.activate ( uint  keyval,
GdkModifierType  modifiers,
ObjectGtk  object 
)

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

binding_set: binding_set to activate keyval: key value of the binding modifiers: key modifier of the binding object: object to activate when binding found Returns: TRUE if a binding was found and activated

static int gtk.BindingSet.BindingSet.activate ( ObjectGtk  object,
uint  keyval,
GdkModifierType  modifiers 
) [static]

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

object: object to activate when binding found keyval: key value of the binding modifiers: key modifier of the binding Returns: TRUE if a binding was found and activated

static int gtk.BindingSet.BindingSet.activateEvent ( ObjectGtk  object,
GdkEventKey event 
) [static]

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

object: a GtkObject (generally must be a widget) event: a GdkEventKey Returns: TRUE if a matching key binding was found

void gtk.BindingSet.BindingSet.addPath ( GtkPathType  pathType,
char[]  pathPattern,
GtkPathPriorityType  priority 
)

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

binding_set: binding set to add a path to path_type: path type the pattern applies to path_pattern: the actual match pattern priority: binding priority See Also Keyboard Accelerators installing and using keyboard short-cuts. Resource Files Gtk+ Resource Files - behavior and style definitions.

void gtk.BindingSet.BindingSet.bindingEntryAddSignal ( uint  keyval,
GdkModifierType  modifiers,
char[]  signalName,
uint  nArgs,
  ... 
)

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

When the binding is activated, signal_name will be emitted on the target widget, with n_args Varargs used as arguments. binding_set: binding_set to install an entry for keyval: key value of binding to install modifiers: key modifier of binding to install signal_name: signal to execute upon activation n_args: number of arguments to signal_name @: arguments to signal_name ...:

void gtk.BindingSet.BindingSet.bindingEntryAddSignall ( uint  keyval,
GdkModifierType  modifiers,
char[]  signalName,
ListSG  bindingArgs 
)

Warning gtk_binding_entry_add_signall is deprecated and should not be used in newly-written code.

Deprecated. binding_set: binding set to add a signal to keyval: key value modifiers: key modifier signal_name: signal name to be bound binding_args: list of GtkBindingArg signal arguments

void gtk.BindingSet.BindingSet.bindingEntryClear ( uint  keyval,
GdkModifierType  modifiers 
)

Warning gtk_binding_entry_clear is deprecated and should not be used in newly-written code.

Use of this function is deprecated. binding_set: keyval: modifiers:

void gtk.BindingSet.BindingSet.bindingEntryRemove ( uint  keyval,
GdkModifierType  modifiers 
)

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

binding_set: binding_set to remove an entry of keyval: key value of binding to remove modifiers: key modifier of binding to remove

void gtk.BindingSet.BindingSet.bindingEntrySkip ( uint  keyval,
GdkModifierType  modifiers 
)

binding_set: binding_set to skip an entry of keyval: key value of binding to skip modifiers: key modifier of binding to skip Since 2.12 Install a binding on which causes key lookups to be aborted, to prevent bindings from lower priority sets to be activated.

static uint gtk.BindingSet.BindingSet.bindingParseBinding ( GScanner scanner  )  [static]

Warning gtk_binding_parse_binding is deprecated and should not be used in newly-written code.

Deprecated as public API, used only internally. scanner: GtkRC scanner Returns: expected token upon errors, G_TOKEN_NONE on success.

static BindingSet gtk.BindingSet.BindingSet.byClass ( void *  objectClass  )  [static]

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. object_class: a valid GtkObject class Returns: the binding set corresponding to object_class

static BindingSet gtk.BindingSet.BindingSet.find ( char[]  setName  )  [static]

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(). set_name: unique binding set name Returns: NULL or the specified binding set

GtkBindingSet* gtk.BindingSet.BindingSet.getBindingSetStruct (  ) 

void* gtk.BindingSet.BindingSet.getStruct (  )  [protected]

the main Gtk struct as a void*


Member Data Documentation

GtkBindingSet* gtk.BindingSet.BindingSet.gtkBindingSet [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo