Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
Prompt the user for a file or directory name
- As of Gtk+ 2.4 this module has been deprecated in favour of
FileChooser
This module is empty in Gtk3.
- data FileSelection
- class DialogClass o => FileSelectionClass o
- castToFileSelection :: GObjectClass obj => obj -> FileSelection
- gTypeFileSelection :: GType
- toFileSelection :: FileSelectionClass o => o -> FileSelection
- fileSelectionNew :: GlibString string => string -> IO FileSelection
- fileSelectionSetFilename :: (FileSelectionClass self, GlibString string) => self -> string -> IO ()
- fileSelectionGetFilename :: (FileSelectionClass self, GlibString string) => self -> IO string
- fileSelectionShowFileopButtons :: FileSelectionClass self => self -> IO ()
- fileSelectionHideFileopButtons :: FileSelectionClass self => self -> IO ()
- fileSelectionGetButtons :: FileSelectionClass fsel => fsel -> IO (Button, Button)
- fileSelectionComplete :: (FileSelectionClass self, GlibString string) => self -> string -> IO ()
- fileSelectionGetSelections :: (FileSelectionClass self, GlibString string) => self -> IO [string]
- fileSelectionSetSelectMultiple :: FileSelectionClass self => self -> Bool -> IO ()
- fileSelectionGetSelectMultiple :: FileSelectionClass self => self -> IO Bool
- fileSelectionFilename :: (FileSelectionClass self, GlibString string) => Attr self string
- fileSelectionShowFileops :: FileSelectionClass self => Attr self Bool
- fileSelectionSelectMultiple :: FileSelectionClass self => Attr self Bool
Detail
FileSelection
should 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.
File selection dialogs are created with a call to fileSelectionNew
.
The default filename can be set using fileSelectionSetFilename
and the
selected filename retrieved using fileSelectionGetFilename
.
Use fileSelectionComplete
to display files and directories that match a
given pattern. This can be used for example, to show only *.txt files, or
only files beginning with gtk*.
Simple file operations; create directory, delete file, and rename file,
are available from buttons at the top of the dialog. These can be hidden
using fileSelectionHideFileopButtons
and shown again using
fileSelectionShowFileopButtons
.
Class Hierarchy
|GObject
| +----Object
| +----Widget
| +----Container
| +----Bin
| +----Window
| +----Dialog
| +----FileSelection
Types
data FileSelection Source
castToFileSelection :: GObjectClass obj => obj -> FileSelection Source
toFileSelection :: FileSelectionClass o => o -> FileSelection Source
Constructors
:: GlibString string | |
=> string |
|
-> IO FileSelection |
Creates a new file selection dialog box. By default it will contain a
TreeView
of the application's current working directory, and a file
listing. Operation buttons that allow the user to create a directory, delete
files and rename files, are also present.
Methods
fileSelectionSetFilename Source
:: (FileSelectionClass self, GlibString string) | |
=> self | |
-> string |
|
-> IO () |
Sets a default path for the file requestor. If filename
includes a
directory path, then the requestor will open with that path as its current
working directory.
This has the consequence that in order to open the requestor with a
working directory and an empty filename, filename
must have a trailing
directory separator.
fileSelectionGetFilename Source
:: (FileSelectionClass self, GlibString string) | |
=> self | |
-> IO string | returns currently-selected filename |
This function returns the selected filename.
If no file is selected then the selected directory path is returned.
fileSelectionShowFileopButtons :: FileSelectionClass self => self -> IO () Source
Shows the file operation buttons, if they have previously been hidden. The rest of the widgets in the dialog will be resized accordingly.
fileSelectionHideFileopButtons :: FileSelectionClass self => self -> IO () Source
Hides the file operation buttons that normally appear at the top of the
dialog. Useful if you wish to create a custom file selector, based on
FileSelection
.
fileSelectionGetButtons :: FileSelectionClass fsel => fsel -> IO (Button, Button) Source
Extract the buttons of a fileselection.
:: (FileSelectionClass self, GlibString string) | |
=> self | |
-> string |
|
-> IO () |
Will attempt to match pattern
to a valid filenames or subdirectories in
the current directory. If a match can be made, the matched filename will
appear in the text entry field of the file selection dialog. If a partial
match can be made, the "Files" list will contain those file names which
have been partially matched, and the "Folders" list those directories
which have been partially matched.
fileSelectionGetSelections :: (FileSelectionClass self, GlibString string) => self -> IO [string] Source
Retrieves the list of file selections the user has made in the dialog box. This function is intended for use when the user can select multiple files in the file list.
fileSelectionSetSelectMultiple Source
:: FileSelectionClass self | |
=> self | |
-> Bool |
|
-> IO () |
Sets whether the user is allowed to select multiple files in the file
list. Use fileSelectionGetSelections
to get the list of selected files.
fileSelectionGetSelectMultiple Source
:: FileSelectionClass self | |
=> self | |
-> IO Bool | returns |
Determines whether or not the user is allowed to select multiple files in
the file list. See fileSelectionSetSelectMultiple
.
Attributes
fileSelectionFilename :: (FileSelectionClass self, GlibString string) => Attr self string Source
The currently selected filename.
fileSelectionShowFileops :: FileSelectionClass self => Attr self Bool Source
Whether buttons for creating/manipulating files should be displayed.
Default value: False
fileSelectionSelectMultiple :: FileSelectionClass self => Attr self Bool Source
Whether to allow multiple files to be selected.
Default value: False