Merge branch 'grid-clip'
See https://github.com/wxWidgets/wxWidgets/pull/648
This commit is contained in:
@@ -1436,16 +1436,30 @@ class WXDLLIMPEXP_CORE wxDCClipper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
|
wxDCClipper(wxDC& dc, const wxRegion& r) : m_dc(dc)
|
||||||
{ dc.SetClippingRegion(r.GetBox()); }
|
{
|
||||||
|
dc.GetClippingBox(m_oldClipRect);
|
||||||
|
dc.SetClippingRegion(r.GetBox());
|
||||||
|
}
|
||||||
wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
|
wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc)
|
||||||
{ dc.SetClippingRegion(r.x, r.y, r.width, r.height); }
|
{
|
||||||
|
dc.GetClippingBox(m_oldClipRect);
|
||||||
|
dc.SetClippingRegion(r.x, r.y, r.width, r.height);
|
||||||
|
}
|
||||||
wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
|
wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc)
|
||||||
{ dc.SetClippingRegion(x, y, w, h); }
|
{
|
||||||
|
dc.GetClippingBox(m_oldClipRect);
|
||||||
|
dc.SetClippingRegion(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
~wxDCClipper() { m_dc.DestroyClippingRegion(); }
|
~wxDCClipper()
|
||||||
|
{
|
||||||
|
m_dc.DestroyClippingRegion();
|
||||||
|
m_dc.SetClippingRegion(m_oldClipRect);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxDC& m_dc;
|
wxDC& m_dc;
|
||||||
|
wxRect m_oldClipRect;
|
||||||
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxDCClipper);
|
wxDECLARE_NO_COPY_CLASS(wxDCClipper);
|
||||||
};
|
};
|
||||||
|
@@ -1669,11 +1669,10 @@ public:
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@note Unlike other similar classes such as wxDCFontChanger, wxDCClipper
|
@note Since 3.1.1 wxDCClipper restores the previously active clipping
|
||||||
currently doesn't restore the previously active clipping region when it
|
region when it is destroyed. Previously it reset clipping on the
|
||||||
is destroyed but simply resets clipping on the associated wxDC. This
|
associated wxDC and this has to be taken into account explicitly in
|
||||||
may be changed in the future wxWidgets versions but has to be taken
|
previous wxWidgets versions.
|
||||||
into account explicitly in the current one.
|
|
||||||
|
|
||||||
@library{wxcore}
|
@library{wxcore}
|
||||||
@category{gdi}
|
@category{gdi}
|
||||||
|
@@ -1871,7 +1871,10 @@ void wxGrid::Render( wxDC& dc,
|
|||||||
dc.DrawRectangle( pointOffSet, sizeCells );
|
dc.DrawRectangle( pointOffSet, sizeCells );
|
||||||
|
|
||||||
// draw cells
|
// draw cells
|
||||||
DrawGridCellArea( dc, renderCells );
|
{
|
||||||
|
wxDCClipper clipper( dc, wxRect(pointOffSet, sizeCells) );
|
||||||
|
DrawGridCellArea( dc, renderCells );
|
||||||
|
}
|
||||||
|
|
||||||
// draw grid lines
|
// draw grid lines
|
||||||
if ( style & wxGRID_DRAW_CELL_LINES )
|
if ( style & wxGRID_DRAW_CELL_LINES )
|
||||||
|
@@ -630,8 +630,7 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
|
|||||||
for (int i = col + cell_cols; i <= col_end; i++)
|
for (int i = col + cell_cols; i <= col_end; i++)
|
||||||
{
|
{
|
||||||
clip.width = grid.GetColSize(i) - 1;
|
clip.width = grid.GetColSize(i) - 1;
|
||||||
dc.DestroyClippingRegion();
|
wxDCClipper clipper(dc, clip);
|
||||||
dc.SetClippingRegion(clip);
|
|
||||||
|
|
||||||
SetTextColoursAndFont(grid, attr, dc,
|
SetTextColoursAndFont(grid, attr, dc,
|
||||||
grid.IsInSelection(row,i));
|
grid.IsInSelection(row,i));
|
||||||
@@ -644,7 +643,6 @@ void wxGridCellStringRenderer::Draw(wxGrid& grid,
|
|||||||
rect = rectCell;
|
rect = rectCell;
|
||||||
rect.Inflate(-1);
|
rect.Inflate(-1);
|
||||||
rect.width++;
|
rect.width++;
|
||||||
dc.DestroyClippingRegion();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user