]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/gridmovers.py
Add *wxTopLevelWindowGTK*RequestUserAttention*int*;
[wxWidgets.git] / wxPython / wx / lib / gridmovers.py
index bb931d1e4681f3721fe9d3e856a09a60587588b0..9cd7269dfb6b23b10b73729d4d4b048b68ef1754 100644 (file)
@@ -74,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)
 
@@ -91,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)
 
@@ -159,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)
 
 
 
 
 
 
@@ -222,12 +222,12 @@ 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)
 
 #----------------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------------
 
@@ -252,7 +252,9 @@ class GridColMover(wx.EvtHandler):
 
     def OnMouseMove(self,evt):
         if self.isDragging:
 
     def OnMouseMove(self,evt):
         if self.isDragging:
-            if abs(self.startX - evt.m_x) >= 3:
+            if abs(self.startX - evt.m_x) >= 3 \
+                   and abs(evt.m_x - self.lastX) >= 3:
+                self.lastX = evt.m_x 
                 self.didMove = True
                 sx,y = self.grid.GetViewStart()
                 w,h = self.lwin.GetClientSize()
                 self.didMove = True
                 sx,y = self.grid.GetViewStart()
                 w,h = self.lwin.GetClientSize()
@@ -288,10 +290,9 @@ class GridColMover(wx.EvtHandler):
                 self.colWin.DisplayAt(px,y)
                 return
 
                 self.colWin.DisplayAt(px,y)
                 return
 
-        evt.Skip()
 
     def OnPress(self,evt):
 
     def OnPress(self,evt):
-        self.startX = evt.m_x
+        self.startX = self.lastX = evt.m_x
         sx = self.grid.GetViewStart()[0] * self.ux
         sx -= self.grid._rlSize
         px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
         sx = self.grid.GetViewStart()[0] * self.ux
         sx -= self.grid._rlSize
         px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
@@ -314,6 +315,7 @@ class GridColMover(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:
@@ -346,7 +348,7 @@ class GridColMover(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
 
@@ -372,7 +374,9 @@ class GridRowMover(wx.EvtHandler):
 
     def OnMouseMove(self,evt):
         if self.isDragging:
 
     def OnMouseMove(self,evt):
         if self.isDragging:
-            if abs(self.startY - evt.m_y) >= 3:
+            if abs(self.startY - evt.m_y) >= 3 \
+                   and abs(evt.m_y - self.lastY) >= 3:
+                self.lastY = evt.m_y
                 self.didMove = True
                 x,sy = self.grid.GetViewStart()
                 w,h = self.lwin.GetClientSizeTuple()
                 self.didMove = True
                 x,sy = self.grid.GetViewStart()
                 w,h = self.lwin.GetClientSizeTuple()
@@ -411,10 +415,9 @@ class GridRowMover(wx.EvtHandler):
                 self.rowWin.DisplayAt(x,py)
                 return
 
                 self.rowWin.DisplayAt(x,py)
                 return
 
-        evt.Skip()
 
     def OnPress(self,evt):
 
     def OnPress(self,evt):
-        self.startY = evt.m_y
+        self.startY = self.lastY = evt.m_y
         sy = self.grid.GetViewStart()[1] * self.uy
         sy -= self.grid._clSize
         px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
         sy = self.grid.GetViewStart()[1] * self.uy
         sy -= self.grid._clSize
         px,py = self.lwin.ClientToScreenXY(evt.m_x,evt.m_y)
@@ -437,6 +440,7 @@ class GridRowMover(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:
@@ -469,7 +473,7 @@ class GridRowMover(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