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 module gtk.PopupBox;
26 
27 private import gtk.MessageDialog;
28 private import gtk.Window;
29 private import gtkc.gtk;
30 public  import gtkc.gtktypes;
31 
32 
33 /** */
34 public struct PopupBox
35 {
36 	/**
37 	 * Create an information popup dialog.
38 	 * Params:
39 	 *  message = The message to show on the dialog
40 	 *  title = The title of the dialog
41 	 */
42 	public static void information(string message, string title)
43 	{
44 		information(null, message, title);
45 	}
46 	
47 	/**
48 	 * Create an information popup dialog.
49 	 * Params:
50 	 *  parent = The parent window of this popup dialog
51 	 *  message = The message to show on the dialog
52 	 *  title = The title of the dialog
53 	 */
54 	public static void information(Window parent, string message, string title)
55 	{
56 		MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0,
57 		MessageType.INFO,
58 		ButtonsType.OK ,
59 		message);
60 		d.setTitle(title);
61 		//d.addButton("gtk-dialog-info",GtkResponseType.GTK_RESPONSE_OK);
62 		d.run();
63 		d.destroy();
64 	}
65 	
66 	
67 	/**
68 	 * Create an error popup dialog.
69 	 * Params:
70 	 *  message = The message to show on the dialog
71 	 *  title = The title of the dialog
72 	 */
73 	public static void error(string message, string title)
74 	{
75 		error(null, message, title);
76 	}
77 	
78 	/**
79 	 * Create an error popup dialog.
80 	 * Params:
81 	 *  parent = The parent window of this popup dialog
82 	 *  message = The message to show on the dialog
83 	 *  title = The title of the dialog
84 	 */
85 	public static void error(Window parent, string message, string title)
86 	{
87 		MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0,
88 		MessageType.ERROR,
89 		ButtonsType.CANCEL ,
90 		message);
91 		d.setTitle(title);
92 		//d.addButton("gtk-dialog-error",ResponseType.GTK_RESPONSE_CANCEL);
93 		d.run();
94 		d.destroy();
95 	}
96 	
97 	
98 	
99 	/**
100 	 * Create an 'yes' or 'no' popup dialog.
101 	 * Params:
102 	 *  message = The message to show on the dialog
103 	 *  title = The title of the dialog
104 	 */
105 	public static bool yesNo(string message, string title)
106 	{
107 		return yesNo(null, message, title);
108 	}
109 	
110 	/**
111 	 * Create an 'yes' or 'no' popup dialog.
112 	 * Params:
113 	 *  parent = The parent window of this popup dialog
114 	 *  message = The message to show on the dialog
115 	 *  title = The title of the dialog
116 	 */
117 	public static bool yesNo(Window parent, string message, string title)
118 	{
119 		MessageDialog d = new MessageDialog(
120 			parent, cast(GtkDialogFlags)0,
121 			MessageType.QUESTION,
122 			ButtonsType.NONE,
123 			message);
124 		d.setTitle(title);
125 		d.addButton("gtk-no",ResponseType.NO);
126 		d.addButton("gtk-yes",ResponseType.YES);
127 		int responce = d.run();
128 		d.destroy();
129 		return responce == ResponseType.YES;
130 	}
131 	
132 	
133 	/**
134 	 * Create an 'yes', 'no' or 'cancel' popup dialog.
135 	 * Params:
136 	 *  message = The message to show on the dialog
137 	 *  title = The title of the dialog
138 	 */
139 	public static ResponseType yesNoCancel(string message, string title)
140 	{
141 		return yesNoCancel(null, message, title);
142 	}
143 	
144 	/**
145 	 * Create an 'yes', 'no' or 'cancel' popup dialog.
146 	 * Params:
147 	 *  parent = The parent window of this popup dialog
148 	 *  message = The message to show on the dialog
149 	 *  title = The title of the dialog
150 	 */
151 	public static ResponseType yesNoCancel(Window parent, string message, string title)
152 	{
153 		MessageDialog d = new MessageDialog(
154 			parent, cast(GtkDialogFlags)0,
155 			MessageType.QUESTION,
156 			ButtonsType.NONE ,
157 			message);
158 		d.setTitle(title);
159 		d.addButton("gtk-no",ResponseType.NO);
160 		d.addButton("gtk-yes",ResponseType.YES);
161 		d.addButton("gtk-cancel",ResponseType.CANCEL);
162 		ResponseType responce = cast(ResponseType)d.run();
163 		d.destroy();
164 		return responce;
165 	}
166 
167 	/**
168 	 */
169 }