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