[Commits] (davids) colheader - fixed Win32 "no selection" bug

commits at osafoundation.org commits at osafoundation.org
Thu Apr 21 11:45:47 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/src/generic/colheader.cpp 1.76 1.77

Log message:

colheader - fixed Win32 "no selection" bug
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.76&r2=text&tr2=1.77

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.76 internal/wxPython-2.5/src/generic/colheader.cpp:1.77
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.76	Wed Apr 20 10:23:35 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Thu Apr 21 11:45:45 2005
@@ -1360,7 +1360,9 @@
 				// generic case - add selection indicator
 				resultV |= m_ItemList[i]->GenericDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
 				if (m_BVisibleSelection && (i == m_ItemSelected))
-					wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, &m_SelectionColour, m_SelectionDrawStyle );
+					wxColumnHeaderItem::GenericDrawSelection(
+						&dc, &boundsR,
+						&m_SelectionColour, m_SelectionDrawStyle );
 
 				// NB: for MSW, existing clips must be destroyed before changing the clipping geometry;
 				// on Mac (and perhaps other platforms) this limitation doesn't apply
@@ -1375,12 +1377,15 @@
 		wxWindowMSW::MSWDefWindowProc( WM_PAINT, 0, 0 );
 
 		// MSW case - add selection indicator - no appropriate native adornment exists
+		// FIXME: the DC has to be a wxClientDC instead of a wxPaintDC - why?
 		if (m_BVisibleSelection && (m_ItemSelected >= 0))
 			if (GetItemBounds( m_ItemSelected, &boundsR ))
 			{
-			wxPaintDC		dc( this );
+			wxClientDC		dc( this );
 
-				wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, &m_SelectionColour, m_SelectionDrawStyle );
+				wxColumnHeaderItem::GenericDrawSelection(
+					&dc, &boundsR,
+					&m_SelectionColour, m_SelectionDrawStyle );
 			}
 	}
 
@@ -2026,12 +2031,6 @@
 		qdBoundsR.top = boundsR->y + 1;
 		qdBoundsR.bottom = qdBoundsR.top + boundsR->height;
 
-#if 0
-		wxLogDebug(
-			_T("MacDrawItem (J - x,O,S - w,E): [%ld - %ld, %ld, %ld - %ld, %ld]"),
-			m_TextJust, boundsR->x, originX, startX, boundsR->width, maxExtentX );
-#endif
-
 		nativeFontID = dc->GetFont().MacGetThemeFontID();
 
 		if (bUseUnicode)
@@ -2110,18 +2109,13 @@
 		// calculate and cache text extent
 		CalculateTextExtent( dc, false );
 
-		// FIXME: need to clip long text items
 		GetTextUIExtent( startX, originX, maxExtentX );
 
-#if 0
-		wxLogDebug(
-			_T("GenericDrawItem (J - x,O,S - w,E): [%ld - %ld, %ld, %ld - %ld, %ld]"),
-			m_TextJust, boundsR->x, originX, startX, boundsR->width, maxExtentX );
-#endif
-
 		descentY = 1;
 		if ((m_LabelTextExtent.y > 0) && (m_LabelTextExtent.y < localBoundsR.height))
-			descentY = ((localBoundsR.height - m_LabelTextExtent.y) / 2) - 1;
+			descentY = ((localBoundsR.height - m_LabelTextExtent.y) / 2);
+
+		// FIXME: need to clip long text items
 		dc->DrawText( m_LabelTextRef.c_str(), startX, localBoundsR.y + descentY );
 	}
 



More information about the Commits mailing list