]> git.saurik.com Git - wxWidgets.git/blob - include/wx/volume.h
Updates to match recent CVS changes.
[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 #include "wx/defs.h"
24
25 #if wxUSE_FSVOLUME
26
27 // the volume flags
28 enum
29 {
30 // is the volume mounted?
31 wxFS_VOL_MOUNTED = 0x0001,
32
33 // is the volume removable (floppy, CD, ...)?
34 wxFS_VOL_REMOVABLE = 0x0002,
35
36 // read only? (otherwise read write)
37 wxFS_VOL_READONLY = 0x0004,
38
39 // network resources
40 wxFS_VOL_REMOTE = 0x0008
41 };
42
43 // the volume types
44 enum wxFSVolumeKind
45 {
46 wxFS_VOL_FLOPPY,
47 wxFS_VOL_DISK,
48 wxFS_VOL_CDROM,
49 wxFS_VOL_DVDROM,
50 wxFS_VOL_NETWORK,
51 wxFS_VOL_OTHER,
52 wxFS_VOL_MAX
53 };
54
55 #if wxUSE_GUI
56
57 #include "wx/icon.h"
58
59 enum wxFSIconType
60 {
61 wxFS_VOL_ICO_SMALL = 0,
62 wxFS_VOL_ICO_LARGE,
63 wxFS_VOL_ICO_SEL_SMALL,
64 wxFS_VOL_ICO_SEL_LARGE,
65 wxFS_VOL_ICO_MAX
66 };
67
68 // already in wx/iconbndl.h
69 // WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
70
71 #endif // wxUSE_GUI
72
73 class WXDLLEXPORT wxFSVolume
74 {
75 public:
76 // return the array containing the names of the volumes
77 //
78 // only the volumes with the flags such that
79 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
80 // are returned (by default, all mounted ones)
81 static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
82 int flagsUnset = 0);
83
84 // stop execution of GetVolumes() called previously (should be called from
85 // another thread, of course)
86 static void CancelSearch();
87
88 // create the volume object with this name (should be one of those returned
89 // by GetVolumes()).
90 wxFSVolume();
91 wxFSVolume(const wxString& name);
92 bool Create(const wxString& name);
93
94 // accessors
95 // ---------
96
97 // is this a valid volume?
98 bool IsOk() const;
99
100 // kind of this volume?
101 wxFSVolumeKind GetKind() const;
102
103 // flags of this volume?
104 int GetFlags() const;
105
106 // can we write to this volume?
107 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
108
109 // get the name of the volume and the name which should be displayed to the
110 // user
111 wxString GetName() const { return m_volName; }
112 wxString GetDisplayName() const { return m_dispName; }
113
114 #if wxUSE_GUI
115 wxIcon GetIcon(wxFSIconType type) const;
116 #endif
117
118 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
119
120 private:
121 wxString m_volName;
122 wxString m_dispName;
123 #if wxUSE_GUI
124 wxIconArray m_icons;
125 #endif
126 bool m_isOk;
127
128 };
129
130 #endif // wxUSE_FSVOLUME
131
132 #endif // _WX_FSVOLUME_H_
133