CLASS:: Dialog
summary:: Shows various system dialogs
categories:: GUI>Accessories
related:: Classes/FileDialog, Classes/File

DESCRIPTION::
This class allows to show various system dialogs. link::#*openPanel:: will show a dialog for selecting a file to open, and link::#*savePanel:: will show a dialog for selecting or creating a file to save to.

The methods here are convenience functions built on top of link::Classes/FileDialog::.

CLASSMETHODS::
PRIVATE:: key

METHOD:: openPanel
	Shows a dialog for selection of an existing file (or multiple files) to open. It does not do anything with the file, instead it just passes the chosen filenames to the given result handler.

	ARGUMENT:: okFunc
		An object to be evaluated when OK is pressed. As argument, either a single filename is passed as a String, or an Array of Strings for multiple selected items is passed, depending on the strong::multipleSelection:: argument. The paths will always be absolute paths.
	ARGUMENT:: cancelFunc
		An object to be evaluated when Cancel is pressed.
	ARGUMENT:: multipleSelection
		A Boolean indicating whether multiple files can be selected.
	ARGUMENT:: path
		A string. The dialog will initially display the contents of this path. The default is the current
		user's home directory.
	DISCUSSION::
	Example:
code::
(
Dialog.openPanel({ arg path;
	path.postln;
},{
	"cancelled".postln;
});
)
::

METHOD:: savePanel
	Shows a dialog for selecting or creating a file to save to. It does not do anything with the selected file, and does not create any file; instead it just passes the chosen filename to the given result handler.

	ARGUMENT:: okFunc
		An object to be evaluated when OK is pressed. The chosen filename (as an absolute path) is passed as a String as argument. If the file already exists, the user will be asked to confirm.
	ARGUMENT:: cancelFunc
		An object to be evaluated when Cancel is pressed.
	ARGUMENT:: path
		A string. The dialog will initially display the contents of this path. The default is the current
		user's home directory.
	DISCUSSION::
	Example:
code::
(
Dialog.savePanel({ arg path;
	path.postln;
},{
	"cancelled".postln;
});
)
::

METHOD:: getPaths
	note::Deprecated. Use link::#*openPanel:: instead. ::

	Implements the same functionality as *openPanel, only the last argument is named differently and defaults to true.
