From: Vadim Zeitlin Date: Mon, 21 Feb 2000 14:25:20 +0000 (+0000) Subject: include X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b3a7510d21b9d4f9646b32edf9fe6f453f2c6dc9 include git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a862e9ee29..faeb6fcc13 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -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 diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 57475faf26..dc7160f294 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -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(); } diff --git a/src/motif/region.cpp b/src/motif/region.cpp index f9e7e47413..fb3b1e3db2 100644 --- a/src/motif/region.cpp +++ b/src/motif/region.cpp @@ -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]; /*