From: <sir...@us...> - 2003-02-24 14:35:55
|
Update of /cvsroot/btplusplus/BT++/src/TabTrans In directory sc8-pr-cvs1:/tmp/cvs-serv12649/src/TabTrans Modified Files: Grid.py Log Message: Added scrolling + Begin/EndDrawing() Index: Grid.py =================================================================== RCS file: /cvsroot/btplusplus/BT++/src/TabTrans/Grid.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Grid.py 23 Feb 2003 21:01:42 -0000 1.6 --- Grid.py 24 Feb 2003 14:35:46 -0000 1.7 *************** *** 16,20 **** def __init__(self, parent): ! wxGrid.__init__(self, parent, -1, wxPoint(0,0), wxSize(786,335), style = (wxSIMPLE_BORDER | wxVSCROLL | wxHSCROLL)) self.RegisterDataType( 'ProgressBar', Renderer.ProgressBar(), None ) --- 16,20 ---- def __init__(self, parent): ! wxGrid.__init__(self, parent, -1, wxPoint(0,0), wxSize(786,335), style = wxSIMPLE_BORDER) self.RegisterDataType( 'ProgressBar', Renderer.ProgressBar(), None ) *************** *** 105,108 **** --- 105,109 ---- } + EVT_ERASE_BACKGROUND( self, self.OnEraseBg ) EVT_PAINT( self, self.OnPaint ) EVT_SIZE( self, self.OnSize ) *************** *** 212,227 **** ########################################################################################################### def OnPaint(self, evt = None): if self.IsShown() == false: return - try: dc = self.BufferDC ! # Clear background dc.SetBackground( self.DrawTools['EmptyBackground'] ) dc.Clear() ! # Draw the selections dc.SetPen( self.DrawTools['HighlightOutline'] ) --- 213,237 ---- ########################################################################################################### + def OnEraseBg(self, evt): + pass + def OnPaint(self, evt = None): if self.IsShown() == false: return try: + scx, scy = self.GetViewStart() + unx, uny = self.GetScrollPixelsPerUnit() + + scx = -scx * unx + scy = -scy * uny + dc = self.BufferDC ! dc.BeginDrawing() ! # Clear background dc.SetBackground( self.DrawTools['EmptyBackground'] ) dc.Clear() ! # Draw the selections dc.SetPen( self.DrawTools['HighlightOutline'] ) *************** *** 233,238 **** wxGridCellCoords(sel[len(sel)-1], 6) ) ! dc.DrawRectangle( rect.x + 2, ! rect.y + 20, rect.width + 21, rect.height - 5 ) --- 243,248 ---- wxGridCellCoords(sel[len(sel)-1], 6) ) ! dc.DrawRectangle( scx + rect.x + 2, ! scy + rect.y + 20, rect.width + 21, rect.height - 5 ) *************** *** 256,272 **** x = x + self.GetColSize(col) ! dc.DrawRectangle( rect.x + 25, ! rect.y, rect.width, rect.height ) dc.DrawText( self.Table.GetColLabelValue(col), ! rect.x + 29, ! rect.y + 2 ) # Draw the row 'labels' for row in numrows: ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], 0, y + 20, true ) y = y + self.GetRowSize(row) --- 266,282 ---- x = x + self.GetColSize(col) ! dc.DrawRectangle( scx + rect.x + 25, ! scy + rect.y, rect.width, rect.height ) dc.DrawText( self.Table.GetColLabelValue(col), ! scx + rect.x + 29, ! scy + rect.y + 2 ) # Draw the row 'labels' for row in numrows: ! dc.DrawBitmap( self.DrawTools['ArrowBitmap'], scx, scy + y + 20, true ) y = y + self.GetRowSize(row) *************** *** 280,285 **** None, dc, ! wxRect( rect.x + 25, ! rect.y + 18, rect.width, rect.height ), --- 290,295 ---- None, dc, ! wxRect( scx + rect.x + 25, ! scy + rect.y + 18, rect.width, rect.height ), *************** *** 289,296 **** --- 299,309 ---- + dc.EndDrawing() w, h = dc.GetSizeTuple() ondc = wxClientDC(self) + ondc.BeginDrawing() ondc.Blit(0, 0, w, h, dc, 0, 0 ) + ondc.EndDrawing() except: pass |