clip column image (and not only the text) to the column width (patch 1664588)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -98,6 +98,9 @@ static const int WIDTH_COL_DEFAULT = 80;
|
|||||||
// the space between the image and the text in the report mode
|
// the space between the image and the text in the report mode
|
||||||
static const int IMAGE_MARGIN_IN_REPORT_MODE = 5;
|
static const int IMAGE_MARGIN_IN_REPORT_MODE = 5;
|
||||||
|
|
||||||
|
// the space between the image and the text in the report mode in header
|
||||||
|
static const int HEADER_IMAGE_MARGIN_IN_REPORT_MODE = 2;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// private classes
|
// private classes
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -1846,7 +1849,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
wLabel += 2 * EXTRA_WIDTH;
|
wLabel += 2 * EXTRA_WIDTH;
|
||||||
|
|
||||||
// and the width of the icon, if any
|
// and the width of the icon, if any
|
||||||
static const int MARGIN_BETWEEN_TEXT_AND_ICON = 2;
|
|
||||||
int ix = 0, iy = 0; // init them just to suppress the compiler warnings
|
int ix = 0, iy = 0; // init them just to suppress the compiler warnings
|
||||||
const int image = item.m_image;
|
const int image = item.m_image;
|
||||||
wxImageList *imageList;
|
wxImageList *imageList;
|
||||||
@@ -1856,7 +1858,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if ( imageList )
|
if ( imageList )
|
||||||
{
|
{
|
||||||
imageList->GetSize(image, ix, iy);
|
imageList->GetSize(image, ix, iy);
|
||||||
wLabel += ix + MARGIN_BETWEEN_TEXT_AND_ICON;
|
wLabel += ix + HEADER_IMAGE_MARGIN_IN_REPORT_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1885,6 +1887,10 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// draw the text and image clipping them so that they
|
||||||
|
// don't overwrite the column boundary
|
||||||
|
wxDCClipper clipper(dc, x, HEADER_OFFSET_Y, cw, h - 4 );
|
||||||
|
|
||||||
// if we have an image, draw it on the right of the label
|
// if we have an image, draw it on the right of the label
|
||||||
if ( imageList )
|
if ( imageList )
|
||||||
{
|
{
|
||||||
@@ -1892,18 +1898,12 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
(
|
(
|
||||||
image,
|
image,
|
||||||
dc,
|
dc,
|
||||||
xAligned + wLabel - ix - MARGIN_BETWEEN_TEXT_AND_ICON,
|
xAligned + wLabel - ix - HEADER_IMAGE_MARGIN_IN_REPORT_MODE,
|
||||||
HEADER_OFFSET_Y + (h - 4 - iy)/2,
|
HEADER_OFFSET_Y + (h - 4 - iy)/2,
|
||||||
wxIMAGELIST_DRAW_TRANSPARENT
|
wxIMAGELIST_DRAW_TRANSPARENT
|
||||||
);
|
);
|
||||||
|
|
||||||
cw -= ix + MARGIN_BETWEEN_TEXT_AND_ICON;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the text clipping it so that it doesn't overwrite the column
|
|
||||||
// boundary
|
|
||||||
wxDCClipper clipper(dc, x, HEADER_OFFSET_Y, cw, h - 4 );
|
|
||||||
|
|
||||||
dc.DrawText( item.GetText(),
|
dc.DrawText( item.GetText(),
|
||||||
xAligned + EXTRA_WIDTH, h / 2 - hLabel / 2 ); //HEADER_OFFSET_Y + EXTRA_HEIGHT );
|
xAligned + EXTRA_WIDTH, h / 2 - hLabel / 2 ); //HEADER_OFFSET_Y + EXTRA_HEIGHT );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user