fixed the selection rectangle drawing (was off by 1)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f6278a74c2
commit
f44b4495db
@ -191,7 +191,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
|
|||||||
|
|
||||||
HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
|
HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont);
|
||||||
|
|
||||||
DrawState(hdc, NULL, NULL,
|
::DrawState(hdc, NULL, NULL,
|
||||||
(LPARAM)m_strName.c_str(), m_strName.length(),
|
(LPARAM)m_strName.c_str(), m_strName.length(),
|
||||||
x, rc.y, rc.GetWidth(), rc.GetHeight(),
|
x, rc.y, rc.GetWidth(), rc.GetHeight(),
|
||||||
DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
|
DST_PREFIXTEXT | (st & wxODDisabled ? DSS_DISABLED : 0));
|
||||||
@ -234,9 +234,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
|
|||||||
RECT rect = { 0, 0, GetMarginWidth(), m_nHeight };
|
RECT rect = { 0, 0, GetMarginWidth(), m_nHeight };
|
||||||
if ( m_nHeight > 0 )
|
if ( m_nHeight > 0 )
|
||||||
{
|
{
|
||||||
#ifndef __SC__
|
::DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
|
||||||
DrawFrameControl(hdcMem, &rect, DFC_MENU, DFCS_MENUCHECK);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally copy it to screen DC and clean up
|
// finally copy it to screen DC and clean up
|
||||||
@ -265,21 +263,22 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
|
|||||||
// there should be enough place!
|
// there should be enough place!
|
||||||
wxASSERT((nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight()));
|
wxASSERT((nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight()));
|
||||||
|
|
||||||
int heightDiff = (m_nHeight - nBmpHeight);
|
int heightDiff = m_nHeight - nBmpHeight;
|
||||||
// if (heightDiff = -1)
|
|
||||||
// heightDiff = -2;
|
|
||||||
|
|
||||||
//MT: blit with mask enabled.
|
|
||||||
dc.Blit(rc.x + (GetMarginWidth() - nBmpWidth) / 2,
|
dc.Blit(rc.x + (GetMarginWidth() - nBmpWidth) / 2,
|
||||||
rc.y + heightDiff / 2,
|
rc.y + heightDiff / 2,
|
||||||
nBmpWidth, nBmpHeight,
|
nBmpWidth, nBmpHeight,
|
||||||
&dcMem, 0, 0, wxCOPY, TRUE);
|
&dcMem, 0, 0, wxCOPY, TRUE /* use mask */);
|
||||||
|
|
||||||
if ( st & wxODSelected ) {
|
if ( st & wxODSelected ) {
|
||||||
#ifdef O_DRAW_NATIVE_API
|
#ifdef O_DRAW_NATIVE_API
|
||||||
RECT rectBmp = { rc.GetLeft(), rc.GetTop(),
|
RECT rectBmp =
|
||||||
rc.GetLeft() + GetMarginWidth(),
|
{
|
||||||
rc.GetTop() + m_nHeight };
|
rc.GetLeft(),
|
||||||
|
rc.GetTop(),
|
||||||
|
rc.GetLeft() + GetMarginWidth() - 1,
|
||||||
|
rc.GetTop() + m_nHeight - 1
|
||||||
|
};
|
||||||
|
|
||||||
SetBkColor(hdc, colBack);
|
SetBkColor(hdc, colBack);
|
||||||
DrawEdge(hdc, &rectBmp, EDGE_RAISED, BF_SOFT | BF_RECT);
|
DrawEdge(hdc, &rectBmp, EDGE_RAISED, BF_SOFT | BF_RECT);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user