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