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.RecentChooserDialog; 26 27 private import glib.ConstructionException; 28 private import gtk.Dialog; 29 private import gtk.RecentChooserIF; 30 private import gtk.RecentChooserT; 31 private import gtk.RecentManager; 32 private import gtk.Window; 33 private import gtk.c.functions; 34 public import gtk.c.types; 35 public import gtkc.gtktypes; 36 37 38 /** 39 * #GtkRecentChooserDialog is a dialog box suitable for displaying the recently 40 * used documents. This widgets works by putting a #GtkRecentChooserWidget inside 41 * a #GtkDialog. It exposes the #GtkRecentChooserIface interface, so you can use 42 * all the #GtkRecentChooser functions on the recent chooser dialog as well as 43 * those for #GtkDialog. 44 * 45 * Note that #GtkRecentChooserDialog does not have any methods of its own. 46 * Instead, you should use the functions that work on a #GtkRecentChooser. 47 * 48 * ## Typical usage ## {#gtkrecentchooser-typical-usage} 49 * 50 * In the simplest of cases, you can use the following code to use 51 * a #GtkRecentChooserDialog to select a recently used file: 52 * 53 * |[<!-- language="C" --> 54 * GtkWidget *dialog; 55 * gint res; 56 * 57 * dialog = gtk_recent_chooser_dialog_new ("Recent Documents", 58 * parent_window, 59 * _("_Cancel"), 60 * GTK_RESPONSE_CANCEL, 61 * _("_Open"), 62 * GTK_RESPONSE_ACCEPT, 63 * NULL); 64 * 65 * res = gtk_dialog_run (GTK_DIALOG (dialog)); 66 * if (res == GTK_RESPONSE_ACCEPT) 67 * { 68 * GtkRecentInfo *info; 69 * GtkRecentChooser *chooser = GTK_RECENT_CHOOSER (dialog); 70 * 71 * info = gtk_recent_chooser_get_current_item (chooser); 72 * open_file (gtk_recent_info_get_uri (info)); 73 * gtk_recent_info_unref (info); 74 * } 75 * 76 * gtk_widget_destroy (dialog); 77 * ]| 78 * 79 * Recently used files are supported since GTK+ 2.10. 80 */ 81 public class RecentChooserDialog : Dialog, RecentChooserIF 82 { 83 /** the main Gtk struct */ 84 protected GtkRecentChooserDialog* gtkRecentChooserDialog; 85 86 /** Get the main Gtk struct */ 87 public GtkRecentChooserDialog* getRecentChooserDialogStruct(bool transferOwnership = false) 88 { 89 if (transferOwnership) 90 ownedRef = false; 91 return gtkRecentChooserDialog; 92 } 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gtkRecentChooserDialog; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class. 102 */ 103 public this (GtkRecentChooserDialog* gtkRecentChooserDialog, bool ownedRef = false) 104 { 105 this.gtkRecentChooserDialog = gtkRecentChooserDialog; 106 super(cast(GtkDialog*)gtkRecentChooserDialog, ownedRef); 107 } 108 109 // add the RecentChooser capabilities 110 mixin RecentChooserT!(GtkRecentChooserDialog); 111 112 /** 113 * Creates a new GtkRecentChooserDialog with a specified recent manager. 114 * This is useful if you have implemented your own recent manager, or if you 115 * have a customized instance of a GtkRecentManager object. 116 * Since 2.10 117 * Params: 118 * title = Title of the dialog, or null 119 * parent = Transient parent of the dialog, or null, 120 * manager = a GtkRecentManager, or null 121 * buttonsText = text to go in the buttons 122 * responses = response ID's for the buttons 123 * Throws: ConstructionException GTK+ fails to create the object. 124 */ 125 public this (string title, Window parent, RecentManager manager, string[] buttonsText=null, ResponseType[] responses=null ) 126 { 127 // GtkWidget* gtk_recent_chooser_dialog_new_for_manager (const gchar *title, GtkWindow *parent, GtkRecentManager *manager, const gchar *first_button_text, ...); 128 auto p = gtk_recent_chooser_dialog_new_for_manager(Str.toStringz(title), (parent is null) ? null : parent.getWindowStruct(), (manager is null) ? null : manager.getRecentManagerStruct(), null); 129 if(p is null) 130 { 131 throw new ConstructionException("null returned by gtk_recent_chooser_dialog_new_for_manager"); 132 } 133 this(cast(GtkRecentChooserDialog*) p); 134 addButtons(buttonsText, responses); 135 } 136 137 /** 138 * Creates a new GtkRecentChooserDialog with a specified recent manager. 139 * This is useful if you have implemented your own recent manager, or if you 140 * have a customized instance of a GtkRecentManager object. 141 * Since 2.10 142 * Params: 143 * title = Title of the dialog, or null 144 * parent = Transient parent of the dialog, or null, 145 * manager = a GtkRecentManager, or null 146 * stockIDs = stockIDs of the buttons 147 * responses = response ID's for the buttons 148 * Throws: ConstructionException GTK+ fails to create the object. 149 */ 150 public this (string title, Window parent, RecentManager manager, StockID[] stockIDs, ResponseType[] responses=null ) 151 { 152 // GtkWidget* gtk_recent_chooser_dialog_new_for_manager (const gchar *title, GtkWindow *parent, GtkRecentManager *manager, const gchar *first_button_text, ...); 153 auto p = gtk_recent_chooser_dialog_new_for_manager(Str.toStringz(title), (parent is null) ? null : parent.getWindowStruct(), (manager is null) ? null : manager.getRecentManagerStruct(), null); 154 if(p is null) 155 { 156 throw new ConstructionException("null returned by gtk_recent_chooser_dialog_new_for_manager"); 157 } 158 this(cast(GtkRecentChooserDialog*) p); 159 addButtons(stockIDs, responses); 160 } 161 162 /** 163 */ 164 165 /** */ 166 public static GType getType() 167 { 168 return gtk_recent_chooser_dialog_get_type(); 169 } 170 }