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  = GtkMessageDialog.html
27  * outPack = gtk
28  * outFile = MessageDialog
29  * strct   = GtkMessageDialog
30  * realStrct=
31  * ctorStrct=
32  * clss    = MessageDialog
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_message_dialog_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- gtk_message_dialog_new
45  * 	- gtk_message_dialog_new_with_markup
46  * 	- gtk_message_dialog_get_message_area
47  * omit signals:
48  * imports:
49  * 	- glib.Str
50  * 	- gtk.VBox
51  * 	- gtk.Widget
52  * 	- gtk.Window
53  * structWrap:
54  * 	- GtkWidget* -> Widget
55  * 	- GtkWindow* -> Window
56  * module aliases:
57  * local aliases:
58  * overrides:
59  */
60 
61 module gtk.MessageDialog;
62 
63 public  import gtkc.gtktypes;
64 
65 private import gtkc.gtk;
66 private import glib.ConstructionException;
67 private import gobject.ObjectG;
68 
69 private import glib.Str;
70 private import gtk.VBox;
71 private import gtk.Widget;
72 private import gtk.Window;
73 
74 
75 private import gtk.Dialog;
76 
77 /**
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  *
83  * One difference from GtkDialog is that GtkMessageDialog sets the
84  * "skip-taskbar-hint" property to TRUE, so that the dialog is hidden
85  * from the taskbar by default.
86  *
87  * The easiest way to do a modal message dialog is to use gtk_dialog_run(), though
88  * you can also pass in the GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically
89  * makes the dialog modal and waits for the user to respond to it. gtk_dialog_run()
90  * returns when any dialog button is clicked.
91  *
92  * $(DDOC_COMMENT example)
93  *
94  * You might do a non-modal GtkMessageDialog as follows:
95  *
96  * $(DDOC_COMMENT example)
97  *
98  * GtkMessageDialog as GtkBuildable
99  *
100  * The GtkMessageDialog implementation of the GtkBuildable interface exposes
101  * the message area as an internal child with the name "message_area".
102  */
103 public class MessageDialog : Dialog
104 {
105 	
106 	/** the main Gtk struct */
107 	protected GtkMessageDialog* gtkMessageDialog;
108 	
109 	
110 	/** Get the main Gtk struct */
111 	public GtkMessageDialog* getMessageDialogStruct()
112 	{
113 		return gtkMessageDialog;
114 	}
115 	
116 	
117 	/** the main Gtk struct as a void* */
118 	protected override void* getStruct()
119 	{
120 		return cast(void*)gtkMessageDialog;
121 	}
122 	
123 	/**
124 	 * Sets our main struct and passes it to the parent class
125 	 */
126 	public this (GtkMessageDialog* gtkMessageDialog)
127 	{
128 		super(cast(GtkDialog*)gtkMessageDialog);
129 		this.gtkMessageDialog = gtkMessageDialog;
130 	}
131 	
132 	protected override void setStruct(GObject* obj)
133 	{
134 		super.setStruct(obj);
135 		gtkMessageDialog = cast(GtkMessageDialog*)obj;
136 	}
137 	
138 	/**
139 	 * Creates a new message dialog, which is a simple dialog with an icon
140 	 * indicating the dialog type (error, warning, etc.) and some text the
141 	 * user may want to see. When the user clicks a button a "response"
142 	 * signal is emitted with response IDs from GtkResponseType. See
143 	 * GtkDialog for more details.
144 	 * Params:
145 	 *    	parent = transient parent, or NULL for none
146 	 *    	flags = flags
147 	 *    	type = type of message
148 	 *    	buttons= set of buttons to use
149 	 *    	messageFormat = printf()-style format string, or NULL
150 	 *    	message = the message - should be null, any formatting should be done prior to call this constructor
151 	 *  arguments for message_format
152 	 * Returns:
153 	 *  a new GtkMessageDialog
154 	 */
155 	public this (Window parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, string messageFormat, string message=null )
156 	{
157 		this(parent, flags, type, buttons, false, messageFormat, message );
158 	}
159 	
160 	/**
161 	 * Creates a new message dialog, which is a simple dialog with an icon
162 	 * indicating the dialog type (error, warning, etc.) and some text which
163 	 * is marked up with the Pango text markup language.
164 	 * When the user clicks a button a "response" signal is emitted with
165 	 * response IDs from GtkResponseType. See GtkDialog for more details.
166 	 *
167 	 * If Markup is true special XML characters in the printf() arguments passed to this
168 	 * function will automatically be escaped as necessary.
169 	 * (See g_markup_printf_escaped() for how this is implemented.)
170 	 * Usually this is what you want, but if you have an existing
171 	 * Pango markup string that you want to use literally as the
172 	 * label, then you need to use gtk_message_dialog_set_markup()
173 	 * instead, since you can't pass the markup string either
174 	 * as the format (it might contain '%' characters) or as a string
175 	 * argument.
176 	 * Since 2.4
177 	 * Examples:
178 	 * --------------------
179 	 *  GtkWidget *dialog;
180 	 *  dialog = gtk_message_dialog_new (main_application_window,
181 	 *  GTK_DIALOG_DESTROY_WITH_PARENT,
182 	 *  GTK_MESSAGE_ERROR,
183 	 *  GTK_BUTTONS_CLOSE,
184 	 *  NULL);
185 	 *  gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
186 	 *  markup);
187 	 * --------------------
188 	 * Params:
189 	 *  parent = transient parent, or NULL for none
190 	 *  flags = flags
191 	 *  type = type of message
192 	 *  buttons = set of buttons to use
193 	 *  messageFormat = printf()-style format string, or NULL
194 	 *  message = the message - should be null, any formatting should be done prior to call this constructor
195 	 * Throws: ConstructionException GTK+ fails to create the object.
196 	 */
197 	public this (Window parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, bool markup, string messageFormat, string message=null )
198 	{
199 		GtkMessageDialog* p;
200 		
201 		if ( markup )
202 		{
203 			// GtkWidget* gtk_message_dialog_new_with_markup  (GtkWindow *parent,  GtkDialogFlags flags,  GtkMessageType type,  GtkButtonsType buttons,  const gchar *message_format,  ...);
204 			p = cast(GtkMessageDialog*)gtk_message_dialog_new_with_markup(
205 			parent is null ? null : parent.getWindowStruct(),
206 			flags,
207 			type,
208 			buttons,
209 			Str.toStringz(messageFormat),
210 			Str.toStringz(message),	// this should be null
211 			null
212 			);
213 		}
214 		else
215 		{
216 			// GtkWidget* gtk_message_dialog_new (GtkWindow *parent,  GtkDialogFlags flags,  GtkMessageType type,  GtkButtonsType buttons,  const gchar *message_format,  ...);
217 			p = cast(GtkMessageDialog*)gtk_message_dialog_new(
218 			parent is null ? null : parent.getWindowStruct(),
219 			flags,
220 			type,
221 			buttons,
222 			Str.toStringz(messageFormat),
223 			Str.toStringz(message),	// this should be null
224 			null
225 			);
226 		}
227 		
228 		if(p is null)
229 		{
230 			throw new ConstructionException("null returned by gtk_button_new()");
231 		}
232 		
233 		this(p);
234 	}
235 	
236 	/**
237 	 * Since 2.22
238 	 * Returns: A GtkVBox corresponding to the "message area" in the message_dialog. This is the box where the dialog's primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels, on the right side of the dialog's image (or on the left for right-to-left languages). See gtk_dialog_get_content_area() for the corresponding function in the parent GtkDialog.
239 	 */
240 	public VBox getMessageArea()
241 	{
242 		// GtkWidget * gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog);
243 		auto p = gtk_message_dialog_get_message_area(gtkMessageDialog);
244 		if(p is null)
245 		{
246 			return null;
247 		}
248 		return new VBox(cast(GtkVBox*) p);
249 	}
250 	
251 	/**
252 	 */
253 	
254 	/**
255 	 * Sets the text of the message dialog to be str, which is marked
256 	 * up with the Pango text markup
257 	 * language.
258 	 * Since 2.4
259 	 * Params:
260 	 * str = markup string (see Pango markup format)
261 	 */
262 	public void setMarkup(string str)
263 	{
264 		// void gtk_message_dialog_set_markup (GtkMessageDialog *message_dialog,  const gchar *str);
265 		gtk_message_dialog_set_markup(gtkMessageDialog, Str.toStringz(str));
266 	}
267 	
268 	/**
269 	 * Sets the dialog's image to image.
270 	 * Since 2.10
271 	 * Params:
272 	 * image = the image
273 	 */
274 	public void setImage(Widget image)
275 	{
276 		// void gtk_message_dialog_set_image (GtkMessageDialog *dialog,  GtkWidget *image);
277 		gtk_message_dialog_set_image(gtkMessageDialog, (image is null) ? null : image.getWidgetStruct());
278 	}
279 	
280 	/**
281 	 * Gets the dialog's image.
282 	 * Since 2.14
283 	 * Returns: the dialog's image. [transfer none]
284 	 */
285 	public Widget getImage()
286 	{
287 		// GtkWidget * gtk_message_dialog_get_image (GtkMessageDialog *dialog);
288 		auto p = gtk_message_dialog_get_image(gtkMessageDialog);
289 		
290 		if(p is null)
291 		{
292 			return null;
293 		}
294 		
295 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
296 	}
297 }