]> git.saurik.com Git - wxWidgets.git/blob - include/wx/volume.h
added wxFSVolume patch from George Policello (untested, unreferenced from the project...
[wxWidgets.git] / include / wx / volume.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/volume.h
3 // Purpose: wxFSVolume - encapsulates system volume information
4 // Author: George Policello
5 // Modified by:
6 // Created: 28 Jan 02
7 // RCS-ID: $Id$
8 // Copyright: (c) 2002 George Policello
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ----------------------------------------------------------------------------
13 // wxFSVolume represents a volume/drive/mount point in a file system
14 // ----------------------------------------------------------------------------
15
16 #ifndef _WX_FSVOLUME_H_
17 #define _WX_FSVOLUME_H_
18
19 #ifdef __GNUG__
20 #pragma interface "fsvolume.h"
21 #endif
22
23 // the volume flags
24 enum
25 {
26 // is the volume mounted?
27 wxFS_VOL_MOUNTED = 0x0001,
28
29 // is the volume removable (floppy, CD, ...)?
30 wxFS_VOL_REMOVABLE = 0x0002,
31
32 // read only? (otherwise read write)
33 wxFS_VOL_READONLY = 0x0004,
34
35 // network resources
36 wxFS_VOL_REMOTE = 0x0008
37 };
38
39 // the volume types
40 enum wxFSVolumeKind
41 {
42 wxFS_VOL_FLOPPY,
43 wxFS_VOL_DISK,
44 wxFS_VOL_CDROM,
45 wxFS_VOL_DVDROM,
46 wxFS_VOL_NETWORK,
47 wxFS_VOL_OTHER,
48 wxFS_VOL_MAX
49 };
50
51 #if wxUSE_GUI
52 enum wxFSIconType
53 {
54 wxFS_VOL_ICO_SMALL = 0,
55 wxFS_VOL_ICO_LARGE,
56 wxFS_VOL_ICO_SEL_SMALL,
57 wxFS_VOL_ICO_SEL_LARGE,
58 wxFS_VOL_ICO_MAX
59 };
60 #endif // wxUSE_GUI
61
62 WX_DECLARE_OBJARRAY(wxIcon, wxIconArray);
63
64 class WXDLLEXPORT wxFSVolume
65 {
66 public:
67 // return the array containing the names of the volumes
68 //
69 // only the volumes with the flags such that
70 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
71 // are returned (by default, all mounted ones)
72 static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
73 int flagsUnset = 0);
74
75 // stop execution of GetVolumes() called previously (should be called from
76 // another thread, of course)
77 static void CancelSearch();
78
79 // create the volume object with this name (should be one of those returned
80 // by GetVolumes()).
81 wxFSVolume();
82 wxFSVolume(const wxString& name);
83 bool Create(const wxString& name);
84
85 // accessors
86 // ---------
87
88 // is this a valid volume?
89 bool IsOk() const;
90
91 // kind of this volume?
92 wxFSVolumeKind GetKind() const;
93
94 // flags of this volume?
95 int GetFlags() const;
96
97 // can we write to this volume?
98 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
99
100 // get the name of the volume and the name which should be displayed to the
101 // user
102 wxString GetName() const { return m_volName; }
103 wxString GetDisplayName() const { return m_dispName; }
104
105 #if wxUSE_GUI
106 wxIcon GetIcon(wxFSIconType type) const;
107 #endif
108
109 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
110
111 private:
112 wxString m_volName;
113 wxString m_dispName;
114 #if wxUSE_GUI
115 wxIconArray m_icons;
116 #endif
117 bool m_isOk;
118
119 };
120
121 #endif // _WX_FSVOLUME_H_
122