Add wxDataViewCtrl debug option to display render bounds
For debugging convenience define DEBUG_RENDER_EXTENTS to draw a red rectangle around a custom rendered cell's full rectangle, and a green rect for the extent of the item appearing inside it. Custom renderers ordinarily should not draw outside of the green rect. A notable exception is drawn text, particularly multi-line ones.
This commit is contained in:
@@ -32,6 +32,10 @@
|
|||||||
#include "wx/access.h"
|
#include "wx/access.h"
|
||||||
#endif // wxUSE_ACCESSIBILITY
|
#endif // wxUSE_ACCESSIBILITY
|
||||||
|
|
||||||
|
// Uncomment this line to, for custom renderers, visually show the extent
|
||||||
|
// of both a cell and its item.
|
||||||
|
//#define DEBUG_RENDER_EXTENTS
|
||||||
|
|
||||||
const char wxDataViewCtrlNameStr[] = "dataviewCtrl";
|
const char wxDataViewCtrlNameStr[] = "dataviewCtrl";
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -1035,6 +1039,20 @@ wxDataViewCustomRendererBase::WXCallRender(wxRect rectCell, wxDC *dc, int state)
|
|||||||
if ( m_attr.HasFont() )
|
if ( m_attr.HasFont() )
|
||||||
changeFont.Set(m_attr.GetEffectiveFont(dc->GetFont()));
|
changeFont.Set(m_attr.GetEffectiveFont(dc->GetFont()));
|
||||||
|
|
||||||
|
#ifdef DEBUG_RENDER_EXTENTS
|
||||||
|
{
|
||||||
|
|
||||||
|
wxDCBrushChanger changeBrush(*dc, *wxTRANSPARENT_BRUSH);
|
||||||
|
wxDCPenChanger changePen(*dc, *wxRED);
|
||||||
|
|
||||||
|
dc->DrawRectangle(rectCell);
|
||||||
|
|
||||||
|
dc->SetPen(*wxGREEN);
|
||||||
|
dc->DrawRectangle(rectItem);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Render(rectItem, dc, state);
|
Render(rectItem, dc, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user