[Commits] (davids) colheader - fixed bitmap scaling issue; tweaked demo

commits at osafoundation.org commits at osafoundation.org
Mon Apr 11 17:43:49 PDT 2005


Commit by: davids
Modified files:
internal/wxPython-2.5/src/generic/colheader.cpp 1.60 1.61
internal/wxPython-2.5/wxPython/demo/ColumnHeader.py 1.23 1.24

Log message:

colheader - fixed bitmap scaling issue; tweaked demo
r=TBD



ViewCVS links:
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/src/generic/colheader.cpp.diff?r1=text&tr1=1.60&r2=text&tr2=1.61
http://cvs.osafoundation.org/index.cgi/internal/wxPython-2.5/wxPython/demo/ColumnHeader.py.diff?r1=text&tr1=1.23&r2=text&tr2=1.24

Index: internal/wxPython-2.5/wxPython/demo/ColumnHeader.py
diff -u internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.23 internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.24
--- internal/wxPython-2.5/wxPython/demo/ColumnHeader.py:1.23	Mon Apr 11 10:55:20 2005
+++ internal/wxPython-2.5/wxPython/demo/ColumnHeader.py	Mon Apr 11 17:43:47 2005
@@ -56,8 +56,8 @@
 
         # add demo UI controls
         miscControlsY = 175
-        prompt = "Unicode build: [%d]" %(ch1.GetFlagUnicode())
         hasUnicode = ch1.GetFlagUnicode()
+        prompt = "Unicode build: [%d]" %(hasUnicode)
         l1 = wx.StaticText( self, -1, prompt, (self.colStartX, miscControlsY + 150), (150, 20) )
 
         l0O = wx.StaticText( self, -1, "Last Action:", (self.colStartX, miscControlsY + 175), (90, 20) )
@@ -82,22 +82,22 @@
         styleList = ['None', 'Native', 'BoldLabel', 'Grey', 'InvertBevel', 'Underline', 'Overline', 'Frame', 'Bullet']
         wx.StaticText( self, -1, "Selection Style:", (self.colStartX, miscControlsY + 75), (150, -1) )
         choice = wx.Choice( self, -1, (self.colStartX, miscControlsY + 95), choices = styleList )
-        choice.SetSelection( 1 )
+        choice.SetSelection( ch1.GetSelectionDrawStyle() )
         self.Bind( wx.EVT_CHOICE, self.OnEvtChoice, choice )
 
         self.colStartX += 150
 
         cb1 = wx.CheckBox( self, -1, "Enable", (self.colStartX, miscControlsY), (100, 20), wx.NO_BORDER )
         self.Bind( wx.EVT_CHECKBOX, self.OnTestEnableCheckBox, cb1 )
-        cb1.SetValue( True )
+        cb1.SetValue( ch1.IsEnabled() )
 
         cb2 = wx.CheckBox( self, -1, "Visible Selection", (self.colStartX, miscControlsY + 25), (150, 20), wx.NO_BORDER )
         self.Bind( wx.EVT_CHECKBOX, self.OnTestVisibleSelectionCheckBox, cb2 )
-        cb2.SetValue( True )
+        cb2.SetValue( ch1.GetFlagVisibleSelection() )
 
         cb3 = wx.CheckBox( self, -1, "Proportional Resizing", (self.colStartX, miscControlsY + 50), (200, 20), wx.NO_BORDER )
         self.Bind( wx.EVT_CHECKBOX, self.OnTestProportionalResizingCheckBox, cb3 )
-        cb3.SetValue( True )
+        cb3.SetValue(  ch1.GetFlagProportionalResizing() )
 
         self.colStartX = 175
 

Index: internal/wxPython-2.5/src/generic/colheader.cpp
diff -u internal/wxPython-2.5/src/generic/colheader.cpp:1.60 internal/wxPython-2.5/src/generic/colheader.cpp:1.61
--- internal/wxPython-2.5/src/generic/colheader.cpp:1.60	Sun Apr 10 14:21:22 2005
+++ internal/wxPython-2.5/src/generic/colheader.cpp	Mon Apr 11 17:43:47 2005
@@ -176,7 +176,7 @@
 #if defined(__WXMAC__)
 	// NB: or kThemeSystemFontTag, kThemeViewsFontTag
 	m_Font.MacCreateThemeFont( kThemeSmallSystemFont );
-	m_SelectionDrawStyle = 0;
+	m_SelectionDrawStyle = wxCOLUMNHEADER_SELECTIONDRAWSTYLE_None;
 #else
 	m_Font.SetFamily( 0 );
 	m_SelectionDrawStyle = wxCOLUMNHEADER_SELECTIONDRAWSTYLE_Native;
@@ -1790,16 +1790,17 @@
 {
 wxRect			targetBoundsR;
 
-	// NB: could rewrite to make NULL wxBitmap for no bitmap
 	delete m_BitmapRef;
-	m_BitmapRef = new wxBitmap( bitmapRef );
+	m_BitmapRef = NULL;
 
-	if ((boundsR != NULL) && HasValidBitmapRef( m_BitmapRef ))
+	if ((boundsR != NULL) && HasValidBitmapRef( &bitmapRef ))
 	{
-		GenericGetBitmapItemBounds( boundsR, m_TextJust, &targetBoundsR );
+	wxBitmap		localBitmap;
 
-		m_BitmapRef->SetWidth( targetBoundsR.width );
-		m_BitmapRef->SetHeight( targetBoundsR.height );
+		GenericGetBitmapItemBounds( boundsR, m_TextJust, &targetBoundsR );
+		targetBoundsR.x = targetBoundsR.y = 0;
+		localBitmap = bitmapRef.GetSubBitmap( targetBoundsR );
+		m_BitmapRef = new wxBitmap( localBitmap );
 	}
 	else
 	{



More information about the Commits mailing list