FileChooserRef

public struct FileChooserRef : FileChooserProtocol

GtkFileChooser is an interface that can be implemented by file selection widgets.

In GTK, the main objects that implement this interface are [classGtk.FileChooserWidget] and [classGtk.FileChooserDialog].

You do not need to write an object that implements the GtkFileChooser interface unless you are trying to adapt an existing file selector to expose a standard programming interface.

GtkFileChooser allows for shortcuts to various places in the filesystem. In the default implementation these are displayed in the left pane. It may be a bit confusing at first that these shortcuts come from various sources and in various flavours, so lets explain the terminology here:

  • Bookmarks: are created by the user, by dragging folders from the right pane to the left pane, or by using the “Add”. Bookmarks can be renamed and deleted by the user.

  • Shortcuts: can be provided by the application. For example, a Paint program may want to add a shortcut for a Clipart folder. Shortcuts cannot be modified by the user.

  • Volumes: are provided by the underlying filesystem abstraction. They are the “roots” of the filesystem.

File Names and Encodings

When the user is finished selecting files in a GtkFileChooser, your program can get the selected filenames as GFiles.

Adding options

You can add extra widgets to a file chooser to provide options that are not present in the default design, by using [methodGtk.FileChooser.add_choice]. Each choice has an identifier and a user visible label; additionally, each choice can have multiple options. If a choice has no option, it will be rendered as a check button with the given label; if a choice has options, it will be rendered as a combo box.

The FileChooserRef type acts as a lightweight Swift reference to an underlying GtkFileChooser instance. It exposes methods that can operate on this data type through FileChooserProtocol conformance. Use FileChooserRef only as an unowned reference to an existing GtkFileChooser instance.

  • ptr
    Untyped pointer to the underlying `GtkFileChooser` instance.
    

    For type-safe access, use the generated, typed pointer file_chooser_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

FileChooser Interface

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkFileChooser>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkFileChooser>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkFileChooser>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkFileChooser>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements FileChooserProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : FileChooserProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FileChooserProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FileChooserProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FileChooserProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FileChooserProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to FileChooserProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)