module FileDialogs

Defined in:

tinyfiledialogs-cr.cr

Constant Summary

DEFAULT_RGB_ARRAY = StaticArray[0_u8, 128_u8, 255_u8]

Class Method Summary

Class Method Detail

def self.beep #

Beep


[View source]
def self.color_chooser(*, title : String | Nil = nil, default_hex : String | Nil = nil, default_rgb : StaticArray(LibC::UChar, 3) = DEFAULT_RGB_ARRAY, result_rgb : Pointer(StaticArray(LibC::UChar, 3)) | Nil = nil) : String | Nil #

Creates a color choice dialog. Optional (title: String | Nil) defaults to nil. Optional (default_hex: String | Nil) defaults to nil. Determines the initial color of the color picker. Use nil if prefer to use default_rgb instead. Optional (default_rgb: StaticArray(LibC::Uchar, 3)) defaults to StaticArray[0_u8, 128_u8, 255_u8]. Only used if default_hex is nil. Optional (result_rgb: Pointer(StaticArray(LibC::Uchar,3)) | Nil) defaults to nil. This array is modified in place for the RGB of the chosen color. When result_rgb is nil, FileDialog.color_results_rgb keeps track of the results of the latest color choice as a StaticArray regardless. Returns a String representing the hexcode of the chosen color.


[View source]
def self.color_results_rgb : StaticArray(LibC::UChar, 3) #

The latest color_chooser result in RGB. Only updated when color_chooser is used and result_rgb is nil. Returns StaticArray(LibC::UChar, 3).


[View source]
def self.input_box(*, title : String, message : String, default : String | Nil = nil) : String | Nil #

Creates a text input box. Requires (title: String, message: String) Optional (default: String | Nil) defaults to nil. Determines the default string in the input box. Use nil for a password box. Returns a String (the input text) or nil (on canceling input).


[View source]
def self.message_box(*, title : String, message : String, type : String = "ok", icon : String = "info", default : Int = 0) : Symbol #

Creates a message popup Requires (title: String, message: String) Optional (type: String) defaults to "ok". Can also be "okaycancel", "yesno", or "yesnocancel", determining which buttons are shown. Optional (icon: String) defaults to "info". Can also be "warning", "error", or "question". Options (default: Int) defaults to 0. Determines which button is highlighted by default. Returns Symbol of :cancel, :no, :ok, or :yes depending on pressed button. Returns :cancel if no button was pressed.


[View source]
def self.notify_popup(*, title : String, message : String, icon : String = "info") #

Creates a notification popup Requires (title: String, message: String) Optional (icon: String) defaults to "info". Can also be "warning", or "error"


[View source]
def self.open_file_dialog(*, title : String | Nil = nil, default : String | Nil = nil, filter_patterns : Array(String) | Nil = nil, description : String | Nil = nil, multiple_selects : Bool = false) : Array(String) | Nil #

Creates a open file(s) location dialog. Optional (title: String | Nil) defaults to nil. Optional (default: String | Nil) defaults to nil. Determines default opening location and/or directory. End with "/" to indicate choosing a directory rather than a filename. Optional (filter_patterns: Array(String) | Nil) defaults to nil. Use an array of filetypes formatted like [".txt", ".png"] to determine filters. Optional (description: String | Nil) defaults to nil. Use to show a description of the file you're opening or other info. Optional (multiple_selects: Bool) defaults to false. Use true if you want the user to be able to choose multiple files. Returns an Array(String) of all files chosen, even if only 1, or nil upon canceling. Does not do any File IO.


[View source]
def self.save_file_dialog(*, title : String | Nil = nil, default : String | Nil = nil, filter_patterns : Array(String) | Nil = nil, description : String | Nil = nil) : String | Nil #

Creates a saving file location dialog. Optional (title: String | Nil) defaults to nil. Optional (default: String | Nil) defaults to nil. Determines default saving location and/or directory. End with "/" to indicate choosing a directory rather than a filename. Optional (filter_patterns: Array(String) | Nil) defaults to nil. Use an array of filetypes formatted like [".txt", ".png"] to determine filters. Optional (description: String | Nil) defaults to nil. Use to show a description of the file you're saving or other info. Returns a string denoting choice of where to save a file, or nil upon canceling. Does not do any File IO.


[View source]
def self.select_folder_dialog(*, title : String | Nil = nil, default : String | Nil = nil) : String | Nil #

Creates a select folder dialog. Optional (title: String | Nil) defaults to nil. Optional (default: String | Nil) defaults to nil. Determines default opening directory. Returns a string of chosen folder, or nil upon canceling. Does not do any File IO.


[View source]