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