Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::FileChooserButton Class Reference

A GtkFileChooserButton C++ wrapper class. More...

`#include <xfc/gtk/filechooserbutton.hh>`

Inheritance diagram for Xfc::Gtk::FileChooserButton:

List of all members.

## Public Member Functions

Constructors

- FileChooserButton (FileChooserAction action, const char *backend=0)
    Constructs a new FileChooserButton.
- FileChooserButton (const String &title, FileChooserAction action, const char *backend=0)
    Constructs a new FileChooserButton with the given title.
- FileChooserButton (FileChooserDialog &dialog)
    Constructs a FileChooserButton widget which uses dialog as it's file-picking window.
- virtual ~FileChooserButton ()
    Destructor.

Accessors

- GtkFileChooserButton * gtk_file_chooser_button () const
    Get a pointer to the GtkFileChooserButton structure.
- operator GtkFileChooserButton * () const
    Conversion operator; safely converts an FileChooserButton to a GtkFileChooserButton pointer.
- String 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.

Methods

- void set_title (const String &title)
    Modifies the title of the browse dialog used by the button.
- void set_width_chars (int n_chars)
    Sets the width (in characters) that button will use to n_chars.

## Protected Member Functions

Constructors

- FileChooserButton (GtkFileChooserButton *button, bool owns_reference=false)
    Construct a new FileChooserButton from an existing GtkFileChooserButton.

## Detailed Description

A GtkFileChooserButton C++ wrapper class.

FileChooserButton is a widget that lets the user select a file or folder. It implements the FileChooser interface. Visually, it's 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.

Example: Create a button to let the user select a file in /etc

In the simplest of cases, you can use FileChooserDialog as in the following code:

        Gtk::FileChooserButton *button = new Gtk::FileChooserButton(_("Select a file"));
        button->set_current_folder("/etc");

FileChooserButton only supports the FileChooserActions: Gtk::FILE_CHOOSER_ACTION_OPEN and Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER. FileChooserButton will ellipsize the label, and thus will thus request little horizontal space. To give the button more space, you should call set_width_chars(), Gtk::Widget::size_request(), or pack the button in such a way that other interface elements give space to the widget.

## Constructor & Destructor Documentation

Xfc::Gtk::FileChooserButton::FileChooserButton | ( | GtkFileChooserButton * | button,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

  | Construct a new FileChooserButton from an existing GtkFileChooserButton. Parameters:
  | button | A pointer to a GtkFileChooserButton.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.
The button can be a newly created GtkFileChooserButton or an existing GtkFileChooserButton. (see G::Object::Object).

Xfc::Gtk::FileChooserButton::FileChooserButton | ( | FileChooserAction | action,
|  | const char * | backend = `0`
| ) |

  | Constructs a new FileChooserButton. Parameters:
  | action | The open for the widget.
  | backend | The name of the specific filesystem backend to use, or null for the default.

Xfc::Gtk::FileChooserButton::FileChooserButton | ( | const String & | title,
|  | FileChooserAction | action,
|  | const char * | backend = `0`
| ) |

  | Constructs a new FileChooserButton with the given title. Parameters:
  | title | The title of the browse dialog.
  | action | The open for the widget.
  | backend | The name of the specific filesystem backend to use, or null for the default.

Xfc::Gtk::FileChooserButton::FileChooserButton | ( | FileChooserDialog & | dialog | ) |

  | Constructs a FileChooserButton widget which uses dialog as it's file-picking window. Parameters:
  | dialog | A FileChooserDialog.

## Member Function Documentation

String Xfc::Gtk::FileChooserButton::get_title | ( |  | ) | const

| Retrieves the title of the browse dialog used by button. Returns: The browse dialog's title.

int Xfc::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.

void Xfc::Gtk::FileChooserButton::set_title | ( | const String & | title | ) |

  | Modifies the title of the browse dialog used by the button. Parameters:
  | title | The new title for the browse dialog.

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

  | Sets the width (in characters) that button will use to n_chars. Parameters:
  | n_chars | The new width, in chracters.

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

- filechooserbutton.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3