Listview text justification

Duane Clark dclark at akamail.com
Fri Mar 1 12:30:09 CST 2002


I really wasn't planning on doing all this when I started, but once I 
got into it...

Log message:
	Add support for report mode text justification.

-------------- next part --------------
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.122
diff -u -r1.122 listview.c
--- dlls/comctl32/listview.c	2002/02/28 21:42:25	1.122
+++ dlls/comctl32/listview.c	2002/03/01 16:24:17
@@ -258,6 +258,7 @@
 static VOID LISTVIEW_RemoveSelectionRange(HWND hwnd, INT lItem, INT uItem);
 static void LISTVIEW_FillBackground(HWND hwnd, HDC hdc, LPRECT rc);
 static void ListView_UpdateLargeItemLabelRect (HWND hwnd, const LISTVIEW_INFO* infoPtr, int nItem, RECT *rect);
+static LRESULT LISTVIEW_GetColumnT(HWND, INT, LPLVCOLUMNW, BOOL);
 
 /******** Defines that LISTVIEW_ProcessLetterKeys uses ****************/
 #define KEY_DELAY       450
@@ -2992,8 +2993,11 @@
   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongW(hwnd, 0); 
   WCHAR szDispText[DISP_TEXT_SIZE];
   LVITEMW lvItem;
+  LVCOLUMNW lvColumn;
   UINT textoutOptions = ETO_CLIPPED | ETO_OPAQUE;
   RECT rcTemp;
+  INT textLeft;
+  INT nLabelWidth = 0;
 
   TRACE("(hwnd=%x, hdc=%x, nItem=%d, nSubItem=%d)\n", hwnd, hdc,
         nItem, nSubItem);
@@ -3008,6 +3012,22 @@
   *lvItem.pszText = '\0';
   LISTVIEW_GetItemW(hwnd, &lvItem, TRUE);
   TRACE("   lvItem=%s\n", debuglvitem_t(&lvItem, TRUE));
+  
+  ZeroMemory(&lvColumn, sizeof(lvColumn));
+  lvColumn.mask = LVCF_FMT;
+  LISTVIEW_GetColumnT(hwnd, nSubItem, &lvColumn, TRUE);
+  textLeft = rcItem.left;
+  if (lvColumn.fmt != LVCFMT_LEFT)
+  {
+    if ((nLabelWidth = LISTVIEW_GetStringWidthT(hwnd, lvItem.pszText, TRUE)))
+    {
+      if (lvColumn.fmt == LVCFMT_RIGHT)
+        textLeft = rcItem.right - nLabelWidth;
+      else
+        textLeft = rcItem.left + (rcItem.right-rcItem.left-nLabelWidth)/2;
+    }
+  }
+    
 
   /* redraw the background of the item */
   rcTemp = rcItem;
@@ -3048,7 +3068,7 @@
     SetTextColor(hdc, infoPtr->clrText);
   }
 
-  ExtTextOutW(hdc, rcItem.left, rcItem.top, textoutOptions, 
+  ExtTextOutW(hdc, textLeft, rcItem.top, textoutOptions, 
               &rcItem, lvItem.pszText, lstrlenW(lvItem.pszText), NULL);
 
   if (Selected)


More information about the wine-patches mailing list