include/ax/ax_supportedfiles.h

Go to the documentation of this file.
00001 
00002 // Name:        ax_supportedfiles.h
00003 // Purpose:     A class for manipulating supported file types
00004 // Author:      Julian Smart
00005 // Modified by:
00006 // Created:     2008-11-18
00007 // RCS-ID:      $Id$
00008 // Copyright:   (c) Julian Smart
00009 // Licence:     
00011 
00012 #ifndef _AX_SUPPORTEDFILES_H_
00013 #define _AX_SUPPORTEDFILES_H_
00014 
00015 class wxConfigBase;
00016 class wxCheckListBox;
00017 
00022 class AxSupportedFiles: public wxObject
00023 {
00024 public:
00025     AxSupportedFiles() {}
00026     AxSupportedFiles(const AxSupportedFiles& supported) { Copy(supported); }
00027     ~AxSupportedFiles() {}
00028 
00030 
00031     void operator = (const AxSupportedFiles& supported) { Copy(supported); }
00032     void Copy (const AxSupportedFiles& supported);
00033 
00035     bool LoadConfig(wxConfigBase& config);
00036 
00038     bool SaveConfig(wxConfigBase& config);
00039 
00041     void Init();
00042 
00044     void Clear();
00045 
00047     bool AddFileType(const wxString& ext, const wxString& description, bool enabled = true);
00048 
00050     bool Enable(const wxString& ext, bool enabled = true);
00051 
00053     bool IsEnabled(const wxString& ext) const;
00054 
00056     bool TypeExists(const wxString& ext) const;
00057 
00059     size_t GetCount() const { return m_supportedFileExtensions.GetCount(); }
00060 
00062     wxString GetExtension(int idx) const { return m_supportedFileExtensions[idx]; }
00063 
00065     wxString GetDescription(int idx) const { return m_supportedFileDescriptions[idx]; }
00066 
00068     bool GetEnabled(int idx) const { return m_supportedFileStates[idx] != 0; }
00069 
00071     bool RemoveFileType(int idx);
00072 
00074     wxArrayString& GetFileExtensions() { return m_supportedFileExtensions; }
00075     wxArrayString& GetFileDescriptions() { return m_supportedFileDescriptions; }
00076     wxArrayInt& GetFileStates() { return m_supportedFileStates; }
00077 
00079     bool TransferDataToCheckListBox(wxCheckListBox* checkListBox, bool recreateList = true);
00080     bool TransferDataFromCheckListBox(wxCheckListBox* checkListBox);
00081 
00083     wxString GetWildcard() const;
00084 
00085 protected:
00086     wxArrayString   m_supportedFileExtensions;
00087     wxArrayString   m_supportedFileDescriptions;
00088     wxArrayInt      m_supportedFileStates;
00089 };
00090 
00091 #endif
00092     // _AX_SUPPORTEDFILES_H_

Generated on Wed May 6 19:20:18 2009 for AxTk by  doxygen 1.5.1