Ignore:
Timestamp:
Dec 20, 1999, 5:46:39 PM (26 years ago)
Author:
cbratschi
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/listview.c

    r2126 r2161  
     1/*$Id: listview.c,v 1.18 1999-12-20 16:46:39 cbratschi Exp $*/
    12/*
    23 * Listview control
     
    89 *
    910 * NOTES
    10  * Listview control implementation. 
     11 * Listview control implementation.
    1112 *
    1213 * TODO:
     
    2021 * Data structure:
    2122 *   LISTVIEW_SetItemCount : not completed
    22  * 
     23 *
    2324 * Unicode:
    2425 *   LISTVIEW_SetItemW : no unicode support
     
    3233 *   LISTVIEW_GetHotCursor : not implemented
    3334 *   LISTVIEW_GetHoverTime : not implemented
    34  *   LISTVIEW_GetISearchString : not implemented 
     35 *   LISTVIEW_GetISearchString : not implemented
    3536 *   LISTVIEW_GetBkImage : not implemented
    3637 *   LISTVIEW_GetColumnOrderArray : simple hack only
     
    3839 *   LISTVIEW_Arrange : empty stub
    3940 *   LISTVIEW_ApproximateViewRect : incomplete
    40  *   LISTVIEW_Scroll : not implemented 
     41 *   LISTVIEW_Scroll : not implemented
    4142 *   LISTVIEW_RedrawItems : empty stub
    4243 *   LISTVIEW_Update : not completed
     
    9697
    9798
    98 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 
    99         INT width, INT height, HWND parent, HINSTANCE hinst,
    100         EditlblCallback EditLblCb, DWORD param);
    101  
     99HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     100        INT width, INT height, HWND parent, HINSTANCE hinst,
     101        EditlblCallback EditLblCb, DWORD param);
     102
    102103/*
    103104 * forward declarations
     
    143144
    144145/*************************************************************************
    145  * LISTVIEW_UpdateHeaderSize [Internal] 
     146 * LISTVIEW_UpdateHeaderSize [Internal]
    146147 *
    147148 * Function to resize the header control
     
    179180/***
    180181 * DESCRIPTION:
    181  * Update the scrollbars. This functions should be called whenever 
     182 * Update the scrollbars. This functions should be called whenever
    182183 * the content, size or view changes.
    183  * 
     184 *
    184185 * PARAMETER(S):
    185186 * [I] HWND : window handle
     
    190191static VOID LISTVIEW_UpdateScroll(HWND hwnd)
    191192{
    192   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     193  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    193194  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    194195  UINT uView =  lStyle & LVS_TYPEMASK;
     
    226227      if (lStyle & WS_HSCROLL)
    227228      {
    228         ShowScrollBar(hwnd, SB_HORZ, FALSE);
     229        ShowScrollBar(hwnd, SB_HORZ, FALSE);
    229230      }
    230231    }
     
    244245    {
    245246      scrollInfo.nPos = 0;
    246     } 
     247    }
    247248    scrollInfo.nMin = 0;
    248     scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE  ; 
     249    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE  ;
    249250    scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
    250251    scrollInfo.nMax = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1;
    251     SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 
     252    SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    252253
    253254    /* Update the Header Control */
     
    585586 * DESCRIPTION:
    586587 * Calculates the width of an item.
    587  * 
     588 *
    588589 * PARAMETER(S):
    589590 * [I] HWND : window handle
     
    624625  {
    625626    for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
    626     { 
     627    {
    627628      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, i);
    628629      nItemWidth = max(nItemWidth, nLabelWidth);
    629630    }
    630    
     631
    631632    /* default label size */
    632633    if (GETITEMCOUNT(infoPtr) == 0)
     
    644645        /* add padding */
    645646        nItemWidth += WIDTH_PADDING;
    646      
     647
    647648        if (infoPtr->himlSmall != NULL)
    648649        {
     
    657658    }
    658659  }
    659  
     660
    660661  return nItemWidth;
    661662}
     
    664665 * DESCRIPTION:
    665666 * Calculates the width of a specific item.
    666  * 
    667  * PARAMETER(S):
    668  * [I] HWND : window handle
    669  * [I] LPSTR : string 
     667 *
     668 * PARAMETER(S):
     669 * [I] HWND : window handle
     670 * [I] LPSTR : string
    670671 *
    671672 * RETURN:
     
    719720        /* add padding */
    720721        nItemWidth += WIDTH_PADDING;
    721      
     722
    722723        if (infoPtr->himlSmall != NULL)
    723724        {
     
    732733    }
    733734  }
    734  
     735
    735736  return nItemWidth;
    736737}
     
    20102011 * DESCRIPTION:
    20112012 * Draws listview items when in report display mode.
    2012  * 
    2013  * PARAMETER(S):
    2014  * [I] HWND : window handle
    2015  * [I] HDC : device context handle 
     2013 *
     2014 * PARAMETER(S):
     2015 * [I] HWND : window handle
     2016 * [I] HDC : device context handle
    20162017 *
    20172018 * RETURN:
     
    20692070
    20702071      /* Offset the Scroll Bar Pos */
    2071       if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 
     2072      if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
    20722073      {
    20732074        rcItem.left -= (scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE);
     
    20772078      if (j == 0)
    20782079      {
    2079         LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 
    2080       }
    2081       else 
     2080        LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem);
     2081      }
     2082      else
    20822083      {
    20832084        LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem);
    20842085      }
    20852086    }
    2086    
     2087
    20872088    nDrawPosY += infoPtr->nItemHeight;
    20882089  }
     
    21902191 * DESCRIPTION:
    21912192 * Draws listview items when in list display mode.
    2192  * 
    2193  * PARAMETER(S):
    2194  * [I] HWND : window handle
    2195  * [I] HDC : device context handle 
     2193 *
     2194 * PARAMETER(S):
     2195 * [I] HWND : window handle
     2196 * [I] HDC : device context handle
    21962197 *
    21972198 * RETURN:
     
    22082209  INT nItemWidth = LISTVIEW_GetItemWidth(hwnd);
    22092210  INT nItemHeight = LISTVIEW_GetItemHeight(hwnd);
    2210  
     2211
    22112212  /* get number of fully visible columns */
    22122213  nColumnCount = LISTVIEW_GetColumnCount(hwnd);
     
    25812582 * DESCRIPTION:
    25822583 * Removes a column from the listview control.
    2583  * 
     2584 *
    25842585 * PARAMETER(S):
    25852586 * [I] HWND : window handle
     
    25952596  UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;
    25962597  BOOL bResult = FALSE;
    2597  
     2598
    25982599  if (Header_DeleteItem(infoPtr->hwndHeader, nColumn) != FALSE)
    25992600  {
     
    27132714       int sItem = nItem < GETITEMCOUNT(infoPtr) ? nItem : nItem - 1;
    27142715       if (infoPtr->nFocusedItem == nItem)
    2715            LISTVIEW_SetItemFocus(hwnd, sItem);
     2716           LISTVIEW_SetItemFocus(hwnd, sItem);
    27162717    }
    27172718    else
    2718           infoPtr->nFocusedItem = -1;
     2719          infoPtr->nFocusedItem = -1;
    27192720
    27202721    LISTVIEW_UpdateScroll(hwnd);
     
    27662767  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    27672768  HDPA hdpaSubItems;
    2768  
     2769
    27692770  ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA));
    27702771
    27712772  if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem)))
    2772           return FALSE;
     2773          return FALSE;
    27732774
    27742775  if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0)))
    2775           return FALSE;
     2776          return FALSE;
    27762777
    27772778  dispInfo.hdr.hwndFrom = hwnd;
     
    28112812  RECT rect;
    28122813  LISTVIEW_ITEM *lpItem;
    2813   HWND hedit; 
     2814  HWND hedit;
    28142815  HINSTANCE hinst = GetWindowLongA(hwnd, GWL_HINSTANCE);
    28152816  INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
    28162817  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    28172818  HDPA hdpaSubItems;
    2818  
     2819
    28192820  if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS)
    28202821      return FALSE;
     
    28252826  ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA));
    28262827  if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem)))
    2827           return 0;
     2828          return 0;
    28282829
    28292830  if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0)))
    2830           return 0;
     2831          return 0;
    28312832
    28322833  dispInfo.hdr.hwndFrom = hwnd;
     
    28432844
    28442845  if (ListView_LVNotify(GetParent(hwnd), nCtrlId, &dispInfo))
    2845           return 0;
     2846          return 0;
    28462847
    28472848  rect.left = LVIR_LABEL;
    28482849  if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect))
    2849           return 0;
    2850  
    2851  if (!(hedit = CreateEditLabel(dispInfo.item.pszText , WS_VISIBLE, 
    2852                  rect.left, rect.top, rect.right - rect.left + 15,
    2853                  rect.bottom - rect.top,
    2854                 hwnd, hinst, LISTVIEW_EndEditLabel, nItem)))
    2855         return 0;
     2850          return 0;
     2851
     2852 if (!(hedit = CreateEditLabel(dispInfo.item.pszText , WS_VISIBLE,
     2853                 rect.left, rect.top, rect.right - rect.left + 15,
     2854                 rect.bottom - rect.top,
     2855                hwnd, hinst, LISTVIEW_EndEditLabel, nItem)))
     2856        return 0;
    28562857
    28572858  infoPtr->hwndEdit = hedit;
    2858   SetFocus(hedit); 
     2859  SetFocus(hedit);
    28592860  SendMessageA(hedit, EM_SETSEL, 0, -1);
    28602861
     
    33583359
    33593360    if (!lpiArray)
    3360         return FALSE;
     3361        return FALSE;
    33613362
    33623363    /* little hack */
    33633364    for (i = 0; i < iCount; i++)
    3364         lpiArray[i] = i;
     3365        lpiArray[i] = i;
    33653366
    33663367    return TRUE;
     
    44504451 * DESCRIPTION:
    44514452 * Retrieves the origin coordinates when in icon or small icon display mode.
    4452  * 
     4453 *
    44534454 * PARAMETER(S):
    44544455 * [I] HWND : window handle
    44554456 * [O] LPPOINT : coordinate information
    4456  * 
     4457 *
    44574458 * RETURN:
    44584459 *   SUCCESS : TRUE
     
    44644465  UINT uView = lStyle & LVS_TYPEMASK;
    44654466  BOOL bResult = FALSE;
    4466  
     4467
    44674468//  TRACE("(hwnd=%x, lpptOrigin=%p)\n", hwnd, lpptOrigin);
    44684469
     
    44774478    {
    44784479      scrollInfo.fMask = SIF_POS;
    4479       if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 
    4480       {
    4481         lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE; 
     4480      if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
     4481      {
     4482        lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
    44824483      }
    44834484    }
     
    44914492      }
    44924493    }
    4493      
     4494
    44944495    bResult = TRUE;
    44954496  }
    4496  
     4497
    44974498  return bResult;
    44984499}
     
    48474848 * DESCRIPTION:
    48484849 * Inserts a new item in the listview control.
    4849  * 
     4850 *
    48504851 * PARAMETER(S):
    48514852 * [I] HWND : window handle
     
    48884889            if (nItem != -1)
    48894890            {
    4890               nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 
     4891              nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem,
    48914892                                    hdpaSubItems);
    48924893              if (nItem != -1)
     
    48984899                  {
    48994900                    LISTVIEW_SetItemFocus(hwnd, nItem);
    4900                   }           
     4901                  }
    49014902                }
    4902                
     4903
    49034904                /* send LVN_INSERTITEM notification */
    49044905                ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
     
    49094910                nmlv.lParam = lpItem->lParam;;
    49104911                ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);
    4911                
     4912
    49124913                if ((uView == LVS_SMALLICON) || (uView == LVS_LIST))
    4913                 {
    4914                   nItemWidth = LISTVIEW_CalculateWidth(hwnd, lpLVItem->iItem);
    4915                   if (nItemWidth > infoPtr->nItemWidth)
    4916                   {
    4917                     infoPtr->nItemWidth = nItemWidth;
    4918                   }
    4919                 }
     4914                {
     4915                  nItemWidth = LISTVIEW_CalculateWidth(hwnd, lpLVItem->iItem);
     4916                  if (nItemWidth > infoPtr->nItemWidth)
     4917                  {
     4918                    infoPtr->nItemWidth = nItemWidth;
     4919                  }
     4920                }
    49204921
    49214922                /* align items (set position of each item) */
     
    49314932                  }
    49324933                }
    4933                
     4934
    49344935                LISTVIEW_UpdateScroll(hwnd);
    49354936                /* refresh client area */
     
    49484949    COMCTL32_Free(lpItem);
    49494950  }
    4950  
     4951
    49514952  return nItem;
    49524953}
     
    51835184
    51845185    if (!lpiArray)
    5185         return FALSE;
     5186        return FALSE;
    51865187
    51875188    return TRUE;
     
    58975898 * DESCRIPTION:
    58985899 * Performs vertical scrolling.
    5899  * 
     5900 *
    59005901 * PARAMETER(S):
    59015902 * [I] HWND : window handle
    59025903 * [I] INT : scroll code
    5903  * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 
     5904 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION
    59045905 *             or SB_THUMBTRACK.
    59055906 * [I] HWND : scrollbar control window handle
     
    59165917  scrollInfo.cbSize = sizeof(SCROLLINFO);
    59175918  scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    5918  
     5919
    59195920  if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE)
    59205921  {
     
    59285929      }
    59295930    break;
    5930    
     5931
    59315932    case SB_LINEDOWN:
    59325933      if (scrollInfo.nPos < scrollInfo.nMax)
     
    59355936      }
    59365937      break;
    5937      
     5938
    59385939    case SB_PAGEUP:
    59395940      if (scrollInfo.nPos > scrollInfo.nMin)
     
    59505951      }
    59515952      break;
    5952      
     5953
    59535954    case SB_PAGEDOWN:
    59545955      if (scrollInfo.nPos < scrollInfo.nMax)
     
    59775978    }
    59785979  }
    5979    
     5980
    59805981  return 0;
    59815982}
     
    59845985 * DESCRIPTION:
    59855986 * Performs horizontal scrolling.
    5986  * 
     5987 *
    59875988 * PARAMETER(S):
    59885989 * [I] HWND : window handle
    59895990 * [I] INT : scroll code
    5990  * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 
     5991 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION
    59915992 *             or SB_THUMBTRACK.
    59925993 * [I] HWND : scrollbar control window handle
     
    60036004  scrollInfo.cbSize = sizeof(SCROLLINFO);
    60046005  scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    6005  
     6006
    60066007  if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
    60076008  {
     
    60166017      }
    60176018      break;
    6018    
     6019
    60196020    case SB_LINERIGHT:
    60206021      if (scrollInfo.nPos < scrollInfo.nMax)
     
    60236024      }
    60246025      break;
    6025      
     6026
    60266027    case SB_PAGELEFT:
    60276028      if (scrollInfo.nPos > scrollInfo.nMin)
     
    60376038      }
    60386039      break;
    6039      
     6040
    60406041    case SB_PAGERIGHT:
    60416042      if (scrollInfo.nPos < scrollInfo.nMax)
     
    60716072    }
    60726073  }
    6073    
     6074
    60746075  return 0;
    60756076}
     
    64436444 * DESCRIPTION:
    64446445 * Handles notifications from children.
    6445  * 
     6446 *
    64466447 * PARAMETER(S):
    64476448 * [I] HWND : window handle
    64486449 * [I] INT : control identifier
    64496450 * [I] LPNMHDR : notification information
    6450  * 
     6451 *
    64516452 * RETURN:
    64526453 * Zero
     
    64556456{
    64566457  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    6457  
    6458   if (lpnmh->hwndFrom == infoPtr->hwndHeader) 
     6458
     6459  if (lpnmh->hwndFrom == infoPtr->hwndHeader)
    64596460  {
    64606461    /* handle notification from header control */
     
    64776478        nmlv.iItem = -1;
    64786479        nmlv.iSubItem = pnmHeader->iItem;
    6479        
     6480
    64806481        ListView_LVNotify(GetParent(hwnd),lCtrlId, &nmlv);
    64816482
     
    73707371 * DESCRIPTION:
    73717372 * Handle any WM_COMMAND messages
    7372  * 
     7373 *
    73737374 * PARAMETER(S):
    73747375 *
     
    73797380    switch (HIWORD(wParam))
    73807381    {
    7381         case EN_UPDATE:
    7382         {
    7383             /*
    7384              * Adjust the edit window size
    7385              */
    7386             char buffer[1024];
    7387             LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    7388             HDC           hdc      = GetDC(infoPtr->hwndEdit);
    7389             RECT          rect;
    7390             SIZE          sz;
    7391 
    7392             GetWindowTextA(infoPtr->hwndEdit, buffer, 1024);
    7393             GetWindowRect(infoPtr->hwndEdit, &rect);
    7394             if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz))
    7395             {
    7396                     SetWindowPos (
    7397                 infoPtr->hwndEdit,
    7398                 HWND_TOP,
    7399                 0,
    7400                 0,
    7401                 sz.cx + 15,
    7402                 rect.bottom - rect.top,
    7403                 SWP_DRAWFRAME|SWP_NOMOVE);
    7404             }
    7405             ReleaseDC(hwnd, hdc);
    7406 
    7407             break;
    7408         }
    7409 
    7410         default:
    7411           return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam);
     7382        case EN_UPDATE:
     7383        {
     7384            /*
     7385             * Adjust the edit window size
     7386             */
     7387            char buffer[1024];
     7388            LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     7389            HDC           hdc      = GetDC(infoPtr->hwndEdit);
     7390            RECT          rect;
     7391            SIZE          sz;
     7392
     7393            GetWindowTextA(infoPtr->hwndEdit, buffer, 1024);
     7394            GetWindowRect(infoPtr->hwndEdit, &rect);
     7395            if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz))
     7396            {
     7397                    SetWindowPos (
     7398                infoPtr->hwndEdit,
     7399                HWND_TOP,
     7400                0,
     7401                0,
     7402                sz.cx + 15,
     7403                rect.bottom - rect.top,
     7404                SWP_DRAWFRAME|SWP_NOMOVE);
     7405            }
     7406            ReleaseDC(hwnd, hdc);
     7407
     7408            break;
     7409        }
     7410
     7411        default:
     7412          return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam);
    74127413    }
    74137414
     
    74247425 * RETURN:
    74257426 */
    7426 LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg, 
    7427         WPARAM wParam, LPARAM lParam)
     7427LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg,
     7428        WPARAM wParam, LPARAM lParam)
    74287429{
    74297430    BOOL cancel = TRUE;
     
    74337434    switch (uMsg)
    74347435    {
    7435         case WM_GETDLGCODE:
    7436           return DLGC_WANTARROWS | DLGC_WANTALLKEYS;
    7437                        
    7438         case WM_KILLFOCUS:
    7439             break;
    7440 
    7441         case WM_DESTROY:
    7442             {
    7443                 WNDPROC editProc = einfo->EditWndProc;
    7444                 SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc);
    7445                 COMCTL32_Free(einfo);
    7446                 infoPtr->pedititem = NULL;
    7447                 return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam);
    7448             }
    7449 
    7450         case WM_CHAR:
    7451             if (VK_RETURN == (INT)wParam)
    7452             {
    7453                 cancel = FALSE;
    7454                 break;
    7455             }
    7456             else if (VK_ESCAPE == (INT)wParam)
    7457                 break;
    7458 
    7459         default:
    7460             return CallWindowProcA(einfo->EditWndProc, hwnd,
    7461                         uMsg, wParam, lParam);
     7436        case WM_GETDLGCODE:
     7437          return DLGC_WANTARROWS | DLGC_WANTALLKEYS;
     7438
     7439        case WM_KILLFOCUS:
     7440            break;
     7441
     7442        case WM_DESTROY:
     7443            {
     7444                WNDPROC editProc = einfo->EditWndProc;
     7445                SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc);
     7446                COMCTL32_Free(einfo);
     7447                infoPtr->pedititem = NULL;
     7448                return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam);
     7449            }
     7450
     7451        case WM_CHAR:
     7452            if (VK_RETURN == (INT)wParam)
     7453            {
     7454                cancel = FALSE;
     7455                break;
     7456            }
     7457            else if (VK_ESCAPE == (INT)wParam)
     7458                break;
     7459
     7460        default:
     7461            return CallWindowProcA(einfo->EditWndProc, hwnd,
     7462                        uMsg, wParam, lParam);
    74627463    }
    74637464
    74647465    if (einfo->EditLblCb)
    74657466    {
    7466         char *buffer  = NULL;
    7467 
    7468         if (!cancel)
    7469         {
    7470             int len = 1 + GetWindowTextLengthA(hwnd);
    7471 
    7472             if (len > 1)
    7473             {
    7474                 if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char))))
    7475                 {
    7476                     GetWindowTextA(hwnd, buffer, len);
    7477                 }
    7478             }
    7479         }
    7480            
    7481         einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param);
    7482 
    7483         if (buffer)
    7484             COMCTL32_Free(buffer);
    7485 
    7486         einfo->EditLblCb = NULL;
     7467        char *buffer  = NULL;
     7468
     7469        if (!cancel)
     7470        {
     7471            int len = 1 + GetWindowTextLengthA(hwnd);
     7472
     7473            if (len > 1)
     7474            {
     7475                if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char))))
     7476                {
     7477                    GetWindowTextA(hwnd, buffer, len);
     7478                }
     7479            }
     7480        }
     7481
     7482        einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param);
     7483
     7484        if (buffer)
     7485            COMCTL32_Free(buffer);
     7486
     7487        einfo->EditLblCb = NULL;
    74877488    }
    74887489
     
    75007501 * RETURN:
    75017502 */
    7502 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 
    7503         INT width, INT height, HWND parent, HINSTANCE hinst,
    7504         EditlblCallback EditLblCb, DWORD param)
     7503HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     7504        INT width, INT height, HWND parent, HINSTANCE hinst,
     7505        EditlblCallback EditLblCb, DWORD param)
    75057506{
    75067507    HWND hedit;
    75077508    LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(parent, 0);
    75087509    if (NULL == (infoPtr->pedititem = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM))))
    7509         return 0;
     7510        return 0;
    75107511
    75117512    style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER;
    7512     if (!(hedit = CreateWindowA("Edit", text, style, x, y, width, height, 
    7513                     parent, 0, hinst, 0)))
    7514     {
    7515         COMCTL32_Free(infoPtr->pedititem);
    7516         return 0;
     7513    if (!(hedit = CreateWindowA("Edit", text, style, x, y, width, height,
     7514                    parent, 0, hinst, 0)))
     7515    {
     7516        COMCTL32_Free(infoPtr->pedititem);
     7517        return 0;
    75177518    }
    75187519
    75197520    infoPtr->pedititem->param = param;
    75207521    infoPtr->pedititem->EditLblCb = EditLblCb;
    7521     infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit, 
    7522           GWL_WNDPROC, (LONG) EditLblWndProc);
     7522    infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit,
     7523          GWL_WNDPROC, (LONG) EditLblWndProc);
    75237524
    75247525    return hedit;
Note: See TracChangeset for help on using the changeset viewer.