include/ax_resource/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:     New BSD License
00011 
00012 #ifndef _AX_SUPPORTEDFILES_H_
00013 #define _AX_SUPPORTEDFILES_H_
00014 
00015 class wxConfigBase;
00016 class wxCheckListBox;
00017 
00026 class AxSupportedFiles: public wxObject
00027 {
00028 public:
00029     AxSupportedFiles() {}
00030     AxSupportedFiles(const AxSupportedFiles& supported) { Copy(supported); }
00031     ~AxSupportedFiles() {}
00032 
00034 
00035     void operator = (const AxSupportedFiles& supported) { Copy(supported); }
00036     void Copy (const AxSupportedFiles& supported);
00037 
00039     bool LoadConfig(wxConfigBase& config);
00040 
00042     bool SaveConfig(wxConfigBase& config);
00043 
00045     void Init();
00046 
00048     void Clear();
00049 
00051     bool AddFileType(const wxString& ext, const wxString& description, bool enabled = true);
00052 
00054     bool Enable(const wxString& ext, bool enabled = true);
00055 
00057     bool IsEnabled(const wxString& ext) const;
00058 
00060     bool TypeExists(const wxString& ext) const;
00061 
00063     size_t GetCount() const { return m_supportedFileExtensions.GetCount(); }
00064 
00066     wxString GetExtension(int idx) const { return m_supportedFileExtensions[idx]; }
00067 
00069     wxString GetDescription(int idx) const { return m_supportedFileDescriptions[idx]; }
00070 
00072     bool GetEnabled(int idx) const { return m_supportedFileStates[idx] != 0; }
00073 
00075     bool RemoveFileType(int idx);
00076 
00078     wxArrayString& GetFileExtensions() { return m_supportedFileExtensions; }
00079     wxArrayString& GetFileDescriptions() { return m_supportedFileDescriptions; }
00080     wxArrayInt& GetFileStates() { return m_supportedFileStates; }
00081 
00083     bool TransferDataToCheckListBox(wxCheckListBox* checkListBox, bool recreateList = true);
00084     bool TransferDataFromCheckListBox(wxCheckListBox* checkListBox);
00085 
00087     wxString GetWildcard() const;
00088 
00089 protected:
00090     wxArrayString   m_supportedFileExtensions;
00091     wxArrayString   m_supportedFileDescriptions;
00092     wxArrayInt      m_supportedFileStates;
00093 };
00094 
00095 #endif
00096     // _AX_SUPPORTEDFILES_H_

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