tableeditor.h
Go to the documentation of this file.00001 #ifndef TABLE_EDITOR_HEADER_INCLUDED_p
00002 #define TABLE_EDITOR_HEADER_INCLUDED_p
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <cxxtls/tableviewer.h>
00029 #include <cxxtls/file.h>
00030
00031 namespace cxxtls
00032 {
00033
00034 class TableEditor
00035 : public TableViewer
00045 {
00046
00047 size_t fieldEditColumn_;
00048
00049
00050 public:
00051
00052 TableEditor(ViewerManager *vm,
00053 int delimChar=','
00054 );
00070
00071 virtual ~TableEditor();
00072
00073
00074 protected:
00075
00076 int delimiter_;
00077 bool keyKludge_;
00078
00079 virtual bool handle_event( CursorWindow::input_event const * e,
00080 CursorWindow::viewport * vp
00081 );
00084
00085
00086 virtual void setCursorInfo(CursorWindow::viewport *vp,
00087 size_t worldRow,
00088 size_t worldCol,
00089 bool displayed
00090 );
00094
00095 void terminateInput();
00097
00098 CellInfo *editCell();
00104
00105 virtual void paintField(CursorWindow::viewport *vp,
00106 size_t vpRow,
00107 size_t vpCol,
00108 CellInfo const *cell,
00109 size_t cellRow,
00110 size_t vpColumns,
00111 bool editCursor
00112 );
00136
00137 static bool isTableEditKey(CursorWindow::input_event const * e);
00142
00143 bool fieldEditable(size_t tableRow, size_t tableCol) const
00154
00155 {
00156 if( tableRow >= rows_.size()
00157 || tableCol >= cols_.size()
00158 )
00159 return false;
00160
00161 return rows_[tableRow].editable_ && cols_[tableCol].editable_;
00162 }
00163
00164 bool fieldEditable(CursorInfo const &cur) const
00174 {
00175 return fieldEditable(cur.row_, cur.col_);
00176 }
00177
00178
00179 void snatchEdit(CursorWindow::viewport *vp, FileName const &directory);
00191
00192 };
00193
00194 }
00195 #endif