XGP::FileDialog Class Reference

This class can be be used to retrieve file or directory names from the user. More...

List of all members.

Public Types

enum  { NONE = 0, ASK_OVERWRITE = 1, MUST_EXIST = 2, MULTIPLE = 0x80000000 }

Public Member Functions

 ~FileDialog ()
std::string execModal ()
void on_response (int cmd)

Static Public Member Functions

static FileDialogcreate (const Glib::ustring &title, Gtk::FileChooserAction action=Gtk::FILE_CHOOSER_ACTION_OPEN, unsigned int dlgOption=NONE)

Public Attributes

sigc::signal< void, const
std::string & > 
sigSelected

Protected Types

enum  commandID { OK = 1, CANCEL }

Protected Member Functions

virtual void fileSelected (std::string &)
void free (int)
 FileDialog (const Glib::ustring &title, Gtk::FileChooserAction action=Gtk::FILE_CHOOSER_ACTION_OPEN, unsigned int dlgOption=NONE)


Detailed Description

This class can be be used to retrieve file or directory names from the user.

It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list or the drop-down history menu. Alternatively, the TAB key can be used to navigate using filename completion - common in text based editors such as emacs and jed.

The caller is informed via the passed callback about the selection.

There are some flags to perform some checks if the OK button is selected:

See also the description of the parent for further options!


Member Enumeration Documentation

anonymous enum

Options for the dialog.

Enumerator:
NONE  Don't perform any checks on the entered file.
ASK_OVERWRITE  Security question if file exists.
MUST_EXIST  Only allow to select of existing files.
MULTIPLE  User can select multiple files.

enum XGP::FileDialog::commandID [protected]

IDs for the possible commands (OK, CANCEL).


Constructor & Destructor Documentation

XGP::FileDialog::~FileDialog (  ) 

Destructor.

XGP::FileDialog::FileDialog ( const Glib::ustring &  title,
Gtk::FileChooserAction  action = Gtk::FILE_CHOOSER_ACTION_OPEN,
unsigned int  dlgOption = NONE 
) [protected]

Constructor; Creates a (modeless) dialog to select a file.

Parameters:
title Text to display in the title of the dialog
action Action which is caused by clicking a file
dlgOption Checks to perform after selecting OK


Member Function Documentation

FileDialog * XGP::FileDialog::create ( const Glib::ustring &  title,
Gtk::FileChooserAction  action = Gtk::FILE_CHOOSER_ACTION_OPEN,
unsigned int  dlgOption = NONE 
) [static]

Creates the dialog.

Creates a (modeless) dialog and registers a handler to free it after deleting.

Parameters:
title Title of the dialog
action Action which is caused by clicking a file
dlgOption Options for the dialog

std::string XGP::FileDialog::execModal (  ) 

Performs the dialog modaly.

Returns:
std::string The selected file
Remarks:
When executed modally, only the first file is returned

virtual void XGP::FileDialog::fileSelected ( std::string &   )  [inline, protected, virtual]

Callback after selecting a file.

Parameters:
 Name of selected file

void XGP::FileDialog::free ( int   )  [protected]

Frees the dialog.

Remarks:
Call only if the dialog was created with new

void XGP::FileDialog::on_response ( int  cmd  ) 

Callback on user-action (file selected or dialog closed).

Parameters:
cmd ID of selected action
Remarks:
- Depending on the option, the file must either exist or it is checked if it should be overwritten


Member Data Documentation

sigc::signal<void, const std::string&> XGP::FileDialog::sigSelected

Signal emitted, when OK is selected.


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

XGP Version 0.9.31 - Generated on Wed Nov 18 11:25:30 2009 by doxygen 1.5.8