[Commits] (davids) colheader - improve text vertical positioning in generic renderer

commits at osafoundation.org commits at osafoundation.org
Wed Apr 20 10:23:36 PDT 2005


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

Log message:

colheader - improve text vertical positioning in generic renderer
r=TBD



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

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.75 internal/wxPython-2.5/src/generic/colheader.cpp:1.76
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.75	Tue Apr 19 16:02:11 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Wed Apr 20 10:23:35 2005
@@ -1399,9 +1399,12 @@
 
 				// MacOS case - selection indicator is drawn as needed
 				resultV |= m_ItemList[i]->MacDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
-			}
 
-		dc.DestroyClippingRegion();
+				// NB: for MSW, existing clips must be destroyed before changing the clipping geometry;
+				// on Mac (and perhaps other platforms) this limitation doesn't apply, but it's used
+				// by a tenuous argument of "balance" with the generic version
+				dc.DestroyClippingRegion();
+			}
 	}
 #endif
 
@@ -2080,7 +2083,7 @@
 	bool				bVisibleSelection )
 {
 wxRect		localBoundsR, subItemBoundsR;
-long			startX, originX, maxExtentX;
+long			startX, originX, maxExtentX, descentY;
 bool			bSelected, bHasIcon;
 
 	wxUnusedVar( bUseUnicode );
@@ -2116,7 +2119,10 @@
 			m_TextJust, boundsR->x, originX, startX, boundsR->width, maxExtentX );
 #endif
 
-		dc->DrawText( m_LabelTextRef.c_str(), startX, localBoundsR.y + 1 );
+		descentY = 1;
+		if ((m_LabelTextExtent.y > 0) && (m_LabelTextExtent.y < localBoundsR.height))
+			descentY = ((localBoundsR.height - m_LabelTextExtent.y) / 2) - 1;
+		dc->DrawText( m_LabelTextRef.c_str(), startX, localBoundsR.y + descentY );
 	}
 
 	// render the bitmap, should one be present



More information about the Commits mailing list