1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gtk-General.html
27  * outPack = gtk
28  * outFile = Main
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Main
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_main_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * 	- gtk_true
45  * 	- gtk_false
46  * 	- gtk_timeout_
47  * 	- gtk_idle_
48  * omit code:
49  * omit signals:
50  * imports:
51  * 	- glib.ErrorG
52  * 	- glib.GException
53  * 	- gdk.Event
54  * 	- gtk.Widget
55  * 	- gtk.ObjectGtk
56  * 	- pango.PgLanguage
57  * 	- glib.Str
58  * 	- gtkc.gtk
59  * 	- gthread.Thread
60  * 	- gdk.Threads
61  * structWrap:
62  * 	- GdkEvent* -> Event
63  * 	- GtkObject* -> ObjectGtk
64  * 	- GtkWidget* -> Widget
65  * 	- PangoLanguage* -> PgLanguage
66  * module aliases:
67  * local aliases:
68  * 	- main -> run
69  * overrides:
70  */
71 
72 module gtk.Main;
73 
74 public  import gtkc.gtktypes;
75 
76 private import gtkc.gtk;
77 private import glib.ConstructionException;
78 private import gobject.ObjectG;
79 
80 
81 private import glib.ErrorG;
82 private import glib.GException;
83 private import gdk.Event;
84 private import gtk.Widget;
85 private import gtk.ObjectGtk;
86 private import pango.PgLanguage;
87 private import glib.Str;
88 private import gtkc.gtk;
89 private import gthread.Thread;
90 private import gdk.Threads;
91 
92 
93 
94 
95 /**
96  * Description
97  * Before using GTK+, you need to initialize it; initialization connects
98  * to the window system display, and parses some standard command line
99  * arguments. The gtk_init() function initializes GTK+. gtk_init() exits
100  * the application if errors occur; to avoid this, use gtk_init_check().
101  * gtk_init_check() allows you to recover from a failed GTK+
102  * initialization - you might start up your application in text mode instead.
103  * Like all GUI toolkits, GTK+ uses an event-driven programming
104  * model. When the user is doing nothing, GTK+ sits in the
105  * main loop and waits for input. If the user
106  * performs some action - say, a mouse click - then the main loop "wakes
107  * up" and delivers an event to GTK+. GTK+ forwards the event to one or
108  * more widgets.
109  * When widgets receive an event, they frequently emit one or more
110  * signals. Signals notify your program that
111  * "something interesting happened" by invoking functions you've
112  * connected to the signal with g_signal_connect(). Functions connected
113  * to a signal are often termed callbacks.
114  * When your callbacks are invoked, you would typically take some action
115  * - for example, when an Open button is clicked you might display a
116  * GtkFileSelectionDialog. After a callback finishes, GTK+ will return
117  * to the main loop and await more user input.
118  * $(DDOC_COMMENT example)
119  * It's OK to use the GLib main loop directly instead of gtk_main(),
120  * though it involves slightly more typing. See GMainLoop in the GLib
121  * documentation.
122  */
123 public class Main
124 {
125 	
126 	/**
127 	 * Call this function before using any other GTK+ functions in your GUI applications.
128 	 */
129 	public static void init(string[] args)
130 	{
131 		char** argv = (new char*[args.length]).ptr;
132 		int argc = 0;
133 		foreach (string p; args)
134 		{
135 			argv[argc++] = cast(char*)p;
136 		}
137 		
138 		init(&argc,&argv);
139 	}
140 	
141 	/**
142 	 * This initiates GtkD to supports multi threaded programs.
143 	 * read full documantation at http://gtk.org/faq/#AEN482
144 	 * from the FAQ:
145 	 * "There is a single global lock that you must acquire with
146 	 * gdk_threads_enter() before making any GDK calls,
147 	 * and release with gdk_threads_leave() afterwards throughout your code."
148 	 * This is to be used on any call to GDK not executed from the main thread.
149 	 */
150 	public static void initMultiThread(string[] args)
151 	{
152 		Thread.init(null);
153 		gdkThreadsInit();
154 		init(args);
155 	}
156 	
157 	
158 	/**
159 	 */
160 	
161 	/**
162 	 * Warning
163 	 * gtk_set_locale has been deprecated since version 2.24 and should not be used in newly-written code. Use setlocale() directly
164 	 * Initializes internationalization support for GTK+. gtk_init()
165 	 * automatically does this, so there is typically no point
166 	 * in calling this function.
167 	 * If you are calling this function because you changed the locale
168 	 * after GTK+ is was initialized, then calling this function
169 	 * may help a bit. (Note, however, that changing the locale
170 	 * after GTK+ is initialized may produce inconsistent results and
171 	 * is not really supported.)
172 	 * In detail - sets the current locale according to the
173 	 * program environment. This is the same as calling the C library function
174 	 * setlocale (LC_ALL, "") but also takes care of the
175 	 * locale specific setup of the windowing system used by GDK.
176 	 * Returns: a string corresponding to the locale set, typically in the form lang_COUNTRY, where lang is an ISO-639 language code, and COUNTRY is an ISO-3166 country code. On Unix, this form matches the result of the setlocale(); it is also used on other machines, such as Windows, where the C library returns a different result. The string is owned by GTK+ and should not be modified or freed.
177 	 */
178 	public static string setLocale()
179 	{
180 		// gchar * gtk_set_locale (void);
181 		return Str.toString(gtk_set_locale());
182 	}
183 	
184 	/**
185 	 * Prevents gtk_init(), gtk_init_check(), gtk_init_with_args() and
186 	 * gtk_parse_args() from automatically
187 	 * calling setlocale (LC_ALL, ""). You would
188 	 * want to use this function if you wanted to set the locale for
189 	 * your program to something other than the user's locale, or if
190 	 * you wanted to set different values for different locale categories.
191 	 * Most programs should not need to call this function.
192 	 */
193 	public static void disableSetlocale()
194 	{
195 		// void gtk_disable_setlocale (void);
196 		gtk_disable_setlocale();
197 	}
198 	
199 	/**
200 	 * Returns the PangoLanguage for the default language currently in
201 	 * effect. (Note that this can change over the life of an
202 	 * application.) The default language is derived from the current
203 	 * locale. It determines, for example, whether GTK+ uses the
204 	 * right-to-left or left-to-right text direction.
205 	 * This function is equivalent to pango_language_get_default(). See
206 	 * that function for details.
207 	 * Returns: the default language as a PangoLanguage, must not be freed
208 	 */
209 	public static PgLanguage getDefaultLanguage()
210 	{
211 		// PangoLanguage * gtk_get_default_language (void);
212 		auto p = gtk_get_default_language();
213 		
214 		if(p is null)
215 		{
216 			return null;
217 		}
218 		
219 		return ObjectG.getDObject!(PgLanguage)(cast(PangoLanguage*) p);
220 	}
221 	
222 	/**
223 	 * Parses command line arguments, and initializes global
224 	 * attributes of GTK+, but does not actually open a connection
225 	 * to a display. (See gdk_display_open(), gdk_get_display_arg_name())
226 	 * Any arguments used by GTK+ or GDK are removed from the array and
227 	 * argc and argv are updated accordingly.
228 	 * There is no need to call this function explicitely if you are using
229 	 * gtk_init(), or gtk_init_check().
230 	 * Params:
231 	 * argv = a pointer to the array of
232 	 * command line arguments. [array length=argc][inout]
233 	 * Returns: TRUE if initialization succeeded, otherwise FALSE.
234 	 */
235 	public static int parseArgs(ref string[] argv)
236 	{
237 		// gboolean gtk_parse_args (int *argc,  char ***argv);
238 		char** outargv = Str.toStringzArray(argv);
239 		int argc = cast(int) argv.length;
240 		
241 		auto p = gtk_parse_args(&argc, &outargv);
242 		
243 		argv = null;
244 		foreach ( cstr; outargv[0 .. argc] )
245 		{
246 			argv ~= Str.toString(cstr);
247 		}
248 		return p;
249 	}
250 	
251 	/**
252 	 * Call this function before using any other GTK+ functions in your GUI
253 	 * applications. It will initialize everything needed to operate the
254 	 * toolkit and parses some standard command line options.
255 	 * argc and argv are adjusted accordingly so your own code will
256 	 * never see those standard arguments.
257 	 * Since 2.18, GTK+ calls signal (SIGPIPE, SIG_IGN)
258 	 * during initialization, to ignore SIGPIPE signals, since these are
259 	 * almost never wanted in graphical applications. If you do need to
260 	 * handle SIGPIPE for some reason, reset the handler after gtk_init(),
261 	 * but notice that other libraries (e.g. libdbus or gvfs) might do
262 	 * similar things.
263 	 * Note
264 	 * Params:
265 	 * argc = Address of the argc parameter of
266 	 * your main() function. Changed if any arguments were handled. [inout]
267 	 * argv = Address of the
268 	 * argv parameter of main(). Any options
269 	 * understood by GTK+ are stripped before return. [array length=argc][inout][allow-none]
270 	 */
271 	public static void init(int* argc, char*** argv)
272 	{
273 		// void gtk_init (int *argc,  char ***argv);
274 		gtk_init(argc, argv);
275 	}
276 	
277 	/**
278 	 * This function does the same work as gtk_init() with only
279 	 * a single change: It does not terminate the program if the GUI can't be
280 	 * initialized. Instead it returns FALSE on failure.
281 	 * This way the application can fall back to some other means of communication
282 	 * with the user - for example a curses or command line interface.
283 	 * Params:
284 	 * argv = Address of the argv parameter of main().
285 	 * Any parameters understood by gtk_init() are stripped before return. [array length=argc][inout][allow-none]
286 	 * Returns: TRUE if the GUI has been successfully initialized, FALSE otherwise.
287 	 */
288 	public static int initCheck(ref string[] argv)
289 	{
290 		// gboolean gtk_init_check (int *argc,  char ***argv);
291 		char** outargv = Str.toStringzArray(argv);
292 		int argc = cast(int) argv.length;
293 		
294 		auto p = gtk_init_check(&argc, &outargv);
295 		
296 		argv = null;
297 		foreach ( cstr; outargv[0 .. argc] )
298 		{
299 			argv ~= Str.toString(cstr);
300 		}
301 		return p;
302 	}
303 	
304 	/**
305 	 * This function does the same work as gtk_init_check().
306 	 * Additionally, it allows you to add your own commandline options,
307 	 * and it automatically generates nicely formatted
308 	 * --help output. Note that your program will
309 	 * be terminated after writing out the help output.
310 	 * Since 2.6
311 	 * Params:
312 	 * argv = a pointer to the array of
313 	 * command line arguments. [inout][array length=argc]
314 	 * parameterString = a string which is displayed in
315 	 * the first line of --help output, after
316 	 * programname [OPTION...]
317 	 * entries = a NULL-terminated array
318 	 * of GOptionEntrys describing the options of your program. [array zero-terminated=1]
319 	 * translationDomain = a translation domain to use for translating
320 	 * the --help output for the options in entries
321 	 * with gettext(), or NULL
322 	 * Returns: TRUE if the GUI has been successfully initialized, FALSE otherwise.
323 	 * Throws: GException on failure.
324 	 */
325 	public static int initWithArgs(ref string[] argv, string parameterString, GOptionEntry[] entries, string translationDomain)
326 	{
327 		// gboolean gtk_init_with_args (int *argc,  char ***argv,  const char *parameter_string,  GOptionEntry *entries,  const char *translation_domain,  GError **error);
328 		char** outargv = Str.toStringzArray(argv);
329 		int argc = cast(int) argv.length;
330 		GError* err = null;
331 		
332 		auto p = gtk_init_with_args(&argc, &outargv, Str.toStringz(parameterString), entries.ptr, Str.toStringz(translationDomain), &err);
333 		
334 		if (err !is null)
335 		{
336 			throw new GException( new ErrorG(err) );
337 		}
338 		
339 		argv = null;
340 		foreach ( cstr; outargv[0 .. argc] )
341 		{
342 			argv ~= Str.toString(cstr);
343 		}
344 		return p;
345 	}
346 	
347 	/**
348 	 * Returns a GOptionGroup for the commandline arguments recognized
349 	 * by GTK+ and GDK. You should add this group to your GOptionContext
350 	 * with g_option_context_add_group(), if you are using
351 	 * g_option_context_parse() to parse your commandline arguments.
352 	 * Since 2.6
353 	 * Params:
354 	 * openDefaultDisplay = whether to open the default display
355 	 * when parsing the commandline arguments
356 	 * Returns: a GOptionGroup for the commandline arguments recognized by GTK+
357 	 */
358 	public static GOptionGroup* getOptionGroup(int openDefaultDisplay)
359 	{
360 		// GOptionGroup * gtk_get_option_group (gboolean open_default_display);
361 		return gtk_get_option_group(openDefaultDisplay);
362 	}
363 	
364 	/**
365 	 * Warning
366 	 * gtk_exit is deprecated and should not be used in newly-written code. Use the standard exit() function instead.
367 	 * Terminates the program and returns the given exit code to the caller.
368 	 * This function will shut down the GUI and free all resources allocated
369 	 * for GTK+.
370 	 * Params:
371 	 * errorCode = Return value to pass to the caller. This is dependent on the
372 	 * target system but at least on Unix systems 0 means success.
373 	 */
374 	public static void exit(int errorCode)
375 	{
376 		// void gtk_exit (gint error_code);
377 		gtk_exit(errorCode);
378 	}
379 	
380 	/**
381 	 * Checks if any events are pending. This can be used to update the GUI
382 	 * and invoke timeouts etc. while doing some time intensive computation.
383 	 * $(DDOC_COMMENT example)
384 	 * Returns: TRUE if any events are pending, FALSE otherwise.
385 	 */
386 	public static int eventsPending()
387 	{
388 		// gboolean gtk_events_pending (void);
389 		return gtk_events_pending();
390 	}
391 	
392 	/**
393 	 * Runs the main loop until gtk_main_quit() is called. You can nest calls to
394 	 * gtk_main(). In that case gtk_main_quit() will make the innermost invocation
395 	 * of the main loop return.
396 	 */
397 	public static void run()
398 	{
399 		// void gtk_main (void);
400 		gtk_main();
401 	}
402 	
403 	/**
404 	 * Asks for the current nesting level of the main loop. This can be useful
405 	 * when calling gtk_quit_add().
406 	 * Returns: the nesting level of the current invocation of the main loop.
407 	 */
408 	public static uint level()
409 	{
410 		// guint gtk_main_level (void);
411 		return gtk_main_level();
412 	}
413 	
414 	/**
415 	 * Makes the innermost invocation of the main loop return when it regains
416 	 * control.
417 	 */
418 	public static void quit()
419 	{
420 		// void gtk_main_quit (void);
421 		gtk_main_quit();
422 	}
423 	
424 	/**
425 	 * Runs a single iteration of the mainloop. If no events are waiting to be
426 	 * processed GTK+ will block until the next event is noticed. If you don't
427 	 * want to block look at gtk_main_iteration_do() or check if any events are
428 	 * pending with gtk_events_pending() first.
429 	 * Returns: TRUE if gtk_main_quit() has been called for the innermost mainloop.
430 	 */
431 	public static int iteration()
432 	{
433 		// gboolean gtk_main_iteration (void);
434 		return gtk_main_iteration();
435 	}
436 	
437 	/**
438 	 * Runs a single iteration of the mainloop. If no events are available either
439 	 * return or block dependent on the value of blocking.
440 	 * Params:
441 	 * blocking = TRUE if you want GTK+ to block if no events are pending.
442 	 * Returns: TRUE if gtk_main_quit() has been called for the innermost mainloop.
443 	 */
444 	public static int iterationDo(int blocking)
445 	{
446 		// gboolean gtk_main_iteration_do (gboolean blocking);
447 		return gtk_main_iteration_do(blocking);
448 	}
449 	
450 	/**
451 	 * Processes a single GDK event. This is public only to allow filtering of events
452 	 * between GDK and GTK+. You will not usually need to call this function directly.
453 	 * While you should not call this function directly, you might want to know
454 	 * how exactly events are handled. So here is what this function does with
455 	 * Params:
456 	 * event = An event to process (normally) passed by GDK.
457 	 */
458 	public static void doEvent(Event event)
459 	{
460 		// void gtk_main_do_event (GdkEvent *event);
461 		gtk_main_do_event((event is null) ? null : event.getEventStruct());
462 	}
463 	
464 	/**
465 	 * Makes widget the current grabbed widget. This means that interaction with
466 	 * other widgets in the same application is blocked and mouse as well as
467 	 * keyboard events are delivered to this widget.
468 	 * If widget is not sensitive, it is not set as the current grabbed
469 	 * widget and this function does nothing.
470 	 * Params:
471 	 * widget = The widget that grabs keyboard and pointer events.
472 	 */
473 	public static void grabAdd(Widget widget)
474 	{
475 		// void gtk_grab_add (GtkWidget *widget);
476 		gtk_grab_add((widget is null) ? null : widget.getWidgetStruct());
477 	}
478 	
479 	/**
480 	 * Queries the current grab of the default window group.
481 	 * Queries the current grab of the default window group.
482 	 * Returns: The widget which currently has the grab or NULL if no grab is active. [transfer none]
483 	 */
484 	public static Widget grabGetCurrent()
485 	{
486 		// GtkWidget * gtk_grab_get_current (void);
487 		auto p = gtk_grab_get_current();
488 		
489 		if(p is null)
490 		{
491 			return null;
492 		}
493 		
494 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
495 	}
496 	
497 	/**
498 	 * Removes the grab from the given widget. You have to pair calls to gtk_grab_add()
499 	 * and gtk_grab_remove().
500 	 * If widget does not have the grab, this function does nothing.
501 	 * Params:
502 	 * widget = The widget which gives up the grab.
503 	 */
504 	public static void grabRemove(Widget widget)
505 	{
506 		// void gtk_grab_remove (GtkWidget *widget);
507 		gtk_grab_remove((widget is null) ? null : widget.getWidgetStruct());
508 	}
509 	
510 	/**
511 	 * Warning
512 	 * gtk_init_add is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
513 	 * Registers a function to be called when the mainloop is started.
514 	 * Params:
515 	 * data = Data to pass to that function.
516 	 */
517 	public static void initAdd(GtkFunction funct, void* data)
518 	{
519 		// void gtk_init_add (GtkFunction function,  gpointer data);
520 		gtk_init_add(funct, data);
521 	}
522 	
523 	/**
524 	 * Warning
525 	 * gtk_quit_add_destroy is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
526 	 * Trigger destruction of object in case the mainloop at level main_level
527 	 * is quit.
528 	 * Params:
529 	 * mainLevel = Level of the mainloop which shall trigger the destruction.
530 	 * object = Object to be destroyed.
531 	 */
532 	public static void quitAddDestroy(uint mainLevel, ObjectGtk object)
533 	{
534 		// void gtk_quit_add_destroy (guint main_level,  GtkObject *object);
535 		gtk_quit_add_destroy(mainLevel, (object is null) ? null : object.getObjectGtkStruct());
536 	}
537 	
538 	/**
539 	 * Warning
540 	 * gtk_quit_add is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
541 	 * Registers a function to be called when an instance of the mainloop is left.
542 	 * Params:
543 	 * mainLevel = Level at which termination the function shall be called. You
544 	 * can pass 0 here to have the function run at the termination of the current
545 	 * mainloop.
546 	 * data = Pointer to pass when calling function.
547 	 * Returns: A handle for this quit handler (you need this for gtk_quit_remove()) or 0 if you passed a NULL pointer in function.
548 	 */
549 	public static uint quitAdd(uint mainLevel, GtkFunction funct, void* data)
550 	{
551 		// guint gtk_quit_add (guint main_level,  GtkFunction function,  gpointer data);
552 		return gtk_quit_add(mainLevel, funct, data);
553 	}
554 	
555 	/**
556 	 * Warning
557 	 * gtk_quit_add_full is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
558 	 * Registers a function to be called when an instance of the mainloop is left.
559 	 * In comparison to gtk_quit_add() this function adds the possibility to
560 	 * pass a marshaller and a function to be called when the quit handler is freed.
561 	 * The former can be used to run interpreted code instead of a compiled function
562 	 * while the latter can be used to free the information stored in data (while
563 	 * you can do this in function as well)... So this function will mostly be
564 	 * used by GTK+ wrappers for languages other than C.
565 	 * Params:
566 	 * mainLevel = Level at which termination the function shall be called. You
567 	 * can pass 0 here to have the function run at the termination of the current
568 	 * mainloop.
569 	 * marshal = The marshaller to be used. If this is non-NULL, function is
570 	 * ignored.
571 	 * data = Pointer to pass when calling function.
572 	 * destroy = Function to call to destruct data. Gets data as argument.
573 	 * Returns: A handle for this quit handler (you need this for gtk_quit_remove()) or 0 if you passed a NULL pointer in function.
574 	 */
575 	public static uint quitAddFull(uint mainLevel, GtkFunction funct, GtkCallbackMarshal marshal, void* data, GDestroyNotify destroy)
576 	{
577 		// guint gtk_quit_add_full (guint main_level,  GtkFunction function,  GtkCallbackMarshal marshal,  gpointer data,  GDestroyNotify destroy);
578 		return gtk_quit_add_full(mainLevel, funct, marshal, data, destroy);
579 	}
580 	
581 	/**
582 	 * Warning
583 	 * gtk_quit_remove is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
584 	 * Removes a quit handler by its identifier.
585 	 * Params:
586 	 * quitHandlerId = Identifier for the handler returned when installing it.
587 	 */
588 	public static void quitRemove(uint quitHandlerId)
589 	{
590 		// void gtk_quit_remove (guint quit_handler_id);
591 		gtk_quit_remove(quitHandlerId);
592 	}
593 	
594 	/**
595 	 * Warning
596 	 * gtk_quit_remove_by_data is deprecated and should not be used in newly-written code. This function is going to be removed in GTK+ 3.0
597 	 * Removes a quit handler identified by its data field.
598 	 * Params:
599 	 * data = The pointer passed as data to gtk_quit_add() or gtk_quit_add_full().
600 	 */
601 	public static void quitRemoveByData(void* data)
602 	{
603 		// void gtk_quit_remove_by_data (gpointer data);
604 		gtk_quit_remove_by_data(data);
605 	}
606 	
607 	/**
608 	 * Warning
609 	 * gtk_input_add_full has been deprecated since version 2.4 and should not be used in newly-written code. Use g_io_add_watch_full() instead.
610 	 * Registers a function to be called when a condition becomes true
611 	 * on a file descriptor.
612 	 * Params:
613 	 * source = a file descriptor.
614 	 * condition = the condition.
615 	 * marshal = The marshaller to use instead of the function (if non-NULL).
616 	 * data = callback data passed to function.
617 	 * destroy = callback function to call with data when the input
618 	 * handler is removed, or NULL.
619 	 * Returns: A unique id for the event source; to be used with gtk_input_remove().
620 	 */
621 	public static uint inputAddFull(int source, GdkInputCondition condition, GdkInputFunction funct, GtkCallbackMarshal marshal, void* data, GDestroyNotify destroy)
622 	{
623 		// guint gtk_input_add_full (gint source,  GdkInputCondition condition,  GdkInputFunction function,  GtkCallbackMarshal marshal,  gpointer data,  GDestroyNotify destroy);
624 		return gtk_input_add_full(source, condition, funct, marshal, data, destroy);
625 	}
626 	
627 	/**
628 	 * Warning
629 	 * gtk_input_remove has been deprecated since version 2.4 and should not be used in newly-written code. Use g_source_remove() instead.
630 	 * Removes the function with the given id.
631 	 * Params:
632 	 * inputHandlerId = Identifies the function to remove.
633 	 */
634 	public static void inputRemove(uint inputHandlerId)
635 	{
636 		// void gtk_input_remove (guint input_handler_id);
637 		gtk_input_remove(inputHandlerId);
638 	}
639 	
640 	/**
641 	 * Installs a key snooper function, which will get called on all key events
642 	 * before delivering them normally.
643 	 * Params:
644 	 * snooper = a GtkKeySnoopFunc.
645 	 * funcData = data to pass to snooper.
646 	 * Returns: a unique id for this key snooper for use with gtk_key_snooper_remove().
647 	 */
648 	public static uint keySnooperInstall(GtkKeySnoopFunc snooper, void* funcData)
649 	{
650 		// guint gtk_key_snooper_install (GtkKeySnoopFunc snooper,  gpointer func_data);
651 		return gtk_key_snooper_install(snooper, funcData);
652 	}
653 	
654 	/**
655 	 * Removes the key snooper function with the given id.
656 	 * Params:
657 	 * snooperHandlerId = Identifies the key snooper to remove.
658 	 */
659 	public static void keySnooperRemove(uint snooperHandlerId)
660 	{
661 		// void gtk_key_snooper_remove (guint snooper_handler_id);
662 		gtk_key_snooper_remove(snooperHandlerId);
663 	}
664 	
665 	/**
666 	 * Obtains a copy of the event currently being processed by GTK+. For
667 	 * example, if you get a "clicked" signal from GtkButton, the current
668 	 * event will be the GdkEventButton that triggered the "clicked"
669 	 * signal. The returned event must be freed with gdk_event_free().
670 	 * If there is no current event, the function returns NULL.
671 	 * Returns: a copy of the current event, or NULL if no current event. [transfer full]
672 	 */
673 	public static Event getCurrentEvent()
674 	{
675 		// GdkEvent * gtk_get_current_event (void);
676 		auto p = gtk_get_current_event();
677 		
678 		if(p is null)
679 		{
680 			return null;
681 		}
682 		
683 		return ObjectG.getDObject!(Event)(cast(GdkEvent*) p);
684 	}
685 	
686 	/**
687 	 * If there is a current event and it has a timestamp, return that
688 	 * timestamp, otherwise return GDK_CURRENT_TIME.
689 	 * Returns: the timestamp from the current event, or GDK_CURRENT_TIME.
690 	 */
691 	public static uint getCurrentEventTime()
692 	{
693 		// guint32 gtk_get_current_event_time (void);
694 		return gtk_get_current_event_time();
695 	}
696 	
697 	/**
698 	 * If there is a current event and it has a state field, place
699 	 * that state field in state and return TRUE, otherwise return
700 	 * FALSE.
701 	 * Params:
702 	 * state = a location to store the state of the current event. [out]
703 	 * Returns: TRUE if there was a current event and it had a state field
704 	 */
705 	public static int getCurrentEventState(out GdkModifierType state)
706 	{
707 		// gboolean gtk_get_current_event_state (GdkModifierType *state);
708 		return gtk_get_current_event_state(&state);
709 	}
710 	
711 	/**
712 	 * If event is NULL or the event was not associated with any widget,
713 	 * returns NULL, otherwise returns the widget that received the event
714 	 * originally.
715 	 * Params:
716 	 * event = a GdkEvent
717 	 * Returns: the widget that originally received event, or NULL. [transfer none]
718 	 */
719 	public static Widget getEventWidget(Event event)
720 	{
721 		// GtkWidget * gtk_get_event_widget (GdkEvent *event);
722 		auto p = gtk_get_event_widget((event is null) ? null : event.getEventStruct());
723 		
724 		if(p is null)
725 		{
726 			return null;
727 		}
728 		
729 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
730 	}
731 	
732 	/**
733 	 * Sends an event to a widget, propagating the event to parent widgets
734 	 * if the event remains unhandled. Events received by GTK+ from GDK
735 	 * normally begin in gtk_main_do_event(). Depending on the type of
736 	 * event, existence of modal dialogs, grabs, etc., the event may be
737 	 * propagated; if so, this function is used. gtk_propagate_event()
738 	 * calls gtk_widget_event() on each widget it decides to send the
739 	 * event to. So gtk_widget_event() is the lowest-level function; it
740 	 * simply emits the "event" and possibly an event-specific signal on a
741 	 * widget. gtk_propagate_event() is a bit higher-level, and
742 	 * gtk_main_do_event() is the highest level.
743 	 * All that said, you most likely don't want to use any of these
744 	 * functions; synthesizing events is rarely needed. Consider asking on
745 	 * the mailing list for better ways to achieve your goals. For
746 	 * example, use gdk_window_invalidate_rect() or
747 	 * gtk_widget_queue_draw() instead of making up expose events.
748 	 * Params:
749 	 * widget = a GtkWidget
750 	 * event = an event
751 	 */
752 	public static void propagateEvent(Widget widget, Event event)
753 	{
754 		// void gtk_propagate_event (GtkWidget *widget,  GdkEvent *event);
755 		gtk_propagate_event((widget is null) ? null : widget.getWidgetStruct(), (event is null) ? null : event.getEventStruct());
756 	}
757 }