case WXK_DOWN:
case WXK_LEFT:
case WXK_RIGHT:
+ case WXK_PRIOR:
+ case WXK_NEXT:
case WXK_RETURN:
if ( m_isCellControl )
{
wxGRID_CELLCTRL,
"",
wxPoint(1,1),
- wxSize(1,1),
- wxNO_BORDER
+ wxSize(1,1)
#ifdef __WXMSW__
- | wxTE_MULTILINE | wxTE_NO_VSCROLL
+ , wxTE_MULTILINE | wxTE_NO_VSCROLL
#endif
);
int row, int col,
wxMouseEvent& mouseEv )
{
- if ( type == EVT_WXGRID_ROW_SIZE ||
- type == EVT_WXGRID_COL_SIZE )
+ if ( type == EVT_GRID_ROW_SIZE ||
+ type == EVT_GRID_COL_SIZE )
{
int rowOrCol = (row == -1 ? col : row);
return GetEventHandler()->ProcessEvent(gridEvt);
}
- else if ( type == EVT_WXGRID_RANGE_SELECT )
+ else if ( type == EVT_GRID_RANGE_SELECT )
{
wxGridRangeSelectEvent gridEvt( GetId(),
type,
bool wxGrid::SendEvent( const wxEventType type,
int row, int col )
{
- if ( type == EVT_WXGRID_ROW_SIZE ||
- type == EVT_WXGRID_COL_SIZE )
+ if ( type == EVT_GRID_ROW_SIZE ||
+ type == EVT_GRID_COL_SIZE )
{
int rowOrCol = (row == -1 ? col : row);
if ( YToEdgeOfRow(y) < 0 )
{
row = YToRow(y);
- if ( !SendEvent( EVT_WXGRID_LABEL_LEFT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_LEFT_CLICK, row, col, ev ) )
{
SelectRow( row, ev.ShiftDown() );
m_cursorMode = WXGRID_CURSOR_SELECT_ROW;
if ( XToEdgeOfCol(x) < 0 )
{
col = XToCol(x);
- if ( !SendEvent( EVT_WXGRID_LABEL_LEFT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_LEFT_CLICK, row, col, ev ) )
{
SelectCol( col, ev.ShiftDown() );
m_cursorMode = WXGRID_CURSOR_SELECT_COL;
{
// leave both row and col as -1
//
- if ( !SendEvent( EVT_WXGRID_LABEL_LEFT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_LEFT_CLICK, row, col, ev ) )
{
SelectAll();
}
case WXGRID_CELL:
{
XYToCell( x, y, cellCoords );
- if ( !SendEvent( EVT_WXGRID_CELL_LEFT_CLICK,
+ if ( !SendEvent( EVT_GRID_CELL_LEFT_CLICK,
cellCoords.GetRow(),
cellCoords.GetCol(),
ev ) )
if ( YToEdgeOfRow(y) < 0 )
{
row = YToRow(y);
- SendEvent( EVT_WXGRID_LABEL_LEFT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_LEFT_DCLICK, row, col, ev );
}
}
break;
if ( XToEdgeOfCol(x) < 0 )
{
col = XToCol(x);
- SendEvent( EVT_WXGRID_LABEL_LEFT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_LEFT_DCLICK, row, col, ev );
}
}
break;
{
// leave both row and col as -1
//
- SendEvent( EVT_WXGRID_LABEL_LEFT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_LEFT_DCLICK, row, col, ev );
}
break;
case WXGRID_CELL:
{
XYToCell( x, y, cellCoords );
- SendEvent( EVT_WXGRID_CELL_LEFT_DCLICK,
+ SendEvent( EVT_GRID_CELL_LEFT_DCLICK,
cellCoords.GetRow(),
cellCoords.GetCol(),
ev );
// Note: we are ending the event *after* doing
// default processing in this case
//
- SendEvent( EVT_WXGRID_ROW_SIZE, m_dragRowOrCol, -1, ev );
+ SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, ev );
}
}
break;
// Note: we are ending the event *after* doing
// default processing in this case
//
- SendEvent( EVT_WXGRID_COL_SIZE, -1, m_dragRowOrCol, ev );
+ SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, ev );
}
}
break;
// Note: we are ending the event *after* doing
// default processing in this case
//
- SendEvent( EVT_WXGRID_RANGE_SELECT, -1, -1, ev );
+ SendEvent( EVT_GRID_RANGE_SELECT, -1, -1, ev );
}
}
break;
case WXGRID_ROWLABEL:
{
row = YToRow(y);
- if ( !SendEvent( EVT_WXGRID_LABEL_RIGHT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) )
{
// TODO: default processing ?
}
case WXGRID_COLLABEL:
{
col = XToCol(x);
- if ( !SendEvent( EVT_WXGRID_LABEL_RIGHT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) )
{
// TODO: default processing ?
}
{
// leave both row and col as -1
//
- if ( !SendEvent( EVT_WXGRID_LABEL_RIGHT_CLICK, row, col, ev ) )
+ if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) )
{
// TODO: default processing ?
}
case WXGRID_CELL:
{
XYToCell( x, y, cellCoords );
- if ( !SendEvent( EVT_WXGRID_CELL_RIGHT_CLICK,
+ if ( !SendEvent( EVT_GRID_CELL_RIGHT_CLICK,
cellCoords.GetRow(),
cellCoords.GetCol(),
ev ) )
case WXGRID_ROWLABEL:
{
row = YToRow(y);
- SendEvent( EVT_WXGRID_LABEL_RIGHT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev );
}
break;
case WXGRID_COLLABEL:
{
col = XToCol(x);
- SendEvent( EVT_WXGRID_LABEL_RIGHT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev );
}
break;
{
// leave both row and col as -1
//
- SendEvent( EVT_WXGRID_LABEL_RIGHT_DCLICK, row, col, ev );
+ SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev );
}
break;
case WXGRID_CELL:
{
XYToCell( x, y, cellCoords );
- SendEvent( EVT_WXGRID_CELL_RIGHT_DCLICK,
+ SendEvent( EVT_GRID_CELL_RIGHT_DCLICK,
cellCoords.GetRow(),
cellCoords.GetCol(),
ev );
void wxGrid::SelectCell( const wxGridCellCoords& coords )
{
+ if ( SendEvent( EVT_GRID_SELECT_CELL, coords.GetRow(), coords.GetCol() ) )
+ {
+ // the event has been intercepted - do nothing
+ return;
+ }
+
wxClientDC dc( this );
if ( m_currentCellCoords != wxGridNoCellCoords )
if ( valueChanged )
{
- SendEvent( EVT_WXGRID_CELL_CHANGE,
+ SendEvent( EVT_GRID_CELL_CHANGE,
m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() );
}
y = m_rowBottoms[row] - m_rowHeights[row];
if ( y >= ch ) return;
- dc.SetLogicalFunction( wxXOR );
+ dc.SetLogicalFunction( wxINVERT );
dc.SetPen( wxPen(GetCellHighlightColour(), 2, wxSOLID) );
dc.SetBrush( *wxTRANSPARENT_BRUSH );
- dc.DrawRectangle( x, y,
- m_colWidths[col] + 2,
- m_rowHeights[row] + 2 );
+ dc.DrawRectangle( x-2, y-2,
+ m_colWidths[col] + 6,
+ m_rowHeights[row] + 6 );
dc.SetLogicalFunction( wxCOPY );
}
//
void wxGrid::HideCurrentCellHighlight( wxDC& dc )
{
- if ( m_currentCellHighlighted &&
+ if ( !m_cellEditCtrlEnabled &&
+ m_currentCellHighlighted &&
m_currentCellCoords != wxGridNoCellCoords )
{
DrawCellHighlight( dc, m_currentCellCoords );
//
void wxGrid::ShowCurrentCellHighlight( wxDC& dc )
{
- if ( !m_currentCellHighlighted &&
+ if ( !m_cellEditCtrlEnabled &&
+ !m_currentCellHighlighted &&
m_currentCellCoords != wxGridNoCellCoords )
{
DrawCellHighlight( dc, m_currentCellCoords );
if ( m_cellEditCtrl &&
enable != m_cellEditCtrlEnabled )
{
+ wxClientDC dc( this );
+
+ HideCurrentCellHighlight( dc );
HideCellEditControl();
SaveEditControlValue();
SetEditControlValue();
ShowCellEditControl();
+ ShowCurrentCellHighlight( dc );
}
}
// Note: we are ending the event *after* doing
// default processing in this case
//
- SendEvent( EVT_WXGRID_ROW_SIZE,
+ SendEvent( EVT_GRID_ROW_SIZE,
row, -1 );
}
else
// Note: we are ending the event *after* doing
// default processing in this case
//
- SendEvent( EVT_WXGRID_COL_SIZE,
+ SendEvent( EVT_GRID_COL_SIZE,
-1, col );
}
else
}
wxGridRangeSelectEvent gridEvt( GetId(),
- EVT_WXGRID_RANGE_SELECT,
+ EVT_GRID_RANGE_SELECT,
this,
m_selectedTopLeft,
m_selectedBottomRight );
}
wxGridRangeSelectEvent gridEvt( GetId(),
- EVT_WXGRID_RANGE_SELECT,
+ EVT_GRID_RANGE_SELECT,
this,
m_selectedTopLeft,
m_selectedBottomRight );
if ( !m_isDragging )
{
wxGridRangeSelectEvent gridEvt( GetId(),
- EVT_WXGRID_RANGE_SELECT,
+ EVT_GRID_RANGE_SELECT,
this,
m_selectedTopLeft,
m_selectedBottomRight );