[Commits] (davids) colheader - checkpoint for selection drawing

commits at osafoundation.org commits at osafoundation.org
Thu Apr 7 09:05:31 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/include/wx/generic/colheader.h 1.22 1.23
internal/wxPython-2.5/src/generic/colheader.cpp 1.50 1.51

Log message:

colheader - checkpoint for selection drawing
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/include/wx/generic/colheader.h.diff?r1=text&tr1=1.22&r2=text&tr2=1.23
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.50&r2=text&tr2=1.51

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.50 internal/wxPython-2.5/src/generic/colheader.cpp:1.51
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.50	Wed Apr  6 18:23:37 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Thu Apr  7 09:05:29 2005
@@ -1268,7 +1268,7 @@
 		{
 		wxClientDC		dc( this );
 
-			wxColumnHeaderItem::MSWRenderSelection( &dc, &boundsR );
+			wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, 0 );
 		}
 	}
 
@@ -1686,17 +1686,6 @@
 		SetBitmapRef( *(info->m_BitmapRef), NULL );
 }
 
-// static
-bool wxColumnHeaderItem::HasValidBitmapRef(
-	const wxBitmap		*bitmapRef )
-{
-bool		bResultV;
-
-	bResultV = ((bitmapRef != NULL) && bitmapRef->Ok());
-
-	return bResultV;
-}
-
 void wxColumnHeaderItem::GetBitmapRef(
 	wxBitmap			&bitmapRef ) const
 {
@@ -1718,7 +1707,7 @@
 
 	if ((boundsR != NULL) && HasValidBitmapRef( m_BitmapRef ))
 	{
-		GetBitmapItemBounds( boundsR, m_TextJust, &targetBoundsR );
+		GenericGetBitmapItemBounds( boundsR, m_TextJust, &targetBoundsR );
 
 		m_BitmapRef->SetWidth( targetBoundsR.width );
 		m_BitmapRef->SetHeight( targetBoundsR.height );
@@ -1973,7 +1962,7 @@
 	{
 	wxRect		subItemBoundsR;
 
-		GetBitmapItemBounds( boundsR, m_TextJust, &subItemBoundsR );
+		GenericGetBitmapItemBounds( boundsR, m_TextJust, &subItemBoundsR );
 		dc->DrawBitmap( *m_BitmapRef, subItemBoundsR.x, subItemBoundsR.y, false );
 	}
 
@@ -2044,7 +2033,7 @@
 		dc->DrawText( m_LabelTextRef.c_str(), originX, localBoundsR.y + 1 );
 
 	// draw sort direction arrows (if specified)
-	// NB: what if icon avail? mut. ex.?
+	// NB: what if icon avail? mutually exclusive?
 	if (bSelected && m_BSortEnabled)
 	{
 		// NB: should the first arg be the original "boundsR" arg ??
@@ -2056,7 +2045,7 @@
 	if (bHasIcon)
 	{
 		// NB: should the first arg be the original "boundsR" arg ??
-		GetBitmapItemBounds( &localBoundsR, m_TextJust, &subItemBoundsR );
+		GenericGetBitmapItemBounds( &localBoundsR, m_TextJust, &subItemBoundsR );
 		dc->DrawBitmap( *m_BitmapRef, subItemBoundsR.x, subItemBoundsR.y, false );
 	}
 
@@ -2068,44 +2057,6 @@
 #pragma mark -
 #endif
 
-#if defined(__WXMSW__)
-// static
-void wxColumnHeaderItem::MSWRenderSelection(
-	wxClientDC			*dc,
-	const wxRect			*boundsR )
-{
-RECT			gdiBoundsR;
-HDC			targetHDC;
-//HPEN		targetPen, prevPen;
-HBRUSH		targetBrush;
-COLORREF		targetColor;
-
-	if ((dc == NULL) || (boundsR == NULL))
-		return;
-
-	// rendering effects under consideration:
-	//	frameRect( 2 pixels ), fillRect( 25-50% gray ), rollover bar (orange)
-
-	// compute the sub-item bounds rect
-	gdiBoundsR.left = boundsR->x;
-	gdiBoundsR.right = gdiBoundsR.left + boundsR->width;
-	gdiBoundsR.top = boundsR->y;
-	gdiBoundsR.bottom = gdiBoundsR.top + boundsR->height;
-
-	// now...frame it (or something)
-	targetHDC = GetHdcOf( *dc );
-
-	//targetPen = CreatePen( PS_SOLID, 2, 0 );
-	//prevPen = ::SelectObject( targetPen );
-	targetColor = ::GetBkColor( targetHDC );
-	targetBrush = ::CreateSolidBrush( targetColor );
-	::FrameRect( targetHDC, &gdiBoundsR, targetBrush );
-	::DeleteObject( targetBrush );
-	//(void)::SelectObject( prevPen );
-	//::DeleteObject( targetPen );
-}
-#endif
-
 #if defined(__WXMAC__)
 // static
 void wxColumnHeaderItem::MacDrawThemeBackgroundNoArrows(
@@ -2148,6 +2099,59 @@
 #endif
 
 // static
+void wxColumnHeaderItem::GenericDrawSelection(
+	wxClientDC			*dc,
+	const wxRect			*boundsR,
+	long					drawStyle )
+{
+#if defined(__WXMSW__)
+RECT			gdiBoundsR;
+HDC			targetHDC;
+//HPEN		targetPen, prevPen;
+HBRUSH		targetBrush;
+COLORREF		targetColor;
+
+	if ((dc == NULL) || (boundsR == NULL))
+		return;
+
+	// rendering effects under consideration:
+	//	frameRect( 2 pixels ), fillRect( 25-50% gray ), rollover bar (orange)
+
+	// compute the sub-item bounds rect
+	gdiBoundsR.left = boundsR->x;
+	gdiBoundsR.right = gdiBoundsR.left + boundsR->width;
+	gdiBoundsR.top = boundsR->y;
+	gdiBoundsR.bottom = gdiBoundsR.top + boundsR->height;
+
+	// now...frame it (or something)
+	targetHDC = GetHdcOf( *dc );
+
+	switch (drawStyle)
+	{
+	case 0:
+		//targetPen = CreatePen( PS_SOLID, 2, 0 );
+		//prevPen = ::SelectObject( targetPen );
+		targetColor = ::GetBkColor( targetHDC );
+		targetBrush = ::CreateSolidBrush( targetColor );
+		::FrameRect( targetHDC, &gdiBoundsR, targetBrush );
+		::DeleteObject( targetBrush );
+		//(void)::SelectObject( prevPen );
+		//::DeleteObject( targetPen );
+		break;
+
+	default:
+		break;
+	}
+#else
+
+	wxUnusedVar( dc );
+	wxUnusedVar( boundsR );
+	wxUnusedVar( drawStyle );
+
+#endif
+}
+
+// static
 void wxColumnHeaderItem::GenericGetSortArrowBounds(
 	const wxRect			*itemBoundsR,
 	wxRect				*targetBoundsR )
@@ -2211,7 +2215,7 @@
 }
 
 // static
-void wxColumnHeaderItem::GetBitmapItemBounds(
+void wxColumnHeaderItem::GenericGetBitmapItemBounds(
 	const wxRect			*itemBoundsR,
 	long					targetJustification,
 	wxRect				*targetBoundsR )
@@ -2259,6 +2263,17 @@
 }
 
 // static
+bool wxColumnHeaderItem::HasValidBitmapRef(
+	const wxBitmap		*bitmapRef )
+{
+bool		bResultV;
+
+	bResultV = ((bitmapRef != NULL) && bitmapRef->Ok());
+
+	return bResultV;
+}
+
+// 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.22 internal/wxPython-2.5/include/wx/generic/colheader.h:1.23
--- internal/wxPython-2.5/include/wx/generic/colheader.h:1.22	Wed Apr  6 10:11:30 2005
+++ internal/wxPython-2.5/include/wx/generic/colheader.h	Thu Apr  7 09:05:28 2005
@@ -102,11 +102,22 @@
 #endif
 
 public:
-#if defined(__WXMSW__)
-	static void MSWRenderSelection(
+	static void GenericDrawSelection(
 		wxClientDC		*dc,
-		const wxRect		*boundsR );
-#endif
+		const wxRect		*boundsR,
+		long				drawStyle );
+
+	static void GenericDrawSortArrow(
+		wxClientDC		*dc,
+		const wxRect		*boundsR,
+		bool				bSortAscending );
+	static void GenericGetSortArrowBounds(
+		const wxRect		*itemBoundsR,
+		wxRect			*targetBoundsR );
+	static void GenericGetBitmapItemBounds(
+		const wxRect		*itemBoundsR,
+		long				targetJustification,
+		wxRect			*targetBoundsR );
 
 #if defined(__WXMAC__)
 	static void MacDrawThemeBackgroundNoArrows(
@@ -114,20 +125,8 @@
 		bool				bSelected );
 #endif
 
-	static void GenericGetSortArrowBounds(
-		const wxRect		*itemBoundsR,
-		wxRect			*targetBoundsR );
-	static void GenericDrawSortArrow(
-		wxClientDC		*dc,
-		const wxRect		*boundsR,
-		bool				bSortAscending );
-
 	static bool HasValidBitmapRef(
 		const wxBitmap	*bitmapRef );
-	static void GetBitmapItemBounds(
-		const wxRect		*itemBoundsR,
-		long				targetJustification,
-		wxRect			*targetBoundsR );
 
 	static long ConvertJustification(
 		long				sourceEnum,



More information about the Commits mailing list