Moved grid lines and cells by one pixel.
Call SelectBlock in SetCurrentCell (possibly not, what we want?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5994
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
bool IsEditable() { return m_editable; }
void EnableEditing( bool edit );
bool IsEditable() { return m_editable; }
void EnableEditing( bool edit );
-#if 0 // at the moment the cell edit control is always active
void EnableCellEditControl( bool enable );
void EnableCellEditControl( bool enable );
bool IsCellEditControlEnabled()
{ return (m_cellEditCtrl && m_cellEditCtrlEnabled); }
bool IsCellEditControlEnabled()
{ return (m_cellEditCtrl && m_cellEditCtrlEnabled); }
}
dc.SetPen( *wxTRANSPARENT_PEN );
}
dc.SetPen( *wxTRANSPARENT_PEN );
dc.DrawRectangle(rect);
}
dc.DrawRectangle(rect);
}
m_owner = parent;
m_rowLabelWin = rowLblWin;
m_colLabelWin = colLblWin;
m_owner = parent;
m_rowLabelWin = rowLblWin;
m_colLabelWin = colLblWin;
SetBackgroundColour( "WHITE" );
}
SetBackgroundColour( "WHITE" );
}
//
m_cellEditCtrl = new wxGridTextCtrl( m_gridWin,
this,
//
m_cellEditCtrl = new wxGridTextCtrl( m_gridWin,
this,
wxGRID_CELLCTRL,
"",
wxPoint(1,1),
wxGRID_CELLCTRL,
"",
wxPoint(1,1),
);
m_cellEditCtrl->Show( FALSE );
);
m_cellEditCtrl->Show( FALSE );
- m_cellEditCtrlEnabled = TRUE;
+ m_cellEditCtrlEnabled = FALSE;
m_editCtrlType = wxGRID_TEXTCTRL;
}
m_editCtrlType = wxGRID_TEXTCTRL;
}
//
if ( event.LeftDown() )
{
//
if ( event.LeftDown() )
{
+ if ( event.AltDown() )
+ {
+ MakeCellVisible( coords );
+ SetCurrentCell( coords );
+ EnableCellEditControl( TRUE );
+ }
+ else
+ {
+ EnableCellEditControl( FALSE );
+ }
if ( event.ShiftDown() )
{
SelectBlock( m_currentCellCoords, coords );
if ( event.ShiftDown() )
{
SelectBlock( m_currentCellCoords, coords );
//
else if ( event.LeftDClick() )
{
//
else if ( event.LeftDClick() )
{
+ EnableCellEditControl( FALSE );
if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 )
{
SendEvent( EVT_GRID_CELL_LEFT_DCLICK,
if ( XToEdgeOfCol(x) < 0 && YToEdgeOfRow(y) < 0 )
{
SendEvent( EVT_GRID_CELL_LEFT_DCLICK,
//
else if ( event.RightDown() )
{
//
else if ( event.RightDown() )
{
+ EnableCellEditControl( FALSE );
if ( !SendEvent( EVT_GRID_CELL_RIGHT_CLICK,
coords.GetRow(),
coords.GetCol(),
if ( !SendEvent( EVT_GRID_CELL_RIGHT_CLICK,
coords.GetRow(),
coords.GetCol(),
//
else if ( event.RightDClick() )
{
//
else if ( event.RightDClick() )
{
+ EnableCellEditControl( FALSE );
if ( !SendEvent( EVT_GRID_CELL_RIGHT_DCLICK,
coords.GetRow(),
coords.GetCol(),
if ( !SendEvent( EVT_GRID_CELL_RIGHT_DCLICK,
coords.GetRow(),
coords.GetCol(),
default:
// now try the cell edit control
//
default:
// now try the cell edit control
//
+ if ( !IsCellEditControlEnabled() )
+ EnableCellEditControl( TRUE );
if ( IsCellEditControlEnabled() )
if ( IsCellEditControlEnabled() )
- {
- event.SetEventObject( m_cellEditCtrl );
- m_cellEditCtrl->GetEventHandler()->ProcessEvent( event );
- }
- break;
+ {
+ event.SetEventObject( m_cellEditCtrl );
+ m_cellEditCtrl->GetEventHandler()->ProcessEvent( event );
+ }
+ break;
m_currentCellCoords = coords;
SetEditControlValue();
m_currentCellCoords = coords;
SetEditControlValue();
if ( m_displayed )
{
ShowCellEditControl();
if ( m_displayed )
{
ShowCellEditControl();
if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r );
}
}
if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r );
}
}
+#else
+ SelectBlock ( coords, coords );
+#endif
// but all the rest is drawn by the cell renderer and hence may be
// customized
wxRect rect;
// but all the rest is drawn by the cell renderer and hence may be
// customized
wxRect rect;
- rect.x = m_colRights[col] - m_colWidths[col] + 1;
- rect.y = m_rowBottoms[row] - m_rowHeights[row] + 1;
+ rect.x = m_colRights[col] - m_colWidths[col];
+ rect.y = m_rowBottoms[row] - m_rowHeights[row];
rect.width = m_colWidths[col] - 1;
rect.height = m_rowHeights[row] - 1;
rect.width = m_colWidths[col] - 1;
rect.height = m_rowHeights[row] - 1;
int i;
for ( i = 0; i < m_numRows; i++ )
{
int i;
for ( i = 0; i < m_numRows; i++ )
{
- if ( m_rowBottoms[i] > bottom )
+ if ( m_rowBottoms[i]-1 > bottom )
- else if ( m_rowBottoms[i] >= top )
+ else if ( m_rowBottoms[i]-1 >= top )
- dc.DrawLine( left, m_rowBottoms[i], right, m_rowBottoms[i] );
+ dc.DrawLine( left, m_rowBottoms[i]-1, right, m_rowBottoms[i]-1 );
//
for ( i = 0; i < m_numCols; i++ )
{
//
for ( i = 0; i < m_numCols; i++ )
{
- if ( m_colRights[i] > right )
+ if ( m_colRights[i]-1 > right )
- else if ( m_colRights[i] >= left )
+ else if ( m_colRights[i]-1 >= left )
- dc.DrawLine( m_colRights[i], top, m_colRights[i], bottom );
+ dc.DrawLine( m_colRights[i]-1, top, m_colRights[i]-1, bottom );
-#if 0 // disabled for the moment - the cell control is always active
void wxGrid::EnableCellEditControl( bool enable )
{
void wxGrid::EnableCellEditControl( bool enable )
{
+ if ( m_currentCellCoords == wxGridNoCellCoords )
+ SetCurrentCell( 0, 0 );
if ( m_cellEditCtrl &&
enable != m_cellEditCtrlEnabled )
{
if ( m_cellEditCtrl &&
enable != m_cellEditCtrlEnabled )
{
- m_cellEditCtrlEnabled = enable;
- if ( m_cellEditCtrlEnabled )
+ m_cellEditCtrlEnabled = enable;
+ // requires m_cellEditCtrlEnabled to be already true
ShowCellEditControl();
}
else
{
HideCellEditControl();
ShowCellEditControl();
}
else
{
HideCellEditControl();
+ // requires m_cellEditCtrlEnabled to be still true
+ m_cellEditCtrlEnabled = enable;
void wxGrid::ShowCellEditControl()
void wxGrid::ShowCellEditControl()
if ( IsCellEditControlEnabled() )
{
m_cellEditCtrl->Show( FALSE );
if ( IsCellEditControlEnabled() )
{
m_cellEditCtrl->Show( FALSE );