Handle cell alignment in the renderer itself in generic wxDVC.
Instead of using wxDataViewRenderer::GetSize() and rendering the cell into the appropriate part of the rectangle, pass the full rectangle and the alignment of the cell contents in it to the renderer itself. This fixes the bug with bold text being truncated in the "attributes" column of the dataview sample and is also generally more flexible as the renderer may decide itself what to do with the extra space. It also somewhat reduces the code duplication between CreateItemBitmap() and OnPaint(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,11 +48,9 @@ public:
|
||||
virtual bool
|
||||
RenderWithAttr(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
const wxDataViewItemAttr * WXUNUSED(attr), // NULL if none
|
||||
int state)
|
||||
{
|
||||
return Render(rect, &dc, state);
|
||||
}
|
||||
int align, // combination of horizontal and vertical
|
||||
const wxDataViewItemAttr *attr, // may be NULL if none
|
||||
int state);
|
||||
|
||||
virtual wxSize GetSize() const = 0;
|
||||
|
||||
@@ -118,6 +116,7 @@ public:
|
||||
// Draw the text using the provided attributes
|
||||
void RenderText(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int align,
|
||||
const wxString& text,
|
||||
const wxDataViewItemAttr *attr, // may be NULL if none
|
||||
int state,
|
||||
@@ -147,11 +146,15 @@ public:
|
||||
|
||||
virtual bool RenderWithAttr(wxDC& dc,
|
||||
const wxRect& rect,
|
||||
int align,
|
||||
const wxDataViewItemAttr *attr,
|
||||
int state);
|
||||
virtual bool Render( wxRect cell, wxDC *dc, int state )
|
||||
virtual bool Render(wxRect WXUNUSED(cell),
|
||||
wxDC * WXUNUSED(dc),
|
||||
int WXUNUSED(state))
|
||||
{
|
||||
return RenderWithAttr(*dc, cell, NULL, state);
|
||||
wxFAIL_MSG("only RenderWithAttr() should be called");
|
||||
return false;
|
||||
}
|
||||
|
||||
wxSize GetSize() const;
|
||||
|
Reference in New Issue
Block a user