module Gtk::FileChooser

Overview

Gtk::FileChooser is an interface that can be implemented by file selection widgets.

In GTK, the main objects that implement this interface are Gtk::FileChooserWidget and Gtk::FileChooserDialog.

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

Gtk::FileChooser 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:

File Names and Encodings

When the user is finished selecting files in a Gtk::FileChooser, 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 Gtk::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.

Direct including types

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/file_chooser.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.cast(obj : GObject::Object) : self #

Cast a GObject::Object to self, throws a TypeCastError if the cast can't be made.


[View source]

Class Method Detail

def self.cast?(obj : GObject::Object) : self | Nil #

[View source]
def self.g_type : UInt64 #

[View source]

Instance Method Detail

def action : Gtk::FileChooserAction #

[View source]
def action=(action : Gtk::FileChooserAction) : Nil #

[View source]
def add_choice(id : String, label : String, options : Enumerable(String) | Nil, option_labels : Enumerable(String) | Nil) : Nil #

[View source]
def add_filter(filter : Gtk::FileFilter) : Nil #

[View source]
def add_shortcut_folder(folder : Gio::File) : Bool #

[View source]
def choice(id : String) : String | Nil #

[View source]
def create_folders : Bool #

[View source]
def create_folders=(create_folders : Bool) : Nil #

[View source]
def create_folders? : Bool #

[View source]
def current_folder : Gio::File | Nil #

[View source]
def current_folder=(file : Gio::File | Nil) : Bool #

[View source]
def current_name : String | Nil #

[View source]
def current_name=(name : String) : Nil #

[View source]
def file : Gio::File | Nil #

[View source]
def file=(file : Gio::File) : Bool #

[View source]
def files : Gio::ListModel #

[View source]
def filter : Gtk::FileFilter | Nil #

[View source]
def filter=(filter : Gtk::FileFilter) : Nil #

[View source]
def filters : Gio::ListModel #

[View source]
def remove_choice(id : String) : Nil #

[View source]
def remove_filter(filter : Gtk::FileFilter) : Nil #

[View source]
def remove_shortcut_folder(folder : Gio::File) : Bool #

[View source]
def select_multiple : Bool #

[View source]
def select_multiple=(select_multiple : Bool) : Nil #

[View source]
def select_multiple? : Bool #

[View source]
def set_choice(id : String, option : String) : Nil #

[View source]
def shortcut_folders : Gio::ListModel #

[View source]
abstract def to_unsafe #

[View source]