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