2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
27 * outFile = MessageDialog
28 * strct = GtkMessageDialog
31 * clss = MessageDialog
39 * - gtk_message_dialog_
44 * - gtk_message_dialog_new
45 * - gtk_message_dialog_new_with_markup
50 * - GtkWindow* -> Window
55 module gtk
.MessageDialog
;
61 import tango
.io
.Stdout
; // use the tango loging?
65 private import gtkc
.gtktypes
;
67 private import gtkc
.gtk
;
70 private import glib
.Str
;
71 private import gtk
.Window
;
78 * GtkMessageDialog presents a dialog with an image representing the type of
79 * message (Error, Question, etc.) alongside some message text. It's simply a
80 * convenience widget; you could construct the equivalent of GtkMessageDialog
81 * from GtkDialog without too much effort, but GtkMessageDialog saves typing.
82 * The easiest way to do a modal message dialog is to use gtk_dialog_run(), though
83 * you can also pass in the GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically
84 * makes the dialog modal and waits for the user to respond to it. gtk_dialog_run()
85 * returns when any dialog button is clicked.
86 * Example2.A modal dialog.
87 * dialog = gtk_message_dialog_new (main_application_window,
88 * GTK_DIALOG_DESTROY_WITH_PARENT,
91 * "Error loading file '%s': %s",
92 * filename, g_strerror (errno));
93 * gtk_dialog_run (GTK_DIALOG (dialog));
94 * gtk_widget_destroy (dialog);
95 * You might do a non-modal GtkMessageDialog as follows:
96 * Example3.A non-modal dialog.
97 * dialog = gtk_message_dialog_new (main_application_window,
98 * GTK_DIALOG_DESTROY_WITH_PARENT,
101 * "Error loading file '%s': %s",
102 * filename, g_strerror (errno));
103 * /+* Destroy the dialog when the user responds to it (e.g. clicks a button) +/
104 * g_signal_connect_swapped (dialog, "response",
105 * G_CALLBACK (gtk_widget_destroy),
108 private import gtk
.Dialog
;
109 public class MessageDialog
: Dialog
112 /** the main Gtk struct */
113 protected GtkMessageDialog
* gtkMessageDialog
;
116 public GtkMessageDialog
* getMessageDialogStruct()
118 return gtkMessageDialog
;
122 /** the main Gtk struct as a void* */
123 protected void* getStruct()
125 return cast(void*)gtkMessageDialog
;
129 * Sets our main struct and passes it to the parent class
131 public this (GtkMessageDialog
* gtkMessageDialog
)
135 if ( gtkMessageDialog
is null )
140 Stdout("struct gtkMessageDialog is null on constructor").newline
;
144 printf("struct gtkMessageDialog is null on constructor");
151 assert(gtkMessageDialog
!is null, "struct gtkMessageDialog is null on constructor");
153 super(cast(GtkDialog
*)gtkMessageDialog
);
154 this.gtkMessageDialog
= gtkMessageDialog
;
158 * Creates a new message dialog, which is a simple dialog with an icon
159 * indicating the dialog type (error, warning, etc.) and some text the
160 * user may want to see. When the user clicks a button a "response"
161 * signal is emitted with response IDs from GtkResponseType. See
162 * GtkDialog for more details.
164 * transient parent, or NULL for none
170 * set of buttons to use
172 * printf()-style format string, or NULL
174 * the message - should be null, any formatting should be done prior to call this constructor
175 * arguments for message_format
177 * a new GtkMessageDialog
179 public this (Window parent
, GtkDialogFlags flags
, GtkMessageType type
, GtkButtonsType buttons
, char[] messageFormat
, char[] message
=null )
181 this(parent
, flags
, type
, buttons
, false, messageFormat
, message
);
185 * Creates a new message dialog, which is a simple dialog with an icon
186 * indicating the dialog type (error, warning, etc.) and some text which
187 * is marked up with the Pango text markup language.
188 * When the user clicks a button a "response" signal is emitted with
189 * response IDs from GtkResponseType. See GtkDialog for more details.
191 * If Markup is true special XML characters in the printf() arguments passed to this
192 * function will automatically be escaped as necessary.
193 * (See g_markup_printf_escaped() for how this is implemented.)
194 * Usually this is what you want, but if you have an existing
195 * Pango markup string that you want to use literally as the
196 * label, then you need to use gtk_message_dialog_set_markup()
197 * instead, since you can't pass the markup string either
198 * as the format (it might contain '%' characters) or as a string
201 * dialog = gtk_message_dialog_new (main_application_window,
202 * GTK_DIALOG_DESTROY_WITH_PARENT,
206 * gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
209 * transient parent, or NULL for none
215 * set of buttons to use
217 * printf()-style format string, or NULL
219 * the message - should be null, any formatting should be done prior to call this constructor
221 * arguments for message_format
223 * a new GtkMessageDialog
226 public this (Window parent
, GtkDialogFlags flags
, GtkMessageType type
, GtkButtonsType buttons
, bool markup
, char[] messageFormat
, char[] message
=null )
230 // GtkWidget* gtk_message_dialog_new_with_markup (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...);
232 cast(GtkMessageDialog
*)gtk_message_dialog_new_with_markup(
233 parent
is null ?
null : parent
.getWindowStruct(),
237 Str
.toStringz(messageFormat
),
238 Str
.toStringz(message
), // this should be null
245 // GtkWidget* gtk_message_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar *message_format, ...);
247 cast(GtkMessageDialog
*)gtk_message_dialog_new(
248 parent
is null ?
null : parent
.getWindowStruct(),
252 Str
.toStringz(messageFormat
),
253 Str
.toStringz(message
), // this should be null
270 * Sets the text of the message dialog to be str, which is marked
271 * up with the Pango text markup
276 * markup string (see Pango markup format)
279 public void setMarkup(char[] str)
281 // void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog, const gchar *str);
282 gtk_message_dialog_set_markup(gtkMessageDialog
, Str
.toStringz(str));
286 * Sets the dialog's image to image.
293 public void setImage(GtkWidget
* image
)
295 // void gtk_message_dialog_set_image (GtkMessageDialog *dialog, GtkWidget *image);
296 gtk_message_dialog_set_image(gtkMessageDialog
, image
);
300 * Sets the secondary text of the message dialog to be message_format
301 * (with printf()-style).
302 * Note that setting a secondary text makes the primary text become
303 * bold, unless you have provided explicit markup.
307 * printf()-style format string, or NULL
309 * arguments for message_format
312 public void formatSecondaryText(char[] messageFormat
, ... )
314 // void gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog, const gchar *message_format, ...);
315 gtk_message_dialog_format_secondary_text(gtkMessageDialog
, Str
.toStringz(messageFormat
));
319 * Sets the secondary text of the message dialog to be message_format (with
320 * printf()-style), which is marked up with the
321 * Pango text markup language.
322 * Note that setting a secondary text makes the primary text become
323 * bold, unless you have provided explicit markup.
324 * Due to an oversight, this function does not escape special XML characters
325 * like gtk_message_dialog_new_with_markup() does. Thus, if the arguments
326 * may contain special XML characters, you should use g_markup_printf_escaped()
329 * msg = g_markup_printf_escaped (message_format, ...);
330 * gtk_message_dialog_format_secondary_markup (message_dialog, "%s", msg);
335 * printf()-style markup string (see
336 * Pango markup format), or NULL
338 * arguments for message_format
341 * The "buttons" property
342 * "buttons" GtkButtonsType : Write / Construct Only
343 * The buttons shown in the message dialog.
344 * Default value: GTK_BUTTONS_NONE
346 public void formatSecondaryMarkup(char[] messageFormat
, ... )
348 // void gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog, const gchar *message_format, ...);
349 gtk_message_dialog_format_secondary_markup(gtkMessageDialog
, Str
.toStringz(messageFormat
));