00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _STRINGTABLE_H_
00013 #define _STRINGTABLE_H_
00014
00015 #include "wx/wx.h"
00016
00022 class wxStringTable
00023 {
00024 public:
00025 wxStringTable() {}
00026
00028 void AddString(const wxString& name, const wxString& value = wxEmptyString);
00029
00031 void RemoveString(const wxString& name);
00032 void RemoveString(int idx);
00033
00035 size_t GetCount() const { return m_stringNames.GetCount(); }
00036
00038 void Clear() { m_stringNames.Clear(); m_stringValues.Clear(); }
00039
00041 void ClearValues();
00042
00044 int FindString(const wxString& name) const;
00045
00047 wxString GetString(const wxString& name) const;
00048
00050 wxString GetString(size_t i) const;
00051
00053 wxString* GetStringPtr(size_t i) const;
00054
00056 wxString GetStringRaw(size_t i) const;
00057
00059 wxString GetName(size_t i) const;
00060
00062 void SetName(size_t i, const wxString& name);
00063
00065 void SetString(size_t i, const wxString& value);
00066
00068 void SetString(const wxString& name, const wxString& value);
00069
00071 const wxString& GetTableName() const { return m_tableName; }
00072
00074 void SetTableName(const wxString& name) { m_tableName = name; }
00075
00077 bool LoadFile(const wxString& filename);
00078
00080 bool SaveFile(const wxString& filename);
00081
00082 protected:
00083
00084 wxArrayString m_stringNames;
00085 wxArrayString m_stringValues;
00086
00087 wxString m_tableName;
00088 };
00089
00094 class wxStringTablePanel: public wxScrolledWindow
00095 {
00096 DECLARE_DYNAMIC_CLASS( wxStringTablePanel )
00097 DECLARE_EVENT_TABLE()
00098
00099 public:
00101 wxStringTablePanel();
00102 wxStringTablePanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0 )
00103 {
00104 Create(NULL, parent, id, pos, size, style);
00105 }
00106 wxStringTablePanel( wxStringTable* table, wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0 );
00107
00109 bool Create( wxStringTable* table, wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0 );
00110
00112 ~wxStringTablePanel();
00113
00115 void Init();
00116
00118 void CreateControls();
00119
00121 void ShowTable();
00122
00124 void RebuildTable(wxStringTable* table = NULL);
00125
00127 wxStringTable* GetTable() const { return m_table; }
00128 void SetTable(wxStringTable* table) { m_table = table; }
00129
00130 protected:
00131
00132 wxStringTable* m_table;
00133 };
00134
00135 #endif
00136