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