]>
Commit | Line | Data |
---|---|---|
7183fd72 VZ |
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 | ||
05815ab3 VZ |
23 | #include "wx/defs.h" |
24 | ||
25 | #if wxUSE_FSVOLUME | |
26 | ||
7183fd72 VZ |
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 | |
05815ab3 VZ |
56 | |
57 | #include "wx/icon.h" | |
58 | ||
7183fd72 VZ |
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 | }; | |
7183fd72 VZ |
67 | |
68 | WX_DECLARE_OBJARRAY(wxIcon, wxIconArray); | |
69 | ||
05815ab3 VZ |
70 | #endif // wxUSE_GUI |
71 | ||
7183fd72 VZ |
72 | class WXDLLEXPORT wxFSVolume |
73 | { | |
74 | public: | |
75 | // return the array containing the names of the volumes | |
76 | // | |
77 | // only the volumes with the flags such that | |
78 | // (flags & flagsSet) == flagsSet && !(flags & flagsUnset) | |
79 | // are returned (by default, all mounted ones) | |
80 | static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED, | |
81 | int flagsUnset = 0); | |
82 | ||
83 | // stop execution of GetVolumes() called previously (should be called from | |
84 | // another thread, of course) | |
85 | static void CancelSearch(); | |
86 | ||
87 | // create the volume object with this name (should be one of those returned | |
88 | // by GetVolumes()). | |
89 | wxFSVolume(); | |
90 | wxFSVolume(const wxString& name); | |
91 | bool Create(const wxString& name); | |
92 | ||
93 | // accessors | |
94 | // --------- | |
95 | ||
96 | // is this a valid volume? | |
97 | bool IsOk() const; | |
98 | ||
99 | // kind of this volume? | |
100 | wxFSVolumeKind GetKind() const; | |
101 | ||
102 | // flags of this volume? | |
103 | int GetFlags() const; | |
104 | ||
105 | // can we write to this volume? | |
106 | bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); } | |
107 | ||
108 | // get the name of the volume and the name which should be displayed to the | |
109 | // user | |
110 | wxString GetName() const { return m_volName; } | |
111 | wxString GetDisplayName() const { return m_dispName; } | |
112 | ||
113 | #if wxUSE_GUI | |
114 | wxIcon GetIcon(wxFSIconType type) const; | |
115 | #endif | |
116 | ||
117 | // TODO: operatios (Mount(), Unmount(), Eject(), ...)? | |
118 | ||
119 | private: | |
120 | wxString m_volName; | |
121 | wxString m_dispName; | |
122 | #if wxUSE_GUI | |
123 | wxIconArray m_icons; | |
124 | #endif | |
125 | bool m_isOk; | |
126 | ||
127 | }; | |
128 | ||
05815ab3 VZ |
129 | #endif // wxUSE_FSVOLUME |
130 | ||
7183fd72 VZ |
131 | #endif // _WX_FSVOLUME_H_ |
132 |