git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6174
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#if WXGRID_DRAW_LINES
m_owner->DrawAllGridLines( dc, reg );
#endif
#if WXGRID_DRAW_LINES
m_owner->DrawAllGridLines( dc, reg );
#endif
+ m_owner->DrawHighlight( dc );
attr->GetEditor()->StartingKey(event);
attr->DecRef();
}
attr->GetEditor()->StartingKey(event);
attr->DecRef();
}
+ else
+ {
+ // let others process char events for readonly cells
+ event.Skip();
+ }
// but all the rest is drawn by the cell renderer and hence may be
// customized
attr->GetRenderer()->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords));
// but all the rest is drawn by the cell renderer and hence may be
// customized
attr->GetRenderer()->Draw(*this, *attr, dc, rect, row, col, IsInSelection(coords));
-
- if ( isCurrent )
- {
- DrawCellHighlight(dc, attr);
- }
rect.width = m_colWidths[col] - 1;
rect.height = m_rowHeights[row] - 1;
rect.width = m_colWidths[col] - 1;
rect.height = m_rowHeights[row] - 1;
- if ( attr->IsReadOnly() )
- {
- // hmmm... what could we do here to show that the cell is disabled?
- // for now, I just draw a thinner border than for the other ones, but
- // it doesn't look really good
- dc.SetPen(wxPen(m_gridLineColour, 2, wxSOLID));
- dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ // hmmm... what could we do here to show that the cell is disabled?
+ // for now, I just draw a thinner border than for the other ones, but
+ // it doesn't look really good
+ dc.SetPen(wxPen(m_gridLineColour, attr->IsReadOnly() ? 1 : 3, wxSOLID));
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+
+ dc.DrawRectangle(rect);
- dc.DrawRectangle(rect);
- }
- else
- {
- // VZ: my experiments with 3d borders...
- dc.SetPen(wxPen(m_gridLineColour, 3, wxSOLID));
- dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ // VZ: my experiments with 3d borders...
- dc.DrawRectangle(rect);
-#else //1
- // FIXME we should properly set colours for arbitrary bg
+ // how to properly set colours for arbitrary bg?
wxCoord x1 = rect.x,
y1 = rect.y,
x2 = rect.x + rect.width -1,
wxCoord x1 = rect.x,
y1 = rect.y,
x2 = rect.x + rect.width -1,
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(x1, y2, x2, y2);
dc.DrawLine(x2, y1, x2, y2+1);
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(x1, y2, x2, y2);
dc.DrawLine(x2, y1, x2, y2+1);
}
void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
}
void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
m_colRights[col], m_rowBottoms[row] );
}
m_colRights[col], m_rowBottoms[row] );
}
+void wxGrid::DrawHighlight(wxDC& dc)
+{
+ // if the active cell was repainted, repaint its highlight too because it
+ // might have been damaged by the grid lines
+ size_t count = m_cellsExposed.GetCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( m_cellsExposed[n] == m_currentCellCoords )
+ {
+ wxGridCellAttr* attr = GetCellAttr(m_currentCellCoords);
+ DrawCellHighlight(dc, attr);
+ attr->DecRef();
+
+ break;
+ }
+ }
+}
// TODO: remove this ???
// This is used to redraw all grid lines e.g. when the grid line colour
// TODO: remove this ???
// This is used to redraw all grid lines e.g. when the grid line colour
m_dragCount = 0;
m_isDragging = FALSE;
m_dragCount = 0;
m_isDragging = FALSE;
- m_dropTarget = (wxGenericTreeItem *)NULL;
+ m_dropTarget =
+ m_oldSelection = (wxGenericTreeItem *)NULL;
m_renameTimer = new wxTreeRenameTimer( this );
m_renameTimer = new wxTreeRenameTimer( this );
// we're going to drag this item
m_isDragging = TRUE;
// we're going to drag this item
m_isDragging = TRUE;
+ // remember the old cursor because we will change it while
+ // dragging
+ m_oldCursor = m_cursor;
+
+ // in a single selection control, hide the selection temporarily
+ if ( !(GetWindowStyleFlag() & wxTR_MULTIPLE) )
+ {
+ m_oldSelection = GetSelection().m_pItem;
+
+ if ( m_oldSelection )
+ {
+ m_oldSelection->SetHilight(FALSE);
+ RefreshLine(m_oldSelection);
+ }
+ }
+
m_isDragging = FALSE;
m_dropTarget = (wxGenericTreeItem *)NULL;
m_isDragging = FALSE;
m_dropTarget = (wxGenericTreeItem *)NULL;
+ if ( m_oldSelection )
+ {
+ m_oldSelection->SetHilight(TRUE);
+ RefreshLine(m_oldSelection);
+ m_oldSelection = (wxGenericTreeItem *)NULL;
+ }
+
- SetCursor(wxCURSOR_DEFAULT);
+ SetCursor(m_oldCursor);
m_numRects = count;
m_rects = new wxRect[m_numRects];
m_numRects = count;
m_rects = new wxRect[m_numRects];
- int i = 0;
- for (i = 0; i < m_numRects; i++)
+ for (size_t i = 0; i < m_numRects; i++)
m_rects[i] = rects[i];
/*
m_rects[i] = rects[i];
/*