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