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