1 // Generated by gmmproc 2.60.0 -- DO NOT MODIFY! 2 #ifndef _GTKMM_FILECHOOSER_H 3 #define _GTKMM_FILECHOOSER_H 4 5 6 #include <glibmm/ustring.h> 7 #include <sigc++/sigc++.h> 8 9 /* Copyright (C) 2003 The gtkmm Development Team 10 * 11 * This library is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public 13 * License as published by the Free Software Foundation; either 14 * version 2.1 of the License, or (at your option) any later version. 15 * 16 * This library is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with this library; if not, write to the Free Software 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 */ 25 26 #include <vector> 27 28 #include <gtkmm/widget.h> 29 #include <gtkmm/filefilter.h> 30 #include <giomm/file.h> 31 32 33 #ifndef DOXYGEN_SHOULD_SKIP_THIS 34 using GtkFileChooser = struct _GtkFileChooser; 35 using GtkFileChooserClass = struct _GtkFileChooserClass; 36 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 37 38 39 #ifndef DOXYGEN_SHOULD_SKIP_THIS 40 namespace Gtk 41 { class FileChooser_Class; } // namespace Gtk 42 #endif // DOXYGEN_SHOULD_SKIP_THIS 43 44 namespace Gtk 45 { 46 47 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ 48 49 /** 50 * @var FileChooserAction FILE_CHOOSER_ACTION_OPEN 51 * Indicates open mode. The file chooser 52 * will only let the user pick an existing file. 53 * 54 * @var FileChooserAction FILE_CHOOSER_ACTION_SAVE 55 * Indicates save mode. The file chooser 56 * will let the user pick an existing file, or type in a new 57 * filename. 58 * 59 * @var FileChooserAction FILE_CHOOSER_ACTION_SELECT_FOLDER 60 * Indicates an Open mode for 61 * selecting folders. The file chooser will let the user pick an 62 * existing folder. 63 * 64 * @var FileChooserAction FILE_CHOOSER_ACTION_CREATE_FOLDER 65 * Indicates a mode for creating a 66 * new folder. The file chooser will let the user name an existing or 67 * new folder. 68 * 69 * @enum FileChooserAction 70 * 71 * Describes whether a Gtk::FileChooser is being used to open existing files 72 * or to save to a possibly new file. 73 * 74 * @ingroup gtkmmEnums 75 */ 76 enum FileChooserAction 77 { 78 FILE_CHOOSER_ACTION_OPEN, 79 FILE_CHOOSER_ACTION_SAVE, 80 FILE_CHOOSER_ACTION_SELECT_FOLDER, 81 FILE_CHOOSER_ACTION_CREATE_FOLDER 82 }; 83 84 } // namespace Gtk 85 86 #ifndef DOXYGEN_SHOULD_SKIP_THIS 87 namespace Glib 88 { 89 90 template <> 91 class Value<Gtk::FileChooserAction> : public Glib::Value_Enum<Gtk::FileChooserAction> 92 { 93 public: 94 static GType value_type() G_GNUC_CONST; 95 }; 96 97 } // namespace Glib 98 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 99 100 namespace Gtk 101 { 102 103 /** 104 * @var FileChooserConfirmation FILE_CHOOSER_CONFIRMATION_CONFIRM 105 * The file chooser will present 106 * its stock dialog to confirm about overwriting an existing file. 107 * 108 * @var FileChooserConfirmation FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME 109 * The file chooser will 110 * terminate and accept the user’s choice of a file name. 111 * 112 * @var FileChooserConfirmation FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN 113 * The file chooser will 114 * continue running, so as to let the user select another file name. 115 * 116 * @enum FileChooserConfirmation 117 * 118 * Used as a return value of handlers for the 119 * Gtk::FileChooser::signal_confirm_overwrite() signal of a Gtk::FileChooser. This 120 * value determines whether the file chooser will present the stock 121 * confirmation dialog, accept the user’s choice of a filename, or 122 * let the user choose another filename. 123 * 124 * @newin{2,8} 125 * 126 * @ingroup gtkmmEnums 127 */ 128 enum FileChooserConfirmation 129 { 130 FILE_CHOOSER_CONFIRMATION_CONFIRM, 131 FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME, 132 FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN 133 }; 134 135 } // namespace Gtk 136 137 #ifndef DOXYGEN_SHOULD_SKIP_THIS 138 namespace Glib 139 { 140 141 template <> 142 class Value<Gtk::FileChooserConfirmation> : public Glib::Value_Enum<Gtk::FileChooserConfirmation> 143 { 144 public: 145 static GType value_type() G_GNUC_CONST; 146 }; 147 148 } // namespace Glib 149 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 150 151 namespace Gtk 152 { 153 154 155 //Note that GTK_FILE_SYSTEM_ERROR is not currently public GTK+ API and should 156 //never be instantiated by the GTK+ C API. 157 158 /** %Exception class for Gdk::FileChooser errors. 159 */ 160 class FileChooserError : public Glib::Error 161 { 162 public: 163 /** @var Code NONEXISTENT 164 * Indicates that a file does not exist. 165 * 166 * @var Code BAD_FILENAME 167 * Indicates a malformed filename. 168 * 169 * @var Code ALREADY_EXISTS 170 * Indicates a duplicate path (e.g. when 171 * adding a bookmark). 172 * 173 * @var Code INCOMPLETE_HOSTNAME 174 * Indicates an incomplete hostname (e.g. "http://foo" without a slash after that). 175 * 176 * @enum Code 177 * 178 * These identify the various errors that can occur while calling 179 * Gtk::FileChooser functions. 180 */ 181 enum Code 182 { 183 NONEXISTENT, 184 BAD_FILENAME, 185 ALREADY_EXISTS, 186 INCOMPLETE_HOSTNAME 187 }; 188 189 FileChooserError(Code error_code, const Glib::ustring& error_message); 190 explicit FileChooserError(GError* gobject); 191 Code code() const; 192 193 #ifndef DOXYGEN_SHOULD_SKIP_THIS 194 private: 195 196 static void throw_func(GError* gobject); 197 198 friend void wrap_init(); // uses throw_func() 199 200 #endif //DOXYGEN_SHOULD_SKIP_THIS 201 }; 202 203 } // namespace Gtk 204 205 #ifndef DOXYGEN_SHOULD_SKIP_THIS 206 namespace Glib 207 { 208 209 template <> 210 class Value<Gtk::FileChooserError::Code> : public Glib::Value_Enum<Gtk::FileChooserError::Code> 211 { 212 public: 213 static GType value_type() G_GNUC_CONST; 214 }; 215 216 } // namespace Glib 217 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 218 219 namespace Gtk 220 { 221 222 223 /** 224 * Gtk::FileChooser is an interface that can be implemented by file selection 225 * widgets. In gtkmm, the main objects that implement this interface are 226 * FileChooserWidget and FileChooserDialog. You do not need to write an 227 * object that implements the FileChooser interface unless you are trying to 228 * adapt an existing file selector to expose a standard programming interface. 229 * 230 * @par File Names and Encodings 231 * When the user is finished selecting files in a FileChooser, your program 232 * can get the selected names either as filenames or as URIs. For URIs, the 233 * normal escaping rules are applied if the URI contains non-ASCII characters. 234 * However, filenames are always returned in the character set specified by the 235 * G_FILENAME_ENCODING environment variable. Please see the Glib documentation 236 * for more details about this variable. 237 * 238 * @par Important 239 * This means that while you can pass the result of FileChooser::get_filename() 240 * to <tt>open(2)</tt> or <tt>fopen(3)</tt>, you may not be able to directly 241 * set it as the text of a Gtk::Label widget unless you convert it first to 242 * UTF-8, which all gtkmm widgets expect. You should use 243 * Glib::filename_to_utf8() to convert filenames into strings that can be 244 * passed to gtkmm widgets. 245 */ 246 247 class FileChooser : public Glib::Interface 248 { 249 250 #ifndef DOXYGEN_SHOULD_SKIP_THIS 251 252 public: 253 using CppObjectType = FileChooser; 254 using CppClassType = FileChooser_Class; 255 using BaseObjectType = GtkFileChooser; 256 using BaseClassType = GtkFileChooserClass; 257 258 // noncopyable 259 FileChooser(const FileChooser&) = delete; 260 FileChooser& operator=(const FileChooser&) = delete; 261 262 private: 263 friend class FileChooser_Class; 264 static CppClassType filechooser_class_; 265 266 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 267 protected: 268 /** 269 * You should derive from this class to use it. 270 */ 271 FileChooser(); 272 273 #ifndef DOXYGEN_SHOULD_SKIP_THIS 274 /** Called by constructors of derived classes. Provide the result of 275 * the Class init() function to ensure that it is properly 276 * initialized. 277 * 278 * @param interface_class The Class object for the derived type. 279 */ 280 explicit FileChooser(const Glib::Interface_Class& interface_class); 281 282 public: 283 // This is public so that C++ wrapper instances can be 284 // created for C instances of unwrapped types. 285 // For instance, if an unexpected C type implements the C interface. 286 explicit FileChooser(GtkFileChooser* castitem); 287 288 protected: 289 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 290 291 public: 292 293 FileChooser(FileChooser&& src) noexcept; 294 FileChooser& operator=(FileChooser&& src) noexcept; 295 296 ~FileChooser() noexcept override; 297 298 static void add_interface(GType gtype_implementer); 299 300 /** Get the GType for this class, for use with the underlying GObject type system. 301 */ 302 static GType get_type() G_GNUC_CONST; 303 304 #ifndef DOXYGEN_SHOULD_SKIP_THIS 305 static GType get_base_type() G_GNUC_CONST; 306 #endif 307 308 ///Provides access to the underlying C GObject. gobj()309 GtkFileChooser* gobj() { return reinterpret_cast<GtkFileChooser*>(gobject_); } 310 311 ///Provides access to the underlying C GObject. gobj()312 const GtkFileChooser* gobj() const { return reinterpret_cast<GtkFileChooser*>(gobject_); } 313 314 private: 315 316 public: 317 318 319 /** Sets the type of operation that the chooser is performing; the 320 * user interface is adapted to suit the selected action. For example, 321 * an option to create a new folder might be shown if the action is 322 * Gtk::FILE_CHOOSER_ACTION_SAVE but not if the action is 323 * Gtk::FILE_CHOOSER_ACTION_OPEN. 324 * 325 * @newin{2,4} 326 * 327 * @param action The action that the file selector is performing. 328 */ 329 void set_action(FileChooserAction action); 330 331 /** Gets the type of operation that the file chooser is performing; see 332 * set_action(). 333 * 334 * @newin{2,4} 335 * 336 * @return The action that the file selector is performing. 337 */ 338 FileChooserAction get_action() const; 339 340 /** Sets whether only local files can be selected in the 341 * file selector. If @a local_only is <tt>true</tt> (the default), 342 * then the selected file or files are guaranteed to be 343 * accessible through the operating systems native file 344 * system and therefore the application only 345 * needs to worry about the filename functions in 346 * Gtk::FileChooser, like get_filename(), 347 * rather than the URI functions like 348 * get_uri(), 349 * 350 * On some systems non-native files may still be 351 * available using the native filesystem via a userspace 352 * filesystem (FUSE). 353 * 354 * @newin{2,4} 355 * 356 * @param local_only <tt>true</tt> if only local files can be selected. 357 */ 358 void set_local_only(bool local_only = true); 359 360 /** Gets whether only local files can be selected in the 361 * file selector. See set_local_only() 362 * 363 * @newin{2,4} 364 * 365 * @return <tt>true</tt> if only local files can be selected. 366 */ 367 bool get_local_only() const; 368 369 /** Sets whether multiple files can be selected in the file selector. This is 370 * only relevant if the action is set to be Gtk::FILE_CHOOSER_ACTION_OPEN or 371 * Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER. 372 * 373 * @newin{2,4} 374 * 375 * @param select_multiple <tt>true</tt> if multiple files can be selected. 376 */ 377 void set_select_multiple(bool select_multiple = true); 378 379 /** Gets whether multiple files can be selected in the file 380 * selector. See set_select_multiple(). 381 * 382 * @newin{2,4} 383 * 384 * @return <tt>true</tt> if multiple files can be selected. 385 */ 386 bool get_select_multiple() const; 387 388 389 /** Sets whether hidden files and folders are displayed in the file selector. 390 * 391 * @newin{2,6} 392 * 393 * @param show_hidden <tt>true</tt> if hidden files and folders should be displayed. 394 */ 395 void set_show_hidden(bool show_hidden = true); 396 397 /** Gets whether hidden files and folders are displayed in the file selector. 398 * See set_show_hidden(). 399 * 400 * @newin{2,6} 401 * 402 * @return <tt>true</tt> if hidden files and folders are displayed. 403 */ 404 bool get_show_hidden() const; 405 406 407 /** Sets whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode will present 408 * a confirmation dialog if the user types a file name that already exists. This 409 * is <tt>false</tt> by default. 410 * 411 * If set to <tt>true</tt>, the @a chooser will emit the 412 * Gtk::FileChooser::signal_confirm_overwrite() signal when appropriate. 413 * 414 * If all you need is the stock confirmation dialog, set this property to <tt>true</tt>. 415 * You can override the way confirmation is done by actually handling the 416 * Gtk::FileChooser::signal_confirm_overwrite() signal; please refer to its documentation 417 * for the details. 418 * 419 * @newin{2,8} 420 * 421 * @param do_overwrite_confirmation Whether to confirm overwriting in save mode. 422 */ 423 void set_do_overwrite_confirmation(bool do_overwrite_confirmation = true); 424 425 /** Queries whether a file chooser is set to confirm for overwriting when the user 426 * types a file name that already exists. 427 * 428 * @newin{2,8} 429 * 430 * @return <tt>true</tt> if the file chooser will present a confirmation dialog; 431 * <tt>false</tt> otherwise. 432 */ 433 bool get_do_overwrite_confirmation() const; 434 435 436 /** Sets whether file choser will offer to create new folders. 437 * This is only relevant if the action is not set to be 438 * Gtk::FILE_CHOOSER_ACTION_OPEN. 439 * 440 * @newin{2,18} 441 * 442 * @param create_folders <tt>true</tt> if the Create Folder button should be displayed. 443 */ 444 void set_create_folders(bool create_folders = true); 445 446 /** Gets whether file choser will offer to create new folders. 447 * See set_create_folders(). 448 * 449 * @newin{2,18} 450 * 451 * @return <tt>true</tt> if the Create Folder button should be displayed. 452 */ 453 bool get_create_folders() const; 454 455 456 /** Sets the current name in the file selector, as if entered 457 * by the user. Note that the name passed in here is a UTF-8 458 * string rather than a filename. This function is meant for 459 * such uses as a suggested name in a “Save As...” dialog. You can 460 * pass “Untitled.doc” or a similarly suitable suggestion for the @a name. 461 * 462 * If you want to preselect a particular existing file, you should use 463 * set_filename() or set_uri() instead. 464 * Please see the documentation for those functions for an example of using 465 * set_current_name() as well. 466 * 467 * @newin{2,4} 468 * 469 * @param name The filename to use, as a UTF-8 string. 470 */ 471 void set_current_name(const Glib::ustring& name); 472 473 /** Gets the current name in the file selector, as entered by the user in the 474 * text entry for “Name”. 475 * 476 * This is meant to be used in save dialogs, to get the currently typed filename 477 * when the file itself does not exist yet. For example, an application that 478 * adds a custom extra widget to the file chooser for “file format” may want to 479 * change the extension of the typed filename based on the chosen format, say, 480 * from “.jpg” to “.png”. 481 * 482 * @newin{3,10} 483 * 484 * @return The raw text from the file chooser’s “Name” entry. Note that this string is not a full pathname or URI; it is 485 * whatever the contents of the entry are. Note also that this string is in 486 * UTF-8 encoding, which is not necessarily the system’s encoding for filenames. 487 */ 488 Glib::ustring get_current_name() const; 489 490 491 /** Gets the filename for the currently selected file in 492 * the file selector. The filename is returned as an absolute path. If 493 * multiple files are selected, one of the filenames will be returned at 494 * random. 495 * 496 * If the file chooser is in folder mode, this function returns the selected 497 * folder. 498 * 499 * @newin{2,4} 500 * 501 * @return The currently selected filename, or an empty string 502 * if no file is selected, or the selected file can't 503 * be represented with a local filename. 504 */ 505 std::string get_filename() const; 506 507 /** Sets @a filename as the current filename for the file chooser, by changing to 508 * the file’s parent folder and actually selecting the file in list; all other 509 * files will be unselected. If the @a chooser is in 510 * Gtk::FILE_CHOOSER_ACTION_SAVE mode, the file’s base name will also appear in 511 * the dialog’s file name entry. 512 * 513 * Note that the file must exist, or nothing will be done except 514 * for the directory change. 515 * 516 * You should use this function only when implementing a save 517 * dialog for which you already have a file name to which 518 * the user may save. For example, when the user opens an existing file and 519 * then does Save As... to save a copy or 520 * a modified version. If you don’t have a file name already — for 521 * example, if the user just created a new file and is saving it for the first 522 * time, do not call this function. Instead, use something similar to this: 523 * 524 * [C example ellipted] 525 * 526 * In the first case, the file chooser will present the user with useful suggestions 527 * as to where to save his new file. In the second case, the file’s existing location 528 * is already known, so the file chooser will use it. 529 * 530 * @newin{2,4} 531 * 532 * @param filename The filename to set as current. 533 * @return Not useful. 534 */ 535 bool set_filename(const std::string& filename); 536 537 /** Selects a filename. If the file name isn’t in the current 538 * folder of @a chooser, then the current folder of @a chooser will 539 * be changed to the folder containing @a filename. 540 * 541 * @newin{2,4} 542 * 543 * @param filename The filename to select. 544 * @return Not useful. 545 * 546 * See also: set_filename(). 547 */ 548 bool select_filename(const std::string& filename); 549 550 /** Unselects a currently selected filename. If the filename 551 * is not in the current directory, does not exist, or 552 * is otherwise not currently selected, does nothing. 553 * 554 * @newin{2,4} 555 * 556 * @param filename The filename to unselect. 557 */ 558 void unselect_filename(const std::string& filename); 559 560 /** Selects all the files in the current folder of a file chooser. 561 * 562 * @newin{2,4} 563 */ 564 void select_all(); 565 566 /** Unselects all the files in the current folder of a file chooser. 567 * 568 * @newin{2,4} 569 */ 570 void unselect_all(); 571 572 573 /** Lists all the selected files and subfolders in the current folder of 574 * @a chooser. The returned names are full absolute paths. If files in the current 575 * folder cannot be represented as local filenames they will be ignored. (See 576 * get_uris()) 577 * 578 * @newin{2,4} 579 * 580 * @return A list containing the filenames of all selected 581 * files and subfolders in the current folder. 582 */ 583 std::vector<std::string> get_filenames() const; 584 585 586 /** Sets the current folder for @a chooser from a local filename. 587 * The user will be shown the full contents of the current folder, 588 * plus user interface elements for navigating to other folders. 589 * 590 * In general, you should not use this function. See the 591 * [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] 592 * for the rationale behind this. 593 * 594 * @newin{2,4} 595 * 596 * @param filename The full path of the new current folder. 597 * @return Not useful. 598 */ 599 bool set_current_folder(const std::string& filename); 600 601 /** Gets the current folder of @a chooser as a local filename. 602 * See set_current_folder(). 603 * 604 * Note that this is the folder that the file chooser is currently displaying 605 * (e.g. "/home/username/Documents"), which is not the same 606 * as the currently-selected folder if the chooser is in 607 * Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER mode 608 * (e.g. "/home/username/Documents/selected-folder/". To get the 609 * currently-selected folder in that mode, use get_uri() as the 610 * usual way to get the selection. 611 * 612 * @newin{2,4} 613 * 614 * @return The full path of the current folder, possibly empty if the current 615 * path cannot be represented as a local filename. This function may also return 616 * an empty string if the file chooser was unable to load the last folder that was 617 * requested from it; for example, as would be for calling 618 * set_current_folder() on a nonexistent folder. 619 */ 620 std::string get_current_folder() const; 621 622 623 /* URI manipulation 624 */ 625 626 /** Gets the URI for the currently selected file in 627 * the file selector. If multiple files are selected, 628 * one of the filenames will be returned at random. 629 * 630 * If the file chooser is in folder mode, this function returns the selected 631 * folder. 632 * 633 * @newin{2,4} 634 * 635 * @return The currently selected URI, or an empty string 636 * if no file is selected. 637 */ 638 Glib::ustring get_uri() const; 639 640 /** Sets the file referred to by @a uri as the current file for the file chooser, 641 * by changing to the URI’s parent folder and actually selecting the URI in the 642 * list. If the @a chooser is Gtk::FILE_CHOOSER_ACTION_SAVE mode, the URI’s base 643 * name will also appear in the dialog’s file name entry. 644 * 645 * Note that the URI must exist, or nothing will be done except for the 646 * directory change. 647 * 648 * You should use this function only when implementing a save 649 * dialog for which you already have a file name to which 650 * the user may save. For example, when the user opens an existing file and then 651 * does Save As... to save a copy or a 652 * modified version. If you don’t have a file name already — for example, 653 * if the user just created a new file and is saving it for the first time, do 654 * not call this function. Instead, use something similar to this: 655 * 656 * [C example ellipted] 657 * 658 * 659 * In the first case, the file chooser will present the user with useful suggestions 660 * as to where to save his new file. In the second case, the file’s existing location 661 * is already known, so the file chooser will use it. 662 * 663 * @newin{2,4} 664 * 665 * @param uri The URI to set as current. 666 * @return Not useful. 667 */ 668 bool set_uri(const Glib::ustring& uri); 669 670 /** Selects the file to by @a uri. If the URI doesn’t refer to a 671 * file in the current folder of @a chooser, then the current folder of 672 * @a chooser will be changed to the folder containing @a filename. 673 * 674 * @newin{2,4} 675 * 676 * @param uri The URI to select. 677 * @return Not useful. 678 */ 679 bool select_uri(const Glib::ustring& uri); 680 681 /** Unselects the file referred to by @a uri. If the file 682 * is not in the current directory, does not exist, or 683 * is otherwise not currently selected, does nothing. 684 * 685 * @newin{2,4} 686 * 687 * @param uri The URI to unselect. 688 */ 689 void unselect_uri(const Glib::ustring& uri); 690 691 692 /** Lists all the selected files and subfolders in the current folder of 693 * @a chooser. The returned names are full absolute URIs. 694 * 695 * @newin{2,4} 696 * 697 * @return A list containing the URIs of all selected 698 * files and subfolders in the current folder. 699 */ 700 std::vector<Glib::ustring> get_uris() const; 701 702 703 /** Sets the current folder for @a chooser from an URI. 704 * The user will be shown the full contents of the current folder, 705 * plus user interface elements for navigating to other folders. 706 * 707 * In general, you should not use this function. See the 708 * [section on setting up a file chooser dialog][gtkfilechooserdialog-setting-up] 709 * for the rationale behind this. 710 * 711 * @newin{2,4} 712 * 713 * @param uri The URI for the new current folder. 714 * @return <tt>true</tt> if the folder could be changed successfully, <tt>false</tt> 715 * otherwise. 716 */ 717 bool set_current_folder_uri(const Glib::ustring& uri); 718 719 /** Gets the current folder of @a chooser as an URI. 720 * See set_current_folder_uri(). 721 * 722 * Note that this is the folder that the file chooser is currently displaying 723 * (e.g. "file:///home/username/Documents"), which is not the same 724 * as the currently-selected folder if the chooser is in 725 * Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER mode 726 * (e.g. "file:///home/username/Documents/selected-folder/". To get the 727 * currently-selected folder in that mode, use get_uri() as the 728 * usual way to get the selection. 729 * 730 * @newin{2,4} 731 * 732 * @return The URI for the current folder. 733 */ 734 Glib::ustring get_current_folder_uri() const; 735 736 737 /** Sets @a file as the current filename for the file chooser, by changing 738 * to the file’s parent folder and actually selecting the file in list. If 739 * the @a chooser is in Gtk::FILE_CHOOSER_ACTION_SAVE mode, the file’s base name 740 * will also appear in the dialog’s file name entry. 741 * 742 * If the file name isn’t in the current folder of @a chooser, then the current 743 * folder of @a chooser will be changed to the folder containing @a filename. This 744 * is equivalent to a sequence of unselect_all() followed by 745 * select_filename(). 746 * 747 * Note that the file must exist, or nothing will be done except 748 * for the directory change. 749 * 750 * If you are implementing a save dialog, 751 * you should use this function if you already have a file name to which the 752 * user may save; for example, when the user opens an existing file and then 753 * does Save As... If you don’t have 754 * a file name already — for example, if the user just created a new 755 * file and is saving it for the first time, do not call this function. 756 * Instead, use something similar to this: 757 * 758 * [C example ellipted] 759 * 760 * @newin{2,14} 761 * 762 * @param file The Gio::File to set as current. 763 * @return Not useful. 764 * 765 * @throws Glib::Error 766 */ 767 bool set_file(const Glib::RefPtr<const Gio::File>& file); 768 769 770 /** Selects the file referred to by @a file. An internal function. See 771 * _gtk_file_chooser_select_uri(). 772 * 773 * @newin{2,14} 774 * 775 * @param file The file to select. 776 * @return Not useful. 777 * 778 * @throws Glib::Error 779 */ 780 bool select_file(const Glib::RefPtr<const Gio::File>& file); 781 782 /** Unselects the file referred to by @a file. If the file is not in the current 783 * directory, does not exist, or is otherwise not currently selected, does nothing. 784 * 785 * @newin{2,14} 786 * 787 * @param file A Gio::File. 788 */ 789 void unselect_file(const Glib::RefPtr<const Gio::File>& file); 790 791 792 /** Lists all the selected files and subfolders in the current folder of @a chooser 793 * as Gio::File. An internal function, see get_uris(). 794 * 795 * @newin{2,14} 796 * 797 * @return A SList 798 * containing a Gio::File for each selected file and subfolder in the 799 * current folder. 800 */ 801 std::vector< Glib::RefPtr<Gio::File> > get_files(); 802 803 804 /** Sets the current folder for @a chooser from a Gio::File. 805 * Internal function, see set_current_folder_uri(). 806 * 807 * @newin{2,14} 808 * 809 * @param file The Gio::File for the new folder. 810 * @return <tt>true</tt> if the folder could be changed successfully, <tt>false</tt> 811 * otherwise. 812 * 813 * @throws Glib::Error 814 */ 815 bool set_current_folder_file(const Glib::RefPtr<const Gio::File>& file); 816 817 //No refreturn is needed here, because the C function provides a reference: 818 819 /** Gets the current folder of @a chooser as Gio::File. 820 * See get_current_folder_uri(). 821 * 822 * @newin{2,14} 823 * 824 * @return The Gio::File for the current folder. 825 */ 826 Glib::RefPtr<Gio::File> get_current_folder_file(); 827 828 //No refreturn is needed here, because the C function provides a reference: 829 830 /** Gets the Gio::File for the currently selected file in 831 * the file selector. If multiple files are selected, 832 * one of the files will be returned at random. 833 * 834 * If the file chooser is in folder mode, this function returns the selected 835 * folder. 836 * 837 * @newin{2,14} 838 * 839 * @return A selected Gio::File. You own the returned file; 840 * use Glib::object_unref() to release it. 841 */ 842 Glib::RefPtr<Gio::File> get_file(); 843 844 /** Gets the Gio::File for the currently selected file in 845 * the file selector. If multiple files are selected, 846 * one of the files will be returned at random. 847 * 848 * If the file chooser is in folder mode, this function returns the selected 849 * folder. 850 * 851 * @newin{2,14} 852 * 853 * @return A selected Gio::File. You own the returned file; 854 * use Glib::object_unref() to release it. 855 */ 856 Glib::RefPtr<const Gio::File> get_file() const; 857 858 /* Preview widget 859 */ 860 861 /** Sets an application-supplied widget to use to display a custom preview 862 * of the currently selected file. To implement a preview, after setting the 863 * preview widget, you connect to the Gtk::FileChooser::signal_update_preview() 864 * signal, and call get_preview_filename() or 865 * get_preview_uri() on each change. If you can 866 * display a preview of the new file, update your widget and 867 * set the preview active using set_preview_widget_active(). 868 * Otherwise, set the preview inactive. 869 * 870 * When there is no application-supplied preview widget, or the 871 * application-supplied preview widget is not active, the file chooser 872 * will display no preview at all. 873 * 874 * @newin{2,4} 875 * 876 * @param preview_widget Widget for displaying preview. 877 */ 878 void set_preview_widget(Gtk::Widget& preview_widget); 879 880 881 /** Gets the current preview widget; see 882 * set_preview_widget(). 883 * 884 * @newin{2,4} 885 * 886 * @return The current preview widget, or <tt>nullptr</tt>. 887 */ 888 Gtk::Widget* get_preview_widget(); 889 890 /** Gets the current preview widget; see 891 * set_preview_widget(). 892 * 893 * @newin{2,4} 894 * 895 * @return The current preview widget, or <tt>nullptr</tt>. 896 */ 897 const Gtk::Widget* get_preview_widget() const; 898 899 900 /** Sets whether the preview widget set by 901 * set_preview_widget() should be shown for the 902 * current filename. When @a active is set to false, the file chooser 903 * may display an internally generated preview of the current file 904 * or it may display no preview at all. See 905 * set_preview_widget() for more details. 906 * 907 * @newin{2,4} 908 * 909 * @param active Whether to display the user-specified preview widget. 910 */ 911 void set_preview_widget_active(bool active = true); 912 913 /** Gets whether the preview widget set by set_preview_widget() 914 * should be shown for the current filename. See 915 * set_preview_widget_active(). 916 * 917 * @newin{2,4} 918 * 919 * @return <tt>true</tt> if the preview widget is active for the current filename. 920 */ 921 bool get_preview_widget_active() const; 922 923 924 /** Sets whether the file chooser should display a stock label with the name of 925 * the file that is being previewed; the default is <tt>true</tt>. Applications that 926 * want to draw the whole preview area themselves should set this to <tt>false</tt> and 927 * display the name themselves in their preview widget. 928 * 929 * See also: set_preview_widget() 930 * 931 * @newin{2,4} 932 * 933 * @param use_label Whether to display a stock label with the name of the previewed file. 934 */ 935 void set_use_preview_label(bool use_label = true); 936 937 /** Gets whether a stock label should be drawn with the name of the previewed 938 * file. See set_use_preview_label(). 939 * 940 * @return <tt>true</tt> if the file chooser is set to display a label with the 941 * name of the previewed file, <tt>false</tt> otherwise. 942 */ 943 bool get_use_preview_label() const; 944 945 946 /** Gets the filename that should be previewed in a custom preview 947 * widget. See set_preview_widget(). 948 * 949 * @newin{2,4} 950 * 951 * @return The filename to preview, or an empty string if no file 952 * is selected, or if the selected file cannot be represented 953 * as a local filename. 954 */ 955 std::string get_preview_filename() const; 956 957 /** Gets the URI that should be previewed in a custom preview 958 * widget. See set_preview_widget(). 959 * 960 * @newin{2,4} 961 * 962 * @return The URI for the file to preview, or an empty string if no file is 963 * selected. 964 */ 965 Glib::ustring get_preview_uri() const; 966 967 //No refreturn is needed here, because the C function provides a reference: 968 969 /** Gets the Gio::File that should be previewed in a custom preview 970 * Internal function, see get_preview_uri(). 971 * 972 * @newin{2,14} 973 * 974 * @return The Gio::File for the file to preview, 975 * or <tt>nullptr</tt> if no file is selected. Free with Glib::object_unref(). 976 */ 977 Glib::RefPtr<Gio::File> get_preview_file(); 978 979 /** Gets the Gio::File that should be previewed in a custom preview 980 * Internal function, see get_preview_uri(). 981 * 982 * @newin{2,14} 983 * 984 * @return The Gio::File for the file to preview, 985 * or <tt>nullptr</tt> if no file is selected. Free with Glib::object_unref(). 986 */ 987 Glib::RefPtr<const Gio::File> get_preview_file() const; 988 989 /* Extra widget 990 */ 991 992 /** Sets an application-supplied widget to provide extra options to the user. 993 * 994 * @newin{2,4} 995 * 996 * @param extra_widget Widget for extra options. 997 */ 998 void set_extra_widget(Gtk::Widget& extra_widget); 999 1000 /** Gets the current extra widget; see 1001 * set_extra_widget(). 1002 * 1003 * @newin{2,4} 1004 * 1005 * @return The current extra widget, or <tt>nullptr</tt>. 1006 */ 1007 Gtk::Widget* get_extra_widget(); 1008 1009 /** Gets the current extra widget; see 1010 * set_extra_widget(). 1011 * 1012 * @newin{2,4} 1013 * 1014 * @return The current extra widget, or <tt>nullptr</tt>. 1015 */ 1016 const Gtk::Widget* get_extra_widget() const; 1017 1018 /* List of user selectable filters 1019 */ 1020 1021 /** Adds @a filter to the list of filters that the user can select between. 1022 * When a filter is selected, only files that are passed by that 1023 * filter are displayed. 1024 * 1025 * Note that the @a chooser takes ownership of the filter, so you have to 1026 * ref and sink it if you want to keep a reference. 1027 * 1028 * @newin{2,4} 1029 * 1030 * @param filter A Gtk::FileFilter. 1031 */ 1032 void add_filter(const Glib::RefPtr<FileFilter>& filter); 1033 1034 /** Removes @a filter from the list of filters that the user can select between. 1035 * 1036 * @newin{2,4} 1037 * 1038 * @param filter A Gtk::FileFilter. 1039 */ 1040 void remove_filter(const Glib::RefPtr<FileFilter>& filter); 1041 1042 1043 /** Lists the current set of user-selectable filters; see 1044 * add_filter(), remove_filter(). 1045 * 1046 * @newin{2,4} 1047 * 1048 * @return A list containing the current set of 1049 * user selectable filters. 1050 */ 1051 std::vector< Glib::RefPtr<FileFilter> > list_filters(); 1052 1053 /** Lists the current set of user-selectable filters; see 1054 * add_filter(), remove_filter(). 1055 * 1056 * @newin{2,4} 1057 * 1058 * @return A list containing the current set of 1059 * user selectable filters. 1060 */ 1061 std::vector< Glib::RefPtr<const FileFilter> > list_filters() const; 1062 1063 /* Current filter 1064 */ 1065 1066 /** Sets the current filter; only the files that pass the 1067 * filter will be displayed. If the user-selectable list of filters 1068 * is non-empty, then the filter should be one of the filters 1069 * in that list. Setting the current filter when the list of 1070 * filters is empty is useful if you want to restrict the displayed 1071 * set of files without letting the user change it. 1072 * 1073 * @newin{2,4} 1074 * 1075 * @param filter A Gtk::FileFilter. 1076 */ 1077 void set_filter(const Glib::RefPtr<FileFilter>& filter); 1078 1079 /** Gets the current filter; see set_filter(). 1080 * 1081 * @newin{2,4} 1082 * 1083 * @return The current filter, or <tt>nullptr</tt>. 1084 */ 1085 Glib::RefPtr<FileFilter> get_filter(); 1086 1087 /** Gets the current filter; see set_filter(). 1088 * 1089 * @newin{2,4} 1090 * 1091 * @return The current filter, or <tt>nullptr</tt>. 1092 */ 1093 Glib::RefPtr<const FileFilter> get_filter() const; 1094 1095 /* Per-application shortcut folders */ 1096 1097 1098 /** Adds a folder to be displayed with the shortcut folders in a file chooser. 1099 * Note that shortcut folders do not get saved, as they are provided by the 1100 * application. For example, you can use this to add a 1101 * “/usr/share/mydrawprogram/Clipart” folder to the volume list. 1102 * 1103 * @newin{2,4} 1104 * 1105 * @param folder Filename of the folder to add. 1106 * @return <tt>true</tt> if the folder could be added successfully, <tt>false</tt> 1107 * otherwise. In the latter case, the @a error will be set as appropriate. 1108 * 1109 * @throws Glib::Error 1110 */ 1111 bool add_shortcut_folder(const std::string& folder); 1112 1113 /** Removes a folder from a file chooser’s list of shortcut folders. 1114 * 1115 * @newin{2,4} 1116 * 1117 * @param folder Filename of the folder to remove. 1118 * @return <tt>true</tt> if the operation succeeds, <tt>false</tt> otherwise. 1119 * In the latter case, the @a error will be set as appropriate. 1120 * 1121 * See also: add_shortcut_folder(). 1122 * 1123 * @throws Glib::Error 1124 */ 1125 bool remove_shortcut_folder(const std::string& folder); 1126 1127 1128 /** Queries the list of shortcut folders in the file chooser, as set by 1129 * add_shortcut_folder(). 1130 * 1131 * @newin{2,4} 1132 * 1133 * @return A list of folder filenames, if there are any shortcut 1134 * folders. 1135 */ 1136 std::vector<std::string> list_shortcut_folders() const; 1137 1138 1139 /** Adds a folder URI to be displayed with the shortcut folders in a file 1140 * chooser. Note that shortcut folders do not get saved, as they are provided 1141 * by the application. For example, you can use this to add a 1142 * “file:///usr/share/mydrawprogram/Clipart” folder to the volume list. 1143 * 1144 * @newin{2,4} 1145 * 1146 * @param uri URI of the folder to add. 1147 * @return <tt>true</tt> if the folder could be added successfully, <tt>false</tt> 1148 * otherwise. In the latter case, the @a error will be set as appropriate. 1149 * 1150 * @throws Glib::Error 1151 */ 1152 bool add_shortcut_folder_uri(const Glib::ustring& uri); 1153 1154 /** Removes a folder URI from a file chooser’s list of shortcut folders. 1155 * 1156 * @newin{2,4} 1157 * 1158 * @param uri URI of the folder to remove. 1159 * @return <tt>true</tt> if the operation succeeds, <tt>false</tt> otherwise. 1160 * In the latter case, the @a error will be set as appropriate. 1161 * 1162 * See also: add_shortcut_folder_uri(). 1163 * 1164 * @throws Glib::Error 1165 */ 1166 bool remove_shortcut_folder_uri(const Glib::ustring& uri); 1167 1168 /** Queries the list of shortcut folders in the file chooser, as set by 1169 * add_shortcut_folder_uri(). 1170 * 1171 * @newin{2,4} 1172 * 1173 * @return A list of folder URIs. 1174 */ 1175 std::vector<Glib::ustring> list_shortcut_folder_uris() const; 1176 1177 1178 /** Adds a 'choice' to the file chooser. This is typically implemented 1179 * as a combobox or, for boolean choices, as a checkbutton. You can select 1180 * a value using set_choice() before the dialog is shown, 1181 * and you can obtain the user-selected value in the signal_response() signal handler 1182 * using get_choice(). 1183 * 1184 * Compare set_extra_widget(). 1185 * 1186 * @newin{3,22} 1187 * 1188 * @param id Id for the added choice. 1189 * @param label User-visible label for the added choice. 1190 * @param options Ids for the options of the choice, or <tt>nullptr</tt> for a boolean choice. 1191 * @param option_labels User-visible labels for the options, must be the same length as @a options. 1192 */ 1193 void add_choice(const Glib::ustring& id, const Glib::ustring& label, const std::vector<Glib::ustring>& options, const std::vector<Glib::ustring>& option_labels); 1194 1195 /** Adds a boolean 'choice' to the file chooser. 1196 * This is typically implemented as a checkbutton. You can select 1197 * a value using set_boolean_choice() before the dialog is shown, 1198 * and you can obtain the user-selected value in the signal_response() signal handler 1199 * using get_choice(). 1200 * 1201 * Compare set_extra_widget(). 1202 * 1203 * @newin{3,22} 1204 * 1205 * @param id Id for the added choice. 1206 * @param label User-visible label for the added choice. 1207 */ 1208 void add_choice(const Glib::ustring& id, const Glib::ustring& label); 1209 1210 1211 /** Removes a 'choice' that has been added with add_choice(). 1212 * 1213 * @newin{3,22} 1214 * 1215 * @param id The ID of the choice to remove. 1216 */ 1217 void remove_choice(const Glib::ustring& id); 1218 1219 /** Selects an option in a 'choice' that has been added with 1220 * add_choice(). For a boolean choice, the 1221 * possible options are "true" and "false". 1222 * 1223 * @newin{3,22} 1224 * 1225 * @param id The ID of the choice to set. 1226 * @param option The ID of the option to select. 1227 */ 1228 void set_choice(const Glib::ustring& id, const Glib::ustring& option); 1229 1230 /** Gets the currently selected option in the 'choice' with the given ID. 1231 * 1232 * @newin{3,22} 1233 * 1234 * @param id The ID of the choice to get. 1235 * @return The ID of the currenly selected option. 1236 */ 1237 Glib::ustring get_choice(const Glib::ustring& id) const; 1238 1239 1240 /** 1241 * @par Slot Prototype: 1242 * <tt>void on_my_%current_folder_changed()</tt> 1243 * 1244 * Flags: Run Last 1245 * 1246 * This signal is emitted when the current folder in a Gtk::FileChooser 1247 * changes. This can happen due to the user performing some action that 1248 * changes folders, such as selecting a bookmark or visiting a folder on the 1249 * file list. It can also happen as a result of calling a function to 1250 * explicitly change the current folder in a file chooser. 1251 * 1252 * Normally you do not need to connect to this signal, unless you need to keep 1253 * track of which folder a file chooser is showing. 1254 * 1255 * See also: Gtk::FileChooser::set_current_folder(), 1256 * Gtk::FileChooser::get_current_folder(), 1257 * Gtk::FileChooser::set_current_folder_uri(), 1258 * Gtk::FileChooser::get_current_folder_uri(). 1259 */ 1260 1261 Glib::SignalProxy< void > signal_current_folder_changed(); 1262 1263 1264 /** 1265 * @par Slot Prototype: 1266 * <tt>void on_my_%selection_changed()</tt> 1267 * 1268 * Flags: Run Last 1269 * 1270 * This signal is emitted when there is a change in the set of selected files 1271 * in a Gtk::FileChooser. This can happen when the user modifies the selection 1272 * with the mouse or the keyboard, or when explicitly calling functions to 1273 * change the selection. 1274 * 1275 * Normally you do not need to connect to this signal, as it is easier to wait 1276 * for the file chooser to finish running, and then to get the list of 1277 * selected files using the functions mentioned below. 1278 * 1279 * See also: Gtk::FileChooser::select_filename(), 1280 * Gtk::FileChooser::unselect_filename(), Gtk::FileChooser::get_filename(), 1281 * Gtk::FileChooser::get_filenames(), Gtk::FileChooser::select_uri(), 1282 * Gtk::FileChooser::unselect_uri(), Gtk::FileChooser::get_uri(), 1283 * Gtk::FileChooser::get_uris(). 1284 */ 1285 1286 Glib::SignalProxy< void > signal_selection_changed(); 1287 1288 1289 /** 1290 * @par Slot Prototype: 1291 * <tt>void on_my_%update_preview()</tt> 1292 * 1293 * Flags: Run Last 1294 * 1295 * This signal is emitted when the preview in a file chooser should be 1296 * regenerated. For example, this can happen when the currently selected file 1297 * changes. You should use this signal if you want your file chooser to have 1298 * a preview widget. 1299 * 1300 * Once you have installed a preview widget with 1301 * Gtk::FileChooser::set_preview_widget(), you should update it when this 1302 * signal is emitted. You can use the functions 1303 * Gtk::FileChooser::get_preview_filename() or 1304 * Gtk::FileChooser::get_preview_uri() to get the name of the file to preview. 1305 * Your widget may not be able to preview all kinds of files; your callback 1306 * must call Gtk::FileChooser::set_preview_widget_active() to inform the file 1307 * chooser about whether the preview was generated successfully or not. 1308 * 1309 * Please see the example code in 1310 * [Using a Preview Widget][gtkfilechooser-preview]. 1311 * 1312 * See also: Gtk::FileChooser::set_preview_widget(), 1313 * Gtk::FileChooser::set_preview_widget_active(), 1314 * Gtk::FileChooser::set_use_preview_label(), 1315 * Gtk::FileChooser::get_preview_filename(), 1316 * Gtk::FileChooser::get_preview_uri(). 1317 */ 1318 1319 Glib::SignalProxy< void > signal_update_preview(); 1320 1321 1322 /** 1323 * @par Slot Prototype: 1324 * <tt>void on_my_%file_activated()</tt> 1325 * 1326 * Flags: Run Last 1327 * 1328 * This signal is emitted when the user "activates" a file in the file 1329 * chooser. This can happen by double-clicking on a file in the file list, or 1330 * by pressing `Enter`. 1331 * 1332 * Normally you do not need to connect to this signal. It is used internally 1333 * by Gtk::FileChooserDialog to know when to activate the default button in the 1334 * dialog. 1335 * 1336 * See also: Gtk::FileChooser::get_filename(), 1337 * Gtk::FileChooser::get_filenames(), Gtk::FileChooser::get_uri(), 1338 * Gtk::FileChooser::get_uris(). 1339 */ 1340 1341 Glib::SignalProxy< void > signal_file_activated(); 1342 1343 1344 /** 1345 * @par Slot Prototype: 1346 * <tt>FileChooserConfirmation on_my_%confirm_overwrite()</tt> 1347 * 1348 * Flags: Run Last 1349 * 1350 * This signal gets emitted whenever it is appropriate to present a 1351 * confirmation dialog when the user has selected a file name that 1352 * already exists. The signal only gets emitted when the file 1353 * chooser is in Gtk::FILE_CHOOSER_ACTION_SAVE mode. 1354 * 1355 * Most applications just need to turn on the 1356 * Gtk::FileChooser::property_do_overwrite_confirmation() property (or call the 1357 * Gtk::FileChooser::set_do_overwrite_confirmation() function), and 1358 * they will automatically get a stock confirmation dialog. 1359 * Applications which need to customize this behavior should do 1360 * that, and also connect to the Gtk::FileChooser::signal_confirm_overwrite() 1361 * signal. 1362 * 1363 * A signal handler for this signal must return a 1364 * Gtk::FileChooserConfirmation value, which indicates the action to 1365 * take. If the handler determines that the user wants to select a 1366 * different filename, it should return 1367 * Gtk::FILE_CHOOSER_CONFIRMATION_SELECT_AGAIN. If it determines 1368 * that the user is satisfied with his choice of file name, it 1369 * should return Gtk::FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME. 1370 * On the other hand, if it determines that the stock confirmation 1371 * dialog should be used, it should return 1372 * Gtk::FILE_CHOOSER_CONFIRMATION_CONFIRM. The following example 1373 * illustrates this. 1374 * 1375 * ## Custom confirmation ## {#gtkfilechooser-confirmation} 1376 * 1377 * 1378 * [C example ellipted] 1379 * 1380 * @newin{2,8} 1381 * 1382 * @return A Gtk::FileChooserConfirmation value that indicates which 1383 * action to take after emitting the signal. 1384 */ 1385 1386 Glib::SignalProxy< FileChooserConfirmation > signal_confirm_overwrite(); 1387 1388 1389 /** The type of operation that the file selector is performing. 1390 * 1391 * Default value: Gtk::FILE_CHOOSER_ACTION_OPEN 1392 * 1393 * @return A PropertyProxy that allows you to get or set the value of the property, 1394 * or receive notification when the value of the property changes. 1395 */ 1396 Glib::PropertyProxy< FileChooserAction > property_action() ; 1397 1398 /** The type of operation that the file selector is performing. 1399 * 1400 * Default value: Gtk::FILE_CHOOSER_ACTION_OPEN 1401 * 1402 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1403 * or receive notification when the value of the property changes. 1404 */ 1405 Glib::PropertyProxy_ReadOnly< FileChooserAction > property_action() const; 1406 1407 /** The current filter for selecting which files are displayed. 1408 * 1409 * @return A PropertyProxy that allows you to get or set the value of the property, 1410 * or receive notification when the value of the property changes. 1411 */ 1412 Glib::PropertyProxy< Glib::RefPtr<FileFilter> > property_filter() ; 1413 1414 /** The current filter for selecting which files are displayed. 1415 * 1416 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1417 * or receive notification when the value of the property changes. 1418 */ 1419 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> > property_filter() const; 1420 1421 /** Whether the selected file(s) should be limited to local file: URLs. 1422 * 1423 * Default value: <tt>true</tt> 1424 * 1425 * @return A PropertyProxy that allows you to get or set the value of the property, 1426 * or receive notification when the value of the property changes. 1427 */ 1428 Glib::PropertyProxy< bool > property_local_only() ; 1429 1430 /** Whether the selected file(s) should be limited to local file: URLs. 1431 * 1432 * Default value: <tt>true</tt> 1433 * 1434 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1435 * or receive notification when the value of the property changes. 1436 */ 1437 Glib::PropertyProxy_ReadOnly< bool > property_local_only() const; 1438 1439 /** Application supplied widget for custom previews. 1440 * 1441 * @return A PropertyProxy that allows you to get or set the value of the property, 1442 * or receive notification when the value of the property changes. 1443 */ 1444 Glib::PropertyProxy< Widget* > property_preview_widget() ; 1445 1446 /** Application supplied widget for custom previews. 1447 * 1448 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1449 * or receive notification when the value of the property changes. 1450 */ 1451 Glib::PropertyProxy_ReadOnly< Widget* > property_preview_widget() const; 1452 1453 /** Whether the application supplied widget for custom previews should be shown. 1454 * 1455 * Default value: <tt>true</tt> 1456 * 1457 * @return A PropertyProxy that allows you to get or set the value of the property, 1458 * or receive notification when the value of the property changes. 1459 */ 1460 Glib::PropertyProxy< bool > property_preview_widget_active() ; 1461 1462 /** Whether the application supplied widget for custom previews should be shown. 1463 * 1464 * Default value: <tt>true</tt> 1465 * 1466 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1467 * or receive notification when the value of the property changes. 1468 */ 1469 Glib::PropertyProxy_ReadOnly< bool > property_preview_widget_active() const; 1470 1471 /** Whether to display a stock label with the name of the previewed file. 1472 * 1473 * Default value: <tt>true</tt> 1474 * 1475 * @return A PropertyProxy that allows you to get or set the value of the property, 1476 * or receive notification when the value of the property changes. 1477 */ 1478 Glib::PropertyProxy< bool > property_use_preview_label() ; 1479 1480 /** Whether to display a stock label with the name of the previewed file. 1481 * 1482 * Default value: <tt>true</tt> 1483 * 1484 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1485 * or receive notification when the value of the property changes. 1486 */ 1487 Glib::PropertyProxy_ReadOnly< bool > property_use_preview_label() const; 1488 1489 /** Application supplied widget for extra options. 1490 * 1491 * @return A PropertyProxy that allows you to get or set the value of the property, 1492 * or receive notification when the value of the property changes. 1493 */ 1494 Glib::PropertyProxy< Widget* > property_extra_widget() ; 1495 1496 /** Application supplied widget for extra options. 1497 * 1498 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1499 * or receive notification when the value of the property changes. 1500 */ 1501 Glib::PropertyProxy_ReadOnly< Widget* > property_extra_widget() const; 1502 1503 /** Whether to allow multiple files to be selected. 1504 * 1505 * Default value: <tt>false</tt> 1506 * 1507 * @return A PropertyProxy that allows you to get or set the value of the property, 1508 * or receive notification when the value of the property changes. 1509 */ 1510 Glib::PropertyProxy< bool > property_select_multiple() ; 1511 1512 /** Whether to allow multiple files to be selected. 1513 * 1514 * Default value: <tt>false</tt> 1515 * 1516 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1517 * or receive notification when the value of the property changes. 1518 */ 1519 Glib::PropertyProxy_ReadOnly< bool > property_select_multiple() const; 1520 1521 /** Whether the hidden files and folders should be displayed. 1522 * 1523 * Default value: <tt>false</tt> 1524 * 1525 * @return A PropertyProxy that allows you to get or set the value of the property, 1526 * or receive notification when the value of the property changes. 1527 */ 1528 Glib::PropertyProxy< bool > property_show_hidden() ; 1529 1530 /** Whether the hidden files and folders should be displayed. 1531 * 1532 * Default value: <tt>false</tt> 1533 * 1534 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1535 * or receive notification when the value of the property changes. 1536 */ 1537 Glib::PropertyProxy_ReadOnly< bool > property_show_hidden() const; 1538 1539 /** Whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode 1540 * will present an overwrite confirmation dialog if the user 1541 * selects a file name that already exists. 1542 * 1543 * @newin{2,8} 1544 * 1545 * Default value: <tt>false</tt> 1546 * 1547 * @return A PropertyProxy that allows you to get or set the value of the property, 1548 * or receive notification when the value of the property changes. 1549 */ 1550 Glib::PropertyProxy< bool > property_do_overwrite_confirmation() ; 1551 1552 /** Whether a file chooser in Gtk::FILE_CHOOSER_ACTION_SAVE mode 1553 * will present an overwrite confirmation dialog if the user 1554 * selects a file name that already exists. 1555 * 1556 * @newin{2,8} 1557 * 1558 * Default value: <tt>false</tt> 1559 * 1560 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1561 * or receive notification when the value of the property changes. 1562 */ 1563 Glib::PropertyProxy_ReadOnly< bool > property_do_overwrite_confirmation() const; 1564 1565 /** Whether a file chooser not in Gtk::FILE_CHOOSER_ACTION_OPEN mode 1566 * will offer the user to create new folders. 1567 * 1568 * @newin{2,18} 1569 * 1570 * Default value: <tt>true</tt> 1571 * 1572 * @return A PropertyProxy that allows you to get or set the value of the property, 1573 * or receive notification when the value of the property changes. 1574 */ 1575 Glib::PropertyProxy< bool > property_create_folders() ; 1576 1577 /** Whether a file chooser not in Gtk::FILE_CHOOSER_ACTION_OPEN mode 1578 * will offer the user to create new folders. 1579 * 1580 * @newin{2,18} 1581 * 1582 * Default value: <tt>true</tt> 1583 * 1584 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 1585 * or receive notification when the value of the property changes. 1586 */ 1587 Glib::PropertyProxy_ReadOnly< bool > property_create_folders() const; 1588 1589 1590 public: 1591 1592 public: 1593 //C++ methods used to invoke GTK+ virtual functions: 1594 1595 protected: 1596 //GTK+ Virtual Functions (override these to change behaviour): 1597 1598 //Default Signal Handlers:: 1599 1600 1601 }; 1602 1603 } // namespace Gtk 1604 1605 1606 namespace Glib 1607 { 1608 /** A Glib::wrap() method for this object. 1609 * 1610 * @param object The C instance. 1611 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 1612 * @result A C++ instance that wraps this C instance. 1613 * 1614 * @relates Gtk::FileChooser 1615 */ 1616 Glib::RefPtr<Gtk::FileChooser> wrap(GtkFileChooser* object, bool take_copy = false); 1617 1618 } // namespace Glib 1619 1620 1621 #endif /* _GTKMM_FILECHOOSER_H */ 1622 1623