gntbindable.h File Reference
GNT (GLib Ncurses Toolkit)

Bindable API. More...

`#include <stdio.h>`
`#include <glib.h>`
`#include <glib-object.h>`
`#include <ncurses.h>`

Go to the source code of this file.

## Data Structures

struct | _GntBindable
struct | _GntBindableClass
struct | _GntBindableAction
struct | _GntBindableActionParam

## Macros

#define | GNT_TYPE_BINDABLE (gnt_bindable_get_gtype())
#define | GNT_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_BINDABLE, GntBindable))
#define | GNT_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_BINDABLE, GntBindableClass))
#define | GNT_IS_BINDABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_BINDABLE))
#define | GNT_IS_BINDABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_BINDABLE))
#define | GNT_BINDABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_BINDABLE, GntBindableClass))
#define | GNTDEBUG

## Typedefs

typedef struct _GntBindable | GntBindable
typedef struct _GntBindableClass | GntBindableClass
typedef gboolean(* | GntBindableActionCallback) (GntBindable *bindable, GList *params)
typedef gboolean(* | GntBindableActionCallbackNoParam) (GntBindable *bindable)
typedef struct _GntBindableAction | GntBindableAction
typedef struct _GntBindableActionParam | GntBindableActionParam

## Functions

G_BEGIN_DECLS GType | gnt_bindable_get_gtype (void)
const char * | gnt_bindable_remap_keys (GntBindable *bindable, const char *text)
void | gnt_bindable_action_free (GntBindableAction *action)
| Free a bindable action. More...
void | gnt_bindable_action_param_free (GntBindableActionParam *param)
| Free a GntBindableActionParam. More...
void | gnt_bindable_class_register_action (GntBindableClass *klass, const char *name, GntBindableActionCallback callback, const char *trigger,...)
| Register a bindable action for a class. More...
void | gnt_bindable_register_binding (GntBindableClass *klass, const char *name, const char *trigger,...)
| Register a key-binding to an existing action. More...
gboolean | gnt_bindable_perform_action_key (GntBindable *bindable, const char *keys)
| Perform an action from a keybinding. More...
gboolean | gnt_bindable_check_key (GntBindable *bindable, const char *keys)
| Discover if a key is bound. More...
gboolean | gnt_bindable_perform_action_named (GntBindable *bindable, const char *name,...) G_GNUC_NULL_TERMINATED
| Perform an action on a bindable object. More...
GntBindable * | gnt_bindable_bindings_view (GntBindable *bind)
| Returns a GntTree populated with "key" -> "binding" for the widget. More...
gboolean | gnt_bindable_build_help_window (GntBindable *bindable)
| Builds a window that list the key bindings for a GntBindable object. More...

## Detailed Description

Bindable API.

Definition in file gntbindable.h.

## Function Documentation

void gnt_bindable_action_free | ( | GntBindableAction * | action | ) |

Free a bindable action.

Parameters

  action | The bindable action.

void gnt_bindable_action_param_free | ( | GntBindableActionParam * | param | ) |

Free a GntBindableActionParam.

Parameters

  param | The GntBindableActionParam to free.

GntBindable* gnt_bindable_bindings_view | ( | GntBindable * | bind | ) |

Returns a GntTree populated with "key" -> "binding" for the widget.

Parameters

  bind | The object to list the bindings for.

Returns
  The GntTree.

gboolean gnt_bindable_build_help_window | ( | GntBindable * | bindable | ) |

Builds a window that list the key bindings for a GntBindable object.

From this window a user can select a listing to rebind a new key for the given action.

Parameters

  bindable | The object to list the bindings for.

Returns
  `TRUE`

gboolean gnt_bindable_check_key | ( | GntBindable * | bindable,
|  | const char * | keys
| ) |  |

Discover if a key is bound.

Parameters

  bindable | The bindable object.
  keys | The key to check for.

Returns
  `TRUE` if the the key has an action associated with it.

void gnt_bindable_class_register_action | ( | GntBindableClass * | klass,
|  | const char * | name,
|  | GntBindableActionCallback | callback,
|  | const char * | trigger,
|  |  | ...
| ) |  |

Register a bindable action for a class.

Parameters

  klass | The class the binding is for.
  name | The name of the binding.
  callback | The callback for the binding.
  trigger | The default trigger for the binding, or `NULL`, followed by a NULL-terminated list of default parameters.

G_BEGIN_DECLS GType gnt_bindable_get_gtype | ( | void |  | ) |

Returns

gboolean gnt_bindable_perform_action_key | ( | GntBindable * | bindable,
|  | const char * | keys
| ) |  |

Perform an action from a keybinding.

Parameters

  bindable | The bindable object.
  keys | The key to trigger the action.

Returns
  `TRUE` if the action was performed successfully, `FALSE` otherwise.

gboolean gnt_bindable_perform_action_named | ( | GntBindable * | bindable,
|  | const char * | name,
|  |  | ...
| ) |  |

Perform an action on a bindable object.

Parameters

  bindable | The bindable object.
  name | The action to perform, followed by a `NULL-terminated` list of parameters.

Returns
  `TRUE` if the action was performed successfully, `FALSE` otherwise.

void gnt_bindable_register_binding | ( | GntBindableClass * | klass,
|  | const char * | name,
|  | const char * | trigger,
|  |  | ...
| ) |  |

Register a key-binding to an existing action.

Parameters

  klass | The class the binding is for.
  name | The name of the binding.
  trigger | A new trigger for the binding, followed by a `NULL-terminated` list of parameters for the callback.