alternative to assert
[gtkD.git] / src / gtk / MessageDialog.d
blob7aa0f901790e5625c8a062b86e36bc8905402489
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkMessageDialog.html
26 * outPack = gtk
27 * outFile = MessageDialog
28 * strct = GtkMessageDialog
29 * realStrct=
30 * ctorStrct=
31 * clss = MessageDialog
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_message_dialog_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gtk_message_dialog_new
45 * - gtk_message_dialog_new_with_markup
46 * imports:
47 * - glib.Str
48 * - gtk.Window
49 * structWrap:
50 * - GtkWindow* -> Window
51 * local aliases:
54 module gtk.MessageDialog;
56 private import gtk.gtktypes;
58 private import lib.gtk;
60 private import glib.Str;
61 private import gtk.Window;
63 /**
64 * Description
65 * GtkMessageDialog presents a dialog with an image representing the type of
66 * message (Error, Question, etc.) alongside some message text. It's simply a
67 * convenience widget; you could construct the equivalent of GtkMessageDialog
68 * from GtkDialog without too much effort, but GtkMessageDialog saves typing.
69 * The easiest way to do a modal message dialog is to use gtk_dialog_run(), though
70 * you can also pass in the GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically
71 * makes the dialog modal and waits for the user to respond to it. gtk_dialog_run()
72 * returns when any dialog button is clicked.
73 * Example2.A modal dialog.
74 * dialog = gtk_message_dialog_new (main_application_window,
75 * GTK_DIALOG_DESTROY_WITH_PARENT,
76 * GTK_MESSAGE_ERROR,
77 * GTK_BUTTONS_CLOSE,
78 * "Error loading file '%s': %s",
79 * filename, g_strerror (errno));
80 * gtk_dialog_run (GTK_DIALOG (dialog));
81 * gtk_widget_destroy (dialog);
82 * You might do a non-modal GtkMessageDialog as follows:
83 * Example3.A non-modal dialog.
84 * dialog = gtk_message_dialog_new (main_application_window,
85 * GTK_DIALOG_DESTROY_WITH_PARENT,
86 * GTK_MESSAGE_ERROR,
87 * GTK_BUTTONS_CLOSE,
88 * "Error loading file '%s': %s",
89 * filename, g_strerror (errno));
90 * /+* Destroy the dialog when the user responds to it (e.g. clicks a button) +/
91 * g_signal_connect_swapped (dialog, "response",
92 * G_CALLBACK (gtk_widget_destroy),
93 * dialog);
95 private import gtk.Dialog;
96 public class MessageDialog : Dialog
99 /** the main Gtk struct */
100 protected GtkMessageDialog* gtkMessageDialog;
103 public GtkMessageDialog* getMessageDialogStruct()
105 return gtkMessageDialog;
109 /** the main Gtk struct as a void* */
110 protected void* getStruct()
112 return cast(void*)gtkMessageDialog;
116 * Sets our main struct and passes it to the parent class
118 public this (GtkMessageDialog* gtkMessageDialog)
120 super(cast(GtkDialog*)gtkMessageDialog);
121 this.gtkMessageDialog = gtkMessageDialog;
125 * Creates a new message dialog, which is a simple dialog with an icon
126 * indicating the dialog type (error, warning, etc.) and some text the
127 * user may want to see. When the user clicks a button a "response"
128 * signal is emitted with response IDs from GtkResponseType. See
129 * GtkDialog for more details.
130 * parent:
131 * transient parent, or NULL for none
132 * flags:
133 * flags
134 * type:
135 * type of message
136 * buttons:
137 * set of buttons to use
138 * message_format:
139 * printf()-style format string, or NULL
140 * message:
141 * the message - should be null, any formatting should be done prior to call this constructor
142 * arguments for message_format
143 * Returns:
144 * a new GtkMessageDialog
146 public this (Window parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, char[] messageFormat, char[] message=null )
148 this(parent, flags, type, buttons, false, messageFormat, message );
152 * Creates a new message dialog, which is a simple dialog with an icon
153 * indicating the dialog type (error, warning, etc.) and some text which
154 * is marked up with the Pango text markup language.
155 * When the user clicks a button a "response" signal is emitted with
156 * response IDs from GtkResponseType. See GtkDialog for more details.
158 * If Markup is true special XML characters in the printf() arguments passed to this
159 * function will automatically be escaped as necessary.
160 * (See g_markup_printf_escaped() for how this is implemented.)
161 * Usually this is what you want, but if you have an existing
162 * Pango markup string that you want to use literally as the
163 * label, then you need to use gtk_message_dialog_set_markup()
164 * instead, since you can't pass the markup string either
165 * as the format (it might contain '%' characters) or as a string
166 * argument.
167 * GtkWidget *dialog;
168 * dialog = gtk_message_dialog_new (main_application_window,
169 * GTK_DIALOG_DESTROY_WITH_PARENT,
170 * GTK_MESSAGE_ERROR,
171 * GTK_BUTTONS_CLOSE,
172 * NULL);
173 * gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
174 * markup);
175 * parent:
176 * transient parent, or NULL for none
177 * flags:
178 * flags
179 * type:
180 * type of message
181 * buttons:
182 * set of buttons to use
183 * message_format:
184 * printf()-style format string, or NULL
185 * message:
186 * the message - should be null, any formatting should be done prior to call this constructor
187 * ...:
188 * arguments for message_format
189 * Returns:
190 * a new GtkMessageDialog
191 * Since 2.4
193 public this (Window parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, bit markup, char[] messageFormat, char[] message=null )
195 if ( markup )
197 // GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...);
198 this(
199 cast(GtkMessageDialog*)gtk_message_dialog_new_with_markup(
200 parent is null ? null : parent.getWindowStruct(),
201 flags,
202 type,
203 buttons,
204 Str.toStringz(messageFormat),
205 Str.toStringz(message), // this should be null
206 null
210 else
212 // GtkWidget* gtk_message_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...);
213 this(
214 cast(GtkMessageDialog*)gtk_message_dialog_new(
215 parent is null ? null : parent.getWindowStruct(),
216 flags,
217 type,
218 buttons,
219 Str.toStringz(messageFormat),
220 Str.toStringz(message), // this should be null
221 null
237 * Sets the text of the message dialog to be str, which is marked
238 * up with the Pango text markup
239 * language.
240 * message_dialog:
241 * a GtkMessageDialog
242 * str:
243 * markup string (see Pango markup format)
244 * Since 2.4
246 public void setMarkup(char[] str)
248 // void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog, const gchar *str);
249 gtk_message_dialog_set_markup(gtkMessageDialog, Str.toStringz(str));
253 * Sets the dialog's image to image.
254 * dialog:
255 * a GtkMessageDialog
256 * image:
257 * the image
258 * Since 2.10
260 public void setImage(GtkWidget* image)
262 // void gtk_message_dialog_set_image (GtkMessageDialog *dialog, GtkWidget *image);
263 gtk_message_dialog_set_image(gtkMessageDialog, image);
267 * Sets the secondary text of the message dialog to be message_format
268 * (with printf()-style).
269 * Note that setting a secondary text makes the primary text become
270 * bold, unless you have provided explicit markup.
271 * message_dialog:
272 * a GtkMessageDialog
273 * message_format:
274 * printf()-style format string, or NULL
275 * ...:
276 * arguments for message_format
277 * Since 2.6
279 public void formatSecondaryText(char[] messageFormat, ... )
281 // void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog, const gchar *message_format, ...);
282 gtk_message_dialog_format_secondary_text(gtkMessageDialog, Str.toStringz(messageFormat));
286 * Sets the secondary text of the message dialog to be message_format (with
287 * printf()-style), which is marked up with the
288 * Pango text markup language.
289 * Note that setting a secondary text makes the primary text become
290 * bold, unless you have provided explicit markup.
291 * Due to an oversight, this function does not escape special XML characters
292 * like gtk_message_dialog_new_with_markup() does. Thus, if the arguments
293 * may contain special XML characters, you should use g_markup_printf_escaped()
294 * to escape it.
295 * gchar *msg;
296 * msg = g_markup_printf_escaped (message_format, ...);
297 * gtk_message_dialog_format_secondary_markup (message_dialog, "%s", msg);
298 * g_free (msg);
299 * message_dialog:
300 * a GtkMessageDialog
301 * message_format:
302 * printf()-style markup string (see
303 * Pango markup format), or NULL
304 * ...:
305 * arguments for message_format
306 * Since 2.6
307 * Property Details
308 * The "buttons" property
309 * "buttons" GtkButtonsType : Write / Construct Only
310 * The buttons shown in the message dialog.
311 * Default value: GTK_BUTTONS_NONE
313 public void formatSecondaryMarkup(char[] messageFormat, ... )
315 // void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog, const gchar *message_format, ...);
316 gtk_message_dialog_format_secondary_markup(gtkMessageDialog, Str.toStringz(messageFormat));