Main Page Widgets Namespaces Book

# Gtk::FileChooserButton Class Reference
[Widgets]

Inheritance diagram for Gtk::FileChooserButton:

[legend]
List of all members.

## Detailed Description

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:

## Public Member Functions
| FileChooserButton (FileChooserDialog& dialog)
| Creates a new file-selecting button widget which uses dialog as its file-picking window.
| FileChooserButton (const Glib::ustring& title, FileChooserAction action, const Glib::ustring& backend)
| Creates a new file-selecting button widget using backend.
| FileChooserButton (const Glib::ustring& title, FileChooserAction action=FILE_CHOOSER_ACTION_OPEN)
| Creates a new file-selecting button widget.
| FileChooserButton (FileChooserAction action=FILE_CHOOSER_ACTION_OPEN)
| Creates a new file-selecting button widget with the default title.
bool | get_focus_on_click () const
| Return value: `true` if the button grabs focus when it is clicked with.
Glib::ustring | get_title () const
| Retrieves the title of the browse dialog used by button.
int | get_width_chars () const
| Retrieves the width in characters of the button widget's entry and/or label.
const GtkFileChooserButton* | gobj () const
| Provides access to the underlying C GtkObject.
GtkFileChooserButton* | gobj ()
| Provides access to the underlying C GtkObject.
Glib::PropertyProxy_ReadOnly< bool > | property_focus_on_click () const
| Whether the button grabs focus when it is clicked with the mouse.
Glib::PropertyProxy<bool> | property_focus_on_click ()
| Whether the button grabs focus when it is clicked with the mouse.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const
| The title of the file chooser dialog.
Glib::PropertyProxy<Glib::ustring> | property_title ()
| The title of the file chooser dialog.
Glib::PropertyProxy_ReadOnly< int > | property_width_chars () const
| The desired width of the button widget.
Glib::PropertyProxy<int> | property_width_chars ()
| The desired width of the button widget.
void | set_focus_on_click (gboolean focus_on_click=true)
| Sets whether the button will grab focus when it is clicked with the mouse.
void | set_title (const Glib::ustring& title)
| Modifies the title of the browse dialog used by button.
void | set_width_chars (int n_chars)
| Sets the width (in characters) that button will use to n_chars.
virtual | ~FileChooserButton ()
## Related Functions
(Note that these are not member functions.)
Gtk::FileChooserButton* | wrap (GtkFileChooserButton* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

virtual Gtk::FileChooserButton::~FileChooserButton | ( |  | ) | `[virtual]`

Gtk::FileChooserButton::FileChooserButton | ( | FileChooserAction | action = `FILE_CHOOSER_ACTION_OPEN` | ) | `[explicit]`

Creates a new file-selecting button widget with the default title.

Parameters:

  | title | The title of the browse dialog.
  | action | The open mode for the widget.
  | backend | The name of the Gtk::FileSystem backend to use.

Gtk::FileChooserButton::FileChooserButton | ( | const Glib::ustring & | title,
|  | FileChooserAction | action = `FILE_CHOOSER_ACTION_OPEN` |
| ) |  |  | `[explicit]`

Creates a new file-selecting button widget.

Parameters:

  | title | The title of the browse dialog.
  | action | The open mode for the widget.

Gtk::FileChooserButton::FileChooserButton | ( | const Glib::ustring & | title,
|  | FileChooserAction | action,
|  | const Glib::ustring & | backend |
| ) |  |  | `[explicit]`

Creates a new file-selecting button widget using backend.

Parameters:

  | title | The title of the browse dialog.
  | action | The open mode for the widget.
  | backend | The name of the Gtk::FileSystem backend to use.

Gtk::FileChooserButton::FileChooserButton | ( | FileChooserDialog& | dialog | ) | `[explicit]`

Creates a new file-selecting button widget which uses dialog as its file-picking window.

Parameters:

  | dialog | The dialog to use.

## Member Function Documentation

bool Gtk::FileChooserButton::get_focus_on_click | ( |  | ) | const

Return value: `true` if the button grabs focus when it is clicked with.

Returns:
  `true` if the button grabs focus when it is clicked with the mouse.

Since gtkmm 2.10:

Glib::ustring Gtk::FileChooserButton::get_title | ( |  | ) | const

Retrieves the title of the browse dialog used by button.

The returned value should not be modified or freed.

Returns:
  A pointer to the browse dialog's title.

Since gtkmm 2.6:

int Gtk::FileChooserButton::get_width_chars | ( |  | ) | const

Retrieves the width in characters of the button widget's entry and/or label.

Returns:
  An integer width (in characters) that the button will use to size itself.

Since gtkmm 2.6:

const GtkFileChooserButton* Gtk::FileChooserButton::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::HBox.

GtkFileChooserButton* Gtk::FileChooserButton::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::HBox.

Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooserButton::property_focus_on_click | ( |  | ) | const

Whether the button grabs focus when it is clicked with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<bool> Gtk::FileChooserButton::property_focus_on_click | ( |  | ) |

Whether the button grabs focus when it is clicked with the mouse.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::FileChooserButton::property_title | ( |  | ) | const

The title of the file chooser dialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<Glib::ustring> Gtk::FileChooserButton::property_title | ( |  | ) |

The title of the file chooser dialog.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gtk::FileChooserButton::property_width_chars | ( |  | ) | const

The desired width of the button widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gtk::FileChooserButton::property_width_chars | ( |  | ) |

The desired width of the button widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::FileChooserButton::set_focus_on_click | ( | gboolean | focus_on_click = `true` | ) |

Sets whether the button will grab focus when it is clicked with the mouse.

Making mouse clicks not grab focus is useful in places like toolbars where you don't want the keyboard focus removed from the main area of the application.

Since gtkmm 2.10:

Parameters:

  | focus_on_click | Whether the button grabs focus when clicked with the mouse.

void Gtk::FileChooserButton::set_title | ( | const Glib::ustring & | title | ) |

Modifies the title of the browse dialog used by button.

Since gtkmm 2.6:

Parameters:

  | title | The new browse dialog title.

void Gtk::FileChooserButton::set_width_chars | ( | int | n_chars | ) |

Sets the width (in characters) that button will use to n_chars.

Since gtkmm 2.6:

Parameters:

  | n_chars | The new width, in characters.

## Friends And Related Function Documentation

Gtk::FileChooserButton* wrap | ( | GtkFileChooserButton * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- filechooserbutton.h