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