Add missing AUTHORS and ChangeLog.
[gnt.git] / gnt.h
blob2599b9dc5216bdeba6297e914b468e97f0cc9ee9
1 /**
2 * @defgroup gnt GNT (GLib Ncurses Toolkit)
4 * GNT is an ncurses toolkit for creating text-mode graphical user interfaces
5 * in a fast and easy way.
6 */
7 /**
8 * @file gnt.h GNT API
9 * @ingroup gnt
12 * GNT - The GLib Ncurses Toolkit
14 * GNT is the legal property of its developers, whose names are too numerous
15 * to list here. Please refer to the COPYRIGHT file distributed with this
16 * source distribution.
18 * This library is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
33 #include <glib.h>
34 #include "gntwidget.h"
35 #include "gntclipboard.h"
36 #include "gntcolors.h"
37 #include "gntkeys.h"
39 /**
40 * Get things to compile in Glib < 2.8
42 #if !GLIB_CHECK_VERSION(2,8,0)
43 #define G_PARAM_STATIC_NAME G_PARAM_PRIVATE
44 #define G_PARAM_STATIC_NICK G_PARAM_PRIVATE
45 #define G_PARAM_STATIC_BLURB G_PARAM_PRIVATE
46 #endif
48 /**
49 * Initialize GNT.
51 void gnt_init(void);
53 /**
54 * Start running the mainloop for gnt.
56 void gnt_main(void);
58 /**
59 * Check whether the terminal is capable of UTF8 display.
61 * @return @c FALSE if the terminal is capable of drawing UTF-8, @c TRUE otherwise.
63 gboolean gnt_ascii_only(void);
65 /**
66 * Present a window. If the event was triggered because of user interaction,
67 * the window is moved to the foreground. Otherwise, the Urgent hint is set.
69 * @param window The window the present.
71 * @since 2.0.0 (gnt), 2.1.0 (pidgin)
73 void gnt_window_present(GntWidget *window);
75 /**
76 * @internal
77 * Use #gnt_widget_show instead.
79 void gnt_screen_occupy(GntWidget *widget);
81 /**
82 * @internal
83 * Use #gnt_widget_hide instead.
85 void gnt_screen_release(GntWidget *widget);
87 /**
88 * @internal
89 * Use #gnt_widget_draw instead.
91 void gnt_screen_update(GntWidget *widget);
93 /**
94 * Resize a widget.
96 * @param widget The widget to resize.
97 * @param width The desired width.
98 * @param height The desired height.
100 void gnt_screen_resize_widget(GntWidget *widget, int width, int height);
103 * Move a widget.
105 * @param widget The widget to move.
106 * @param x The desired x-coordinate.
107 * @param y The desired y-coordinate.
109 void gnt_screen_move_widget(GntWidget *widget, int x, int y);
112 * Rename a widget.
114 * @param widget The widget to rename.
115 * @param text The new name for the widget.
117 void gnt_screen_rename_widget(GntWidget *widget, const char *text);
120 * Check whether a widget has focus.
122 * @param widget The widget.
124 * @return @c TRUE if the widget has the current focus, @c FALSE otherwise.
126 gboolean gnt_widget_has_focus(GntWidget *widget);
129 * Set the URGENT hint for a widget.
131 * @param widget The widget to set the URGENT hint for.
133 void gnt_widget_set_urgent(GntWidget *widget);
136 * Register a global action.
138 * @param label The user-visible label for the action.
139 * @param callback The callback function for the action.
141 void gnt_register_action(const char *label, void (*callback)());
144 * Show a menu.
146 * @param menu The menu to display.
148 * @return @c TRUE if the menu is displayed, @c FALSE otherwise (e.g., if another menu is currently displayed).
150 gboolean gnt_screen_menu_show(gpointer menu);
153 * Terminate the mainloop of gnt.
155 void gnt_quit(void);
158 * Get the global clipboard.
160 * @return The clipboard.
162 GntClipboard * gnt_get_clipboard(void);
165 * Get the string in the clipboard.
167 * @return A copy of the string in the clipboard. The caller must @c g_free the string.
169 gchar * gnt_get_clipboard_string(void);
172 * Set the contents of the global clipboard.
174 * @param string The new content of the new clipboard.
176 void gnt_set_clipboard_string(const gchar *string);
179 * Spawn a different application that will consume the console.
181 * @param wd The working directory for the new application.
182 * @param argv The argument vector.
183 * @param envp The environment, or @c NULL.
184 * @param stin Location to store the child's stdin, or @c NULL.
185 * @param stout Location to store the child's stdout, or @c NULL.
186 * @param sterr Location to store the child's stderr, or @c NULL.
187 * @param callback The callback to call after the child exits.
188 * @param data The data to pass to the callback.
190 * @return @c TRUE if the child was successfully spawned, @c FALSE otherwise.
192 gboolean gnt_giveup_console(const char *wd, char **argv, char **envp,
193 gint *stin, gint *stout, gint *sterr,
194 void (*callback)(int status, gpointer data), gpointer data);
197 * Check whether a child process is in control of the current terminal.
199 * @return @c TRUE if a child process (eg., PAGER) is occupying the current
200 * terminal, @c FALSE otherwise.
202 gboolean gnt_is_refugee(void);