]> git.saurik.com Git - wxWidgets.git/blob - include/wx/volume.h
Fixes for WinCE build caused by my last commit.
[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 #include "wx/defs.h"
20
21 #if wxUSE_FSVOLUME
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 class WXDLLIMPEXP_BASE wxFSVolumeBase
52 {
53 public:
54 // return the array containing the names of the volumes
55 //
56 // only the volumes with the flags such that
57 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
58 // are returned (by default, all mounted ones)
59 static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
60 int flagsUnset = 0);
61
62 // stop execution of GetVolumes() called previously (should be called from
63 // another thread, of course)
64 static void CancelSearch();
65
66 // create the volume object with this name (should be one of those returned
67 // by GetVolumes()).
68 wxFSVolumeBase();
69 wxFSVolumeBase(const wxString& name);
70 bool Create(const wxString& name);
71
72 // accessors
73 // ---------
74
75 // is this a valid volume?
76 bool IsOk() const;
77
78 // kind of this volume?
79 wxFSVolumeKind GetKind() const;
80
81 // flags of this volume?
82 int GetFlags() const;
83
84 // can we write to this volume?
85 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
86
87 // get the name of the volume and the name which should be displayed to the
88 // user
89 wxString GetName() const { return m_volName; }
90 wxString GetDisplayName() const { return m_dispName; }
91
92 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
93
94 protected:
95 // the internal volume name
96 wxString m_volName;
97
98 // the volume name as it is displayed to the user
99 wxString m_dispName;
100
101 // have we been initialized correctly?
102 bool m_isOk;
103 };
104
105 #if wxUSE_GUI
106
107 #include "wx/icon.h"
108 #include "wx/iconbndl.h" // only for wxIconArray
109
110 enum wxFSIconType
111 {
112 wxFS_VOL_ICO_SMALL = 0,
113 wxFS_VOL_ICO_LARGE,
114 wxFS_VOL_ICO_SEL_SMALL,
115 wxFS_VOL_ICO_SEL_LARGE,
116 wxFS_VOL_ICO_MAX
117 };
118
119 // wxFSVolume adds GetIcon() to wxFSVolumeBase
120 class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase
121 {
122 public:
123 wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
124 wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); }
125
126 wxIcon GetIcon(wxFSIconType type) const;
127
128 private:
129 void InitIcons();
130
131 // the different icons for this volume (created on demand)
132 wxIconArray m_icons;
133 };
134
135 #else // !wxUSE_GUI
136
137 // wxFSVolume is the same thing as wxFSVolume in wxBase
138 typedef wxFSVolumeBase wxFSVolume;
139
140 #endif // wxUSE_GUI/!wxUSE_GUI
141
142 #endif // wxUSE_FSVOLUME
143
144 #endif // _WX_FSVOLUME_H_
145