GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Gtk::FileChooserDialog Class Reference

A GtkFileChooserDialog C++ wrapper class. More...

#include <gfc/gtk/filechooserdialog.hh>

Inheritance diagram for GFC::Gtk::FileChooserDialog:

GFC::Gtk::Dialog GFC::Gtk::FileChooser GFC::Gtk::Window GFC::G::TypeInterface GFC::Gtk::Bin GFC::G::TypeInstance GFC::Gtk::Container GFC::Trackable GFC::Gtk::Widget GFC::Gtk::Object GFC::Atk::Implementor GFC::G::Object GFC::G::TypeInterface GFC::G::TypeInstance GFC::G::TypeInstance GFC::Trackable GFC::Trackable GFC::Gtk::FileChooserOpenDialog GFC::Gtk::FileChooserSaveAsDialog List of all members.

Public Member Functions

Constructors
Accessors

Protected Member Functions

Constructors

Detailed Description

A GtkFileChooserDialog C++ wrapper class.

FileChooserDialog is a dialog box suitable for use with "File/Open" or "File/Save as" commands. This widget works by putting a Gtk::FileChooserWidget inside a Gtk::Dialog. It exposes the Gtk::FileChooser interface, so you can use all of the Gtk::FileChooser functions on the file chooser dialog as well as those for Gtk::Dialog. To add buttons to the dialog call Gtk::Dialog::add_button().

Note that FileChooserDialog does not have any methods of its own. Instead, you should use the functions that work on a Gtk::FileChooser.

Example: Typical usage

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

    Gtk::FileChooserDialog dialog("Open File", parent_window, Gtk::FILE_CHOOSER_ACTION_OPEN);
    dialog->add_button(Gtk::StockId::CANCEL, Gtk::RESPONSE_CANCEL);                                                      
    dialog->add_button(Gtk::StockId::OPEN, Gtk::RESPONSE_ACCEPT);                                                      
    
    if (dialog->run() == Gtk::RESPONSE_ACCEPT)
    {
        String filename = dialog->get_filename();
        open_file(filename.c_str());
    }

Response Codes

FileChooserDialog inherits from Gtk::Dialog, so buttons that go in its action area have response codes such as Gtk::RESPONSE_ACCEPT and Gtk::RESPONSE_CANCEL. In the above example the calls to add_button() adds stock "Cancel" and "Open" buttons that use the response indentifiers from Gtk::ResponseType. For most dialog boxes you can use your own custom response codes rather than the ones in Gtk::ResponseType, but Gtk::FileChooserDialog assumes that its "accept"-type action, e.g. an "Open" or "Save" button, will have one of the following response codes:

This is because Gtk::FileChooserDialog must intercept responses and switch to folders if appropriate, rather than letting the dialog terminate the implementation uses these known response codes to know which responses can be blocked if appropriate.

Note: Make sure you use a stock response code when you use Gtk::FileChooserDialog to ensure proper operation.


Constructor & Destructor Documentation

GFC::Gtk::FileChooserDialog::FileChooserDialog GtkFileChooserDialog *  dialog,
bool  owns_reference = false
[explicit, protected]
 

Construct a new FileChooserDialog from an existing GtkFileChooserDialog.

Parameters:
dialog A pointer to a GtkFileChooserDialog.
owns_reference Set false if the initial reference count is floating, set true if it's not.

The dialog can be a newly created GtkFileChooserDialog or an existing GtkFileChooserDialog (see G::Object::Object).

GFC::Gtk::FileChooserDialog::FileChooserDialog const String title,
FileChooserAction  action,
const char *  backend = 0
 

Constructs a new FileChooserDialog with no parent.

Parameters:
title The title of the dialog, or null.
action Open or save mode for the dialog.
backend The name of the specific filesystem backend to use, or null for the default.

GFC::Gtk::FileChooserDialog::FileChooserDialog const String title,
Window parent,
FileChooserAction  action,
const char *  backend = 0
 

Constructs a new FileChooserDialog.

Parameters:
title The title of the dialog, or null.
parent The transient parent of the dialog.
action Open or save mode for the dialog.
backend The name of the specific filesystem backend to use, or null for the default.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:39 2004 for GFC-UI by doxygen 1.3.8