00001
00002
00003
00004
00005
00006
00007 #ifndef ADDRESS_GRID_TABLE_H
00008 #define ADDRESS_GRID_TABLE_H
00009
00010 #include <wx/wx.h>
00011 #include <wx/grid.h>
00012 #include <wx/datstrm.h>
00013
00014 #include "AddressManager.h"
00015 #include "ColumnField.h"
00016
00017 WX_DECLARE_OBJARRAY(wxString, StringArray);
00018 WX_DECLARE_OBJARRAY(StringArray, StringGrid);
00019
00023 class wxGridTableBaseWithNotifyMethods : public wxGridTableBase
00024 {
00025 public:
00030 void RequestViewGetValues();
00031
00036 void RequestViewSendValues();
00037
00044 void NotifyRowsInserted(int pos, int numRows);
00045
00051 void NotifyRowsAppended(int numRows);
00052
00059 void NotifyRowsDeleted(int pos, int numRows);
00060
00067 void NotifyColsInserted(int pos, int numCols);
00068
00074 void NotifyColsAppended(int numCols);
00075
00082 void NotifyColsDeleted(int pos, int numCols);
00083 };
00084
00088 class AddressGridTable : public wxGridTableBaseWithNotifyMethods
00089 {
00090 public:
00091
00092
00093 int GetNumberRows();
00094 int GetNumberCols();
00095 wxString GetValue( int row, int col );
00096 void SetValue( int row, int col, const wxString& s );
00097 bool IsEmptyCell( int row, int col );
00098
00099
00100
00101 void Clear();
00102 bool InsertRows( size_t pos = 0, size_t numRows = 1 );
00103 bool AppendRows( size_t numRows = 1 );
00104 bool DeleteRows( size_t pos = 0, size_t numRows = 1 );
00105 bool InsertCols( size_t pos = 0, size_t numCols = 1 );
00106 bool AppendCols( size_t numCols = 1 );
00107 bool DeleteCols( size_t pos = 0, size_t numCols = 1 );
00108
00109 void SetColLabelValue( int col, const wxString& );
00110 wxString GetColLabelValue( int col );
00111
00115 void Initialize();
00116
00121 void Initialize(wxDataInputStream& in);
00122
00127 void serialize(wxDataOutputStream& out);
00128
00135 void Sort(int col1, int col2, int col3);
00136
00141 void ChangeColumns(ColumnFieldArray& column);
00142
00143 private:
00144
00148 void ClearAll();
00149
00153 StringGrid m_data;
00154
00158 StringArray m_colLabels;
00159 };
00160
00161 #endif