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