[Commits] (davids) colheader - checkpoint for selection UI style control

commits at osafoundation.org commits at osafoundation.org
Fri Apr 8 20:59:56 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/include/wx/generic/colheader.h 1.23 1.24
internal/wxPython-2.5/src/generic/colheader.cpp 1.53 1.54
internal/wxPython-2.5/wxPython/src/colheader.i 1.11 1.12

Log message:

colheader - checkpoint for selection UI style control
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/include/wx/generic/colheader.h.diff?r1=text&tr1=1.23&r2=text&tr2=1.24
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.53&r2=text&tr2=1.54
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/wxPython/src/colheader.i.diff?r1=text&tr1=1.11&r2=text&tr2=1.12

Index: internal/wxPython-2.5/include/wx/generic/colheader.h
diff -u internal/wxPython-2.5/include/wx/generic/colheader.h:1.23 internal/wxPython-2.5/include/wx/generic/colheader.h:1.24
--- internal/wxPython-2.5/include/wx/generic/colheader.h:1.23	Thu Apr  7 09:05:28 2005
+++ internal/wxPython-2.5/include/wx/generic/colheader.h	Fri Apr  8 20:59:54 2005
@@ -182,9 +182,12 @@
 	bool RescaleToFit(
 		long				newWidth );
 	bool ResizeDivision(
-		long			itemIndex,
+		long				itemIndex,
 		long				originX );
 
+	long GetSelectionDrawStyle( void ) const;
+	void SetSelectionDrawStyle(
+		long				styleValue );
 	bool GetFlagProportionalResizing( void ) const;
 	void SetFlagProportionalResizing(
 		bool				bFlagValue );
@@ -347,6 +350,7 @@
 	wxColumnHeaderItem		**m_ItemList;
 	long					m_ItemCount;
 	long					m_ItemSelected;
+	long					m_SelectionDrawStyle;
 	bool					m_BProportionalResizing;
 	bool					m_BVisibleSelection;
 	bool					m_BUseUnicode;

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.53 internal/wxPython-2.5/src/generic/colheader.cpp:1.54
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.53	Thu Apr  7 15:29:35 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Fri Apr  8 20:59:54 2005
@@ -163,9 +163,7 @@
 	m_ItemList = NULL;
 	m_ItemCount = 0;
 	m_ItemSelected = wxCOLUMNHEADER_HITTEST_NoPart;
-
-	m_BProportionalResizing = true;
-	m_BVisibleSelection = true;
+	m_SelectionDrawStyle = 0;
 
 #if defined(__WXMAC__)
 	// NB: or kThemeSystemFontTag, kThemeViewsFontTag
@@ -174,6 +172,9 @@
 	m_Font.SetFamily( 0 );
 #endif
 
+	m_BProportionalResizing = true;
+	m_BVisibleSelection = true;
+
 #if wxUSE_UNICODE
 	m_BUseUnicode = true;
 #else
@@ -181,56 +182,6 @@
 #endif
 }
 
-bool wxColumnHeader::GetFlagProportionalResizing( void ) const
-{
-	return m_BProportionalResizing;
-}
-
-void wxColumnHeader::SetFlagProportionalResizing(
-	bool			bFlagValue )
-{
-	if (m_BProportionalResizing == bFlagValue)
-		return;
-
-	m_BProportionalResizing = bFlagValue;
-}
-
-bool wxColumnHeader::GetFlagVisibleSelection( void ) const
-{
-	return m_BVisibleSelection;
-}
-
-void wxColumnHeader::SetFlagVisibleSelection(
-	bool			bFlagValue )
-{
-	if (m_BVisibleSelection == bFlagValue)
-		return;
-
-	m_BVisibleSelection = bFlagValue;
-
-	if (m_ItemSelected >= 0)
-	{
-		RefreshItem( m_ItemSelected );
-		SetViewDirty();
-	}
-}
-
-bool wxColumnHeader::GetFlagUnicode( void ) const
-{
-	return m_BUseUnicode;
-}
-
-// NB: this routine shouldn't really exist
-//
-void wxColumnHeader::SetFlagUnicode(
-	bool			bFlagValue )
-{
-	if (m_BUseUnicode == bFlagValue)
-		return;
-
-	// m_BUseUnicode = bFlagValue;
-}
-
 bool wxColumnHeader::Create(
 	wxWindow			*parent,
 	wxWindowID			id,
@@ -597,6 +548,88 @@
 #pragma mark -
 #endif
 
+long wxColumnHeader::GetSelectionDrawStyle( void ) const
+{
+	return m_SelectionDrawStyle;
+}
+
+// NB: this has no effect on the Mac selection UI,
+// which is well-defined.
+//
+void wxColumnHeader::SetSelectionDrawStyle(
+	long			styleValue )
+{
+	if (m_SelectionDrawStyle == styleValue)
+		return;
+	if ((styleValue < 0) || (styleValue > 0))
+		return;
+
+	m_SelectionDrawStyle = styleValue;
+
+#if !defined(__WXMAC__)
+	if (m_ItemSelected >= 0)
+	{
+		RefreshItem( m_ItemSelected );
+		SetViewDirty();
+	}
+#endif
+}
+
+bool wxColumnHeader::GetFlagProportionalResizing( void ) const
+{
+	return m_BProportionalResizing;
+}
+
+void wxColumnHeader::SetFlagProportionalResizing(
+	bool			bFlagValue )
+{
+	if (m_BProportionalResizing == bFlagValue)
+		return;
+
+	m_BProportionalResizing = bFlagValue;
+}
+
+bool wxColumnHeader::GetFlagVisibleSelection( void ) const
+{
+	return m_BVisibleSelection;
+}
+
+void wxColumnHeader::SetFlagVisibleSelection(
+	bool			bFlagValue )
+{
+	if (m_BVisibleSelection == bFlagValue)
+		return;
+
+	m_BVisibleSelection = bFlagValue;
+
+	if (m_ItemSelected >= 0)
+	{
+		RefreshItem( m_ItemSelected );
+		SetViewDirty();
+	}
+}
+
+bool wxColumnHeader::GetFlagUnicode( void ) const
+{
+	return m_BUseUnicode;
+}
+
+// NB: this routine shouldn't really exist
+//
+void wxColumnHeader::SetFlagUnicode(
+	bool			bFlagValue )
+{
+	if (m_BUseUnicode == bFlagValue)
+		return;
+
+	// m_BUseUnicode = bFlagValue;
+}
+
+// ================
+#if 0
+#pragma mark -
+#endif
+
 // ----------------------------------------------------------------------------
 // utility
 // ----------------------------------------------------------------------------
@@ -1262,14 +1295,14 @@
 	// render native control window
 	wxWindowMSW::MSWDefWindowProc( WM_PAINT, 0, 0 );
 
-	// add selection indicator - no Win32 native mechanism exists
+	// Win32 case - add selection indicator - no native mechanism exists
 	if (m_BVisibleSelection && (m_ItemSelected >= 0))
 	{
 		if (GetItemBounds( m_ItemSelected, &boundsR ))
 		{
 		wxClientDC		dc( this );
 
-			wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, 0 );
+			wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, m_SelectionDrawStyle );
 		}
 	}
 
@@ -1284,13 +1317,14 @@
 		wxDCClipper		boundsClip( dc, boundsR );
 
 #if defined(__WXMAC__)
+			// Mac case - selection indicator is drawn as needed
 			resultV |= m_ItemList[i]->MacDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
-#else
-			resultV |= m_ItemList[i]->GenericDrawItem( this, &dc, &boundsR, m_BUseUnicode, m_BVisibleSelection );
 
+#else
 			// 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, 0 );
+				wxColumnHeaderItem::GenericDrawSelection( &dc, &boundsR, m_SelectionDrawStyle );
 #endif
 		}
 #endif
@@ -2103,8 +2137,8 @@
 	long					drawStyle )
 {
 wxColour		stdSelRGB( 0x66, 0x66, 0x66 );
-wxPen			solidPen( stdSelRGB, 1, wxSOLID );
-int				borderWidth;
+wxPen		targetPen( stdSelRGB, 1, wxSOLID );
+int			borderWidth;
 
 	if ((dc == NULL) || (boundsR == NULL))
 		return;
@@ -2117,33 +2151,29 @@
 	{
 	case 1:
 		// frame border style
-		{
-			borderWidth = 2;
-			solidPen.SetWidth( borderWidth );
-			dc->SetPen( solidPen );
-			dc->SetBrush( *wxTRANSPARENT_BRUSH );
-
-			dc->DrawRectangle(
-				boundsR->x,
-				boundsR->y,
-				boundsR->width - borderWidth,
-				boundsR->height );
-		}
+		borderWidth = 2;
+		targetPen.SetWidth( borderWidth );
+		dc->SetPen( targetPen );
+		dc->SetBrush( *wxTRANSPARENT_BRUSH );
+
+		dc->DrawRectangle(
+			boundsR->x,
+			boundsR->y,
+			boundsR->width - borderWidth,
+			boundsR->height );
 		break;
 
 	default:
 		// underline style - similar to Win32 rollover drawing
-		{
-			borderWidth = 6;
-			solidPen.SetWidth( borderWidth );
-			dc->SetPen( solidPen );
-
-			dc->DrawLine(
-				boundsR->x,
-				boundsR->y + boundsR->height,
-				boundsR->x + boundsR->width - borderWidth,
-				boundsR->y + boundsR->height );
-		}
+		borderWidth = 6;
+		targetPen.SetWidth( borderWidth );
+		dc->SetPen( targetPen );
+
+		dc->DrawLine(
+			boundsR->x,
+			boundsR->y + boundsR->height,
+			boundsR->x + boundsR->width - borderWidth,
+			boundsR->y + boundsR->height );
 		break;
 	}
 }

Index: internal/wxPython-2.5/wxPython/src/colheader.i
diff -u internal/wxPython-2.5/wxPython/src/colheader.i:1.11 internal/wxPython-2.5/wxPython/src/colheader.i:1.12
--- internal/wxPython-2.5/wxPython/src/colheader.i:1.11	Sun Apr  3 00:49:22 2005
+++ internal/wxPython-2.5/wxPython/src/colheader.i	Fri Apr  8 20:59:54 2005
@@ -107,6 +107,9 @@
         long            itemIndex,
         long            originX );
 
+    long GetSelectionDrawStyle( void ) const;
+    void SetSelectionDrawStyle(
+        long                styleValue );
     bool GetFlagProportionalResizing( void ) const;
     void SetFlagProportionalResizing(
         bool                bFlagValue );



More information about the Commits mailing list