1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFSVolume - encapsulates system volume information
4 // Author: George Policello
8 // Copyright: (c) 2002 George Policello
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ----------------------------------------------------------------------------
13 // wxFSVolume represents a volume/drive/mount point in a file system
14 // ----------------------------------------------------------------------------
16 #ifndef _WX_FSVOLUME_H_
17 #define _WX_FSVOLUME_H_
26 // is the volume mounted?
27 wxFS_VOL_MOUNTED
= 0x0001,
29 // is the volume removable (floppy, CD, ...)?
30 wxFS_VOL_REMOVABLE
= 0x0002,
32 // read only? (otherwise read write)
33 wxFS_VOL_READONLY
= 0x0004,
36 wxFS_VOL_REMOTE
= 0x0008
51 class WXDLLIMPEXP_BASE wxFSVolumeBase
54 // return the array containing the names of the volumes
56 // only the volumes with the flags such that
57 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
58 // are returned (by default, all mounted ones)
59 static wxArrayString
GetVolumes(int flagsSet
= wxFS_VOL_MOUNTED
,
62 // stop execution of GetVolumes() called previously (should be called from
63 // another thread, of course)
64 static void CancelSearch();
66 // create the volume object with this name (should be one of those returned
69 wxFSVolumeBase(const wxString
& name
);
70 bool Create(const wxString
& name
);
75 // is this a valid volume?
78 // kind of this volume?
79 wxFSVolumeKind
GetKind() const;
81 // flags of this volume?
84 // can we write to this volume?
85 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY
); }
87 // get the name of the volume and the name which should be displayed to the
89 wxString
GetName() const { return m_volName
; }
90 wxString
GetDisplayName() const { return m_dispName
; }
92 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
95 // the internal volume name
98 // the volume name as it is displayed to the user
101 // have we been initialized correctly?
108 #include "wx/iconbndl.h" // only for wxIconArray
112 wxFS_VOL_ICO_SMALL
= 0,
114 wxFS_VOL_ICO_SEL_SMALL
,
115 wxFS_VOL_ICO_SEL_LARGE
,
119 // wxFSVolume adds GetIcon() to wxFSVolumeBase
120 class wxFSVolume
: public wxFSVolumeBase
123 wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
124 wxFSVolume(const wxString
& name
) : wxFSVolumeBase(name
) { InitIcons(); }
126 wxIcon
GetIcon(wxFSIconType type
) const;
131 // the different icons for this volume (created on demand)
137 // wxFSVolume is the same thing as wxFSVolume in wxBase
138 typedef wxFSVolumeBase wxFSVolume
;
140 #endif // wxUSE_GUI/!wxUSE_GUI
142 #endif // wxUSE_FSVOLUME
144 #endif // _WX_FSVOLUME_H_