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 protected override void setStruct(GObject* obj) 101 { 102 gtkRecentChooserDialog = cast(GtkRecentChooserDialog*)obj; 103 super.setStruct(obj); 104 } 105 106 /** 107 * Sets our main struct and passes it to the parent class. 108 */ 109 public this (GtkRecentChooserDialog* gtkRecentChooserDialog, bool ownedRef = false) 110 { 111 this.gtkRecentChooserDialog = gtkRecentChooserDialog; 112 super(cast(GtkDialog*)gtkRecentChooserDialog, ownedRef); 113 } 114 115 // add the RecentChooser capabilities 116 mixin RecentChooserT!(GtkRecentChooserDialog); 117 118 /** 119 * Creates a new GtkRecentChooserDialog with a specified recent manager. 120 * This is useful if you have implemented your own recent manager, or if you 121 * have a customized instance of a GtkRecentManager object. 122 * Since 2.10 123 * Params: 124 * title = Title of the dialog, or null 125 * parent = Transient parent of the dialog, or null, 126 * manager = a GtkRecentManager, or null 127 * buttonsText = text to go in the buttons 128 * responses = response ID's for the buttons 129 * Throws: ConstructionException GTK+ fails to create the object. 130 */ 131 public this (string title, Window parent, RecentManager manager, string[] buttonsText=null, ResponseType[] responses=null ) 132 { 133 // GtkWidget* gtk_recent_chooser_dialog_new_for_manager (const gchar *title, GtkWindow *parent, GtkRecentManager *manager, const gchar *first_button_text, ...); 134 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); 135 if(p is null) 136 { 137 throw new ConstructionException("null returned by gtk_recent_chooser_dialog_new_for_manager"); 138 } 139 this(cast(GtkRecentChooserDialog*) p); 140 addButtons(buttonsText, responses); 141 } 142 143 /** 144 * Creates a new GtkRecentChooserDialog with a specified recent manager. 145 * This is useful if you have implemented your own recent manager, or if you 146 * have a customized instance of a GtkRecentManager object. 147 * Since 2.10 148 * Params: 149 * title = Title of the dialog, or null 150 * parent = Transient parent of the dialog, or null, 151 * manager = a GtkRecentManager, or null 152 * stockIDs = stockIDs of the buttons 153 * responses = response ID's for the buttons 154 * Throws: ConstructionException GTK+ fails to create the object. 155 */ 156 public this (string title, Window parent, RecentManager manager, StockID[] stockIDs, ResponseType[] responses=null ) 157 { 158 // GtkWidget* gtk_recent_chooser_dialog_new_for_manager (const gchar *title, GtkWindow *parent, GtkRecentManager *manager, const gchar *first_button_text, ...); 159 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); 160 if(p is null) 161 { 162 throw new ConstructionException("null returned by gtk_recent_chooser_dialog_new_for_manager"); 163 } 164 this(cast(GtkRecentChooserDialog*) p); 165 addButtons(stockIDs, responses); 166 } 167 168 /** 169 */ 170 171 /** */ 172 public static GType getType() 173 { 174 return gtk_recent_chooser_dialog_get_type(); 175 } 176 }