Debian Codegraph @

gtk/src/filechooserbutton.hg

raw
1 /* Copyright (C) 2003 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/box.h>
18 #include <gtkmm/filechooserdialog.h>
19 _DEFS(gtkmm,gtk)
20 _PINCLUDE(gtkmm/private/hvbox_p.h)
21
22 namespace Gtk
23 {
24
25 /** A button to launch a file chooser dialog.
26 *
27 * This widget lets the user select a file. It implements the FileChooser interface. Visually, it is a file name with a
28 * button to bring up a FileChooserDialog. The user can then use that dialog to change the file associated with that
29 * button. This widget does not support setting the "select_multiple" property to true.
30 *
31 * The FileChooserButton supports the FileChooserActions FILE_CHOOSER_ACTION_OPEN and FILE_CHOOSER_ACTION_SELECT_FOLDER.
32 *
33 * The FileChooserButton will ellipsize the label, and will thus request little horizontal space. To give the button more
34 * space, you should call size_request(), set_width_chars(), or pack the button in such a way that other interface
35 * elements give space to the widget.
36 *
37 * The FileChooserButton widget looks like this:
38 * @image html filechooserbutton1.png
39 *
40 * @ingroup Widgets
41 */
42 class GTKMM_API FileChooserButton
43 : public HBox, //Note: The C object derives from GtkBox.
44 public FileChooser
45 {
46 _CLASS_GTKOBJECT(FileChooserButton, GtkFileChooserButton, GTK_FILE_CHOOSER_BUTTON, Gtk::HBox, GtkHBox, , , GTKMM_API)
47 _IMPLEMENTS_INTERFACE(FileChooser)
48 public:
49
50 /** Creates a new file-selecting button widget with the default title.
51 * @param action The open mode for the widget.
52 */
53 explicit FileChooserButton(FileChooserAction action = FILE_CHOOSER_ACTION_OPEN);
54
55 /** Creates a new file-selecting button widget.
56 *
57 * @param title The title of the browse dialog.
58 * @param action The open mode for the widget.
59 */
60 _WRAP_CTOR(FileChooserButton(const Glib::ustring& title, FileChooserAction action = FILE_CHOOSER_ACTION_OPEN), gtk_file_chooser_button_new)
61
62 /** Creates a new file-selecting button widget which uses dialog as its file-picking window.
63 *
64 * @param dialog The dialog to use.
65 */
66 _WRAP_CTOR(FileChooserButton(FileChooserDialog& dialog), gtk_file_chooser_button_new_with_dialog)
67
68 _WRAP_METHOD(Glib::ustring get_title() const, gtk_file_chooser_button_get_title)
69 _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_file_chooser_button_set_title)
70
71 _WRAP_METHOD(int get_width_chars() const, gtk_file_chooser_button_get_width_chars)
72 _WRAP_METHOD(void set_width_chars(int n_chars), gtk_file_chooser_button_set_width_chars)
73
74 _WRAP_METHOD(bool get_focus_on_click() const, gtk_file_chooser_button_get_focus_on_click,
75 deprecated "Use Widget::get_focus_on_click() instead.")
76 _WRAP_METHOD(void set_focus_on_click(gboolean focus_on_click = true), gtk_file_chooser_button_set_focus_on_click,
77 deprecated "Use Widget::set_focus_on_click() instead.")
78
79 //This is a G_SIGNAL_ACTION signal, but it seems to be public API for applications.
80 //See http://bugzilla.gnome.org/show_bug.cgi?id=353196
81 _WRAP_SIGNAL(void file_set(), "file-set")
82
83 //_WRAP_PROPERTY("dialog", FileChooserDialog*) //construct-only
84
85 // GtkFileChooserButton:focus-on-click has been removed from gtk+.
86 // TODO: At ABI-break, remove it from gtkmm.
87 #ifndef GTKMM_DISABLE_DEPRECATED
88 /** Whether the button grabs focus when it is clicked with the mouse.
89 * @deprecated Use Widget::property_focus_on_click() instead.
90 *
91 * @return A PropertyProxy that allows you to get or set the value of the property,
92 * or receive notification when the value of the property changes.
93 */
94 Glib::PropertyProxy< bool > property_focus_on_click() ;
95
96 /** Whether the button grabs focus when it is clicked with the mouse.
97 * @deprecated Use Widget::property_focus_on_click() instead.
98 *
99 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
100 * or receive notification when the value of the property changes.
101 */
102 Glib::PropertyProxy_ReadOnly< bool > property_focus_on_click() const;
103 #endif // GTKMM_DISABLE_DEPRECATED
104 //_WRAP_PROPERTY("focus-on-click", bool, deprecated "Use Widget::property_focus_on_click() instead.")
105
106 _WRAP_PROPERTY("title", Glib::ustring)
107 _WRAP_PROPERTY("width-chars", int)
108 };
109
110 } // namespace Gtk