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