wxGridCellRenderer *GetDefaultRenderer() const;
wxGridCellRenderer* GetCellRenderer(int row, int col);
+ // takes ownership of the pointer
+ void SetDefaultEditor(wxGridCellEditor *editor);
+ void SetCellEditor(int row, int col, wxGridCellEditor *editor);
+ wxGridCellEditor *GetDefaultEditor() const;
+ wxGridCellEditor* GetCellEditor(int row, int col);
+
// ------ cell value accessors
//
m_grid->EnableCellEditControl(FALSE);
break;
-// case WXK_UP:
-// case WXK_DOWN:
-// case WXK_LEFT:
-// case WXK_RIGHT:
-// case WXK_PRIOR:
-// case WXK_NEXT:
-// case WXK_SPACE:
-// case WXK_HOME:
-// case WXK_END:
-// // send the event to the parent grid, skipping the
-// // event if nothing happens
-// //
-// event.Skip( m_grid->ProcessEvent( event ) );
-// break;
-
case WXK_TAB:
+ event.Skip( m_grid->ProcessEvent( event ) );
+ break;
+
case WXK_RETURN:
if (!m_grid->ProcessEvent(event))
m_editor->HandleReturn(event);
m_data.Remove( pos );
}
}
- UpdateAttrRows( pos, -numRows );
+ UpdateAttrRows( pos, -((int)numRows) );
if ( GetView() )
{
wxGridTableMessage msg( this,
}
}
}
- UpdateAttrCols( pos, -numCols );
+ UpdateAttrCols( pos, -((int)numCols) );
if ( GetView() )
{
wxGridTableMessage msg( this,
if ( !parent->GetEventHandler()->ProcessEvent( keyEvt ) )
{
+
+ // TODO: Should also support Shift-cursor keys for
+ // extending the selection. Maybe add a flag to
+ // MoveCursorXXX() and MoveCursorXXXBlock() and
+ // just send event.ShiftDown().
+
// try local handlers
//
switch ( event.KeyCode() )
m_defaultCellAttr->SetRenderer(renderer);
}
+void wxGrid::SetDefaultEditor(wxGridCellEditor *editor)
+{
+ m_defaultCellAttr->SetEditor(editor);
+}
+
// ----------------------------------------------------------------------------
// access to the default attrbiutes
// ----------------------------------------------------------------------------
return m_defaultCellAttr->GetRenderer();
}
+wxGridCellEditor *wxGrid::GetDefaultEditor() const
+{
+ return m_defaultCellAttr->GetEditor();
+}
+
// ----------------------------------------------------------------------------
// access to cell attributes
// ----------------------------------------------------------------------------
return renderer;
}
+wxGridCellEditor* wxGrid::GetCellEditor(int row, int col)
+{
+ wxGridCellAttr* attr = GetCellAttr(row, col);
+ wxGridCellEditor* editor = attr->GetEditor();
+ attr->DecRef();
+ return editor;
+}
+
// ----------------------------------------------------------------------------
// attribute support: cache, automatic provider creation, ...
// ----------------------------------------------------------------------------
}
}
+void wxGrid::SetCellEditor(int row, int col, wxGridCellEditor* editor)
+{
+ if ( CanHaveAttributes() )
+ {
+ wxGridCellAttr *attr = GetOrCreateCellAttr(row, col);
+ attr->SetEditor(editor);
+ attr->DecRef();
+ }
+}
+
// ----------------------------------------------------------------------------
// row/col size
// ----------------------------------------------------------------------------