//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System.Runtime.CompilerServices;
namespace bs.Editor
{
/** @addtogroup Windows
* @{
*/
///
/// Contains methods for opening various OS-specific browse, open and save file/folder dialogs.
///
public static class BrowseDialog
{
///
/// Displays a platform specific dialog that allows the user to select file(s).
///
/// Default path the dialog should point to.
/// Semi-colon separated list of file names or types to display in the dialog,
/// for example "exe;txt;png".
/// True if user is allowed to select multiple files.
/// A list of file paths selected by the user.
/// True if the user selected the file(s), false if the user canceled out of the dialog.
public static bool OpenFile(string defaultPath, string filterList, bool allowMultiselect, out string[] outPaths)
{
return Internal_OpenFile(defaultPath, filterList, allowMultiselect, out outPaths);
}
///
/// Displays a platform specific dialog that allows the user to select a folder.
///
/// Default path the dialog should point to.
/// Path to the selected folder.
/// True if the user selected the folder, false if the user canceled out of the dialog.
public static bool OpenFolder(string defaultPath, out string outPath)
{
return Internal_OpenFolder(defaultPath, out outPath);
}
///
/// Displays a platform specific dialog that allows the user to select where to save a file.
///
/// Default path the dialog should point to.
/// Semi-colon separated list of file names or types to display in the dialog,
/// for example "exe;txt;png".
/// File path selected by the user.
/// True if the user selected the file, false if the user canceled out of the dialog.
public static bool SaveFile(string defaultPath, string filterList, out string outPath)
{
return Internal_SaveFile(defaultPath, filterList, out outPath);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Internal_OpenFile(string defaultPath, string filterList, bool allowMultiselect, out string[] outPaths);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Internal_OpenFolder(string defaultPath, out string outPath);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool Internal_SaveFile(string defaultPath, string filterList, out string outPath);
}
/** @} */
}