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