nfd.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Native File Dialog
  3. User API
  4. http://www.frogtoss.com/labs
  5. */
  6. #ifndef _NFD_H
  7. #define _NFD_H
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #include <stddef.h>
  12. /* denotes UTF-8 char */
  13. typedef char nfdchar_t;
  14. /* opaque data structure -- see NFD_PathSet_* */
  15. typedef struct {
  16. nfdchar_t *buf;
  17. size_t *indices; /* byte offsets into buf */
  18. size_t count; /* number of indices into buf */
  19. }nfdpathset_t;
  20. typedef enum {
  21. NFD_ERROR, /* programmatic error */
  22. NFD_OKAY, /* user pressed okay, or successful return */
  23. NFD_CANCEL /* user pressed cancel */
  24. }nfdresult_t;
  25. /* nfd_<targetplatform>.c */
  26. /* single file open dialog */
  27. nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
  28. const nfdchar_t *defaultPath,
  29. nfdchar_t **outPath );
  30. /* multiple file open dialog */
  31. nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
  32. const nfdchar_t *defaultPath,
  33. nfdpathset_t *outPaths );
  34. /* save dialog */
  35. nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
  36. const nfdchar_t *defaultPath,
  37. nfdchar_t **outPath );
  38. /* nfd_common.c */
  39. /* get last error -- set when nfdresult_t returns NFD_ERROR */
  40. const char *NFD_GetError( void );
  41. /* get the number of entries stored in pathSet */
  42. size_t NFD_PathSet_GetCount( const nfdpathset_t *pathSet );
  43. /* Get the UTF-8 path at offset index */
  44. nfdchar_t *NFD_PathSet_GetPath( const nfdpathset_t *pathSet, size_t index );
  45. /* Free the pathSet */
  46. void NFD_PathSet_Free( nfdpathset_t *pathSet );
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif