X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7183fd726e0f2e493bf60e8e623990e5f34a2476..408ac1b8cf965067dbc0c36beabac0c8a5769501:/include/wx/volume.h diff --git a/include/wx/volume.h b/include/wx/volume.h index 32d2f9fed5..e0dcb78f9b 100644 --- a/include/wx/volume.h +++ b/include/wx/volume.h @@ -6,7 +6,7 @@ // Created: 28 Jan 02 // RCS-ID: $Id$ // Copyright: (c) 2002 George Policello -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- @@ -16,10 +16,14 @@ #ifndef _WX_FSVOLUME_H_ #define _WX_FSVOLUME_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "fsvolume.h" #endif +#include "wx/defs.h" + +#if wxUSE_FSVOLUME + // the volume flags enum { @@ -48,20 +52,7 @@ enum wxFSVolumeKind wxFS_VOL_MAX }; -#if wxUSE_GUI -enum wxFSIconType -{ - wxFS_VOL_ICO_SMALL = 0, - wxFS_VOL_ICO_LARGE, - wxFS_VOL_ICO_SEL_SMALL, - wxFS_VOL_ICO_SEL_LARGE, - wxFS_VOL_ICO_MAX -}; -#endif // wxUSE_GUI - -WX_DECLARE_OBJARRAY(wxIcon, wxIconArray); - -class WXDLLEXPORT wxFSVolume +class WXDLLIMPEXP_BASE wxFSVolumeBase { public: // return the array containing the names of the volumes @@ -78,8 +69,8 @@ public: // create the volume object with this name (should be one of those returned // by GetVolumes()). - wxFSVolume(); - wxFSVolume(const wxString& name); + wxFSVolumeBase(); + wxFSVolumeBase(const wxString& name); bool Create(const wxString& name); // accessors @@ -102,21 +93,62 @@ public: wxString GetName() const { return m_volName; } wxString GetDisplayName() const { return m_dispName; } -#if wxUSE_GUI - wxIcon GetIcon(wxFSIconType type) const; -#endif - // TODO: operatios (Mount(), Unmount(), Eject(), ...)? -private: +protected: + // the internal volume name wxString m_volName; + + // the volume name as it is displayed to the user wxString m_dispName; + + // have we been initialized correctly? + bool m_isOk; +}; + #if wxUSE_GUI + +#include "wx/icon.h" +#include "wx/iconbndl.h" // only for wxIconArray + +enum wxFSIconType +{ + wxFS_VOL_ICO_SMALL = 0, + wxFS_VOL_ICO_LARGE, + wxFS_VOL_ICO_SEL_SMALL, + wxFS_VOL_ICO_SEL_LARGE, + wxFS_VOL_ICO_MAX +}; + +// wxFSVolume adds GetIcon() to wxFSVolumeBase +class wxFSVolume : public wxFSVolumeBase +{ +public: + wxFSVolume() : wxFSVolumeBase() { InitIcons(); } + wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { InitIcons(); } + + wxIcon GetIcon(wxFSIconType type) const; + +private: + void InitIcons(); + + // the different icons for this volume (created on demand) wxIconArray m_icons; -#endif - bool m_isOk; +}; + +#else // !wxUSE_GUI +// wxFSVolume is the same thing as wxFSVolume in wxBase +class wxFSVolume : public wxFSVolumeBase +{ +public: + wxFSVolume() : wxFSVolumeBase() { } + wxFSVolume(const wxString& name) : wxFSVolumeBase(name) { } }; +#endif // wxUSE_GUI/!wxUSE_GUI + +#endif // wxUSE_FSVOLUME + #endif // _WX_FSVOLUME_H_