Changeset 2740 for trunk/src


Ignore:
Timestamp:
Feb 10, 2000, 7:51:19 PM (26 years ago)
Author:
cbratschi
Message:

added listview style, treeview rewrite started

Location:
trunk/src/comctl32
Files:
5 edited

Legend:

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

    r2126 r2740  
    2222BOOL WINAPI MakeDragList (HWND hwndLB)
    2323{
    24     FIXME("(0x%x)\n", hwndLB);
     24    //FIXME("(0x%x)\n", hwndLB);
    2525
    2626
     
    3131VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem)
    3232{
    33     FIXME("(0x%x 0x%x %d)\n", hwndParent, hwndLB, nItem);
     33    //FIXME("(0x%x 0x%x %d)\n", hwndParent, hwndLB, nItem);
    3434
    3535
     
    4343    DWORD dwScrollTime;
    4444
    45     FIXME("(0x%x %ld x %ld %s)\n",
    46            hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
     45    //FIXME("(0x%x %ld x %ld %s)\n",
     46    //       hwndLB, pt.x, pt.y, bAutoScroll ? "TRUE" : "FALSE");
    4747
    4848    ScreenToClient (hwndLB, &pt);
     
    5252    if (PtInRect (&rcClient, pt))
    5353    {
    54         /* point is inside -- get the item index */
    55         while (TRUE)
    56         {
    57             if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
    58                 return -1;
     54        /* point is inside -- get the item index */
     55        while (TRUE)
     56        {
     57            if (SendMessageA (hwndLB, LB_GETITEMRECT, nIndex, (LPARAM)&rcClient) == LB_ERR)
     58                return -1;
    5959
    60             if (PtInRect (&rcClient, pt))
    61                 return nIndex;
     60            if (PtInRect (&rcClient, pt))
     61                return nIndex;
    6262
    63             nIndex++;
    64         }
     63            nIndex++;
     64        }
    6565    }
    6666    else
    6767    {
    68         /* point is outside */
    69         if (!bAutoScroll)
    70             return -1;
     68        /* point is outside */
     69        if (!bAutoScroll)
     70            return -1;
    7171
    72         if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
    73             return -1;
     72        if ((pt.x > rcClient.right) || (pt.x < rcClient.left))
     73            return -1;
    7474
    75         if (pt.y < 0)
    76             nIndex--;
    77         else
    78             nIndex++;
     75        if (pt.y < 0)
     76            nIndex--;
     77        else
     78            nIndex++;
    7979
    80         dwScrollTime = GetTickCount ();
     80        dwScrollTime = GetTickCount ();
    8181
    82         if ((dwScrollTime - dwLastScrollTime) < 200)
    83             return -1;
     82        if ((dwScrollTime - dwLastScrollTime) < 200)
     83            return -1;
    8484
    85         dwLastScrollTime = dwScrollTime;
     85        dwLastScrollTime = dwScrollTime;
    8686
    87         SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
     87        SendMessageA (hwndLB, LB_SETTOPINDEX, (WPARAM)nIndex, 0);
    8888    }
    8989
  • trunk/src/comctl32/listview.c

    r2635 r2740  
    1 /*$Id: listview.c,v 1.21 2000-02-04 17:02:07 cbratschi Exp $*/
     1/*$Id: listview.c,v 1.22 2000-02-10 18:51:17 cbratschi Exp $*/
    22/*
    33 * Listview control
     
    5151#include "commctrl.h"
    5252#include "listview.h"
    53 #include "debugtools.h"
     53//#include "debugtools.h"
    5454#include "comctl32.h"
    5555
     
    329329  if ((LVS_TYPEMASK & lStyle) == LVS_EDITLABELS)
    330330  {
    331     FIXME("  LVS_EDITLABELS\n");
     331    //FIXME("  LVS_EDITLABELS\n");
    332332  }
    333333
    334334  if ((LVS_TYPEMASK & lStyle) == LVS_NOLABELWRAP)
    335335  {
    336     FIXME("  LVS_NOLABELWRAP\n");
     336    //FIXME("  LVS_NOLABELWRAP\n");
    337337  }
    338338
    339339  if ((LVS_TYPEMASK & lStyle) == LVS_NOSCROLL)
    340340  {
    341     FIXME("  LVS_NOSCROLL\n");
    342   }
    343 
    344   if ((LVS_TYPEMASK & lStyle) == LVS_NOSORTHEADER)
    345   {
    346     FIXME("  LVS_NOSORTHEADER\n");
     341    //FIXME("  LVS_NOSCROLL\n");
    347342  }
    348343
    349344  if ((LVS_TYPEMASK & lStyle) == LVS_OWNERDRAWFIXED)
    350345  {
    351     FIXME("  LVS_OWNERDRAWFIXED\n");
     346    //FIXME("  LVS_OWNERDRAWFIXED\n");
    352347  }
    353348
    354349  if ((LVS_TYPEMASK & lStyle) == LVS_SHAREIMAGELISTS)
    355350  {
    356     FIXME("  LVS_SHAREIMAGELISTS\n");
     351    //FIXME("  LVS_SHAREIMAGELISTS\n");
    357352  }
    358353
    359354  if ((LVS_TYPEMASK & lStyle) == LVS_SORTASCENDING)
    360355  {
    361     FIXME("  LVS_SORTASCENDING\n");
     356    //FIXME("  LVS_SORTASCENDING\n");
    362357  }
    363358
    364359  if ((LVS_TYPEMASK & lStyle) == LVS_SORTDESCENDING)
    365360  {
    366     FIXME("  LVS_SORTDESCENDING\n");
     361    //FIXME("  LVS_SORTDESCENDING\n");
    367362  }
    368363}
     
    35613556     )
    35623557    return FALSE;
     3558
    35633559  hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
    35643560  if (hdpaSubItems == NULL)
    35653561    return FALSE;
     3562
    35663563  lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
    35673564  if (lpItem == NULL)
    35683565    return FALSE;
     3566
    35693567  ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA));
    35703568  if (lpLVItem->iSubItem == 0)
     
    36403638    }
    36413639  }
     3640
    36423641  if (lpLVItem->iSubItem == 0)
    36433642  {
     
    36523651      lpLVItem->state = lpItem->state & lpLVItem->stateMask;
    36533652    }
     3653
    36543654    if (lpLVItem->mask & LVIF_PARAM)
    36553655    {
    36563656      lpLVItem->lParam = lpItem->lParam;
    36573657    }
     3658
    36583659    if (lpLVItem->mask & LVIF_INDENT)
    36593660    {
     
    36613662    }
    36623663  }
     3664
    36633665  return TRUE;
    36643666}
     
    57175719  UINT uView = lpcs->style & LVS_TYPEMASK;
    57185720  LOGFONTA logFont;
     5721  DWORD headerStyle = WS_CHILD | HDS_HORZ;
    57195722
    57205723  /* initialize info pointer */
     
    57515754
    57525755  /* create header */
     5756  if (!(lpcs->style & LVS_NOSORTHEADER)) headerStyle |= HDS_BUTTONS;
    57535757  infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL,
    5754                                       WS_CHILD | HDS_HORZ | HDS_BUTTONS,
     5758                                      headerStyle,
    57555759                                      0, 0, 0, 0, hwnd, (HMENU)0,
    57565760                                      lpcs->hInstance, NULL);
     
    64756479    if (infoPtr->notifyFormat == NFR_UNICODE)
    64766480    {
    6477       FIXME("NO support for unicode structures");
     6481      //FIXME("NO support for unicode structures");
    64786482    }
    64796483  }
     
    69086912        LISTVIEW_AlignTop(hwnd);
    69096913      }
     6914    }
     6915
     6916    if ((lpss->styleOld & LVS_NOSORTHEADER) != (lpss->styleNew & LVS_NOSORTHEADER))
     6917    {
     6918      INT headerStyle = GetWindowLongA(infoPtr->hwndHeader,GWL_STYLE);
     6919
     6920      if (lpss->styleNew & LVS_NOSORTHEADER)
     6921        headerStyle &= ~HDS_BUTTONS;
     6922      else
     6923        headerStyle |= HDS_BUTTONS;
     6924      SetWindowLongA(infoPtr->hwndHeader,GWL_STYLE,headerStyle);
    69106925    }
    69116926
  • trunk/src/comctl32/resource.asm

    r2523 r2740  
    22;/* Source : rsrc.rc */
    33;/* Cmdline: wrc -s -I. -IE:\IBMCPP\include -I..\..\include -I..\..\include\win -o resource.asm rsrc.rc */
    4 ;/* Date   : Thu Jan 13 17:56:56 2000 */
     4;/* Date   : Fri Feb  4 19:27:28 2000 */
    55
    66        .386p
     
    1212        public  _Resource_PEResTab
    1313        dd      0
    14         dd      0387e03d8h
     14        dd      0389b1a10h
    1515        dd      0
    1616        dw      0, 5
     
    2727L2:
    2828        dd      0
    29         dd      0387e03d8h
     29        dd      0389b1a10h
    3030        dd      0
    3131        dw      0, 7
     
    4646L4:
    4747        dd      0
    48         dd      0387e03d8h
     48        dd      0389b1a10h
    4949        dd      0
    5050        dw      0, 1
     
    5353L5:
    5454        dd      0
    55         dd      0387e03d8h
     55        dd      0389b1a10h
    5656        dd      0
    5757        dw      0, 3
     
    6464L6:
    6565        dd      0
    66         dd      0387e03d8h
     66        dd      0389b1a10h
    6767        dd      0
    6868        dw      0, 1
     
    7171L16:
    7272        dd      0
    73         dd      0387e03d8h
     73        dd      0389b1a10h
    7474        dd      0
    7575        dw      0, 1
     
    7878L2_120:
    7979        dd      0
    80         dd      0387e03d8h
     80        dd      0389b1a10h
    8181        dd      0
    8282        dw      0, 1
     
    8585L2_121:
    8686        dd      0
    87         dd      0387e03d8h
     87        dd      0389b1a10h
    8888        dd      0
    8989        dw      0, 1
     
    9292L2_124:
    9393        dd      0
    94         dd      0387e03d8h
     94        dd      0389b1a10h
    9595        dd      0
    9696        dw      0, 1
     
    9999L2_125:
    100100        dd      0
    101         dd      0387e03d8h
     101        dd      0389b1a10h
    102102        dd      0
    103103        dw      0, 1
     
    106106L2_130:
    107107        dd      0
    108         dd      0387e03d8h
     108        dd      0389b1a10h
    109109        dd      0
    110110        dw      0, 1
     
    113113L2_131:
    114114        dd      0
    115         dd      0387e03d8h
     115        dd      0389b1a10h
    116116        dd      0
    117117        dw      0, 1
     
    120120L2_401:
    121121        dd      0
    122         dd      0387e03d8h
     122        dd      0389b1a10h
    123123        dd      0
    124124        dw      0, 1
     
    127127L4_300:
    128128        dd      0
    129         dd      0387e03d8h
     129        dd      0389b1a10h
    130130        dd      0
    131131        dw      0, 1
     
    134134L5_200:
    135135        dd      0
    136         dd      0387e03d8h
     136        dd      0389b1a10h
    137137        dd      0
    138138        dw      0, 1
     
    141141L5_1006:
    142142        dd      0
    143         dd      0387e03d8h
     143        dd      0389b1a10h
    144144        dd      0
    145145        dw      0, 1
     
    148148L5_1020:
    149149        dd      0
    150         dd      0387e03d8h
     150        dd      0389b1a10h
    151151        dd      0
    152152        dw      0, 1
     
    155155L6_261:
    156156        dd      0
    157         dd      0387e03d8h
     157        dd      0389b1a10h
    158158        dd      0
    159159        dw      0, 1
     
    162162L16_1:
    163163        dd      0
    164         dd      0387e03d8h
     164        dd      0389b1a10h
    165165        dd      0
    166166        dw      0, 1
  • trunk/src/comctl32/status.c

    r2205 r2740  
    1 /* $Id: status.c,v 1.17 1999-12-26 17:32:13 cbratschi Exp $ */
     1/* $Id: status.c,v 1.18 2000-02-10 18:51:19 cbratschi Exp $ */
    22/*
    33 * Interface code to StatusWindow widget/control
     
    853853    int         width, len;
    854854    HDC hdc;
    855     STATUSWINDOWINFO *self;
    856 
    857     self = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
    858     SetWindowLongA (hwnd, 0, (DWORD)self);
    859 
    860     self->numParts = 1;
    861     self->parts = 0;
    862     self->simple = FALSE;
    863     self->clrBk = CLR_DEFAULT;
    864     self->hFont = 0;
     855    STATUSWINDOWINFO *infoPtr;
     856
     857    infoPtr = (STATUSWINDOWINFO*)COMCTL32_Alloc (sizeof(STATUSWINDOWINFO));
     858    SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
     859
     860    infoPtr->numParts = 1;
     861    infoPtr->parts = 0;
     862    infoPtr->simple = FALSE;
     863    infoPtr->clrBk = CLR_DEFAULT;
     864    infoPtr->hFont = 0;
    865865    GetClientRect (hwnd, &rect);
    866866
    867867    nclm.cbSize = sizeof(NONCLIENTMETRICSA);
    868868    SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
    869     self->hDefaultFont = CreateFontIndirectA (&nclm.lfStatusFont);
     869    infoPtr->hDefaultFont = CreateFontIndirectA (&nclm.lfStatusFont);
    870870
    871871    /* initialize simple case */
    872     self->part0.bound = rect;
    873     self->part0.text = 0;
    874     self->part0.x = 0;
    875     self->part0.style = 0;
    876     self->part0.hIcon = 0;
     872    infoPtr->part0.bound = rect;
     873    infoPtr->part0.text = 0;
     874    infoPtr->part0.x = 0;
     875    infoPtr->part0.style = 0;
     876    infoPtr->part0.hIcon = 0;
    877877
    878878    /* initialize first part */
    879     self->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART));
    880     self->parts[0].bound = rect;
    881     self->parts[0].text = 0;
    882     self->parts[0].x = -1;
    883     self->parts[0].style = 0;
    884     self->parts[0].hIcon = 0;
     879    infoPtr->parts = COMCTL32_Alloc (sizeof(STATUSWINDOWPART));
     880    infoPtr->parts[0].bound = rect;
     881    infoPtr->parts[0].text = 0;
     882    infoPtr->parts[0].x = -1;
     883    infoPtr->parts[0].style = 0;
     884    infoPtr->parts[0].hIcon = 0;
    885885
    886886    if (IsWindowUnicode (hwnd)) {
    887         self->bUnicode = TRUE;
     887        infoPtr->bUnicode = TRUE;
    888888        if (lpCreate->lpszName &&
    889889            (len = lstrlenW ((LPCWSTR)lpCreate->lpszName))) {
    890             self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    891             lstrcpyW (self->parts[0].text, (LPCWSTR)lpCreate->lpszName);
     890            infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     891            lstrcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
    892892        }
    893893    }
     
    895895        if (lpCreate->lpszName &&
    896896            (len = lstrlenA ((LPCSTR)lpCreate->lpszName))) {
    897             self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    898             lstrcpyAtoW (self->parts[0].text, (char*)lpCreate->lpszName);
     897            infoPtr->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     898            lstrcpyAtoW (infoPtr->parts[0].text, (char*)lpCreate->lpszName);
    899899        }
    900900    }
     
    905905        HFONT hOldFont;
    906906
    907         hOldFont = SelectObject (hdc,self->hDefaultFont);
     907        hOldFont = SelectObject (hdc,infoPtr->hDefaultFont);
    908908        GetTextMetricsA(hdc, &tm);
    909         self->textHeight = tm.tmHeight;
     909        infoPtr->textHeight = tm.tmHeight;
    910910        SelectObject (hdc, hOldFont);
    911911        ReleaseDC(0, hdc);
     
    913913
    914914    if (GetWindowLongA (hwnd, GWL_STYLE) & SBT_TOOLTIPS) {
    915         self->hwndToolTip =
     915        infoPtr->hwndToolTip =
    916916            CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0,
    917917                               CW_USEDEFAULT, CW_USEDEFAULT,
     
    920920                             GetWindowLongA (hwnd, GWL_HINSTANCE), NULL);
    921921
    922         if (self->hwndToolTip) {
     922        if (infoPtr->hwndToolTip) {
    923923            NMTOOLTIPSCREATED nmttc;
    924924
     
    926926            nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
    927927            nmttc.hdr.code = NM_TOOLTIPSCREATED;
    928             nmttc.hwndToolTips = self->hwndToolTip;
     928            nmttc.hwndToolTips = infoPtr->hwndToolTip;
    929929
    930930            SendMessageA (GetParent (hwnd), WM_NOTIFY,
     
    935935    GetClientRect (GetParent (hwnd), &rect);
    936936    width = rect.right - rect.left;
    937     self->height = self->textHeight + 4 + VERT_BORDER;
    938     MoveWindow (hwnd, lpCreate->x, lpCreate->y-1,
    939                   width, self->height, FALSE);
     937    infoPtr->height = infoPtr->textHeight + 4 + VERT_BORDER;
     938//CB: todo: find bug!
     939infoPtr->height += 4;
     940    MoveWindow(hwnd,lpCreate->x,lpCreate->y-1,width,infoPtr->height,FALSE);
    940941    STATUSBAR_SetPartBounds (hwnd);
    941942
  • trunk/src/comctl32/treeview.c

    r2635 r2740  
    1 /* $Id: treeview.c,v 1.22 2000-02-04 17:02:09 cbratschi Exp $ */
     1/* $Id: treeview.c,v 1.23 2000-02-10 18:51:19 cbratschi Exp $ */
    22/* Treeview control
    33 *
     
    6565  ((TREEVIEW_INFO *) GetWindowLongA( hwnd, 0))
    6666
    67 static BOOL
    68 TREEVIEW_SendSimpleNotify (HWND hwnd, UINT code);
    69 static BOOL
    70 TREEVIEW_SendTreeviewNotify (HWND hwnd, UINT code, UINT action,
    71                         HTREEITEM oldItem, HTREEITEM newItem);
    72 static BOOL
    73 TREEVIEW_SendTreeviewDnDNotify (HWND hwnd, UINT code, HTREEITEM dragItem,
    74                         POINT pt);
    75 static BOOL
    76 TREEVIEW_SendDispInfoNotify (HWND hwnd, TREEVIEW_ITEM *wineItem,
    77                         UINT code, UINT what);
    78 static BOOL
    79 TREEVIEW_SendCustomDrawNotify (HWND hwnd, DWORD dwDrawStage, HDC hdc,
    80                         RECT rc);
    81 static BOOL
    82 TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
    83             TREEVIEW_ITEM *tvItem, UINT uItemDrawState);
    84 static LRESULT
    85 TREEVIEW_DoSelectItem (HWND hwnd, INT action, HTREEITEM newSelect, INT cause);
    86 static void
    87 TREEVIEW_Refresh (HWND hwnd,HDC hdc);
    88 
    89 static LRESULT CALLBACK
    90 TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam,
    91                                                         LPARAM lParam);
    92 
    93 LRESULT WINAPI
    94 TREEVIEW_EndEditLabelNow (HWND hwnd, WPARAM wParam, LPARAM lParam);
    95 
    96 
    97 
     67static BOOL    TREEVIEW_SendSimpleNotify (HWND hwnd, UINT code);
     68static BOOL    TREEVIEW_SendTreeviewNotify (HWND hwnd, UINT code, UINT action, HTREEITEM oldItem, HTREEITEM newItem);
     69static BOOL    TREEVIEW_SendTreeviewDnDNotify (HWND hwnd, UINT code, HTREEITEM dragItem, POINT pt);
     70static BOOL    TREEVIEW_SendDispInfoNotify (HWND hwnd, TREEVIEW_ITEM *wineItem, UINT code, UINT what);
     71static BOOL    TREEVIEW_SendCustomDrawNotify (HWND hwnd, DWORD dwDrawStage, HDC hdc, RECT rc);
     72static BOOL    TREEVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc, TREEVIEW_ITEM *tvItem, UINT uItemDrawState);
     73static LRESULT TREEVIEW_DoSelectItem (HWND hwnd, INT action, HTREEITEM newSelect, INT cause);
     74static void    TREEVIEW_Refresh(HWND hwnd);
     75static void    TREEVIEW_Draw(HWND hwnd,HDC hdc,RECT *updateRect);
     76
     77static LRESULT CALLBACK TREEVIEW_Edit_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
     78
     79LRESULT WINAPI TREEVIEW_EndEditLabelNow (HWND hwnd, WPARAM wParam, LPARAM lParam);
    9880
    9981/* helper functions. Work with the assumption that validity of operands
     
    383365
    384366
    385 
    386 
    387 
    388 
    389 
    390367static LRESULT
    391368TREEVIEW_GetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
     
    502479{
    503480  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    504   HDC hdc;
    505481
    506482  //FIXME("%d %ld\n",wParam,lParam);
     
    511487  infoPtr->insertMarkItem=(HTREEITEM) lParam;
    512488
    513   hdc = GetDC(hwnd);
    514   TREEVIEW_Refresh(hwnd,hdc);
    515   ReleaseDC(hwnd,hdc);
     489  //CB: todo
     490  TREEVIEW_Refresh(hwnd);
    516491
    517492  return 1;
     
    912887  HTREEITEM     *iItem;
    913888  LPRECT        lpRect   = (LPRECT)lParam;
    914   HDC hdc;
    915889
    916890//  TRACE (treeview,"\n");
     
    920894  if (lpRect == NULL)
    921895    return FALSE;
    922 
    923   if (infoPtr->Timer & TV_REFRESH_TIMER_SET)
    924   {
    925     hdc = GetDC(hwnd);
    926     TREEVIEW_Refresh(hwnd,hdc);        /* we want a rect for the current view */
    927     ReleaseDC(hwnd,hdc);
    928   }
    929896
    930897  /*
     
    965932  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    966933
     934  //CB: todo: that's the number of completely visible items
     935
    967936  return (LRESULT) infoPtr->uVisibleHeight / infoPtr->uRealItemHeight;
    968937}
     
    10461015}
    10471016
     1017static void TREEVIEW_RefreshItem(HWND hwnd,TREEVIEW_ITEM *item)
     1018{
     1019  if (item && item->visible)
     1020  {
     1021    //CB: todo: only redraw text and icon
     1022    InvalidateRect(hwnd,&item->rect,TRUE);
     1023  }
     1024}
     1025
     1026static void TREEVIEW_Refresh(HWND hwnd)
     1027{
     1028  InvalidateRect(hwnd,NULL,TRUE);
     1029}
     1030
     1031static void TREEVIEW_CalcItems(HWND hwnd)
     1032{
     1033  //CB: todo: TREEVIEW_Draw should only draw, not calculate!
     1034}
     1035
     1036static void TREEVIEW_SetScrollbars(HWND hwnd)
     1037{
     1038  //CB: todo: dito
     1039}
     1040
     1041static int TREEVIEW_GetFirstVisibleItem(HWND hwnd)
     1042{
     1043  //CB: todo
     1044
     1045  return 0;
     1046}
     1047
    10481048static void
    1049 TREEVIEW_Refresh (HWND hwnd,HDC hdc)
    1050 
     1049TREEVIEW_Draw(HWND hwnd,HDC hdc,RECT *updateRect)
    10511050{
    10521051    TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    10531052    TEXTMETRICA tm;
    10541053    HBRUSH hbrBk;
    1055     RECT rect;
     1054    RECT rect,view;
    10561055    INT iItem, indent, x, y, cx, height, itemHeight;
    1057     INT viewtop,viewbottom,viewleft,viewright;
    10581056    TREEVIEW_ITEM *wineItem, *prevItem;
    10591057
    10601058    //TRACE("\n");
    1061 
    1062     if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
    1063                 KillTimer (hwnd, TV_REFRESH_TIMER);
    1064                 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET;
    1065     }
    1066 
    10671059
    10681060    GetClientRect (hwnd, &rect);
     
    10771069    infoPtr->uVisibleWidth= rect.right-rect.left;
    10781070
    1079     viewtop=infoPtr->cy;
    1080     viewbottom=infoPtr->cy + rect.bottom-rect.top;
    1081     viewleft=infoPtr->cx;
    1082     viewright=infoPtr->cx + rect.right-rect.left;
     1071    view = updateRect ? *updateRect:rect;
     1072    view.left = 0;
     1073    view.right = rect.right;
     1074    OffsetRect(&view,infoPtr->cx,infoPtr->cy);
    10831075
    10841076    /* draw background */
     
    10931085    indent=0;
    10941086    x=y=0;
    1095     //TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright);
    10961087
    10971088    while (iItem) {
     
    11101101        infoPtr->uRealItemHeight=itemHeight;
    11111102
    1112 
    1113 /* FIXME: remove this in later stage  */
    1114 /*
    1115                 if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A)
    1116                 TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x,
    1117                         wineItem->rect.top, wineItem->rect.bottom,
    1118                         wineItem->rect.left, wineItem->rect.right,
    1119                         wineItem->pszText);
    1120                 else
    1121                 TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n",
    1122                                 wineItem->hItem,
    1123                                 wineItem->rect.top, wineItem->rect.bottom,
    1124                                 wineItem->rect.left, wineItem->rect.right);
    1125 */
    1126 
    11271103                height=itemHeight * wineItem->iIntegral +1;
    1128                 if ((y >= viewtop) && (y <= viewbottom) &&
    1129                 (x >= viewleft  ) && (x <= viewright)) {
     1104                if ((((y >= view.top) && (y <= view.bottom)) || ((y+height >= view.top) && (y+height <= view.bottom))) &&
     1105                    (x >= view.left) && (x <= view.right))
     1106                {
    11301107                                wineItem->visible = TRUE;
    11311108                        wineItem->rect.top = y - infoPtr->cy + rect.top;
     
    11711148
    11721149    infoPtr->uTotalHeight=y;
    1173     if (y >= (viewbottom-viewtop)) {
     1150    if (y >= (view.bottom-view.top)) {
    11741151                if (!(infoPtr->uInternalStatus & TV_VSCROLL))
    11751152                        ShowScrollBar (hwnd, SB_VERT, TRUE);
     
    12021179
    12031180  switch (wParam) {
    1204         case TV_REFRESH_TIMER:
    1205                 KillTimer (hwnd, TV_REFRESH_TIMER);
    1206                 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET;
    1207     InvalidateRect(hwnd, NULL, FALSE);
    1208                 return 0;
    12091181        case TV_EDIT_TIMER:
    12101182                KillTimer (hwnd, TV_EDIT_TIMER);
     
    12181190 return 1;
    12191191}
    1220 
    1221 
    1222 static void
    1223 TREEVIEW_QueueRefresh (HWND hwnd)
    1224 
    1225 {
    1226  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    1227 
    1228 // TRACE (treeview,"\n");
    1229  if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
    1230         KillTimer (hwnd, TV_REFRESH_TIMER);
    1231  }
    1232 
    1233  SetTimer (hwnd, TV_REFRESH_TIMER, TV_REFRESH_DELAY, 0);
    1234  infoPtr->Timer|=TV_REFRESH_TIMER_SET;
    1235 }
    1236 
    1237 
    12381192
    12391193static LRESULT
     
    13121266  TREEVIEW_ITEM *wineItem, *returnItem;
    13131267  INT iItem, retval, flag;
    1314   HDC hdc;
    13151268
    13161269  flag  = (INT) wParam;
     
    13221275        case TVGN_CARET:retval=(INT)infoPtr->selectedItem;
    13231276                                        break;
    1324         case TVGN_FIRSTVISIBLE: /* FIXME:we should only recalculate, not redraw */
    1325                                         hdc = GetDC (hwnd);
    1326                                         TREEVIEW_Refresh (hwnd, hdc);
    1327                                         ReleaseDC(hwnd,hdc);
    1328                                         retval=(INT)infoPtr->firstVisible;
    1329                                         break;
     1277        case TVGN_FIRSTVISIBLE: /* FIXME:we should only recalculate, not redraw */
     1278                                        //CB: todo: remove
     1279                                        TREEVIEW_Refresh(hwnd);
     1280                                        retval=(INT)infoPtr->firstVisible;
     1281                                        break;
    13301282        case TVGN_DROPHILITE:
    13311283                                        retval=(INT)infoPtr->dropItem;
     
    19831935   }
    19841936
    1985    TREEVIEW_QueueRefresh (hwnd);
     1937   //CB: todo: calc
     1938   TREEVIEW_Refresh(hwnd);
    19861939
    19871940   return (LRESULT) iItem;
     
    20592012  }
    20602013
    2061   TREEVIEW_QueueRefresh (hwnd);
     2014  //CB: todo: calc
     2015  TREEVIEW_Refresh(hwnd);
    20622016
    20632017  return TRUE;
     
    22362190  }
    22372191
    2238   TREEVIEW_QueueRefresh (hwnd);
     2192  //CB: todo: calc
     2193  TREEVIEW_Refresh(hwnd);
    22392194  return 0;
    22402195}
     
    22442199TREEVIEW_StyleChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
    22452200{
    2246   HDC hdc;
    2247 
    22482201  //TRACE("(%x %lx)\n",wParam,lParam);
    2249   hdc = GetDC (hwnd);
    2250   TREEVIEW_Refresh (hwnd, hdc);
    2251   ReleaseDC(hwnd,hdc);
     2202  //CB: todo: calc
     2203  TREEVIEW_Refresh (hwnd);
    22522204
    22532205  return 0;
     
    23092261    infoPtr->pCallBackSort=NULL;
    23102262    infoPtr->uScrollTime = 300;  /* milliseconds */
    2311         infoPtr->wpEditOrig = NULL; /* we haven't subclassed anything yet */
     2263        infoPtr->wpEditOrig = NULL; /* we haven't subclassed anything yet */
    23122264        infoPtr->hwndToolTip=0;
    23132265    if (!(dwStyle & TVS_NOTOOLTIPS)) {   /* Create tooltip control */
     
    23892341   SetWindowLongA( hwnd, 0, (DWORD)NULL);
    23902342
    2391    if (infoPtr->Timer & TV_REFRESH_TIMER_SET)
    2392         KillTimer (hwnd, TV_REFRESH_TIMER);
    23932343   if (infoPtr->hwndToolTip)
    23942344                DestroyWindow (infoPtr->hwndToolTip);
     
    24082358//    TRACE (treeview,"\n");
    24092359    hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
    2410     TREEVIEW_Refresh (hwnd,hdc);
     2360    TREEVIEW_Draw(hwnd,hdc,&ps.rcPaint);
    24112361    if(!wParam)
    24122362        EndPaint (hwnd, &ps);
     
    24202370{
    24212371   TREEVIEW_SendSimpleNotify (hwnd, NM_SETFOCUS);
    2422    InvalidateRect(hwnd, NULL, FALSE);
     2372
     2373   //CB: todo: focus item
     2374
    24232375   return 0;
    24242376}
     
    24282380{
    24292381   TREEVIEW_SendSimpleNotify (hwnd, NM_KILLFOCUS);
    2430    InvalidateRect(hwnd, NULL, FALSE);
     2382
     2383   //CB: todo: focus item
     2384
    24312385   return 0;
    24322386}
     
    28282782//    wineItem->state);
    28292783
    2830   TREEVIEW_QueueRefresh (hwnd);
     2784  //CB: todo: replace
     2785  TREEVIEW_Refresh(hwnd);
    28312786  return TRUE;
    28322787}
     
    31193074                        wineItem->state|=state<<12;
    31203075                        //TRACE ("state:%x\n", wineItem->state);
    3121                         TREEVIEW_QueueRefresh (hwnd);
     3076                        TREEVIEW_Refresh(hwnd);
    31223077                }
    31233078  }
     
    33003255      infoPtr->selectedItem=(HTREEITEM)newSelect;
    33013256
     3257      TREEVIEW_RefreshItem(hwnd,prevItem);
     3258      TREEVIEW_RefreshItem(hwnd,wineItem);
     3259
    33023260      TREEVIEW_SendTreeviewNotify(
    33033261        hwnd,
     
    33203278        wineItem->state |=TVIS_DROPHILITED;
    33213279
     3280      TREEVIEW_RefreshItem(hwnd,prevItem);
     3281      TREEVIEW_RefreshItem(hwnd,wineItem);
     3282
    33223283      break;
    33233284
     
    33263287      break;
    33273288 }
    3328 
    3329  TREEVIEW_QueueRefresh (hwnd);
    33303289
    33313290//  TRACE (treeview,"Leaving state %d\n", wineItem->state);
     
    33843343 ReleaseDC (0, hdc);
    33853344
     3345 //CB: todo: calc
    33863346 if (lParam)
    3387         TREEVIEW_QueueRefresh (hwnd);
     3347        TREEVIEW_Refresh(hwnd);
    33883348
    33893349 return 0;
     
    33983358  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    33993359  int maxHeight;
     3360  int lastPos = infoPtr->cy;
    34003361
    34013362//  TRACE (treeview,"wp %x, lp %lx\n", wParam, lParam);
     
    34333394  }
    34343395
    3435   TREEVIEW_QueueRefresh (hwnd);
     3396  ScrollWindowEx(hwnd,0,lastPos-infoPtr->cy,NULL,NULL,0,NULL,SW_INVALIDATE);
     3397
    34363398  return TRUE;
    34373399}
     
    34783440  }
    34793441
    3480   TREEVIEW_QueueRefresh (hwnd);
     3442  TREEVIEW_Refresh(hwnd);
     3443
     3444  //CB: todo: use ScrollWindowEx
     3445
    34813446  return TRUE;
    34823447}
     
    36853650{
    36863651   if (uMsg==WM_CREATE)
    3687                 return TREEVIEW_Create (hwnd, wParam, lParam);
     3652                return TREEVIEW_Create (hwnd, wParam, lParam);
    36883653
    36893654   if (!TREEVIEW_GetInfoPtr(hwnd))
     
    39283893
    39293894    ZeroMemory (&wndClass, sizeof(WNDCLASSA));
    3930     wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS;
     3895    wndClass.style         = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
    39313896    wndClass.lpfnWndProc   = (WNDPROC)TREEVIEW_WindowProc;
    39323897    wndClass.cbClsExtra    = 0;
Note: See TracChangeset for help on using the changeset viewer.