[Commits] (davids) colheader - more positioning tweaks

commits at osafoundation.org commits at osafoundation.org
Mon Apr 25 01:14:27 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/include/wx/generic/colheader.h 1.40 1.41
internal/wxPython-2.5/src/generic/colheader.cpp 1.81 1.82
internal/wxPython-2.5/wxPython/demo/ColumnHeader.py 1.29 1.30

Log message:

colheader - more positioning tweaks
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/include/wx/generic/colheader.h.diff?r1=text&tr1=1.40&r2=text&tr2=1.41
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.81&r2=text&tr2=1.82
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/wxPython/demo/ColumnHeader.py.diff?r1=text&tr1=1.29&r2=text&tr2=1.30

Index: internal/wxPython-2.5/wxPython/demo/ColumnHeader.py
diff -u internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.29 internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.30
--- internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.29	Fri Apr 22 10:54:59 2005
+++ internal/wxPython-2.5/wxPython/demo/ColumnHeader.py	Mon Apr 25 01:14:25 2005
@@ -225,7 +225,7 @@
 
 <p>Selections, bitmaps and sort arrows are optional</p>
 
-<p>NB: not all of the selection styles are functional</p>
+<p>NB: not all of the selection styles are implemented</p>
 
 <p>A limitation: text and bitmaps are mutually exclusive.</p>
 

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.81 internal/wxPython-2.5/src/generic/colheader.cpp:1.82
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.81	Sat Apr 23 14:16:20 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Mon Apr 25 01:14:25 2005
@@ -1639,7 +1639,7 @@
 		newFmt |= (itemRef->m_BSortAscending ? HDF_SORTUP : HDF_SORTDOWN);
 
 	// NB: should sort arrows and bitmaps be MutEx?
-	if (itemRef->HasValidBitmapRef( itemRef->m_BitmapRef ))
+	if (itemRef->ValidBitmapRef( itemRef->m_BitmapRef ))
 	{
 		// add bitmap reference
 		newFmt |= HDF_BITMAP;
@@ -1813,7 +1813,7 @@
 	delete m_BitmapRef;
 	m_BitmapRef = NULL;
 
-	if ((boundsR != NULL) && HasValidBitmapRef( &bitmapRef ))
+	if ((boundsR != NULL) && ValidBitmapRef( &bitmapRef ))
 	{
 		GenericGetBitmapItemBounds( boundsR, m_TextJust, NULL, &targetBoundsR );
 		if ((bitmapRef.GetWidth() > targetBoundsR.width) || (bitmapRef.GetHeight() > targetBoundsR.height))
@@ -2006,7 +2006,7 @@
 
 	// determine selection and bitmap rendering conditions
 	bSelected = m_BSelected && bVisibleSelection;
-	bHasIcon = ((dc != NULL) && HasValidBitmapRef( m_BitmapRef ));
+	bHasIcon = ((dc != NULL) && ValidBitmapRef( m_BitmapRef ));
 
 	// a broken, dead attempt to tinge the background
 // Collection	origCol, newCol;
@@ -2126,7 +2126,7 @@
 
 	// determine selection and bitmap rendering conditions
 	bSelected = m_BSelected && bVisibleSelection;
-	bHasIcon = ((dc != NULL) && HasValidBitmapRef( m_BitmapRef ));
+	bHasIcon = ((dc != NULL) && ValidBitmapRef( m_BitmapRef ));
 
 	// draw column header background:
 	// leverage native (GTK?) wxRenderer
@@ -2232,7 +2232,7 @@
 		return 0;
 
 	// determine the minimum width
-	ellipsisStr = wxString( wxT("...") );
+	ellipsisStr = wxString( GetEllipsesString() );
 	dc->GetTextExtent( ellipsisStr, &ellipsisWidth, &targetHeight );
 	if (ellipsisWidth > maxWidth)
 	{
@@ -2274,11 +2274,16 @@
 	long				&extentX ) const
 {
 long		leftDeltaX, leftInsetX, rightInsetX;
+long		insetX;
+
+	insetX = wxCH_kMetricInsetX;
+	if (m_TextJust == CH_JUST_Center)
+		insetX /= 2;
 
 	rightInsetX =
 		(m_BSortEnabled
-		? wxCH_kMetricInsetX + wxCH_kMetricArrowSizeX
-		: wxCH_kMetricInsetX / 2);
+		? (2 * insetX) + wxCH_kMetricArrowSizeX
+		: insetX);
 
 	switch (m_TextJust)
 	{
@@ -2289,7 +2294,7 @@
 	case CH_JUST_Right:
 	case CH_JUST_Left:
 	default:
-		leftInsetX = wxCH_kMetricInsetX;
+		leftInsetX = insetX;
 		break;
 	}
 
@@ -2334,11 +2339,11 @@
 	if ((cutoffCharCount > 0) && (cutoffCharCount <= (long)(targetStr.length())))
 	{
 		truncStr = targetStr.Left( cutoffCharCount );
-		targetStr = truncStr + wxString( wxT("...") );
+		targetStr = truncStr + wxString( GetEllipsesString() );
 	}
 	else
 	{
-		targetStr = wxString( wxT("...") );
+		targetStr = wxString( GetEllipsesString() );
 	}
 }
 
@@ -2606,7 +2611,7 @@
 }
 
 // static
-bool wxColumnHeaderItem::HasValidBitmapRef(
+bool wxColumnHeaderItem::ValidBitmapRef(
 	const wxBitmap		*bitmapRef )
 {
 bool		bResultV;
@@ -2617,6 +2622,12 @@
 }
 
 // static
+wxChar * wxColumnHeaderItem::GetEllipsesString( void )
+{
+	return wxT("...");
+}
+
+// static
 long wxColumnHeaderItem::ConvertJustification(
 	long			sourceEnum,
 	bool			bToNative )

Index: internal/wxPython-2.5/include/wx/generic/colheader.h
diff -u internal/wxPython-2.5/include/wx/generic/colheader.h:1.40 internal/wxPython-2.5/include/wx/generic/colheader.h:1.41
--- internal/wxPython-2.5/include/wx/generic/colheader.h:1.40	Sat Apr 23 01:16:34 2005
+++ internal/wxPython-2.5/include/wx/generic/colheader.h	Mon Apr 25 01:14:24 2005
@@ -363,9 +363,11 @@
 		bool				bSelected );
 #endif
 
-	static bool HasValidBitmapRef(
+	static bool ValidBitmapRef(
 		const wxBitmap	*bitmapRef );
 
+	static wxChar * GetEllipsesString( void );
+
 	static long ConvertJustification(
 		long				sourceEnum,
 		bool				bToNative );



More information about the Commits mailing list