gnt.h File Reference
GNT (GLib Ncurses Toolkit)
`#include <glib.h>`
`#include "gntwidget.h"`
`#include "gntclipboard.h"`
`#include "gntcolors.h"`
`#include "gntkeys.h"`

Go to the source code of this file.

## Macros

#define | G_PARAM_STATIC_NAME G_PARAM_PRIVATE
| Get things to compile in Glib < 2.8.
#define | G_PARAM_STATIC_NICK G_PARAM_PRIVATE
#define | G_PARAM_STATIC_BLURB G_PARAM_PRIVATE
#define | g_timeout_add_seconds(time, callback, data) g_timeout_add(time * 1000, callback, data)

## Functions

void | gnt_init (void)
| Initialize GNT.
void | gnt_main (void)
| Start running the mainloop for gnt.
gboolean | gnt_ascii_only (void)
| Check whether the terminal is capable of UTF8 display. More...
void | gnt_window_present (GntWidget *window)
| Present a window. More...
void | gnt_screen_occupy (GntWidget *widget)
void | gnt_screen_release (GntWidget *widget)
void | gnt_screen_update (GntWidget *widget)
void | gnt_screen_resize_widget (GntWidget *widget, int width, int height)
| Resize a widget. More...
void | gnt_screen_move_widget (GntWidget *widget, int x, int y)
| Move a widget. More...
void | gnt_screen_rename_widget (GntWidget *widget, const char *text)
| Rename a widget. More...
gboolean | gnt_widget_has_focus (GntWidget *widget)
| Check whether a widget has focus. More...
void | gnt_widget_set_urgent (GntWidget *widget)
| Set the URGENT hint for a widget. More...
void | gnt_register_action (const char *label, void(*callback)(void))
| Register a global action. More...
gboolean | gnt_screen_menu_show (gpointer menu)
| Show a menu. More...
void | gnt_quit (void)
| Terminate the mainloop of gnt.
GntClipboard * | gnt_get_clipboard (void)
| Get the global clipboard. More...
gchar * | gnt_get_clipboard_string (void)
| Get the string in the clipboard. More...
void | gnt_set_clipboard_string (const gchar *string)
| Set the contents of the global clipboard. More...
gboolean | gnt_giveup_console (const char *wd, char **argv, char **envp, gint *stin, gint *stout, gint *sterr, void(*callback)(int status, gpointer data), gpointer data)
| Spawn a different application that will consume the console. More...
gboolean | gnt_is_refugee (void)
| Check whether a child process is in control of the current terminal. More...

## Detailed Description

GNT API

Definition in file gnt.h.

## Function Documentation

## gnt_ascii_only()

gboolean gnt_ascii_only | ( | void |  | ) |

Check whether the terminal is capable of UTF8 display.

Returns
  `FALSE` if the terminal is capable of drawing UTF-8, `TRUE` otherwise.

## gnt_get_clipboard()

GntClipboard* gnt_get_clipboard | ( | void |  | ) |

Get the global clipboard.

Returns
  The clipboard.

## gnt_get_clipboard_string()

gchar* gnt_get_clipboard_string | ( | void |  | ) |

Get the string in the clipboard.

Returns
  A copy of the string in the clipboard. The caller must `g_free` the string.

## gnt_giveup_console()

gboolean gnt_giveup_console | ( | const char * | wd,
|  | char ** | argv,
|  | char ** | envp,
|  | gint * | stin,
|  | gint * | stout,
|  | gint * | sterr,
|  | void(*)(int status, gpointer data) | callback,
|  | gpointer | data
| ) |  |

Spawn a different application that will consume the console.

Parameters

  wd | The working directory for the new application.
  argv | The argument vector.
  envp | The environment, or `NULL`.
  stin | Location to store the child's stdin, or `NULL`.
  stout | Location to store the child's stdout, or `NULL`.
  sterr | Location to store the child's stderr, or `NULL`.
  callback | The callback to call after the child exits.
  data | The data to pass to the callback.

Returns
  `TRUE` if the child was successfully spawned, `FALSE` otherwise.

## gnt_is_refugee()

gboolean gnt_is_refugee | ( | void |  | ) |

Check whether a child process is in control of the current terminal.

Returns
  `TRUE` if a child process (eg., PAGER) is occupying the current terminal, `FALSE` otherwise.

## gnt_register_action()

void gnt_register_action | ( | const char * | label,
|  | void(*)(void) | callback
| ) |  |

Register a global action.

Parameters

  label | The user-visible label for the action.
  callback | The callback function for the action.

## gnt_screen_menu_show()

gboolean gnt_screen_menu_show | ( | gpointer | menu | ) |

Show a menu.

Parameters

  menu | The menu to display.

Returns
  `TRUE` if the menu is displayed, `FALSE` otherwise (e.g., if another menu is currently displayed).

## gnt_screen_move_widget()

void gnt_screen_move_widget | ( | GntWidget * | widget,
|  | int | x,
|  | int | y
| ) |  |

Move a widget.

Parameters

  widget | The widget to move.
  x | The desired x-coordinate.
  y | The desired y-coordinate.

## gnt_screen_rename_widget()

void gnt_screen_rename_widget | ( | GntWidget * | widget,
|  | const char * | text
| ) |  |

Rename a widget.

Parameters

  widget | The widget to rename.
  text | The new name for the widget.

## gnt_screen_resize_widget()

void gnt_screen_resize_widget | ( | GntWidget * | widget,
|  | int | width,
|  | int | height
| ) |  |

Resize a widget.

Parameters

  widget | The widget to resize.
  width | The desired width.
  height | The desired height.

## gnt_set_clipboard_string()

void gnt_set_clipboard_string | ( | const gchar * | string | ) |

Set the contents of the global clipboard.

Parameters

  string | The new content of the new clipboard.

## gnt_widget_has_focus()

gboolean gnt_widget_has_focus | ( | GntWidget * | widget | ) |

Check whether a widget has focus.

Parameters

  widget | The widget.

Returns
  `TRUE` if the widget has the current focus, `FALSE` otherwise.

## gnt_widget_set_urgent()

void gnt_widget_set_urgent | ( | GntWidget * | widget | ) |

Set the URGENT hint for a widget.

Parameters

  widget | The widget to set the URGENT hint for.

## gnt_window_present()

void gnt_window_present | ( | GntWidget * | window | ) |

Present a window.

If the event was triggered because of user interaction, the window is moved to the foreground. Otherwise, the Urgent hint is set.

Parameters

  window | The window the present.

Since
  2.0.0 (gnt), 2.1.0 (pidgin)