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 private import gtk.MessageDialog;; 62 private import gtk.Window;; 63 64 65 66 /** 67 */ 68 public class PopupBox 69 { 70 71 /** 72 * Create an information popup dialog. 73 * Params: 74 * message = The message to show on the dialog 75 * title = The title of the dialog 76 */ 77 public static void information(string message, string title) 78 { 79 information(null, message, title); 80 } 81 82 /** 83 * Create an information popup dialog. 84 * Params: 85 * parent = The parent window of this popup dialog 86 * message = The message to show on the dialog 87 * title = The title of the dialog 88 */ 89 public static void information(Window parent, string message, string title) 90 { 91 MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0, 92 MessageType.INFO, 93 ButtonsType.OK , 94 message); 95 d.setTitle(title); 96 //d.addButton("gtk-dialog-info",GtkResponseType.GTK_RESPONSE_OK); 97 d.run(); 98 d.destroy(); 99 } 100 101 102 /** 103 * Create an error popup dialog. 104 * Params: 105 * message = The message to show on the dialog 106 * title = The title of the dialog 107 */ 108 public static void error(string message, string title) 109 { 110 error(null, message, title); 111 } 112 113 /** 114 * Create an error popup dialog. 115 * Params: 116 * parent = The parent window of this popup dialog 117 * message = The message to show on the dialog 118 * title = The title of the dialog 119 */ 120 public static void error(Window parent, string message, string title) 121 { 122 MessageDialog d = new MessageDialog(parent, cast(GtkDialogFlags)0, 123 MessageType.ERROR, 124 ButtonsType.CANCEL , 125 message); 126 d.setTitle(title); 127 //d.addButton("gtk-dialog-error",ResponseType.GTK_RESPONSE_CANCEL); 128 d.run(); 129 d.destroy(); 130 } 131 132 133 134 /** 135 * Create an 'yes' or 'no' popup dialog. 136 * Params: 137 * message = The message to show on the dialog 138 * title = The title of the dialog 139 */ 140 public static bool yesNo(string message, string title) 141 { 142 return yesNo(null, message, title); 143 } 144 145 /** 146 * Create an 'yes' or 'no' 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 bool yesNo(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 int responce = d.run(); 163 d.destroy(); 164 return responce == ResponseType.YES; 165 } 166 167 168 /** 169 * Create an 'yes', 'no' or 'cancel' popup dialog. 170 * Params: 171 * message = The message to show on the dialog 172 * title = The title of the dialog 173 */ 174 public static ResponseType yesNoCancel(string message, string title) 175 { 176 return yesNoCancel(null, message, title); 177 } 178 179 /** 180 * Create an 'yes', 'no' or 'cancel' popup dialog. 181 * Params: 182 * parent = The parent window of this popup dialog 183 * message = The message to show on the dialog 184 * title = The title of the dialog 185 */ 186 public static ResponseType yesNoCancel(Window parent, string message, string title) 187 { 188 MessageDialog d = new MessageDialog( 189 parent, cast(GtkDialogFlags)0, 190 MessageType.QUESTION, 191 ButtonsType.NONE , 192 message); 193 d.setTitle(title); 194 d.addButton("gtk-no",ResponseType.NO); 195 d.addButton("gtk-yes",ResponseType.YES); 196 d.addButton("gtk-cancel",ResponseType.CANCEL); 197 ResponseType responce = cast(ResponseType)d.run(); 198 d.destroy(); 199 return responce; 200 } 201 202 /** 203 */ 204 }