Ignore:
Timestamp:
Feb 25, 2000, 6:00:18 PM (25 years ago)
Author:
cbratschi
Message:

unicode and other changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/treeview.cpp

    r2875 r2895  
    1 /* $Id: treeview.cpp,v 1.1 2000-02-23 17:09:50 cbratschi Exp $ */
     1/* $Id: treeview.cpp,v 1.2 2000-02-25 17:00:18 cbratschi Exp $ */
    22/* Treeview control
    33 *
     
    3232/* CB: todo
    3333 - bug in SetScrollInfo/ShowScrollBar: WM_SIZE and WM_NCPAINT problems (i.e. RegEdit)
     34 - VK_LEFT in WinHlp32 displays expanded icon
    3435 - tooltips not finished
    3536 - expand not finished
     
    325326    if (killItem->pszText != LPSTR_TEXTCALLBACKW)
    326327      COMCTL32_Free (killItem->pszText);
     328    killItem->pszText = NULL;
    327329    TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)kill, 0);
    328330    if (killItem->firstChild)
     
    351353 if (wineItem->pszText != LPSTR_TEXTCALLBACKW)
    352354   COMCTL32_Free (wineItem->pszText);
     355 wineItem->pszText = NULL;
    353356
    354357 TREEVIEW_SendTreeviewNotify (hwnd, TVN_DELETEITEM, 0, (HTREEITEM)iItem, 0);
     
    397400                if (killItem->pszText != LPSTR_TEXTCALLBACKW)
    398401                  COMCTL32_Free (killItem->pszText);
     402                killItem->pszText = NULL;
     403
    399404                TREEVIEW_SendTreeviewNotify
    400405                                        (hwnd, TVN_DELETEITEM, 0, killItem->hItem, 0);
     
    28472852  NMTREEVIEWW nmhdr;
    28482853  TREEVIEW_ITEM  *wineItem;
    2849   HWND parent = GetParent(hwnd);
    28502854  CHAR *oldText = NULL,*newText = NULL;
    28512855  BOOL rc;
     
    28532857  ZeroMemory(&nmhdr,sizeof(NMTREEVIEWW));
    28542858
    2855   nmhdr.hdr.hwndFrom = hwnd;
    2856   nmhdr.hdr.idFrom =  GetWindowLongW( hwnd, GWL_ID);
    2857   nmhdr.hdr.code = code;
    28582859  nmhdr.action = action;
    28592860  if (oldItem)
    28602861  {
    2861     wineItem=& infoPtr->items[(INT)oldItem];
    2862     nmhdr.itemOld.mask              = wineItem->mask;
    2863     nmhdr.itemOld.hItem             = wineItem->hItem;
    2864     nmhdr.itemOld.state             = wineItem->state;
     2862    wineItem = &infoPtr->items[(INT)oldItem];
     2863    nmhdr.itemOld.mask      = wineItem->mask;
     2864    nmhdr.itemOld.hItem     = wineItem->hItem;
     2865    nmhdr.itemOld.state     = wineItem->state;
    28652866    nmhdr.itemOld.stateMask = wineItem->stateMask;
    28662867    nmhdr.itemOld.iImage    = wineItem->iImage;
    2867     if (infoPtr->header.uNotifyFormat == NFR_ANSI)
     2868    if (!isUnicodeNotify(&infoPtr->header))
    28682869    {
    28692870      if (!wineItem->pszText) nmhdr.itemOld.pszText = NULL; else
     
    28852886  if (newItem)
    28862887  {
    2887     wineItem=& infoPtr->items[(INT)newItem];
     2888    wineItem = &infoPtr->items[(INT)newItem];
    28882889    nmhdr.itemNew.mask              = wineItem->mask;
    28892890    nmhdr.itemNew.hItem             = wineItem->hItem;
     
    28912892    nmhdr.itemNew.stateMask = wineItem->stateMask;
    28922893    nmhdr.itemNew.iImage    = wineItem->iImage;
    2893     if (infoPtr->header.uNotifyFormat == NFR_ANSI)
    2894     {
    2895       if (!wineItem->pszText) nmhdr.itemOld.pszText = NULL; else
     2894    if (!isUnicodeNotify(&infoPtr->header))
     2895    {
     2896      if (!wineItem->pszText) nmhdr.itemNew.pszText = NULL; else
    28962897      {
    28972898        INT len = lstrlenW(wineItem->pszText)+1;
     
    28992900        newText = (CHAR*)COMCTL32_Alloc(len);
    29002901        lstrcpyWtoA(newText,wineItem->pszText);
    2901         nmhdr.itemOld.pszText = (WCHAR*)newText;
     2902        nmhdr.itemNew.pszText = (WCHAR*)newText;
    29022903      }
    29032904    } else nmhdr.itemNew.pszText   = wineItem->pszText;
     
    29122913  nmhdr.ptDrag.y = 0;
    29132914
    2914   rc = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)nmhdr.hdr.idFrom,(LPARAM)&nmhdr);
     2915  rc = (BOOL)sendNotify(hwnd,code,&nmhdr.hdr);
    29152916
    29162917  if (oldText) COMCTL32_Free(oldText);
     
    29282929  TREEVIEW_ITEM  *wineItem;
    29292930
    2930   nmhdr.hdr.hwndFrom = hwnd;
    2931   nmhdr.hdr.idFrom =  GetWindowLongA( hwnd, GWL_ID);
    2932   nmhdr.hdr.code = code;
    29332931  nmhdr.action = 0;
    29342932  wineItem=& infoPtr->items[(INT)dragItem];
     
    29412939  nmhdr.ptDrag.y = pt.y;
    29422940
    2943   return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY,
    2944                                    (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmhdr);
     2941  return (BOOL)sendNotify(hwnd,code,&nmhdr.hdr);
    29452942
    29462943}
     
    29532950  BOOL retval;
    29542951  WCHAR *buf;
    2955   HWND parent = GetParent(hwnd);
    2956 
    2957   tvdi.hdr.hwndFrom     = hwnd;
    2958   tvdi.hdr.idFrom       = GetWindowLongA( hwnd, GWL_ID);
    2959   tvdi.hdr.code         = code;
     2952
    29602953  tvdi.item.mask        = what;
    29612954  tvdi.item.hItem       = wineItem->hItem;
    29622955  tvdi.item.state       = wineItem->state;
    29632956  tvdi.item.lParam      = wineItem->lParam;
    2964   tvdi.item.pszText     = (WCHAR*)COMCTL32_Alloc(128*((infoPtr->header.uNotifyFormat == NFR_UNICODE) ? sizeof(WCHAR):sizeof(char)));
     2957  tvdi.item.pszText     = (WCHAR*)COMCTL32_Alloc(128*(isUnicodeNotify(&infoPtr->header) ? sizeof(WCHAR):sizeof(char)));
    29652958  tvdi.item.cchTextMax = 128;
    29662959  buf = tvdi.item.pszText;
    29672960
    2968   retval = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi);
     2961  retval = (BOOL)sendNotify(hwnd,code,&tvdi.hdr);
    29692962
    29702963  /* Ignore posible changes */
     
    29742967  if (what & TVIF_TEXT)
    29752968  {
    2976     if (infoPtr->header.uNotifyFormat == NFR_UNICODE)
     2969    if (isUnicodeNotify(&infoPtr->header))
    29772970    {
    29782971      wineItem->pszText = tvdi.item.pszText;
     
    30223015  LPNMCUSTOMDRAW nmcd;
    30233016
    3024   nmcd =& nmcdhdr.nmcd;
    3025   nmcd->hdr.hwndFrom = hwnd;
    3026   nmcd->hdr.idFrom =  GetWindowLongA( hwnd, GWL_ID);
    3027   nmcd->hdr.code   = NM_CUSTOMDRAW;
     3017  nmcd = &nmcdhdr.nmcd;
    30283018  nmcd->dwDrawStage= dwDrawStage;
    30293019  nmcd->hdc        = hdc;
     
    30393029  nmcdhdr.iLevel   = 0;
    30403030
    3041   return (BOOL)SendMessageA (GetParent (hwnd), WM_NOTIFY,
    3042                                (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr);
     3031  return (BOOL)sendNotify(hwnd,NM_CUSTOMDRAW,&nmcdhdr.nmcd.hdr);
    30433032}
    30443033
     
    30673056
    30683057  nmcd= & nmcdhdr.nmcd;
    3069   nmcd->hdr.hwndFrom = hwnd;
    3070   nmcd->hdr.idFrom =  GetWindowLongA( hwnd, GWL_ID);
    3071   nmcd->hdr.code   = NM_CUSTOMDRAW;
    30723058  nmcd->dwDrawStage= dwDrawStage;
    30733059  nmcd->hdc                = hdc;
     
    30873073  //               dwDrawStage, hdc, dwItemSpec, uItemState);
    30883074
    3089   retval=SendMessageA (GetParent (hwnd), WM_NOTIFY,
    3090                  (WPARAM) GetWindowLongA( hwnd, GWL_ID), (LPARAM)&nmcdhdr);
     3075  retval = sendNotify(hwnd,NM_CUSTOMDRAW,&nmcdhdr.nmcd.hdr);
    30913076
    30923077  infoPtr->clrText=nmcdhdr.clrText;
     
    31003085  NMTVKEYDOWN nmkdhdr;
    31013086
    3102   nmkdhdr.hdr.hwndFrom = hwnd;
    3103   nmkdhdr.hdr.idFrom   =  GetWindowLongA( hwnd, GWL_ID);
    3104   nmkdhdr.hdr.code     = code;
    31053087  nmkdhdr.wVKey = wVKey;
    31063088  nmkdhdr.flags = 0;
    31073089
    3108   SendMessageA(GetParent(hwnd),WM_NOTIFY,(WPARAM)nmkdhdr.hdr.idFrom,(LPARAM)&nmkdhdr);
     3090  sendNotify(hwnd,code,&nmkdhdr.hdr);
    31093091}
    31103092
     
    33873369  NMTVDISPINFOW tvdi;
    33883370  DWORD dwStyle = GetWindowLongA(hwnd,GWL_STYLE);
    3389   HWND parent = GetParent(hwnd);
    33903371  BOOL bCommit;
    33913372  WCHAR *textW = NULL;
     
    33963377     return FALSE;
    33973378
    3398   tvdi.hdr.hwndFrom     = hwnd;
    3399   tvdi.hdr.idFrom       = GetWindowLongA(hwnd, GWL_ID);
    3400   tvdi.hdr.code         = TVN_ENDLABELEDIT;
    34013379  tvdi.item.mask        = 0;
    34023380  tvdi.item.hItem       = editedItem->hItem;
     
    34143392    //}
    34153393
    3416     if (infoPtr->header.uNotifyFormat == NFR_UNICODE) tvdi.item.pszText = textW; else
     3394    if (isUnicodeNotify(&infoPtr->header)) tvdi.item.pszText = textW; else
    34173395    {
    34183396      INT len = iLength+1;
     
    34303408  }
    34313409
    3432   bCommit = (BOOL)SendMessageA(parent,WM_NOTIFY,(WPARAM)tvdi.hdr.idFrom,(LPARAM)&tvdi);
     3410  bCommit = (BOOL)sendNotify(hwnd,TVN_ENDLABELEDIT,&tvdi.hdr);
    34333411
    34343412  if (!bCancel && bCommit) /* Apply the changes */
    34353413  {
    3436     if (infoPtr->header.uNotifyFormat == NFR_ANSI)
     3414    if (!isUnicodeNotify(&infoPtr->header))
    34373415      lstrcpynAtoW(textW,textA,iLength+1);
    34383416    if (lstrcmpW(textW,editedItem->pszText) != 0)
     
    35773555      {
    35783556        NMTVGETINFOTIPW tvgit;
    3579         HWND parent = GetParent(hwnd);
    3580 
    3581         tvgit.hdr.hwndFrom = hwnd;
    3582         tvgit.hdr.idFrom   =  GetWindowLongA(hwnd,GWL_ID);
    3583         tvgit.hdr.code     = (infoPtr->header.uNotifyFormat == NFR_UNICODE) ? TVN_GETINFOTIPW:TVN_GETINFOTIPA;
    3584         tvgit.pszText    = (WCHAR*)COMCTL32_Alloc((infoPtr->header.uNotifyFormat == NFR_UNICODE) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR));
     3557
     3558        tvgit.pszText    = (WCHAR*)COMCTL32_Alloc(isUnicodeNotify(&infoPtr->header) ? INFOTIPSIZE*sizeof(WCHAR):INFOTIPSIZE*sizeof(CHAR));
    35853559        tvgit.cchTextMax = INFOTIPSIZE;
    35863560        tvgit.hItem      = item->hItem;
    35873561        tvgit.lParam     = item->lParam;
    35883562
    3589         SendMessageA(parent,WM_NOTIFY,(WPARAM)tvgit.hdr.idFrom,(LPARAM)&tvgit);
    3590         if (infoPtr->header.uNotifyFormat == NFR_UNICODE)
     3563        sendNotify(hwnd,isUnicodeNotify(&infoPtr->header) ? TVN_GETINFOTIPW:TVN_GETINFOTIPA,&tvgit.hdr);
     3564        if (isUnicodeNotify(&infoPtr->header))
    35913565        {
    35923566          text = tvgit.pszText;
     
    40103984
    40113985    case SB_PAGEUP:
    4012       newY = infoPtr->lefttop.y-MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVisibleHeight);
     3986      newY = infoPtr->lefttop.y-MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVScrollStep);
    40133987      if (newY < 0) newY = 0;
    40143988      break;
    40153989
    40163990    case SB_PAGEDOWN:
    4017       newY = infoPtr->lefttop.y+MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVisibleHeight);
     3991      newY = infoPtr->lefttop.y+MAX(((INT)(infoPtr->uVisibleHeight/infoPtr->uVScrollStep))*infoPtr->uVScrollStep,infoPtr->uVScrollStep);
    40183992      if (newY > maxY) newY = maxY;
    40193993      break;
Note: See TracChangeset for help on using the changeset viewer.