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  = 
27  * outPack = gtk
28  * outFile = PopupBox
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = PopupBox
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * omit structs:
41  * omit prefixes:
42  * omit code:
43  * omit signals:
44  * imports:
45  * 	- gtk.MessageDialog;
46  * 	- gtk.Window;
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gtk.PopupBox;
54 
55 public  import gtkc.gtktypes;
56 
57 private import gtkc.gtk;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 
62 private import gtk.MessageDialog;;
63 private import gtk.Window;;
64 
65 
66 
67 
68 /**
69  */
70 public class PopupBox
71 {
72 	
73 	/**
74 	 * Create an information popup dialog.
75 	 * Params:
76 	 *  message = The message to show on the dialog
77 	 *  title = The title of the dialog
78 	 */
79 	public static void information(string message, string title)
80 	{
81 		information(null, message, title);
82 	}
83 	
84 	/**
85 	 * Create an information popup dialog.
86 	 * Params:
87 	 *  parent = The parent window of this popup dialog
88 	 *  message = The message to show on the dialog
89 	 *  title = The title of the dialog
90 	 */
91 	public static void information(Window parent, string message, string title)
92 	{
93 		MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0,
94 		MessageType.INFO,
95 		ButtonsType.OK ,
96 		message);
97 		d.setTitle(title);
98 		//d.addButton("gtk-dialog-info",GtkResponseType.GTK_RESPONSE_OK);
99 		d.run();
100 		d.destroy();
101 	}
102 	
103 	
104 	/**
105 	 * Create an error popup dialog.
106 	 * Params:
107 	 *  message = The message to show on the dialog
108 	 *  title = The title of the dialog
109 	 */
110 	public static void error(string message, string title)
111 	{
112 		error(null, message, title);
113 	}
114 	
115 	/**
116 	 * Create an error popup dialog.
117 	 * Params:
118 	 *  parent = The parent window of this popup dialog
119 	 *  message = The message to show on the dialog
120 	 *  title = The title of the dialog
121 	 */
122 	public static void error(Window parent, string message, string title)
123 	{
124 		MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0,
125 		MessageType.ERROR,
126 		ButtonsType.CANCEL ,
127 		message);
128 		d.setTitle(title);
129 		//d.addButton("gtk-dialog-error",ResponseType.GTK_RESPONSE_CANCEL);
130 		d.run();
131 		d.destroy();
132 	}
133 	
134 	
135 	
136 	/**
137 	 * Create an 'yes' or 'no' popup dialog.
138 	 * Params:
139 	 *  message = The message to show on the dialog
140 	 *  title = The title of the dialog
141 	 */
142 	public static bool yesNo(string message, string title)
143 	{
144 		return yesNo(null, message, title);
145 	}
146 	
147 	/**
148 	 * Create an 'yes' or 'no' popup dialog.
149 	 * Params:
150 	 *  parent = The parent window of this popup dialog
151 	 *  message = The message to show on the dialog
152 	 *  title = The title of the dialog
153 	 */
154 	public static bool yesNo(Window parent, string message, string title)
155 	{
156 		MessageDialog d = new MessageDialog(
157 		parent, cast(GtkDialogFlags)0,
158 		MessageType.QUESTION,
159 		ButtonsType.NONE,
160 		message);
161 		d.setTitle(title);
162 		d.addButton("gtk-no",ResponseType.NO);
163 		d.addButton("gtk-yes",ResponseType.YES);
164 		int responce = d.run();
165 		d.destroy();
166 		return responce == ResponseType.YES;
167 	}
168 	
169 	
170 	/**
171 	 * Create an 'yes', 'no' or 'cancel' popup dialog.
172 	 * Params:
173 	 *  message = The message to show on the dialog
174 	 *  title = The title of the dialog
175 	 */
176 	public static ResponseType yesNoCancel(string message, string title)
177 	{
178 		return yesNoCancel(null, message, title);
179 	}
180 	
181 	/**
182 	 * Create an 'yes', 'no' or 'cancel' popup dialog.
183 	 * Params:
184 	 *  parent = The parent window of this popup dialog
185 	 *  message = The message to show on the dialog
186 	 *  title = The title of the dialog
187 	 */
188 	public static ResponseType yesNoCancel(Window parent, string message, string title)
189 	{
190 		MessageDialog d = new MessageDialog(
191 		parent, cast(GtkDialogFlags)0,
192 		MessageType.QUESTION,
193 		ButtonsType.NONE ,
194 		message);
195 		d.setTitle(title);
196 		d.addButton("gtk-no",ResponseType.NO);
197 		d.addButton("gtk-yes",ResponseType.YES);
198 		d.addButton("gtk-cancel",ResponseType.CANCEL);
199 		ResponseType responce = cast(ResponseType)d.run();
200 		d.destroy();
201 		return responce;
202 	}
203 	
204 	/**
205 	 */
206 }