gtk-sharp[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.Gtk.DialogGtk.IFileChooser is a dialog box suitable for use with "File/Open" or "File/Save as" commands. This widget works by putting a inside a . It exposes the interface, so you can use all of the functions on the file chooser dialog as well as those for .Similar to but in a dialog.
Typical usage. In the simplest of cases, you can use the following code to select a file for opening:
public class MainWindow: Gtk.Window {
protected virtual void OnBtnLoadFileClicked(object sender, System.EventArgs e)
{
Gtk.FileChooserDialog fc=
new Gtk.FileChooserDialog("Choose the file to open",
this,
FileChooserAction.Open,
"Cancel",ResponseType.Cancel,
"Open",ResponseType.Accept);
if (fc.Run() == (int)ResponseType.Accept)
{
System.IO.FileStream file=System.IO.File.OpenRead(fc.Filename);
file.Close();
}
//Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
fc.Destroy();
}
ConstructorTo be addedTo be addedConstructor
a , pointer to underlying C object.
Constructor for internal use.ConstructorSystem.ParamArray
a title
a parent for the dialog, or . See .
an action, for example save or open.
a list of button text/response pairs for buttons to be added to the dialog, if desired. The pair format is , (see an example in overview section of )
Creates a file chooser dialog.By default, a comes with no buttons, so you'd better provide at least the most basics one (Save/Cancel or Open/Cancel) or your user won't be able to do anything apart from closing the dialog ( closing the dialog returns .None )PropertyGLib.Property("action")Gtk.FileChooserAction
Sets the type of operation that that the chooser is performing; the
user interface is adapted to suit the selected action.
a
For example,
an option to create a new folder might be shown if the action is
but not if the action is
.
MethodSystem.Void
a
Adds to the list of filters that the
user can select between.
When a filter is selected, only files that are passed by that
filter are displayed.
MethodSystem.Boolean
a Adds a folder to be displayed with the shortcut folders in a file chooser.a
Note that shortcut folders do not get saved, as they are provided by the
application. For example, you can use this to add a
"/usr/share/mydrawprogram/Clipart" folder to the volume list.
MethodSystem.Boolean
a
Adds a folder URI to be displayed with the shortcut folders in a file
chooser.
a , true if the folder
could be added successfully, false otherwise.
Note that shortcut folders do not get saved, as they are provided
by the application. For example, you can use this to add a
"file:///usr/share/mydrawprogram/Clipart" folder to the volume list.
EventGLib.Signal("confirm-overwrite")Gtk.ConfirmOverwriteHandlerIndicates a file overwrite has been requested. This event is raised when the user has selected a file name that already exists and the file chooser is in mode.
Most applications just need to turn on the property and they will automatically get a stock confirmation dialog. Applications which need to customize this behavior should do that, and also connect to this event.
A connected to this event must set to the value indicating the action to take. If the handler determines that the user wants to select a different filename, it should return . If it determines that the user is satisfied with his choice of file name, it should return . On the other hand, if it determines that the stock confirmation dialog should be used, it should return .PropertyGLib.Property("create-folders")System.BooleanTo be added.To be added.To be added.PropertySystem.StringThe current folder for the file chooser, when the chooser has selected a local filename.a EventGLib.Signal("current-folder-changed")System.EventHandler
This signal is emitted when the current folder in a file chooser
changes.
This event can happen due to the user performing some action that
changes folders, such as selecting a bookmark or visiting a folder on the
file list. It can also happen as a result of calling a function to
explicitly change the current folder in a file chooser.
Normally you do not need to connect to this signal, unless you need to keep
track of which folder a file chooser is showing.
PropertyGLib.IFileTo be added.To be added.To be added.PropertySystem.StringThe file chooser's current folder, if set from a URI.a PropertySystem.String
Property to represent the current name in the file selector,
as if entered by the user.
a
Note that the name passed in here is a UTF-8
string rather than a filename. This function is meant for
such uses as a suggested name in a "Save As..." dialog.
PropertyGLib.Property("do-overwrite-confirmation")System.BooleanEnables Overwrite Confirmation in the dialog. if confirmation should be performed.PropertyGLib.Property("extra-widget")Gtk.WidgetAn application-supplied widget to provide extra options to the user.a PropertyGLib.IFileTo be added.To be added.To be added.EventGLib.Signal("file-activated")System.EventHandler
This signal is emitted when the user "activates" a file in the file
chooser.
This event can happen by double-clicking on a file in the file list, or
by pressing Enter.
Normally you do not need to connect to this signal. It is used internally
by the file chooser code to know when to activate the default button in the dialog.
PropertySystem.StringThe current filename selected by the file chooser.a PropertySystem.String[]The filenames selected by this widget.a PropertyGLib.IFile[]To be added.To be added.To be added.PropertyGLib.Property("filter")Gtk.FileFilterThe currently-applied file filter.a PropertyGtk.FileFilter[]The filters currently in use by this dialog for patterns of files to display.a PropertyGLib.GTypeThe of this object. a PropertyGLib.Property("local-only")System.Boolean
Sets whether only local files can be selected in the
file selector.
a
If true (the default),
then the selected file are files are guaranteed to be
accessible through the operating systems native file
file system and therefore the application only
needs to worry about the filename functions in
, like
,
rather than the URI functions like
.
MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideConfirmOverwrite", Type=typeof(Gtk.FileChooserDialog))Gtk.FileChooserConfirmationDefault handler for the event.To be added.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideCurrentFolderChanged", Type=typeof(Gtk.FileChooserDialog))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideFileActivated", Type=typeof(Gtk.FileChooserDialog))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideSelectionChanged", Type=typeof(Gtk.FileChooserDialog))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.MethodGLib.DefaultSignalHandler(ConnectionMethod="OverrideUpdatePreview", Type=typeof(Gtk.FileChooserDialog))System.VoidDefault handler for the event.Override this method in a subclass to provide a default handler for the event.PropertyGLib.IFileTo be added.To be added.To be added.PropertySystem.StringInternal function; gets the filename that should be previewed in a custom preview.a Not for general programmer use.PropertySystem.StringThe URI that should be previewed in a custom preview widget. a PropertyGLib.Property("preview-widget")Gtk.Widget
An application-supplied widget to use to display a custom preview
of the currently selected file.
a
To implement a preview, after setting the
preview widget, you connect to the
signal, and check
or
on each change. If you can
display a preview of the new file, update your widget and
set the preview active using
Otherwise, set the preview inactive.
When there is no application-supplied preview widget, or the
application-supplied preview widget is not active, the file chooser
may display an internally generated preview of the current file or
it may display no preview at all.
PropertyGLib.Property("preview-widget-active")System.Boolean
Sets whether the preview widget set by
should be shown for the current filename.
a When this property is set to false, the file chooser
may display an internally generated preview of the current file
or it may display no preview at all.MethodSystem.Void
a Removes from the list of filters that the user can select between.MethodSystem.Boolean
a Removes a folder from a file chooser's list of shortcut folders.a See also .MethodSystem.Boolean
a
Removes a folder URI from a file chooser's list of shortcut folders.
a
See also .
MethodSystem.VoidSelects all the files in the current folder of a file chooser.MethodSystem.Boolean
To be added.
To be added.To be added.To be added.MethodSystem.Boolean
a Selects a filename.a
If the file name isn't in the current
folder of the file chooser, then the current folder of the file chooser will
be changed to the folder containing .
EventGLib.Signal("selection-changed")System.EventHandlerThis event is raised every time the selected file changes.PropertyGLib.Property("select-multiple")System.Boolean
Sets whether multiple files can be selected in the file selector.
a
This is only relevant if the action is set to be
or
.
It cannot be set with either of the folder actions.
MethodSystem.Boolean
a
Selects the file at . If the URI doesn't refer to a
file in the current folder of the file chooser, then the current folder of
the file chooser will be changed to the folder that's part of .
a , true if both the
folder could be changed and the URI was
selected successfully, false otherwise.MethodSystem.Boolean
a
Sets the current folder for the file chooser from a local filename.
a
The user will be shown the full contents of the current folder,
plus user interface elements for navigating to other folders.
MethodSystem.Boolean
To be added.
To be added.To be added.To be added.MethodSystem.Boolean
a , the URI to use
Sets the current folder for the chooser from an URI.
a , true if the folder could be changed successfully, false otherwise
The user will be shown the full contents of the current folder,
plus user interface elements for navigating to other folders.
MethodSystem.Boolean
To be added.
To be added.To be added.To be added.MethodSystem.Boolean
a
Sets as the current filename for
the file chooser;
If the file name isn't in the current folder of the file chooser, then the
current folder of the file chooser will be changed to the folder containing
.
a , true if both the
folder could be changed and the file was
selected successfully, false otherwise.
This is equivalent to a sequence of
followed by .
Note that the file must exist, or nothing will be done except
for the directory change. To pre-enter a filename for the user, as in
a save-as dialog, use .
MethodSystem.Boolean
a
Sets the file referred to by as the
current file for the the file chooser.
a , true if both the folder
could be changed and the URI was
selected successfully, false otherwise.
If the file name isn't in the current folder of the file chooser,
then the current folder of the file chooser will be changed to the folder containing
. This is equivalent to a sequence of
followed by .
Note that the file must exist, or nothing will be done except
for the directory change. To pre-enter a filename for the user, as in
a save-as dialog, use .
PropertySystem.String[]The shortcut folders currently in use for this dialog.a PropertySystem.String[]The shortcut URIs currently allowed for this dialog.a PropertyGLib.Property("show-hidden")System.BooleanIndicates if Hidden files and directories should be visible.a MethodSystem.VoidUnselects all the files in the current folder of a file chooser.MethodSystem.Void
To be added.
To be added.To be added.MethodSystem.Void
a
Unselects a currently selected filename.
If the filename is not in the current directory, does not exist, or
is otherwise not currently selected, does nothing.
MethodSystem.Void
a
Unselects the file referred to by .
If the file is not in the current directory, does not exist, or
is otherwise not currently selected, does nothing.
EventGLib.Signal("update-preview")System.EventHandler
This signal is emitted when the preview in a file chooser should be
regenerated. For example, this can happen when the currently
selected file changes.
You should use this signal if you want your file chooser to have
a preview widget.Once you have installed a preview widget with
, you should update it when this
signal is emitted. You can use the properties
or
to get the name of the file to preview.
Your widget may not be able to preview all kinds of files; your callback
must set to inform the file
chooser about whether the preview was generated successfully or not.
TODO: insert example from gtkfilechooser-preview in gtk+ docs.
PropertySystem.StringThe URI for the currently selected file in
the file selector. a
If multiple files are selected,
one of the filenames will be returned at random.
If the file chooser is in folder mode, this function returns the
selected folder.
PropertySystem.String[]The URIs selected by this dialog.a PropertyGLib.Property("use-preview-label")System.Boolean
Sets whether the file chooser should display a stock label with the name of
the file that is being previewed; the default is true.
a
Applications that
want to draw the whole preview area themselves should set this
to false and display the name themselves in their preview widget.