/* 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, see .
*/
#include
#include
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/hvbox_p.h)
namespace Gtk
{
/** A button to launch a file chooser dialog.
*
* This widget lets the user select a file. It implements the FileChooser interface. Visually, it is a file name with a
* button to bring up a FileChooserDialog. The user can then use that dialog to change the file associated with that
* button. This widget does not support setting the "select_multiple" property to true.
*
* The FileChooserButton supports the FileChooserActions FILE_CHOOSER_ACTION_OPEN and FILE_CHOOSER_ACTION_SELECT_FOLDER.
*
* The FileChooserButton will ellipsize the label, and will thus request little horizontal space. To give the button more
* space, you should call size_request(), set_width_chars(), or pack the button in such a way that other interface
* elements give space to the widget.
*
* The FileChooserButton widget looks like this:
* @image html filechooserbutton1.png
*
* @ingroup Widgets
*/
class GTKMM_API FileChooserButton
: public HBox, //Note: The C object derives from GtkBox.
public FileChooser
{
_CLASS_GTKOBJECT(FileChooserButton, GtkFileChooserButton, GTK_FILE_CHOOSER_BUTTON, Gtk::HBox, GtkHBox, , , GTKMM_API)
_IMPLEMENTS_INTERFACE(FileChooser)
public:
/** Creates a new file-selecting button widget with the default title.
* @param action The open mode for the widget.
*/
explicit FileChooserButton(FileChooserAction action = FILE_CHOOSER_ACTION_OPEN);
/** Creates a new file-selecting button widget.
*
* @param title The title of the browse dialog.
* @param action The open mode for the widget.
*/
_WRAP_CTOR(FileChooserButton(const Glib::ustring& title, FileChooserAction action = FILE_CHOOSER_ACTION_OPEN), gtk_file_chooser_button_new)
/** Creates a new file-selecting button widget which uses dialog as its file-picking window.
*
* @param dialog The dialog to use.
*/
_WRAP_CTOR(FileChooserButton(FileChooserDialog& dialog), gtk_file_chooser_button_new_with_dialog)
_WRAP_METHOD(Glib::ustring get_title() const, gtk_file_chooser_button_get_title)
_WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_file_chooser_button_set_title)
_WRAP_METHOD(int get_width_chars() const, gtk_file_chooser_button_get_width_chars)
_WRAP_METHOD(void set_width_chars(int n_chars), gtk_file_chooser_button_set_width_chars)
_WRAP_METHOD(bool get_focus_on_click() const, gtk_file_chooser_button_get_focus_on_click,
deprecated "Use Widget::get_focus_on_click() instead.")
_WRAP_METHOD(void set_focus_on_click(gboolean focus_on_click = true), gtk_file_chooser_button_set_focus_on_click,
deprecated "Use Widget::set_focus_on_click() instead.")
//This is a G_SIGNAL_ACTION signal, but it seems to be public API for applications.
//See http://bugzilla.gnome.org/show_bug.cgi?id=353196
_WRAP_SIGNAL(void file_set(), "file-set")
//_WRAP_PROPERTY("dialog", FileChooserDialog*) //construct-only
// GtkFileChooserButton:focus-on-click has been removed from gtk+.
// TODO: At ABI-break, remove it from gtkmm.
#ifndef GTKMM_DISABLE_DEPRECATED
/** Whether the button grabs focus when it is clicked with the mouse.
* @deprecated Use Widget::property_focus_on_click() instead.
*
* @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_focus_on_click() ;
/** Whether the button grabs focus when it is clicked with the mouse.
* @deprecated Use Widget::property_focus_on_click() instead.
*
* @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_focus_on_click() const;
#endif // GTKMM_DISABLE_DEPRECATED
//_WRAP_PROPERTY("focus-on-click", bool, deprecated "Use Widget::property_focus_on_click() instead.")
_WRAP_PROPERTY("title", Glib::ustring)
_WRAP_PROPERTY("width-chars", int)
};
} // namespace Gtk