add modified version of Native File Dialog
it will replace portable-file-dialogs on Windows, and perhaps in the rest of operating systems (maybe not Linux) as well.
This commit is contained in:
parent
ad5072dad6
commit
d5d381328b
19 changed files with 2796 additions and 0 deletions
29
extern/nfd-modified/test/test_opendialog.c
vendored
Normal file
29
extern/nfd-modified/test/test_opendialog.c
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "nfd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* this test should compile on all supported platforms */
|
||||
|
||||
int main( void )
|
||||
{
|
||||
nfdchar_t *outPath = NULL;
|
||||
nfdresult_t result = NFD_OpenDialog( "png,jpg;pdf", NULL, &outPath );
|
||||
if ( result == NFD_OKAY )
|
||||
{
|
||||
puts("Success!");
|
||||
puts(outPath);
|
||||
free(outPath);
|
||||
}
|
||||
else if ( result == NFD_CANCEL )
|
||||
{
|
||||
puts("User pressed cancel.");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: %s\n", NFD_GetError() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
32
extern/nfd-modified/test/test_opendialogmultiple.c
vendored
Normal file
32
extern/nfd-modified/test/test_opendialogmultiple.c
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "nfd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* this test should compile on all supported platforms */
|
||||
|
||||
int main( void )
|
||||
{
|
||||
nfdpathset_t pathSet;
|
||||
nfdresult_t result = NFD_OpenDialogMultiple( "png,jpg;pdf", NULL, &pathSet );
|
||||
if ( result == NFD_OKAY )
|
||||
{
|
||||
size_t i;
|
||||
for ( i = 0; i < NFD_PathSet_GetCount(&pathSet); ++i )
|
||||
{
|
||||
nfdchar_t *path = NFD_PathSet_GetPath(&pathSet, i);
|
||||
printf("Path %i: %s\n", (int)i, path );
|
||||
}
|
||||
NFD_PathSet_Free(&pathSet);
|
||||
}
|
||||
else if ( result == NFD_CANCEL )
|
||||
{
|
||||
puts("User pressed cancel.");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: %s\n", NFD_GetError() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
29
extern/nfd-modified/test/test_pickfolder.c
vendored
Normal file
29
extern/nfd-modified/test/test_pickfolder.c
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "nfd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* this test should compile on all supported platforms */
|
||||
|
||||
int main( void )
|
||||
{
|
||||
nfdchar_t *outPath = NULL;
|
||||
nfdresult_t result = NFD_PickFolder( NULL, &outPath );
|
||||
if ( result == NFD_OKAY )
|
||||
{
|
||||
puts("Success!");
|
||||
puts(outPath);
|
||||
free(outPath);
|
||||
}
|
||||
else if ( result == NFD_CANCEL )
|
||||
{
|
||||
puts("User pressed cancel.");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: %s\n", NFD_GetError() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
28
extern/nfd-modified/test/test_savedialog.c
vendored
Normal file
28
extern/nfd-modified/test/test_savedialog.c
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "nfd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* this test should compile on all supported platforms */
|
||||
|
||||
int main( void )
|
||||
{
|
||||
nfdchar_t *savePath = NULL;
|
||||
nfdresult_t result = NFD_SaveDialog( "png,jpg;pdf", NULL, &savePath );
|
||||
if ( result == NFD_OKAY )
|
||||
{
|
||||
puts("Success!");
|
||||
puts(savePath);
|
||||
free(savePath);
|
||||
}
|
||||
else if ( result == NFD_CANCEL )
|
||||
{
|
||||
puts("User pressed cancel.");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Error: %s\n", NFD_GetError() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue