Changeset 1668 for trunk/src/comctl32/treeview.c
- Timestamp:
- Nov 9, 1999, 6:09:27 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/treeview.c
r1614 r1668 1 /* $Id: treeview.c,v 1.1 4 1999-11-05 12:53:06 phallerExp $ */1 /* $Id: treeview.c,v 1.15 1999-11-09 17:09:27 cbratschi Exp $ */ 2 2 /* Treeview control 3 3 * … … 496 496 { 497 497 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 498 499 TRACE("\n");498 499 //TRACE("\n"); 500 500 return (LRESULT) infoPtr->clrBk; 501 501 } … … 507 507 COLORREF prevColor=infoPtr->clrBk; 508 508 509 TRACE("\n");509 //TRACE("\n"); 510 510 infoPtr->clrBk=(COLORREF) lParam; 511 511 return (LRESULT) prevColor; … … 516 516 { 517 517 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 518 519 TRACE("\n");518 519 //TRACE("\n"); 520 520 return (LRESULT) infoPtr->clrText; 521 521 } … … 948 948 { 949 949 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 950 951 950 TEXTMETRICA tm; 951 HBRUSH hbrBk; 952 952 RECT rect; 953 953 HDC hdc; 954 954 INT iItem, indent, x, y, cx, height, itemHeight; 955 955 INT viewtop,viewbottom,viewleft,viewright; 956 956 TREEVIEW_ITEM *wineItem, *prevItem; 957 957 958 TRACE("\n");959 960 958 //TRACE("\n"); 959 960 hdc=GetDC (hwnd); 961 961 962 962 if (infoPtr->Timer & TV_REFRESH_TIMER_SET) { 963 964 963 KillTimer (hwnd, TV_REFRESH_TIMER); 964 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET; 965 965 } 966 966 … … 970 970 971 971 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify 972 973 974 975 976 977 978 979 980 972 (hwnd, CDDS_PREPAINT, hdc, rect); 973 974 if (infoPtr->cdmode==CDRF_SKIPDEFAULT) { 975 ReleaseDC (hwnd, hdc); 976 return; 977 } 978 979 infoPtr->uVisibleHeight= rect.bottom-rect.top; 980 infoPtr->uVisibleWidth= rect.right-rect.left; 981 981 982 982 viewtop=infoPtr->cy; … … 996 996 indent=0; 997 997 x=y=0; 998 TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright);998 //TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright); 999 999 1000 1000 while (iItem) { 1001 1001 prevItem=wineItem; 1002 1002 wineItem= & infoPtr->items[iItem]; 1003 1003 wineItem->iLevel=indent; 1004 1004 1005 1005 ImageList_GetIconSize (infoPtr->himlNormal, &cx, &itemHeight); 1006 1006 if (infoPtr->uItemHeight>itemHeight) 1007 1008 1009 1010 1011 1012 1013 infoPtr->uRealItemHeight=itemHeight; 1007 itemHeight=infoPtr->uItemHeight; 1008 1009 GetTextMetricsA (hdc, &tm); 1010 if ((tm.tmHeight + tm.tmExternalLeading) > itemHeight) 1011 itemHeight=tm.tmHeight + tm.tmExternalLeading; 1012 1013 infoPtr->uRealItemHeight=itemHeight; 1014 1014 1015 1015 1016 1016 /* FIXME: remove this in later stage */ 1017 1017 /* 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1018 if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A) 1019 TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x, 1020 wineItem->rect.top, wineItem->rect.bottom, 1021 wineItem->rect.left, wineItem->rect.right, 1022 wineItem->pszText); 1023 else 1024 TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n", 1025 wineItem->hItem, 1026 wineItem->rect.top, wineItem->rect.bottom, 1027 wineItem->rect.left, wineItem->rect.right); 1028 1028 */ 1029 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 if (x>infoPtr->uTotalWidth) 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1030 height=itemHeight * wineItem->iIntegral +1; 1031 if ((y >= viewtop) && (y <= viewbottom) && 1032 (x >= viewleft ) && (x <= viewright)) { 1033 wineItem->visible = TRUE; 1034 wineItem->rect.top = y - infoPtr->cy + rect.top; 1035 wineItem->rect.bottom = wineItem->rect.top + height ; 1036 wineItem->rect.left = x - infoPtr->cx + rect.left; 1037 wineItem->rect.right = rect.right; 1038 if (!infoPtr->firstVisible) 1039 infoPtr->firstVisible=wineItem->hItem; 1040 TREEVIEW_DrawItem (hwnd, hdc, wineItem); 1041 } 1042 else { 1043 wineItem->visible = FALSE; 1044 wineItem->rect.left = wineItem->rect.top = 0; 1045 wineItem->rect.right= wineItem->rect.bottom = 0; 1046 wineItem->text.left = wineItem->text.top = 0; 1047 wineItem->text.right= wineItem->text.bottom = 0; 1048 } 1049 1050 /* look up next item */ 1051 1052 if ((wineItem->firstChild) && (wineItem->state & TVIS_EXPANDED)) { 1053 iItem=(INT)wineItem->firstChild; 1054 indent++; 1055 x+=infoPtr->uIndent; 1056 if (x>infoPtr->uTotalWidth) 1057 infoPtr->uTotalWidth=x; 1058 } 1059 else { 1060 iItem=(INT)wineItem->sibling; 1061 while ((!iItem) && (indent>0)) { 1062 indent--; 1063 x-=infoPtr->uIndent; 1064 prevItem=wineItem; 1065 wineItem=&infoPtr->items[(INT)wineItem->parent]; 1066 iItem=(INT)wineItem->sibling; 1067 } 1068 } 1069 1069 y +=height; 1070 } 1070 } /* while */ 1071 1071 1072 1072 /* FIXME: infoPtr->uTotalWidth should also take item label into account */ … … 1075 1075 infoPtr->uTotalHeight=y; 1076 1076 if (y >= (viewbottom-viewtop)) { 1077 1078 1079 1080 1081 1082 1083 1077 if (!(infoPtr->uInternalStatus & TV_VSCROLL)) 1078 ShowScrollBar (hwnd, SB_VERT, TRUE); 1079 infoPtr->uInternalStatus |=TV_VSCROLL; 1080 SetScrollRange (hwnd, SB_VERT, 0, 1081 y - infoPtr->uVisibleHeight, FALSE); 1082 SetScrollPos (hwnd, SB_VERT, infoPtr->cy, TRUE); 1083 } 1084 1084 else { 1085 1086 1087 1088 1089 1090 1091 1092 1093 1085 if (infoPtr->uInternalStatus & TV_VSCROLL) 1086 ShowScrollBar (hwnd, SB_VERT, FALSE); 1087 infoPtr->uInternalStatus &= ~TV_VSCROLL; 1088 } 1089 1090 1091 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) 1092 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify 1093 (hwnd, CDDS_POSTPAINT, hdc, rect); 1094 1094 1095 1095 ReleaseDC (hwnd, hdc); 1096 TRACE("done\n");1096 //TRACE("done\n"); 1097 1097 } 1098 1098 … … 1468 1468 if (!TREEVIEW_ValidItem(infoPtr, parent)) 1469 1469 { 1470 ERR ("invalid item hParent=%x\n", (INT)parent);1470 //ERR ("invalid item hParent=%x\n", (INT)parent); 1471 1471 return FALSE; 1472 1472 } … … 1732 1732 switch ((DWORD) ptdi->hInsertAfter) { 1733 1733 case (DWORD) TVI_FIRST: 1734 1734 if (sibItem==wineItem) break; 1735 1735 if (wineItem->parent) { 1736 1736 wineItem->sibling=parentItem->firstChild;
Note:
See TracChangeset
for help on using the changeset viewer.