volume.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: volume.h
  3. // Purpose: interface of wxFSVolume
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. The volume flags.
  9. */
  10. enum wxFSVolumeFlags
  11. {
  12. /// Is the volume mounted?
  13. wxFS_VOL_MOUNTED = 0x0001,
  14. /// Is the volume removable (floppy, CD, ...)?
  15. wxFS_VOL_REMOVABLE = 0x0002,
  16. /// Read only? (otherwise read write).
  17. wxFS_VOL_READONLY = 0x0004,
  18. /// Network resources.
  19. wxFS_VOL_REMOTE = 0x0008
  20. };
  21. /**
  22. The volume types.
  23. */
  24. enum wxFSVolumeKind
  25. {
  26. wxFS_VOL_FLOPPY,
  27. wxFS_VOL_DISK,
  28. wxFS_VOL_CDROM,
  29. wxFS_VOL_DVDROM,
  30. wxFS_VOL_NETWORK,
  31. wxFS_VOL_OTHER,
  32. wxFS_VOL_MAX
  33. };
  34. /**
  35. Icon types used by wxFSVolume.
  36. */
  37. enum wxFSIconType
  38. {
  39. wxFS_VOL_ICO_SMALL = 0,
  40. wxFS_VOL_ICO_LARGE,
  41. wxFS_VOL_ICO_SEL_SMALL,
  42. wxFS_VOL_ICO_SEL_LARGE,
  43. wxFS_VOL_ICO_MAX
  44. };
  45. /**
  46. @class wxFSVolume
  47. wxFSVolume represents a volume (also known as 'drive') in a file system
  48. under wxMSW.
  49. Unix ports of wxWidgets do not have the concept of volumes and thus do
  50. not implement wxFSVolume.
  51. @onlyfor{wxmsw}
  52. @library{wxbase}
  53. @category{misc}
  54. */
  55. class wxFSVolume
  56. {
  57. public:
  58. /**
  59. Default ctor. Use Create() later.
  60. */
  61. wxFSVolume();
  62. /**
  63. Create the volume object with the given @a name (which should be one of
  64. those returned by GetVolumes()).
  65. */
  66. wxFSVolume(const wxString& name);
  67. /**
  68. Create the volume object with the given @a name (which should be one of
  69. those returned by GetVolumes()).
  70. */
  71. bool Create(const wxString& name);
  72. /**
  73. Returns an array containing the names of the volumes of this system.
  74. Only the volumes with @e flags such that the expression
  75. @code (flags & flagsSet) == flagsSet && !(flags & flagsUnset) @endcode
  76. is @true, are returned. By default, all mounted ones are returned.
  77. See ::wxFSVolumeFlags enumeration values for a list of valid flags.
  78. This operation may take a while and, even if this function is
  79. synchronous, it can be stopped using CancelSearch().
  80. */
  81. static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
  82. int flagsUnset = 0);
  83. /**
  84. Stops execution of GetVolumes() called previously (should be called from
  85. another thread, of course).
  86. */
  87. static void CancelSearch();
  88. /**
  89. Is this a valid volume?
  90. */
  91. bool IsOk() const;
  92. /**
  93. Returns the kind of this volume.
  94. */
  95. wxFSVolumeKind GetKind() const;
  96. /**
  97. Returns the flags of this volume. See ::wxFSVolumeFlags enumeration values.
  98. */
  99. int GetFlags() const;
  100. /**
  101. Returns @true if this volume is writable.
  102. */
  103. bool IsWritable() const;
  104. /**
  105. Returns the name of the volume; this is the internal name
  106. for the volume used by the operating system.
  107. */
  108. wxString GetName() const;
  109. /**
  110. Returns the name of the volume meant to be shown to the user.
  111. */
  112. wxString GetDisplayName() const;
  113. /**
  114. This function is available only when @c wxUSE_GUI is @c 1.
  115. Returns the icon used by the native toolkit for the given file system type.
  116. */
  117. wxIcon GetIcon(wxFSIconType type) const;
  118. };