Changeset 1565 for trunk/src/comctl32/treeview.c
- Timestamp:
- Nov 2, 1999, 10:44:04 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/treeview.c
r1444 r1565 1 /* $Id: treeview.c,v 1.1 2 1999-10-25 19:37:21 phallerExp $ */1 /* $Id: treeview.c,v 1.13 1999-11-02 21:44:04 achimha Exp $ */ 2 2 /* Treeview control 3 3 * … … 42 42 */ 43 43 44 /* WINE 991031 level */ 45 44 46 #include <string.h> 45 47 #include "winbase.h" … … 495 497 { 496 498 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 497 498 // TRACE (treeview,"\n");499 return (LRESULT) infoPtr->clr Text;499 500 TRACE("\n"); 501 return (LRESULT) infoPtr->clrBk; 500 502 } 501 503 … … 506 508 COLORREF prevColor=infoPtr->clrBk; 507 509 508 // TRACE (treeview,"\n");510 TRACE("\n"); 509 511 infoPtr->clrBk=(COLORREF) lParam; 510 512 return (LRESULT) prevColor; … … 515 517 { 516 518 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 517 518 // TRACE (treeview,"\n");519 return (LRESULT) infoPtr->clr Bk;519 520 TRACE("\n"); 521 return (LRESULT) infoPtr->clrText; 520 522 } 521 523 … … 947 949 { 948 950 TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd); 949 950 951 TEXTMETRICA tm; 952 HBRUSH hbrBk; 951 953 RECT rect; 952 954 HDC hdc; 953 955 INT iItem, indent, x, y, cx, height, itemHeight; 954 956 INT viewtop,viewbottom,viewleft,viewright; 955 957 TREEVIEW_ITEM *wineItem, *prevItem; 956 958 957 // TRACE (treeview,"\n");958 959 959 TRACE("\n"); 960 961 hdc=GetDC (hwnd); 960 962 961 963 if (infoPtr->Timer & TV_REFRESH_TIMER_SET) { 962 963 964 KillTimer (hwnd, TV_REFRESH_TIMER); 965 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET; 964 966 } 965 967 966 968 967 969 GetClientRect (hwnd, &rect); 968 970 if ((rect.left-rect.right ==0) || (rect.top-rect.bottom==0)) return; 969 971 970 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify 971 972 973 974 975 976 977 978 979 972 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify 973 (hwnd, CDDS_PREPAINT, hdc, rect); 974 975 if (infoPtr->cdmode==CDRF_SKIPDEFAULT) { 976 ReleaseDC (hwnd, hdc); 977 return; 978 } 979 980 infoPtr->uVisibleHeight= rect.bottom-rect.top; 981 infoPtr->uVisibleWidth= rect.right-rect.left; 980 982 981 983 viewtop=infoPtr->cy; … … 984 986 viewright=infoPtr->cx + rect.right-rect.left; 985 987 986 987 988 988 /* draw background */ 989 990 hbrBk = GetSysColorBrush (COLOR_WINDOW);989 990 hbrBk = CreateSolidBrush (infoPtr->clrBk); 991 991 FillRect(hdc, &rect, hbrBk); 992 992 DeleteObject(hbrBk); 993 993 994 994 iItem=(INT)infoPtr->TopRootItem; … … 997 997 indent=0; 998 998 x=y=0; 999 // TRACE (treeview,"[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright);999 TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright); 1000 1000 1001 1001 while (iItem) { 1002 1002 prevItem=wineItem; 1003 1003 wineItem= & infoPtr->items[iItem]; 1004 1004 wineItem->iLevel=indent; 1005 1005 1006 1006 ImageList_GetIconSize (infoPtr->himlNormal, &cx, &itemHeight); 1007 1007 if (infoPtr->uItemHeight>itemHeight) 1008 1009 1010 1011 1012 1013 1014 infoPtr->uRealItemHeight=itemHeight; 1008 itemHeight=infoPtr->uItemHeight; 1009 1010 GetTextMetricsA (hdc, &tm); 1011 if ((tm.tmHeight + tm.tmExternalLeading) > itemHeight) 1012 itemHeight=tm.tmHeight + tm.tmExternalLeading; 1013 1014 infoPtr->uRealItemHeight=itemHeight; 1015 1015 1016 1016 1017 1017 /* FIXME: remove this in later stage */ 1018 1018 /* 1019 // if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A) 1020 //TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x,1021 //wineItem->rect.top, wineItem->rect.bottom,1022 //wineItem->rect.left, wineItem->rect.right,1023 //wineItem->pszText);1024 // else 1025 //TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n",1026 //wineItem->hItem,1027 //wineItem->rect.top, wineItem->rect.bottom,1028 //wineItem->rect.left, wineItem->rect.right);1019 if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A) 1020 TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x, 1021 wineItem->rect.top, wineItem->rect.bottom, 1022 wineItem->rect.left, wineItem->rect.right, 1023 wineItem->pszText); 1024 else 1025 TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n", 1026 wineItem->hItem, 1027 wineItem->rect.top, wineItem->rect.bottom, 1028 wineItem->rect.left, wineItem->rect.right); 1029 1029 */ 1030 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 1057 if (x>infoPtr->uTotalWidth) 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1031 height=itemHeight * wineItem->iIntegral +1; 1032 if ((y >= viewtop) && (y <= viewbottom) && 1033 (x >= viewleft ) && (x <= viewright)) { 1034 wineItem->visible = TRUE; 1035 wineItem->rect.top = y - infoPtr->cy + rect.top; 1036 wineItem->rect.bottom = wineItem->rect.top + height ; 1037 wineItem->rect.left = x - infoPtr->cx + rect.left; 1038 wineItem->rect.right = rect.right; 1039 if (!infoPtr->firstVisible) 1040 infoPtr->firstVisible=wineItem->hItem; 1041 TREEVIEW_DrawItem (hwnd, hdc, wineItem); 1042 } 1043 else { 1044 wineItem->visible = FALSE; 1045 wineItem->rect.left = wineItem->rect.top = 0; 1046 wineItem->rect.right= wineItem->rect.bottom = 0; 1047 wineItem->text.left = wineItem->text.top = 0; 1048 wineItem->text.right= wineItem->text.bottom = 0; 1049 } 1050 1051 /* look up next item */ 1052 1053 if ((wineItem->firstChild) && (wineItem->state & TVIS_EXPANDED)) { 1054 iItem=(INT)wineItem->firstChild; 1055 indent++; 1056 x+=infoPtr->uIndent; 1057 if (x>infoPtr->uTotalWidth) 1058 infoPtr->uTotalWidth=x; 1059 } 1060 else { 1061 iItem=(INT)wineItem->sibling; 1062 while ((!iItem) && (indent>0)) { 1063 indent--; 1064 x-=infoPtr->uIndent; 1065 prevItem=wineItem; 1066 wineItem=&infoPtr->items[(INT)wineItem->parent]; 1067 iItem=(INT)wineItem->sibling; 1068 } 1069 } 1070 1070 y +=height; 1071 } 1071 } /* while */ 1072 1072 1073 1073 /* FIXME: infoPtr->uTotalWidth should also take item label into account */ … … 1076 1076 infoPtr->uTotalHeight=y; 1077 1077 if (y >= (viewbottom-viewtop)) { 1078 1079 1080 1081 SetScrollRange (hwnd, SB_VERT, 0,1082 1083 1084 1078 if (!(infoPtr->uInternalStatus & TV_VSCROLL)) 1079 ShowScrollBar (hwnd, SB_VERT, TRUE); 1080 infoPtr->uInternalStatus |=TV_VSCROLL; 1081 SetScrollRange (hwnd, SB_VERT, 0, 1082 y - infoPtr->uVisibleHeight, FALSE); 1083 SetScrollPos (hwnd, SB_VERT, infoPtr->cy, TRUE); 1084 } 1085 1085 else { 1086 if (infoPtr->uInternalStatus & TV_VSCROLL) 1087 1088 1089 1090 1091 1092 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) 1093 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify1094 1086 if (infoPtr->uInternalStatus & TV_VSCROLL) 1087 ShowScrollBar (hwnd, SB_VERT, FALSE); 1088 infoPtr->uInternalStatus &= ~TV_VSCROLL; 1089 } 1090 1091 1092 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) 1093 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify 1094 (hwnd, CDDS_POSTPAINT, hdc, rect); 1095 1095 1096 1096 ReleaseDC (hwnd, hdc); 1097 // TRACE (treeview,"done\n");1097 TRACE("done\n"); 1098 1098 } 1099 1099 … … 1733 1733 switch ((DWORD) ptdi->hInsertAfter) { 1734 1734 case (DWORD) TVI_FIRST: 1735 if (sibItem==wineItem) break; 1735 1736 if (wineItem->parent) { 1736 1737 wineItem->sibling=parentItem->firstChild;
Note:
See TracChangeset
for help on using the changeset viewer.