git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2000-02-21 14:25:20 +00:00
parent 2cd31b57b2
commit b3a7510d21
3 changed files with 60 additions and 28 deletions

View File

@ -1939,6 +1939,7 @@ void wxGridWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
#if WXGRID_DRAW_LINES
m_owner->DrawAllGridLines( dc, reg );
#endif
m_owner->DrawHighlight( dc );
}
@ -3947,6 +3948,11 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
attr->GetEditor()->StartingKey(event);
attr->DecRef();
}
else
{
// let others process char events for readonly cells
event.Skip();
}
break;
}
}
@ -4098,11 +4104,6 @@ void wxGrid::DrawCell( wxDC& dc, const wxGridCellCoords& 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);
}
}
attr->DecRef();
@ -4122,26 +4123,18 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr )
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...
#if 0
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,
@ -4157,8 +4150,7 @@ void wxGrid::DrawCellHighlight( wxDC& dc, const wxGridCellAttr *attr )
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(x1, y2, x2, y2);
dc.DrawLine(x2, y1, x2, y2+1);
#endif // 0/1
}
#endif // 0
}
void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
@ -4181,6 +4173,23 @@ void wxGrid::DrawCellBorder( wxDC& dc, const wxGridCellCoords& coords )
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

View File

@ -607,7 +607,8 @@ void wxTreeCtrl::Init()
m_dragCount = 0;
m_isDragging = FALSE;
m_dropTarget = (wxGenericTreeItem *)NULL;
m_dropTarget =
m_oldSelection = (wxGenericTreeItem *)NULL;
m_renameTimer = new wxTreeRenameTimer( this );
@ -2143,6 +2144,22 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
// 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);
}
}
CaptureMouse();
}
}
@ -2178,9 +2195,16 @@ void wxTreeCtrl::OnMouse( wxMouseEvent &event )
m_isDragging = FALSE;
m_dropTarget = (wxGenericTreeItem *)NULL;
if ( m_oldSelection )
{
m_oldSelection->SetHilight(TRUE);
RefreshLine(m_oldSelection);
m_oldSelection = (wxGenericTreeItem *)NULL;
}
ReleaseMouse();
SetCursor(wxCURSOR_DEFAULT);
SetCursor(m_oldCursor);
wxYield();
}

View File

@ -462,8 +462,7 @@ void wxRegionIterator::Reset(const wxRegion& region)
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];
/*