FileSelector.pkg 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. $#include "FileSelector.h"
  2. /// %File selector's list entry (file or directory.)
  3. struct FileSelectorEntry
  4. {
  5. /// Name.
  6. String name_;
  7. /// Directory flag.
  8. bool directory_;
  9. };
  10. /// %File selector dialog.
  11. class FileSelector : public Object
  12. {
  13. public:
  14. /// Set fileselector UI style.
  15. void SetDefaultStyle(XMLFile* style);
  16. /// Set title text.
  17. void SetTitle(const String& text);
  18. /// Set button texts.
  19. void SetButtonTexts(const String& okText, const String& cancelText);
  20. /// Set current path.
  21. void SetPath(const String& path);
  22. /// Set current filename.
  23. void SetFileName(const String& fileName);
  24. /// Set filters.
  25. void SetFilters(const Vector<String>& filters, unsigned defaultIndex);
  26. /// Set directory selection mode. Default false.
  27. void SetDirectoryMode(bool enable);
  28. /// Update elements to layout properly. Call this after manually adjusting the sub-elements.
  29. void UpdateElements();
  30. /// Return the UI style file.
  31. XMLFile* GetDefaultStyle() const;
  32. /// Return fileselector window.
  33. Window* GetWindow() const;
  34. /// Return window title text element.
  35. Text* GetTitleText() const;
  36. /// Return file list.
  37. ListView* GetFileList() const;
  38. /// Return path editor.
  39. LineEdit* GetPathEdit() const;
  40. /// Return filename editor.
  41. LineEdit* GetFileNameEdit() const;
  42. /// Return filter dropdown.
  43. DropDownList* GetFilterList() const;
  44. /// Return OK button.
  45. Button* GetOKButton() const;
  46. /// Return cancel button.
  47. Button* GetCancelButton() const;
  48. /// Return close button.
  49. Button* GetCloseButton() const;
  50. /// Return window title.
  51. const String& GetTitle() const;
  52. /// Return current path.
  53. const String& GetPath() const;
  54. /// Return current filename.
  55. const String& GetFileName() const;
  56. /// Return current filter.
  57. const String& GetFilter() const;
  58. /// Return current filter index.
  59. unsigned GetFilterIndex() const;
  60. /// Return directory mode flag.
  61. bool GetDirectoryMode() const;
  62. };