gcsx_filedialog.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* GCSx
  2. ** FILEDIALOG.H
  3. **
  4. ** Standard file open/save/save as dialogs
  5. */
  6. /*****************************************************************************
  7. ** Copyright (C) 2003-2006 Janson
  8. **
  9. ** This program is free software; you can redistribute it and/or modify
  10. ** it under the terms of the GNU General Public License as published by
  11. ** the Free Software Foundation; either version 2 of the License, or
  12. ** (at your option) any later version.
  13. **
  14. ** This program is distributed in the hope that it will be useful,
  15. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ** GNU General Public License for more details.
  18. **
  19. ** You should have received a copy of the GNU General Public License
  20. ** along with this program; if not, write to the Free Software
  21. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  22. *****************************************************************************/
  23. #ifndef __GCSx_FILEDIALOG_H_
  24. #define __GCSx_FILEDIALOG_H_
  25. // Returns false on cancel
  26. // Filename can contain a suggested path/file
  27. int fileOpen(int type, int requireWriteAccess, std::string& filename);
  28. // Prompts to overwrite
  29. // filename can be blank
  30. // extension will be added if none given
  31. // Returns false on cancel
  32. // Previous filename may include a path or be blank
  33. // May create a 0-byte file if one did not exist
  34. int fileSaveAs(int type, std::string& filename);
  35. // Cleans up some global objects
  36. void destroyFileDialogGlobals();
  37. // Treeview derivative that handles drive/directory trees
  38. class DirectoryView : public TreeView {
  39. private:
  40. std::string path;
  41. int hasSubDirs;
  42. public:
  43. // Name is the displayed label, which should be the last portion of the path
  44. // Fullpath NULL for root
  45. DirectoryView(const std::string& name, const char* fullpath, void* tPtr = NULL, int (*tAction)(void* ptr, int code, int command, int check) = NULL, int topLevel = 0);
  46. ~DirectoryView();
  47. void redo(); // Closes and clears all items (refreshes)
  48. int hasSubItems() const;
  49. void expand(int state = 1);
  50. const char* getFullpath() const { return path.c_str(); };
  51. };
  52. #endif