Skip to content

Commit

Permalink
Added documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GamesTrap committed Nov 10, 2020
1 parent 6dc27b3 commit 5c4ef9a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ SOFTWARE.

#include <ModernFileDialogs.h>

//#define SaveFileExamples 1
//#define OpenFileExamples 1
#define SaveFileExamples 1
#define OpenFileExamples 1
#define SelectFolderExamples 1

int main()
Expand Down
2 changes: 0 additions & 2 deletions ModernFileDialogs/ModernFileDialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@ SOFTWARE.
#include <shlobj.h>
#include <conio.h>
#include <direct.h>
#define SLASH "\\"
#else
#include <limits.h>
#include <unistd.h>
#include <dirent.h>
#include <termios.h>
#include <sys/utsname.h>
#include <signal.h>
#define SLASH "/"
#endif

//-------------------------------------------------------------------------------------------------------------------//
Expand Down
54 changes: 42 additions & 12 deletions ModernFileDialogs/ModernFileDialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,72 @@ SOFTWARE.
#include <string>
#include <vector>

//TODO Document
//TODO Multiple filters under the same name should be splitted by ';'s
//TODO Example: {"SomeFile", "*.SF;*.SomeFile}
/// <summary>
/// Open a Save File Dialog.
/// </summary>
/// <param name="title">Title for the Dialog.</param>
/// <param name="defaultPathAndFile">Sets a default path and file.</param>
/// <param name="filterPatterns">File filters (Separate multiple extensions for the same filter with a ';'. Example: {"Test File", "*.Test;*.TS"}.</param>
/// <param name="allFiles">Whether to add a filter for "All Files (*.*)" or not.</param>
/// <returns>Path of the Dialog or empty string.</returns>
std::string SaveFile(const std::string& title,
const std::string& defaultPathAndFile = "",
const std::vector<std::pair<std::string, std::string>>& filterPatterns = {},
bool allFiles = true);

//-------------------------------------------------------------------------------------------------------------------//
//
//TODO Document
//TODO Multiple filters under the same name should be splitted by ';'s
//TODO Example: {"SomeFile", "*.SF;*.SomeFile}

/// <summary>
/// Opens an Open File Dialog.
/// </summary>
/// <param name="title">Title for the Dialog.</param>
/// <param name="defaultPathAndFile">Sets a default path and file.</param>
/// <param name="filterPatterns">File filters (Separate multiple extensions for the same filter with a ';'. Example: {"Test File", "*.Test;*.TS"}.</param>
/// <param name="allowMultipleSelects">Whether to allow multiple file selections or not.</param>
/// <param name="allFiles">Whether to add a filter for "All Files (*.*)" or not.</param>
/// <returns>Path(s) of the Dialog or empty string or vector.</returns>
std::vector<std::string> OpenFile(const std::string& title,
const std::string& defaultPathAndFile = "",
const std::vector<std::pair<std::string, std::string>>& filterPatterns = {},
bool allowMultipleSelects = false,
bool allFiles = true);

//TODO Document
//TODO Single file alias for OpenFile
/// <summary>
/// Opens an Open File Dialog for a single file.<br>
/// Alias for OpenFile();
/// </summary>
/// <param name="title">Title for the Dialog.</param>
/// <param name="defaultPathAndFile">Sets a default path and file.</param>
/// <param name="filterPatterns">File filters (Separate multiple extensions for the same filter with a ';'. Example: {"Test File", "*.Test;*.TS"}.</param>
/// <param name="allFiles">Whether to add a filter for "All Files (*.*)" or not.</param>
/// <returns>Path of the Dialog or empty string.</returns>
std::string OpenSingleFile(const std::string& title,
const std::string& defaultPathAndFile = "",
const std::vector<std::pair<std::string, std::string>>& filterPatterns = {},
bool allFiles = true);

//TODO Document
//TODO Multi file alias for OpenFile
/// <summary>
/// Opens an Open File Dialog for multiple files.<br>
/// Alias for OpenFile();
/// </summary>
/// <param name="title">Title for the Dialog.</param>
/// <param name="defaultPathAndFile">Sets a default path and file.</param>
/// <param name="filterPatterns">File filters (Separate multiple extensions for the same filter with a ';'. Example: {"Test File", "*.Test;*.TS"}.</param>
/// <param name="allFiles">Whether to add a filter for "All Files (*.*)" or not.</param>
/// <returns>Paths of the Dialog or empty vector.</returns>
std::vector<std::string> OpenMultipleFiles(const std::string& title,
const std::string& defaultPathAndFile = "",
const std::vector<std::pair<std::string, std::string>>& filterPatterns = {},
bool allFiles = true);

//-------------------------------------------------------------------------------------------------------------------//

//TODO Document
/// <summary>
/// Opens an Select Folder Dialog.
/// </summary>
/// <param name="title">Title for the Dialog.</param>
/// <param name="defaultPath">Sets a default path and file.</param>
/// <returns>Path of the Select Folder Dialog or empty string.</returns>
std::string SelectFolder(const std::string& title, const std::string& defaultPath = "");

#endif /*_GAMESTRAP_MODERNFILEDIALOGS_H_*/

0 comments on commit 5c4ef9a

Please sign in to comment.