]> git.saurik.com Git - wxWidgets.git/commitdiff
wx.lib.mixins.listctrl: Patches from Toni Brkic:
authorRobin Dunn <robin@alldunn.com>
Mon, 28 Mar 2005 20:04:50 +0000 (20:04 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 28 Mar 2005 20:04:50 +0000 (20:04 +0000)
   * Bugfix for TextEditMixin when the view can't be scrolled
   * Enhancement for ListCtrlAutoWidthMixin, allowing it to manage
     the width of any column.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33131 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/docs/CHANGES.txt
wxPython/wx/lib/mixins/listctrl.py

index 3a9d864d32ae907dcd14e38d86dd94ad581b15b4..b0305246c2ea452dfb927b21efcc0a868131b30e 100644 (file)
@@ -20,11 +20,20 @@ available.
 Added GetCount, GetCountRGB, and GetCountColour methods to
 wx.ImageHistogram. 
 
-wxMSW:  wx.Window.Refresh changed to explicitly refresh all children
-as well.  Previously it was implicitly done because parents did not
-clip thier children by default.  Now that they always clip then
-Refresh needed to do a recursive refresh.  This also fixes the
-Freeze/Thaw problems that some people had with 2.5.4.1.
+wxMSW: wx.Window.Refresh changed to explicitly refresh all children as
+well as the parent.  Previously it was implicitly done because parents
+did not clip their children by default.  Now that they always clip
+children then Refresh needed to be fixed to do a recursive refresh.
+This also fixes the Freeze/Thaw problems that some people had with
+2.5.4.1.
+
+wx.SplitterWindow: Send EVT_SPLITTER_SASH_POS_CHANGED only once after
+end of dragging and not after each CHANGING event (modified patch
+#1076226)
+
+wx.glcanvas.GLCanvas: applied patch fixing problems with X server
+crash when using nVidia cards (patch 1155132)
+
 
 
 
index 3e5c73a80205e9128c9cde08af847b56870bcfdc..7fec34285bcd2ee6e655f75469766b916c024d57 100644 (file)
@@ -176,12 +176,25 @@ class ListCtrlAutoWidthMixin:
     def __init__(self):
         """ Standard initialiser.
         """
-        self._lastColMinWidth = None
-
+        self._resizeColMinWidth = None
+        self._resizeColStyle = "LAST"
+        self._resizeCol = 0
         self.Bind(wx.EVT_SIZE, self._onResize)
         self.Bind(wx.EVT_LIST_COL_END_DRAG, self._onResize, self)
 
 
+    def setResizeColumn(self, col):
+        """
+        Specify which column that should be autosized.  Pass either
+        'LAST' or the column number.  Default is 'LAST'.
+        """
+        if col == "LAST":
+            self._resizeColStyle = "LAST"
+        else:
+            self._resizeColStyle = "COL"
+            self._resizeCol = col
+        
+
     def resizeLastColumn(self, minWidth):
         """ Resize the last column appropriately.
 
@@ -196,8 +209,13 @@ class ListCtrlAutoWidthMixin:
 
             'minWidth' is the preferred minimum width for the last column.
         """
-        self._lastColMinWidth = minWidth
+        self.resizeCloumn(self, minWidth)
+
+
+    def resizeColumn(self, minWidth):
+        self._resizeColMinWidth = minWidth
         self._doResize()
+        
 
     # =====================
     # == Private Methods ==
@@ -231,8 +249,13 @@ class ListCtrlAutoWidthMixin:
         numCols = self.GetColumnCount()
         if numCols == 0: return # Nothing to resize.
 
-        if self._lastColMinWidth == None:
-            self._lastColMinWidth = self.GetColumnWidth(numCols - 1)
+        if(self._resizeColStyle == "LAST"):
+            resizeCol = self.GetColumnCount()
+        else:
+            resizeCol = self._resizeCol
+
+        if self._resizeColMinWidth == None:
+            self._resizeColMinWidth = self.GetColumnWidth(resizeCol - 1)
 
         # We're showing the vertical scrollbar -> allow for scrollbar width
         # NOTE: on GTK, the scrollbar is included in the client size, but on
@@ -244,21 +267,23 @@ class ListCtrlAutoWidthMixin:
                 listWidth = listWidth - scrollWidth
 
         totColWidth = 0 # Width of all columns except last one.
-        for col in range(numCols-1):
-            totColWidth = totColWidth + self.GetColumnWidth(col)
+        for col in range(numCols):
+            if col != (resizeCol-1):
+                totColWidth = totColWidth + self.GetColumnWidth(col)
 
-        lastColWidth = self.GetColumnWidth(numCols - 1)
+        resizeColWidth = self.GetColumnWidth(resizeCol - 1)
 
-        if totColWidth + self._lastColMinWidth > listWidth:
+        if totColWidth + self._resizeColMinWidth > listWidth:
             # We haven't got the width to show the last column at its minimum
             # width -> set it to its minimum width and allow the horizontal
             # scrollbar to show.
-            self.SetColumnWidth(numCols-1, self._lastColMinWidth)
+            self.SetColumnWidth(resizeCol-1, self._resizeColMinWidth)
             return
 
         # Resize the last column to take up the remaining available space.
 
-        self.SetColumnWidth(numCols-1, listWidth - totColWidth)
+        self.SetColumnWidth(resizeCol-1, listWidth - totColWidth)
+
 
 
 
@@ -394,7 +419,10 @@ class TextEditMixin:
         editor = wx.PreTextCtrl()
         
         style =wx.TE_PROCESS_ENTER|wx.TE_PROCESS_TAB|wx.TE_RICH2
-        style |= {wx.LIST_FORMAT_LEFT: wx.TE_LEFT, wx.LIST_FORMAT_RIGHT: wx.TE_RIGHT, wx.LIST_FORMAT_CENTRE : wx.TE_CENTRE}[col_style]
+        style |= {wx.LIST_FORMAT_LEFT: wx.TE_LEFT,
+                  wx.LIST_FORMAT_RIGHT: wx.TE_RIGHT,
+                  wx.LIST_FORMAT_CENTRE : wx.TE_CENTRE
+                  }[col_style]
         
         editor.Create(self, -1, style=style)
         editor.SetBackgroundColour(wx.Colour(red=255,green=255,blue=175)) #Yellow
@@ -493,7 +521,7 @@ class TextEditMixin:
 
         scrolloffset = self.GetScrollPos(wx.HORIZONTAL)
 
-        # scroll foreward
+        # scroll forward
         if x0+x1-scrolloffset > self.GetSize()[0]:
             if wx.Platform == "__WXMSW__":
                 # don't start scrolling unless we really need to
@@ -512,6 +540,9 @@ class TextEditMixin:
                 # Since we can not programmatically scroll the ListCtrl
                 # close the editor so the user can scroll and open the editor
                 # again
+                self.editor.SetValue(self.GetItem(row, col).GetText())
+                self.curRow = row
+                self.curCol = col
                 self.CloseEditor()
                 return