]> git.saurik.com Git - wxWidgets.git/blame - include/wx/volume.h
Add wxWinVersion_7 to the private wxMSW wxWinVersion enum.
[wxWidgets.git] / include / wx / volume.h
CommitLineData
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
65571936 9// Licence: wxWindows licence
7183fd72
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ----------------------------------------------------------------------------
34db8177 13// wxFSVolume represents a volume/drive in a file system
7183fd72
VZ
14// ----------------------------------------------------------------------------
15
16#ifndef _WX_FSVOLUME_H_
17#define _WX_FSVOLUME_H_
18
05815ab3
VZ
19#include "wx/defs.h"
20
21#if wxUSE_FSVOLUME
22
34deaa93
WS
23#include "wx/arrstr.h"
24
7183fd72 25// the volume flags
34db8177 26enum wxFSVolumeFlags
7183fd72
VZ
27{
28 // is the volume mounted?
29 wxFS_VOL_MOUNTED = 0x0001,
30
31 // is the volume removable (floppy, CD, ...)?
32 wxFS_VOL_REMOVABLE = 0x0002,
33
34 // read only? (otherwise read write)
35 wxFS_VOL_READONLY = 0x0004,
36
37 // network resources
38 wxFS_VOL_REMOTE = 0x0008
39};
40
41// the volume types
42enum wxFSVolumeKind
43{
44 wxFS_VOL_FLOPPY,
45 wxFS_VOL_DISK,
46 wxFS_VOL_CDROM,
47 wxFS_VOL_DVDROM,
48 wxFS_VOL_NETWORK,
49 wxFS_VOL_OTHER,
50 wxFS_VOL_MAX
51};
52
bddd7a8d 53class WXDLLIMPEXP_BASE wxFSVolumeBase
7183fd72
VZ
54{
55public:
56 // return the array containing the names of the volumes
57 //
58 // only the volumes with the flags such that
59 // (flags & flagsSet) == flagsSet && !(flags & flagsUnset)
60 // are returned (by default, all mounted ones)
61 static wxArrayString GetVolumes(int flagsSet = wxFS_VOL_MOUNTED,
62 int flagsUnset = 0);
63
64 // stop execution of GetVolumes() called previously (should be called from
65 // another thread, of course)
66 static void CancelSearch();
67
68 // create the volume object with this name (should be one of those returned
69 // by GetVolumes()).
e2478fde
VZ
70 wxFSVolumeBase();
71 wxFSVolumeBase(const wxString& name);
7183fd72
VZ
72 bool Create(const wxString& name);
73
74 // accessors
75 // ---------
76
77 // is this a valid volume?
78 bool IsOk() const;
79
80 // kind of this volume?
81 wxFSVolumeKind GetKind() const;
82
83 // flags of this volume?
84 int GetFlags() const;
85
86 // can we write to this volume?
87 bool IsWritable() const { return !(GetFlags() & wxFS_VOL_READONLY); }
88
89 // get the name of the volume and the name which should be displayed to the
90 // user
91 wxString GetName() const { return m_volName; }
92 wxString GetDisplayName() const { return m_dispName; }
93
7183fd72
VZ
94 // TODO: operatios (Mount(), Unmount(), Eject(), ...)?
95
e2478fde
VZ
96protected:
97 // the internal volume name
7183fd72 98 wxString m_volName;
e2478fde
VZ
99
100 // the volume name as it is displayed to the user
7183fd72 101 wxString m_dispName;
e2478fde
VZ
102
103 // have we been initialized correctly?
104 bool m_isOk;
105};
106
7183fd72 107#if wxUSE_GUI
e2478fde
VZ
108
109#include "wx/icon.h"
110#include "wx/iconbndl.h" // only for wxIconArray
111
112enum wxFSIconType
113{
114 wxFS_VOL_ICO_SMALL = 0,
115 wxFS_VOL_ICO_LARGE,
116 wxFS_VOL_ICO_SEL_SMALL,
117 wxFS_VOL_ICO_SEL_LARGE,
118 wxFS_VOL_ICO_MAX
119};
120
121// wxFSVolume adds GetIcon() to wxFSVolumeBase
d241d258 122class WXDLLIMPEXP_CORE wxFSVolume : public wxFSVolumeBase
e2478fde
VZ
123{
124public:
125 wxFSVolume() : wxFSVolumeBase() { InitIcons(); }
126 wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); }
127
128 wxIcon GetIcon(wxFSIconType type) const;
129
130private:
131 void InitIcons();
132
133 // the different icons for this volume (created on demand)
7183fd72 134 wxIconArray m_icons;
e2478fde
VZ
135};
136
137#else // !wxUSE_GUI
7183fd72 138
e2478fde 139// wxFSVolume is the same thing as wxFSVolume in wxBase
8d65a2e1 140typedef wxFSVolumeBase wxFSVolume;
7183fd72 141
e2478fde
VZ
142#endif // wxUSE_GUI/!wxUSE_GUI
143
05815ab3
VZ
144#endif // wxUSE_FSVOLUME
145
7183fd72 146#endif // _WX_FSVOLUME_H_