]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/gridmovers.py
added a test to check how exception handling works with Win32 SEH; corrected copyright
[wxWidgets.git] / wxPython / wx / lib / gridmovers.py
index 40c5156d5597062eb9f47440065027419a1f919a..66fb28618d3884de2f336f1f8cb7f377bfbd31c3 100644 (file)
 #
 # o 2.5 Compatability changes
 #
 #
 # o 2.5 Compatability changes
 #
+# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o wxGridColMoveEvent -> GridColMoveEvent
+# o wxGridRowMoveEvent -> GridRowMoveEvent
+# o wxGridColMover -> GridColMover
+# o wxGridRowMover -> GridRowMover
+#
+
 
 import  wx
 import  wx.grid
 
 import  wx
 import  wx.grid
@@ -31,7 +39,7 @@ EVT_GRID_ROW_MOVE = wx.PyEventBinder(wxEVT_COMMAND_GRID_ROW_MOVE, 1)
 
 #----------------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------------
 
-class wxGridColMoveEvent(wx.PyCommandEvent):
+class GridColMoveEvent(wx.PyCommandEvent):
     def __init__(self, id, dCol, bCol):
         wx.PyCommandEvent.__init__(self, id = id)
         self.SetEventType(wxEVT_COMMAND_GRID_COL_MOVE)
     def __init__(self, id, dCol, bCol):
         wx.PyCommandEvent.__init__(self, id = id)
         self.SetEventType(wxEVT_COMMAND_GRID_COL_MOVE)
@@ -45,7 +53,7 @@ class wxGridColMoveEvent(wx.PyCommandEvent):
         return self.beforeColumn
 
 
         return self.beforeColumn
 
 
-class wxGridRowMoveEvent(wx.PyCommandEvent):
+class GridRowMoveEvent(wx.PyCommandEvent):
     def __init__(self, id, dRow, bRow):
         wx.PyCommandEvent.__init__(self,id = id)
         self.SetEventType(wxEVT_COMMAND_GRID_ROW_MOVE)
     def __init__(self, id, dRow, bRow):
         wx.PyCommandEvent.__init__(self,id = id)
         self.SetEventType(wxEVT_COMMAND_GRID_ROW_MOVE)
@@ -66,7 +74,7 @@ def _ColToRect(self,col):
     if self.GetNumberRows() > 0:
         rect = self.CellToRect(0,col)
     else:
     if self.GetNumberRows() > 0:
         rect = self.CellToRect(0,col)
     else:
-        rect = wxRect()
+        rect = wx.Rect()
         rect.height = self.GetColLabelSize()
         rect.width = self.GetColSize(col)
 
         rect.height = self.GetColLabelSize()
         rect.width = self.GetColSize(col)
 
@@ -83,7 +91,7 @@ def _RowToRect(self,row):
     if self.GetNumberCols() > 0:
         rect = self.CellToRect(row,0)
     else:
     if self.GetNumberCols() > 0:
         rect = self.CellToRect(row,0)
     else:
-        rect = wxRect()
+        rect = wx.Rect()
         rect.width = self.GetRowLabelSize()
         rect.height = self.GetRowSize(row)
 
         rect.width = self.GetRowLabelSize()
         rect.height = self.GetRowSize(row)
 
@@ -151,12 +159,12 @@ class ColDragWindow(wx.Window):
     def OnPaint(self,evt):
         dc = wx.PaintDC(self)
         w,h = self.GetSize()
     def OnPaint(self,evt):
         dc = wx.PaintDC(self)
         w,h = self.GetSize()
-        dc.DrawBitmap(self.image, (0,0))
+        dc.DrawBitmap(self.image, 0,0)
         dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
         dc.SetBrush(wx.TRANSPARENT_BRUSH)
         dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
         dc.SetBrush(wx.TRANSPARENT_BRUSH)
-        dc.DrawRectangle((0,0), (w,h))
+        dc.DrawRectangle(0,0, w,h)
         iPos = self.GetInsertionPos()
         iPos = self.GetInsertionPos()
-        dc.DrawLine((iPos,h - 10), (iPos,h))
+        dc.DrawLine(iPos,h - 10, iPos,h)
 
 
 
 
 
 
@@ -214,16 +222,16 @@ class RowDragWindow(wx.Window):
     def OnPaint(self,evt):
         dc = wx.PaintDC(self)
         w,h = self.GetSize()
     def OnPaint(self,evt):
         dc = wx.PaintDC(self)
         w,h = self.GetSize()
-        dc.DrawBitmap(self.image, (0,0))
+        dc.DrawBitmap(self.image, 0,0)
         dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
         dc.SetBrush(wx.TRANSPARENT_BRUSH)
         dc.SetPen(wx.Pen(wx.BLACK,1,wx.SOLID))
         dc.SetBrush(wx.TRANSPARENT_BRUSH)
-        dc.DrawRectangle((0,0), (w,h))
+        dc.DrawRectangle(0,0, w,h)
         iPos = self.GetInsertionPos()
         iPos = self.GetInsertionPos()
-        dc.DrawLine((w - 10,iPos), (w,iPos))
+        dc.DrawLine(w - 10,iPos, w,iPos)
 
 #----------------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------------
 
-class wxGridColMover(wx.EvtHandler):
+class GridColMover(wx.EvtHandler):
     def __init__(self,grid):
         wx.EvtHandler.__init__(self)
 
     def __init__(self,grid):
         wx.EvtHandler.__init__(self)
 
@@ -306,6 +314,7 @@ class wxGridColMover(wx.EvtHandler):
         self.colWin = ColDragWindow(self.grid,colImg,col)
         self.colWin.Show(False)
         self.lwin.CaptureMouse()
         self.colWin = ColDragWindow(self.grid,colImg,col)
         self.colWin.Show(False)
         self.lwin.CaptureMouse()
+        evt.Skip()
 
     def OnRelease(self,evt):
         if self.isDragging:
 
     def OnRelease(self,evt):
         if self.isDragging:
@@ -328,7 +337,7 @@ class wxGridColMover(wx.EvtHandler):
                 bCol = self.colWin.GetInsertionColumn()
                 dCol = self.colWin.GetMoveColumn()
                 wx.PostEvent(self,
                 bCol = self.colWin.GetInsertionColumn()
                 dCol = self.colWin.GetMoveColumn()
                 wx.PostEvent(self,
-                             wxGridColMoveEvent(self.grid.GetId(), dCol, bCol))
+                             GridColMoveEvent(self.grid.GetId(), dCol, bCol))
 
             self.colWin.Destroy()
         evt.Skip()
 
             self.colWin.Destroy()
         evt.Skip()
@@ -338,12 +347,12 @@ class wxGridColMover(wx.EvtHandler):
         memdc = wx.MemoryDC()
         memdc.SelectObject(bmp)
         dc = wx.WindowDC(self.lwin)
         memdc = wx.MemoryDC()
         memdc.SelectObject(bmp)
         dc = wx.WindowDC(self.lwin)
-        memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition())
+        memdc.Blit(0,0, rect.width, rect.height, dc, rect.x, rect.y)
         memdc.SelectObject(wx.NullBitmap)
         return bmp
 
 
         memdc.SelectObject(wx.NullBitmap)
         return bmp
 
 
-class wxGridRowMover(wx.EvtHandler):
+class GridRowMover(wx.EvtHandler):
     def __init__(self,grid):
         wx.EvtHandler.__init__(self)
 
     def __init__(self,grid):
         wx.EvtHandler.__init__(self)
 
@@ -429,6 +438,7 @@ class wxGridRowMover(wx.EvtHandler):
         self.rowWin = RowDragWindow(self.grid,rowImg,row)
         self.rowWin.Show(False)
         self.lwin.CaptureMouse()
         self.rowWin = RowDragWindow(self.grid,rowImg,row)
         self.rowWin.Show(False)
         self.lwin.CaptureMouse()
+        evt.Skip()
 
     def OnRelease(self,evt):
         if self.isDragging:
 
     def OnRelease(self,evt):
         if self.isDragging:
@@ -451,7 +461,7 @@ class wxGridRowMover(wx.EvtHandler):
                 dRow = self.rowWin.GetMoveRow()
 
                 wx.PostEvent(self,
                 dRow = self.rowWin.GetMoveRow()
 
                 wx.PostEvent(self,
-                             wxGridRowMoveEvent(self.grid.GetId(), dRow, bRow))
+                             GridRowMoveEvent(self.grid.GetId(), dRow, bRow))
 
             self.rowWin.Destroy()
         evt.Skip()
 
             self.rowWin.Destroy()
         evt.Skip()
@@ -461,7 +471,7 @@ class wxGridRowMover(wx.EvtHandler):
         memdc = wx.MemoryDC()
         memdc.SelectObject(bmp)
         dc = wx.WindowDC(self.lwin)
         memdc = wx.MemoryDC()
         memdc.SelectObject(bmp)
         dc = wx.WindowDC(self.lwin)
-        memdc.Blit((0,0), rect.GetSize(), dc, rect.GetPosition())
+        memdc.Blit(0,0, rect.width, rect.height, dc, rect.x, rect.y)
         memdc.SelectObject(wx.NullBitmap)
         return bmp
 
         memdc.SelectObject(wx.NullBitmap)
         return bmp