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  = glib-Warnings-and-Assertions.html
27  * outPack = glib
28  * outFile = Messages
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = Messages
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module glib.Messages;
54 
55 public  import gtkc.glibtypes;
56 
57 private import gtkc.glib;
58 private import glib.ConstructionException;
59 
60 private import glib.Str;
61 
62 
63 
64 /**
65  * These functions provide support for outputting messages.
66  *
67  * The g_return family of macros (g_return_if_fail(),
68  * g_return_val_if_fail(), g_return_if_reached(), g_return_val_if_reached())
69  * should only be used for programming errors, a typical use case is
70  * checking for invalid parameters at the beginning of a public function.
71  * They should not be used if you just mean "if (error) return", they
72  * should only be used if you mean "if (bug in program) return".
73  * The program behavior is generally considered undefined after one
74  * of these checks fails. They are not intended for normal control
75  * flow, only to give a perhaps-helpful warning before giving up.
76  */
77 public class Messages
78 {
79 	
80 	/**
81 	 */
82 	
83 	/**
84 	 * Sets the print handler.
85 	 * Any messages passed to g_print() will be output via
86 	 * the new handler. The default handler simply outputs
87 	 * the message to stdout. By providing your own handler
88 	 * you can redirect the output, to a GTK+ widget or a
89 	 * log file for example.
90 	 * Params:
91 	 * func = the new print handler
92 	 * Returns: the old print handler
93 	 */
94 	public static GPrintFunc setPrintHandler(GPrintFunc func)
95 	{
96 		// GPrintFunc g_set_print_handler (GPrintFunc func);
97 		return g_set_print_handler(func);
98 	}
99 	
100 	/**
101 	 * Sets the handler for printing error messages.
102 	 * Any messages passed to g_printerr() will be output via
103 	 * the new handler. The default handler simply outputs the
104 	 * message to stderr. By providing your own handler you can
105 	 * redirect the output, to a GTK+ widget or a log file for
106 	 * example.
107 	 * Params:
108 	 * func = the new error message handler
109 	 * Returns: the old error message handler
110 	 */
111 	public static GPrintFunc setPrinterrHandler(GPrintFunc func)
112 	{
113 		// GPrintFunc g_set_printerr_handler (GPrintFunc func);
114 		return g_set_printerr_handler(func);
115 	}
116 	
117 	/**
118 	 * Prompts the user with
119 	 * [E]xit, [H]alt, show [S]tack trace or [P]roceed.
120 	 * This function is intended to be used for debugging use only.
121 	 * The following example shows how it can be used together with
122 	 * the g_log() functions.
123 	 * $(DDOC_COMMENT example)
124 	 * If [E]xit is selected, the application terminates with a call
125 	 * to _exit(0).
126 	 * If [S]tack trace is selected, g_on_error_stack_trace() is called.
127 	 * This invokes gdb, which attaches to the current
128 	 * process and shows a stack trace. The prompt is then shown again.
129 	 * If [P]roceed is selected, the function returns.
130 	 * This function may cause different actions on non-UNIX platforms.
131 	 * Params:
132 	 * prgName = the program name, needed by gdb
133 	 * for the [S]tack trace option. If prg_name is NULL, g_get_prgname()
134 	 * is called to get the program name (which will work correctly if
135 	 * gdk_init() or gtk_init() has been called)
136 	 */
137 	public static void onErrorQuery(string prgName)
138 	{
139 		// void g_on_error_query (const gchar *prg_name);
140 		g_on_error_query(Str.toStringz(prgName));
141 	}
142 	
143 	/**
144 	 * Invokes gdb, which attaches to the current
145 	 * process and shows a stack trace. Called by g_on_error_query()
146 	 * when the [S]tack trace option is selected. You can get the current
147 	 * process's "program name" with g_get_prgname(), assuming that you
148 	 * have called gtk_init() or gdk_init().
149 	 * This function may cause different actions on non-UNIX platforms.
150 	 * Params:
151 	 * prgName = the program name, needed by gdb
152 	 * for the [S]tack trace option.
153 	 */
154 	public static void onErrorStackTrace(string prgName)
155 	{
156 		// void g_on_error_stack_trace (const gchar *prg_name);
157 		g_on_error_stack_trace(Str.toStringz(prgName));
158 	}
159 }