Header control ordering fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ordering wasn't being updated at all when items were being inserted, so this
patch fixes that.

ChangeLog:
Update ordering on insertion of an item

Rob
Index: wine/dlls/comctl32/header.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/header.c,v
retrieving revision 1.54
diff -u -r1.54 header.c
--- wine/dlls/comctl32/header.c	2 Dec 2002 18:11:00 -0000	1.54
+++ wine/dlls/comctl32/header.c	21 May 2003 00:07:36 -0000
@@ -845,7 +845,7 @@
     HDITEMA   *phdi = (HDITEMA*)lParam;
     INT       nItem = (INT)wParam;
     HEADER_ITEM *lpItem;
-    INT       len;
+    INT       len, i, iOrder;
 
     if ((phdi == NULL) || (nItem < 0))
 	return -1;
@@ -853,6 +853,8 @@
     if (nItem > infoPtr->uNumItem)
         nItem = infoPtr->uNumItem;
 
+    iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem;
+
     if (infoPtr->uNumItem == 0) {
         infoPtr->items = COMCTL32_Alloc (sizeof (HEADER_ITEM));
         infoPtr->uNumItem++;
@@ -884,6 +886,12 @@
         COMCTL32_Free (oldItems);
     }
 
+    for (i=0; i < infoPtr->uNumItem; i++)
+    {
+        if (infoPtr->items[i].iOrder >= iOrder)
+            infoPtr->items[i].iOrder++;
+    }
+
     lpItem = &infoPtr->items[nItem];
     lpItem->bDown = FALSE;
 
@@ -921,13 +929,7 @@
     if (phdi->mask & HDI_IMAGE)
         lpItem->iImage = phdi->iImage;
 
-    if (phdi->mask & HDI_ORDER)
-      {
-        lpItem->iOrder = phdi->iOrder;
-      }
-    else
-      lpItem->iOrder=nItem;
-
+    lpItem->iOrder = iOrder;
 
     HEADER_SetItemBounds (hwnd);
 
@@ -944,7 +946,7 @@
     HDITEMW   *phdi = (HDITEMW*)lParam;
     INT       nItem = (INT)wParam;
     HEADER_ITEM *lpItem;
-    INT       len;
+    INT       len, i, iOrder;
 
     if ((phdi == NULL) || (nItem < 0))
 	return -1;
@@ -952,6 +954,8 @@
     if (nItem > infoPtr->uNumItem)
         nItem = infoPtr->uNumItem;
 
+    iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem;
+
     if (infoPtr->uNumItem == 0) {
         infoPtr->items = COMCTL32_Alloc (sizeof (HEADER_ITEM));
         infoPtr->uNumItem++;
@@ -983,6 +987,12 @@
         COMCTL32_Free (oldItems);
     }
 
+    for (i=0; i < infoPtr->uNumItem; i++)
+    {
+        if (infoPtr->items[i].iOrder >= iOrder)
+            infoPtr->items[i].iOrder++;
+    }
+
     lpItem = &infoPtr->items[nItem];
     lpItem->bDown = FALSE;
 
@@ -1021,12 +1031,7 @@
     if (phdi->mask & HDI_IMAGE)
         lpItem->iImage = phdi->iImage;
 
-    if (phdi->mask & HDI_ORDER)
-      {
-        lpItem->iOrder = phdi->iOrder;
-      }
-    else
-      lpItem->iOrder = nItem;
+    lpItem->iOrder = iOrder;
 
     HEADER_SetItemBounds (hwnd);
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux