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_
23 #include "wx/arrstr.h"
28 // is the volume mounted?
29 wxFS_VOL_MOUNTED
= 0x0001,
31 // is the volume removable (floppy, CD, ...)?
32 wxFS_VOL_REMOVABLE
= 0x0002,
34 // read only? (otherwise read write)
35 wxFS_VOL_READONLY
= 0x0004,
38 wxFS_VOL_REMOTE
= 0x0008
53 class WXDLLIMPEXP_BASE wxFSVolumeBase
56 // return the array containing the names of the volumes
58 // only the volumes with the flags such that
59 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
60 // are returned (by default, all mounted ones)
61 static wxArrayString
GetVolumes(int flagsSet
= wxFS_VOL_MOUNTED
,
64 // stop execution of GetVolumes() called previously (should be called from
65 // another thread, of course)
66 static void CancelSearch();
68 // create the volume object with this name (should be one of those returned
71 wxFSVolumeBase(const wxString
& name
);
72 bool Create(const wxString
& name
);
77 // is this a valid volume?
80 // kind of this volume?
81 wxFSVolumeKind
GetKind() const;
83 // flags of this volume?
86 // can we write to this volume?
87 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY
); }
89 // get the name of the volume and the name which should be displayed to the
91 wxString
GetName() const { return m_volName
; }
92 wxString
GetDisplayName() const { return m_dispName
; }
94 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
97 // the internal volume name
100 // the volume name as it is displayed to the user
103 // have we been initialized correctly?
110 #include "wx/iconbndl.h" // only for wxIconArray
114 wxFS_VOL_ICO_SMALL
= 0,
116 wxFS_VOL_ICO_SEL_SMALL
,
117 wxFS_VOL_ICO_SEL_LARGE
,
121 // wxFSVolume adds GetIcon() to wxFSVolumeBase
122 class WXDLLIMPEXP_CORE wxFSVolume
: public wxFSVolumeBase
125 wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
126 wxFSVolume(const wxString
& name
) : wxFSVolumeBase(name
) { InitIcons(); }
128 wxIcon
GetIcon(wxFSIconType type
) const;
133 // the different icons for this volume (created on demand)
139 // wxFSVolume is the same thing as wxFSVolume in wxBase
140 typedef wxFSVolumeBase wxFSVolume
;
142 #endif // wxUSE_GUI/!wxUSE_GUI
144 #endif // wxUSE_FSVOLUME
146 #endif // _WX_FSVOLUME_H_