void wxGrid::Create()
{
m_created = FALSE; // set to TRUE by CreateGrid
- m_displayed = TRUE; // FALSE; // set to TRUE by OnPaint
m_table = (wxGridTableBase *) NULL;
m_ownTable = FALSE;
type,
this,
row, col,
- false,
+ TRUE,
mouseEv.GetX(), mouseEv.GetY(),
mouseEv.ControlDown(),
mouseEv.ShiftDown(),
void wxGrid::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
wxPaintDC dc( this );
-
- if ( m_currentCellCoords == wxGridNoCellCoords &&
- m_numRows && m_numCols )
- {
- m_currentCellCoords.Set(0, 0);
- ShowCellEditControl();
- }
-
- m_displayed = TRUE;
}
void wxGrid::SetCurrentCell( const wxGridCellCoords& coords )
{
- if ( m_displayed &&
- m_currentCellCoords != wxGridNoCellCoords )
+ if ( m_currentCellCoords != wxGridNoCellCoords )
{
HideCellEditControl();
DisableCellEditControl();
m_currentCellCoords = coords;
- if ( m_displayed )
- {
- wxClientDC dc(m_gridWin);
- PrepareDC(dc);
+ wxClientDC dc(m_gridWin);
+ PrepareDC(dc);
+
+ wxGridCellAttr* attr = GetCellAttr(coords);
+ DrawCellHighlight(dc, attr);
+ attr->DecRef();
- wxGridCellAttr* attr = GetCellAttr(coords);
- DrawCellHighlight(dc, attr);
- attr->DecRef();
#if 0
// SN: For my extended selection code, automatic
// deselection is definitely not a good idea.
if ( !GetBatchCount() ) m_gridWin->Refresh( FALSE, &r );
}
#endif
- }
}
void wxGrid::DrawHighlight(wxDC& dc)
{
+ // This if block was previously in wxGrid::OnPaint but that doesn't
+ // seem to get called under wxGTK - MB
+ //
+ if ( m_currentCellCoords == wxGridNoCellCoords &&
+ m_numRows && m_numCols )
+ {
+ m_currentCellCoords.Set(0, 0);
+ }
+
if ( IsCellEditControlEnabled() )
{
// don't show highlight when the edit control is shown
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetRow() > 0 )
{
+ if ( expandSelection )
+ m_selection->SelectCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() );
+
MakeCellVisible( m_currentCellCoords.GetRow() - 1,
m_currentCellCoords.GetCol() );
bool wxGrid::MoveCursorDown( bool expandSelection )
{
- // TODO: allow for scrolling
- //
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetRow() < m_numRows-1 )
{
+ if ( expandSelection )
+ m_selection->SelectCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() );
+
MakeCellVisible( m_currentCellCoords.GetRow() + 1,
m_currentCellCoords.GetCol() );
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetCol() > 0 )
{
+ if ( expandSelection )
+ m_selection->SelectCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() );
+
MakeCellVisible( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() - 1 );
if ( m_currentCellCoords != wxGridNoCellCoords &&
m_currentCellCoords.GetCol() < m_numCols - 1 )
{
+ if ( expandSelection )
+ m_selection->SelectCell( m_currentCellCoords.GetRow(),
+ m_currentCellCoords.GetCol() );
+
MakeCellVisible( m_currentCellCoords.GetRow(),
m_currentCellCoords.GetCol() + 1 );