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_
19 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
20 #pragma interface "fsvolume.h"
30 // is the volume mounted?
31 wxFS_VOL_MOUNTED
= 0x0001,
33 // is the volume removable (floppy, CD, ...)?
34 wxFS_VOL_REMOVABLE
= 0x0002,
36 // read only? (otherwise read write)
37 wxFS_VOL_READONLY
= 0x0004,
40 wxFS_VOL_REMOTE
= 0x0008
55 class WXDLLIMPEXP_BASE wxFSVolumeBase
58 // return the array containing the names of the volumes
60 // only the volumes with the flags such that
61 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
62 // are returned (by default, all mounted ones)
63 static wxArrayString
GetVolumes(int flagsSet
= wxFS_VOL_MOUNTED
,
66 // stop execution of GetVolumes() called previously (should be called from
67 // another thread, of course)
68 static void CancelSearch();
70 // create the volume object with this name (should be one of those returned
73 wxFSVolumeBase(const wxString
& name
);
74 bool Create(const wxString
& name
);
79 // is this a valid volume?
82 // kind of this volume?
83 wxFSVolumeKind
GetKind() const;
85 // flags of this volume?
88 // can we write to this volume?
89 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY
); }
91 // get the name of the volume and the name which should be displayed to the
93 wxString
GetName() const { return m_volName
; }
94 wxString
GetDisplayName() const { return m_dispName
; }
96 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
99 // the internal volume name
102 // the volume name as it is displayed to the user
105 // have we been initialized correctly?
112 #include "wx/iconbndl.h" // only for wxIconArray
116 wxFS_VOL_ICO_SMALL
= 0,
118 wxFS_VOL_ICO_SEL_SMALL
,
119 wxFS_VOL_ICO_SEL_LARGE
,
123 // wxFSVolume adds GetIcon() to wxFSVolumeBase
124 class wxFSVolume
: public wxFSVolumeBase
127 wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
128 wxFSVolume(const wxString
& name
) : wxFSVolumeBase(name
) { InitIcons(); }
130 wxIcon
GetIcon(wxFSIconType type
) const;
135 // the different icons for this volume (created on demand)
141 // wxFSVolume is the same thing as wxFSVolume in wxBase
142 typedef wxFSVolumeBase wxFSVolume
;
144 #endif // wxUSE_GUI/!wxUSE_GUI
146 #endif // wxUSE_FSVOLUME
148 #endif // _WX_FSVOLUME_H_