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.FileChooserWidget; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.Signals; 31 private import gtk.FileChooserIF; 32 private import gtk.FileChooserT; 33 private import gtk.Widget; 34 private import gtk.c.functions; 35 public import gtk.c.types; 36 private import std.algorithm; 37 38 39 /** 40 * `GtkFileChooserWidget` is a widget for choosing files. 41 * 42 * It exposes the [iface@Gtk.FileChooser] interface, and you should 43 * use the methods of this interface to interact with the 44 * widget. 45 * 46 * # CSS nodes 47 * 48 * `GtkFileChooserWidget` has a single CSS node with name filechooser. 49 */ 50 public class FileChooserWidget : Widget, FileChooserIF 51 { 52 /** the main Gtk struct */ 53 protected GtkFileChooserWidget* gtkFileChooserWidget; 54 55 /** Get the main Gtk struct */ 56 public GtkFileChooserWidget* getFileChooserWidgetStruct(bool transferOwnership = false) 57 { 58 if (transferOwnership) 59 ownedRef = false; 60 return gtkFileChooserWidget; 61 } 62 63 /** the main Gtk struct as a void* */ 64 protected override void* getStruct() 65 { 66 return cast(void*)gtkFileChooserWidget; 67 } 68 69 /** 70 * Sets our main struct and passes it to the parent class. 71 */ 72 public this (GtkFileChooserWidget* gtkFileChooserWidget, bool ownedRef = false) 73 { 74 this.gtkFileChooserWidget = gtkFileChooserWidget; 75 super(cast(GtkWidget*)gtkFileChooserWidget, ownedRef); 76 } 77 78 // add the FileChooser capabilities 79 mixin FileChooserT!(GtkFileChooserWidget); 80 81 82 /** */ 83 public static GType getType() 84 { 85 return gtk_file_chooser_widget_get_type(); 86 } 87 88 /** 89 * Creates a new `GtkFileChooserWidget`. 90 * 91 * This is a file chooser widget that can be embedded in custom 92 * windows, and it is the same widget that is used by 93 * `GtkFileChooserDialog`. 94 * 95 * Params: 96 * action = Open or save mode for the widget 97 * 98 * Returns: a new `GtkFileChooserWidget` 99 * 100 * Throws: ConstructionException GTK+ fails to create the object. 101 */ 102 public this(GtkFileChooserAction action) 103 { 104 auto __p = gtk_file_chooser_widget_new(action); 105 106 if(__p is null) 107 { 108 throw new ConstructionException("null returned by new"); 109 } 110 111 this(cast(GtkFileChooserWidget*) __p); 112 } 113 114 /** 115 * Emitted when the user asks for it. 116 * 117 * This is a [keybinding signal](class.SignalAction.html). 118 * 119 * This is used to make the file chooser show the user's Desktop 120 * folder in the file list. 121 * 122 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>. 123 */ 124 gulong addOnDesktopFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 125 { 126 return Signals.connect(this, "desktop-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 127 } 128 129 /** 130 * Emitted when the user asks for it. 131 * 132 * This is a [keybinding signal](class.SignalAction.html). 133 * 134 * This is used to make the file chooser go to a child of the 135 * current folder in the file hierarchy. The subfolder that will 136 * be used is displayed in the path bar widget of the file chooser. 137 * For example, if the path bar is showing "/foo/bar/baz", with bar 138 * currently displayed, then this will cause the file chooser to 139 * switch to the "baz" subfolder. 140 * 141 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>. 142 */ 143 gulong addOnDownFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 144 { 145 return Signals.connect(this, "down-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 146 } 147 148 /** 149 * Emitted when the user asks for it. 150 * 151 * This is a [keybinding signal](class.SignalAction.html). 152 * 153 * This is used to make the file chooser show the user's home 154 * folder in the file list. 155 * 156 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>. 157 */ 158 gulong addOnHomeFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 159 { 160 return Signals.connect(this, "home-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 161 } 162 163 /** 164 * Emitted when the user asks for it. 165 * 166 * This is a [keybinding signal](class.SignalAction.html). 167 * 168 * This is used to make the file chooser show a "Location" prompt which 169 * the user can use to manually type the name of the file he wishes to select. 170 * 171 * The default bindings for this signal are <kbd>Control</kbd>-<kbd>L</kbd> 172 * with a @path string of "" (the empty string). It is also bound to 173 * <kbd>/</kbd> with a @path string of "`/`" (a slash): this lets you 174 * type `/` and immediately type a path name. On Unix systems, this is 175 * bound to <kbd>~</kbd> (tilde) with a @path string of "~" itself for 176 * access to home directories. 177 * 178 * Params: 179 * path = a string that gets put in the text entry for the file name 180 */ 181 gulong addOnLocationPopup(void delegate(string, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 182 { 183 return Signals.connect(this, "location-popup", dlg, connectFlags ^ ConnectFlags.SWAPPED); 184 } 185 186 /** 187 * Emitted when the user asks for it. 188 * 189 * This is a [keybinding signal](class.SignalAction.html). 190 * 191 * This is used to make the file chooser show a "Location" prompt 192 * when the user pastes into a `GtkFileChooserWidget`. 193 * 194 * The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>. 195 */ 196 gulong addOnLocationPopupOnPaste(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 197 { 198 return Signals.connect(this, "location-popup-on-paste", dlg, connectFlags ^ ConnectFlags.SWAPPED); 199 } 200 201 /** 202 * Emitted when the user asks for it. 203 * 204 * This is a [keybinding signal](class.SignalAction.html). 205 * 206 * This is used to toggle the visibility of a "Location" prompt 207 * which the user can use to manually type the name of the file 208 * he wishes to select. 209 * 210 * The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>. 211 */ 212 gulong addOnLocationTogglePopup(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 213 { 214 return Signals.connect(this, "location-toggle-popup", dlg, connectFlags ^ ConnectFlags.SWAPPED); 215 } 216 217 /** 218 * Emitted when the user asks for it. 219 * 220 * This is a [keybinding signal](class.SignalAction.html). 221 * 222 * This is used to move the focus to the places sidebar. 223 * 224 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>. 225 */ 226 gulong addOnPlacesShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 227 { 228 return Signals.connect(this, "places-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED); 229 } 230 231 /** 232 * Emitted when the user asks for it. 233 * 234 * This is a [keybinding signal](class.SignalAction.html). 235 * 236 * This is used to make the file chooser switch to the bookmark 237 * specified in the @bookmark_index parameter. For example, if 238 * you have three bookmarks, you can pass 0, 1, 2 to this signal 239 * to switch to each of them, respectively. 240 * 241 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>1</kbd>, 242 * <kbd>Alt</kbd>-<kbd>2</kbd>, etc. until <kbd>Alt</kbd>-<kbd>0</kbd>. 243 * Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is 244 * actually defined to switch to the bookmark at index 0, and so on 245 * successively. 246 * 247 * Params: 248 * bookmarkIndex = the number of the bookmark to switch to 249 */ 250 gulong addOnQuickBookmark(void delegate(int, FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 251 { 252 return Signals.connect(this, "quick-bookmark", dlg, connectFlags ^ ConnectFlags.SWAPPED); 253 } 254 255 /** 256 * Emitted when the user asks for it. 257 * 258 * This is a [keybinding signal](class.SignalAction.html). 259 * 260 * This is used to make the file chooser show the Recent location. 261 * 262 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>. 263 */ 264 gulong addOnRecentShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 265 { 266 return Signals.connect(this, "recent-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED); 267 } 268 269 /** 270 * Emitted when the user asks for it. 271 * 272 * This is a [keybinding signal](class.SignalAction.html). 273 * 274 * This is used to make the file chooser show the search entry. 275 * 276 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>. 277 */ 278 gulong addOnSearchShortcut(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 279 { 280 return Signals.connect(this, "search-shortcut", dlg, connectFlags ^ ConnectFlags.SWAPPED); 281 } 282 283 /** 284 * Emitted when the user asks for it. 285 * 286 * This is a [keybinding signal](class.SignalAction.html). 287 * 288 * This is used to make the file chooser display hidden files. 289 * 290 * The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>. 291 */ 292 gulong addOnShowHidden(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 293 { 294 return Signals.connect(this, "show-hidden", dlg, connectFlags ^ ConnectFlags.SWAPPED); 295 } 296 297 /** 298 * Emitted when the user asks for it. 299 * 300 * This is a [keybinding signal](class.SignalAction.html). 301 * 302 * This is used to make the file chooser go to the parent 303 * of the current folder in the file hierarchy. 304 * 305 * The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>. 306 */ 307 gulong addOnUpFolder(void delegate(FileChooserWidget) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 308 { 309 return Signals.connect(this, "up-folder", dlg, connectFlags ^ ConnectFlags.SWAPPED); 310 } 311 }