- Timestamp:
- Nov 2, 1999, 10:44:04 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 1 added
- 9 edited
-
comctl32.def (modified) (2 diffs)
-
comctl32undoc.c (modified) (4 diffs)
-
listview.c (modified) (47 diffs)
-
propsheet.c (modified) (36 diffs)
-
resource.asm (added)
-
rsrc.rc (modified) (2 diffs)
-
tab.c (modified) (4 diffs)
-
toolbar.c (modified) (4 diffs)
-
tooltips.c (modified) (5 diffs)
-
treeview.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/comctl32.def
r496 r1565 1 ; $Id: comctl32.def,v 1.1 1 1999-08-14 16:13:09 cbratschiExp $1 ; $Id: comctl32.def,v 1.12 1999-11-02 21:44:01 achimha Exp $ 2 2 LIBRARY COMCTL32 INITINSTANCE 3 3 DESCRIPTION 'COMCTL32 Common Controls Library' … … 122 122 StrToIntA = _COMCTL32_StrToIntA@4 @357 123 123 124 COMCTL32_StrCmpNIW = _COMCTL32_StrCmpNIW@12 @361 125 124 126 DPA_EnumCallback = _DPA_EnumCallback@12 @385 125 127 DPA_DestroyCallback = _DPA_DestroyCallback@12 @386 -
trunk/src/comctl32/comctl32undoc.c
r1058 r1565 1 /* $Id: comctl32undoc.c,v 1.1 2 1999-09-26 11:01:08achimha Exp $ */1 /* $Id: comctl32undoc.c,v 1.13 1999-11-02 21:44:01 achimha Exp $ */ 2 2 /* 3 3 * Undocumented functions from COMCTL32.DLL … … 12 12 */ 13 13 14 /* WINE 99 0923level */14 /* WINE 991031 level */ 15 15 16 16 /* CB: todo … … 1334 1334 v = lpPtrs[(int)(l+r)/2]; 1335 1335 do { 1336 while ((pfnCompare)(lpPtrs[i], v, lParam) >0) i++;1337 while ((pfnCompare)(lpPtrs[j], v, lParam) <0) j--;1336 while ((pfnCompare)(lpPtrs[i], v, lParam) < 0) i++; 1337 while ((pfnCompare)(lpPtrs[j], v, lParam) > 0) j--; 1338 1338 if (i <= j) 1339 1339 { … … 1851 1851 1852 1852 /************************************************************************** 1853 * StrCmpNIW [COMCTL32.361] 1854 * 1855 */ 1856 INT WINAPI COMCTL32_StrCmpNIW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) { 1857 // FIXME("(%s, %s, %i): stub\n", debugstr_w(lpStr1), debugstr_w(lpStr2), nChar); 1858 return 0; 1859 } 1860 1861 /************************************************************************** 1853 1862 * StrRChrA [COMCTL32.351] 1854 1863 * -
trunk/src/comctl32/listview.c
r1431 r1565 34 34 * LISTVIEW_GetISearchString : not implemented 35 35 * LISTVIEW_GetBkImage : not implemented 36 * LISTVIEW_EditLabel : REPORT (need to implement a timer)37 36 * LISTVIEW_GetColumnOrderArray : not implemented 38 37 * LISTVIEW_SetColumnOrderArray : not implemented … … 44 43 */ 45 44 46 /* WINE 99 0923level */45 /* WINE 991031 level */ 47 46 48 47 #include <string.h> … … 80 79 /* default column width for items in list display mode */ 81 80 #define DEFAULT_COLUMN_WIDTH 96 81 82 /* Increment size of the horizontal scroll bar */ 83 #define REPORT_HSCROLL_INC_SIZE 10 82 84 83 85 /* … … 91 93 /* retrieve the number of items in the listview */ 92 94 #define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount) 95 96 /* Some definitions for inline edit control */ 97 typedef BOOL (*EditlblCallback)(HWND, LPSTR, DWORD); 98 99 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 100 INT width, INT height, HWND parent, HINSTANCE hinst, 101 EditlblCallback EditLblCb, DWORD param); 102 103 typedef struct tagEDITLABEL_ITEM 104 { 105 WNDPROC EditWndProc; 106 DWORD param; 107 EditlblCallback EditLblCb; 108 } EDITLABEL_ITEM; 93 109 94 110 /* … … 129 145 static BOOL LISTVIEW_ToggleSelection(HWND, INT); 130 146 static VOID LISTVIEW_UnsupportedStyles(LONG lStyle); 131 132 /*** 133 * DESCRIPTION: 134 * Update the scrollbars. This functions should be called whenever 147 static HWND LISTVIEW_EditLabelA(HWND hwnd, INT nItem); 148 static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem); 149 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam); 150 151 /************************************************************************* 152 * LISTVIEW_UpdateHeaderSize [Internal] 153 * 154 * Function to resize the header control 155 * 156 * PARAMS 157 * hwnd [I] handle to a window 158 * nNewScrollPos [I] Scroll Pos to Set 159 * nOldScrollPos [I] Previous Scroll Pos 160 * 161 * RETURNS 162 * nothing 163 * 164 * NOTES 165 */ 166 static VOID LISTVIEW_UpdateHeaderSize(HWND hwnd, INT nNewScrollPos, INT nOldScrollPos) 167 { 168 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 169 INT nDiff = nOldScrollPos-nNewScrollPos; 170 RECT winRect; 171 POINT point[2]; 172 173 GetWindowRect(infoPtr->hwndHeader, &winRect); 174 point[0].x = winRect.left; 175 point[0].y = winRect.top; 176 point[1].x = winRect.right; 177 point[1].y = winRect.bottom; 178 179 MapWindowPoints(HWND_DESKTOP, hwnd, point, 2); 180 point[0].x += (nDiff * REPORT_HSCROLL_INC_SIZE ); 181 point[1].x -= point[0].x; 182 183 SetWindowPos(infoPtr->hwndHeader,0, 184 point[0].x,point[0].y,point[1].x,point[1].y, 185 SWP_NOZORDER | SWP_NOACTIVATE); 186 } 187 188 /*** 189 * DESCRIPTION: 190 * Update the scrollbars. This functions should be called whenever 135 191 * the content, size or view changes. 136 * 192 * 137 193 * PARAMETER(S): 138 194 * [I] HWND : window handle … … 143 199 static VOID LISTVIEW_UpdateScroll(HWND hwnd) 144 200 { 145 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 201 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 146 202 LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 147 203 UINT uView = lStyle & LVS_TYPEMASK; … … 160 216 { 161 217 /* calculate new scrollbar range */ 162 INT nHiddenItemCount = GETITEMCOUNT(infoPtr) - nCountPerPage; 163 if (nHiddenItemCount % nCountPerColumn == 0) 164 { 165 scrollInfo.nMax = nHiddenItemCount / nCountPerColumn; 218 if((GETITEMCOUNT(infoPtr) % nCountPerPage) == 0) 219 { 220 scrollInfo.nMax = GETITEMCOUNT(infoPtr) / nCountPerPage * LISTVIEW_GetCountPerRow(hwnd)-1; 166 221 } 167 222 else 168 223 { 169 scrollInfo.nMax = nHiddenItemCount / nCountPerColumn + 1;170 } 171 224 scrollInfo.nMax = (GETITEMCOUNT(infoPtr) / nCountPerPage)* LISTVIEW_GetCountPerRow(hwnd); 225 } 226 172 227 scrollInfo.nPos = ListView_GetTopIndex(hwnd) / nCountPerColumn; 173 /*scrollInfo.nPage = LISTVIEW_GetCountPerRow(hwnd);*/174 scrollInfo.fMask = SIF_RANGE | SIF_POS /*| SIF_PAGE*/;228 scrollInfo.nPage = LISTVIEW_GetCountPerRow(hwnd); 229 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 175 230 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 176 231 } … … 180 235 if (lStyle & WS_HSCROLL) 181 236 { 182 ShowScrollBar(hwnd, SB_HORZ, FALSE);237 ShowScrollBar(hwnd, SB_HORZ, FALSE); 183 238 } 184 239 } … … 186 241 else if (uView == LVS_REPORT) 187 242 { 243 RECT clientRect; 188 244 /* update vertical scrollbar */ 189 245 scrollInfo.nMin = 0; 190 scrollInfo.nMax = GETITEMCOUNT(infoPtr) - LISTVIEW_GetCountPerColumn(hwnd);246 scrollInfo.nMax = GETITEMCOUNT(infoPtr) - 1; 191 247 scrollInfo.nPos = ListView_GetTopIndex(hwnd); 192 /*scrollInfo.nPage = nCountPerColumn;*/193 scrollInfo.fMask = SIF_RANGE | SIF_POS /*| SIF_PAGE*/;248 scrollInfo.nPage = LISTVIEW_GetCountPerColumn(hwnd); 249 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 194 250 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 195 251 196 252 /* update horizontal scrollbar */ 197 /* if (infoPtr->nItemWidth > nListWidth) */ 198 /* { */ 199 /* scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; */ 200 /* SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); */ 201 /* } */ 202 203 /* horizontal scrolling has not been implemented yet! I experienced some 204 problems when performing child window scrolling. */ 253 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 254 GetClientRect(hwnd, &clientRect); 255 256 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE) 257 { 258 scrollInfo.nPos = 0; 259 } 260 scrollInfo.nMin = 0; 261 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE ; 262 scrollInfo.nPage = (clientRect.right - clientRect.left) / REPORT_HSCROLL_INC_SIZE; 263 scrollInfo.nMax = infoPtr->nItemWidth; 264 265 /* Check to see if we need the scroll bar */ 266 if(scrollInfo.nMax < 0) 267 { 268 scrollInfo.nMax = 0; 269 } 270 else 271 { 272 /* Even up the max */ 273 scrollInfo.nMax -= (scrollInfo.nMax % REPORT_HSCROLL_INC_SIZE); 274 scrollInfo.nMax = (scrollInfo.nMax / REPORT_HSCROLL_INC_SIZE)-1; 275 } 276 /* Set the scroll pos to the max if the current scroll pos is greater */ 277 if((scrollInfo.nPos+scrollInfo.nPage) > scrollInfo.nMax 278 && scrollInfo.nMax > scrollInfo.nPage) 279 { 280 UINT nOldScrollPos = scrollInfo.nPos; 281 scrollInfo.nPos = scrollInfo.nMax; 282 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 283 GetScrollInfo(hwnd, SB_HORZ, &scrollInfo); 284 LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos, nOldScrollPos); 285 } 286 else 287 { 288 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 289 } 205 290 } 206 291 else … … 233 318 scrollInfo.nPos = 0; 234 319 } 235 320 236 321 if (nHiddenWidth % nScrollPosWidth == 0) 237 322 { 238 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth; 323 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth; 239 324 } 240 325 else 241 326 { 242 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth + 1; 243 } 244 327 scrollInfo.nMax = nHiddenWidth / nScrollPosWidth + 1; 328 } 329 245 330 scrollInfo.nMin = 0; 246 /*scrollInfo.nPage = 10;*/247 scrollInfo.fMask = SIF_RANGE | SIF_POS /*| SIF_PAGE*/;331 scrollInfo.nPage = 10; 332 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 248 333 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 249 334 } … … 279 364 if (nHiddenHeight % nScrollPosHeight == 0) 280 365 { 281 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight; 366 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight; 282 367 } 283 368 else 284 369 { 285 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight + 1; 370 scrollInfo.nMax = nHiddenHeight / nScrollPosHeight + 1; 286 371 } 287 372 288 373 scrollInfo.nMin = 0; 289 /*scrollInfo.nPage = 10;*/290 scrollInfo.fMask = SIF_RANGE | SIF_POS /*| SIF_PAGE*/;374 scrollInfo.nPage = 10; 375 scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; 291 376 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 292 377 } … … 1775 1860 } 1776 1861 1862 /* Don't bother painting item being edited */ 1863 if (infoPtr->lpeditItem && lvItem.state & LVIS_FOCUSED) 1864 return; 1865 1777 1866 if ((lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus != FALSE)) 1778 1867 { … … 1922 2011 * DESCRIPTION: 1923 2012 * Draws listview items when in report display mode. 1924 * 1925 * PARAMETER(S): 1926 * [I] HWND : window handle 1927 * [I] HDC : device context handle 2013 * 2014 * PARAMETER(S): 2015 * [I] HWND : window handle 2016 * [I] HDC : device context handle 1928 2017 * 1929 2018 * RETURN: … … 1933 2022 { 1934 2023 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd,0); 2024 SCROLLINFO scrollInfo; 1935 2025 INT nDrawPosY = infoPtr->rcList.top; 1936 2026 INT nColumnCount; … … 1940 2030 INT nLast; 1941 2031 2032 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 2033 scrollInfo.cbSize = sizeof(SCROLLINFO); 2034 scrollInfo.fMask = SIF_POS; 2035 1942 2036 nItem = ListView_GetTopIndex(hwnd); 1943 2037 … … 1955 2049 rcItem.top = nDrawPosY; 1956 2050 rcItem.bottom = rcItem.top + infoPtr->nItemHeight; 2051 2052 /* Offset the Scroll Bar Pos */ 2053 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 2054 { 2055 rcItem.left -= (scrollInfo.nPos * REPORT_HSCROLL_INC_SIZE); 2056 rcItem.right -= (scrollInfo.nPos * REPORT_HSCROLL_INC_SIZE); 2057 } 2058 1957 2059 if (j == 0) 1958 2060 { 1959 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 1960 } 1961 else 2061 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 2062 } 2063 else 1962 2064 { 1963 2065 LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem); 1964 2066 } 1965 2067 } 1966 2068 1967 2069 nDrawPosY += infoPtr->nItemHeight; 1968 2070 } … … 2070 2172 * DESCRIPTION: 2071 2173 * Draws listview items when in list display mode. 2072 * 2073 * PARAMETER(S): 2074 * [I] HWND : window handle 2075 * [I] HDC : device context handle 2174 * 2175 * PARAMETER(S): 2176 * [I] HWND : window handle 2177 * [I] HDC : device context handle 2076 2178 * 2077 2179 * RETURN: … … 2086 2188 INT nColumnCount; 2087 2189 INT nCountPerColumn; 2088 2190 INT nItemWidth = LISTVIEW_GetItemWidth(hwnd); 2191 INT nItemHeight = LISTVIEW_GetItemHeight(hwnd); 2192 2089 2193 /* get number of fully visible columns */ 2090 2194 nColumnCount = LISTVIEW_GetColumnCount(hwnd); … … 2099 2203 return; 2100 2204 2101 rcItem.top = j * infoPtr->nItemHeight;2102 rcItem.left = i * infoPtr->nItemWidth;2103 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;2104 rcItem.right = rcItem.left + infoPtr->nItemWidth;2205 rcItem.top = j * nItemHeight; 2206 rcItem.left = i * nItemWidth; 2207 rcItem.bottom = rcItem.top + nItemHeight; 2208 rcItem.right = rcItem.left + nItemWidth; 2105 2209 LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem); 2106 2210 } … … 2459 2563 * DESCRIPTION: 2460 2564 * Removes a column from the listview control. 2461 * 2565 * 2462 2566 * PARAMETER(S): 2463 2567 * [I] HWND : window handle … … 2473 2577 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 2474 2578 BOOL bResult = FALSE; 2475 2579 2476 2580 if (Header_DeleteItem(infoPtr->hwndHeader, nColumn) != FALSE) 2477 2581 { 2478 2582 bResult = LISTVIEW_RemoveColumn(infoPtr->hdpaItems, nColumn); 2583 2584 /* Need to reset the item width when deleting a column */ 2585 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 2479 2586 2480 2587 /* reset scroll parameters */ … … 2592 2699 } 2593 2700 2594 /* LISTVIEW_EditLabel */ 2701 /*** 2702 * DESCRIPTION: 2703 * Return edit control handle of current edit label 2704 * 2705 * PARAMETER(S): 2706 * [I] HWND : window handle 2707 * 2708 * RETURN: 2709 * SUCCESS : HWND 2710 * FAILURE : 0 2711 */ 2712 static LRESULT LISTVIEW_GetEditControl(hwnd) 2713 { 2714 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2715 return infoPtr->hwndEdit; 2716 } 2717 2718 2719 /*** 2720 * DESCRIPTION: 2721 * Callback implementation for editlabel control 2722 * 2723 * PARAMETER(S): 2724 * [I] HWND : window handle 2725 * [I] LPSTR : modified text 2726 * [I] DWORD : item index 2727 * 2728 * RETURN: 2729 * SUCCESS : TRUE 2730 * FAILURE : FALSE 2731 */ 2732 2733 static BOOL LISTVIEW_EndEditLabel(HWND hwnd, LPSTR pszText, DWORD nItem) 2734 { 2735 NMLVDISPINFOA dispInfo; 2736 LISTVIEW_ITEM *lpItem; 2737 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 2738 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2739 HDPA hdpaSubItems; 2740 2741 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 2742 2743 if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem))) 2744 return FALSE; 2745 2746 if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0))) 2747 return FALSE; 2748 2749 dispInfo.hdr.hwndFrom = hwnd; 2750 dispInfo.hdr.idFrom = nCtrlId; 2751 dispInfo.hdr.code = LVN_ENDLABELEDITA; 2752 dispInfo.item.mask = 0; 2753 dispInfo.item.iItem = nItem; 2754 dispInfo.item.state = lpItem->state; 2755 dispInfo.item.stateMask = 0; 2756 dispInfo.item.pszText = pszText; 2757 dispInfo.item.cchTextMax = pszText ? strlen(pszText) : 0; 2758 dispInfo.item.iImage = lpItem->iImage; 2759 dispInfo.item.lParam = lpItem->lParam; 2760 2761 ListView_Notify(GetParent(hwnd), nCtrlId, &dispInfo); 2762 infoPtr->hwndEdit = 0; 2763 infoPtr->lpeditItem = NULL; 2764 2765 return TRUE; 2766 } 2767 2768 /*** 2769 * DESCRIPTION: 2770 * Begin in place editing of specified list view item 2771 * 2772 * PARAMETER(S): 2773 * [I] HWND : window handle 2774 * [I] INT : item index 2775 * 2776 * RETURN: 2777 * SUCCESS : TRUE 2778 * FAILURE : FALSE 2779 */ 2780 2781 static HWND LISTVIEW_EditLabelA(HWND hwnd, INT nItem) 2782 { 2783 NMLVDISPINFOA dispInfo; 2784 RECT rect; 2785 LISTVIEW_ITEM *lpItem; 2786 HWND hedit; 2787 HINSTANCE hinst = GetWindowLongA(hwnd, GWL_HINSTANCE); 2788 INT nCtrlId = GetWindowLongA(hwnd, GWL_ID); 2789 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 2790 HDPA hdpaSubItems; 2791 2792 if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS) 2793 return FALSE; 2794 2795 ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA)); 2796 if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem))) 2797 return 0; 2798 2799 if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0))) 2800 return 0; 2801 2802 dispInfo.hdr.hwndFrom = hwnd; 2803 dispInfo.hdr.idFrom = nCtrlId; 2804 dispInfo.hdr.code = LVN_BEGINLABELEDITA; 2805 dispInfo.item.mask = 0; 2806 dispInfo.item.iItem = nItem; 2807 dispInfo.item.state = lpItem->state; 2808 dispInfo.item.stateMask = 0; 2809 dispInfo.item.pszText = lpItem->pszText; 2810 dispInfo.item.cchTextMax = strlen(lpItem->pszText); 2811 dispInfo.item.iImage = lpItem->iImage; 2812 dispInfo.item.lParam = lpItem->lParam; 2813 2814 if (ListView_LVNotify(GetParent(hwnd), nCtrlId, &dispInfo)) 2815 return 0; 2816 2817 rect.left = LVIR_LABEL; 2818 if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect)) 2819 return 0; 2820 2821 if (!(hedit = CreateEditLabel(dispInfo.item.pszText , WS_VISIBLE, 2822 rect.left, rect.top, rect.right - rect.left + 15, 2823 rect.bottom - rect.top, 2824 hwnd, hinst, LISTVIEW_EndEditLabel, nItem))) 2825 return 0; 2826 2827 infoPtr->hwndEdit = hedit; 2828 infoPtr->lpeditItem = lpItem; 2829 SetFocus(hedit); 2830 SendMessageA(hedit, EM_SETSEL, 0, -1); 2831 2832 return hedit; 2833 } 2595 2834 2596 2835 /*** … … 3323 3562 Str_SetPtrA(&lpItem->pszText, dispInfo.item.pszText); 3324 3563 } 3325 lpLVItem->pszText = dispInfo.item.pszText;3564 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3326 3565 } 3327 3566 else if (lpLVItem->mask & LVIF_TEXT) 3328 3567 { 3329 lpLVItem->pszText = lpItem->pszText;3568 strncpy(lpLVItem->pszText, lpItem->pszText, lpLVItem->cchTextMax); 3330 3569 } 3331 3570 … … 3418 3657 Str_SetPtrA(&lpSubItem->pszText, dispInfo.item.pszText); 3419 3658 } 3420 lpLVItem->pszText = dispInfo.item.pszText;3659 strncpy(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax); 3421 3660 } 3422 3661 else if (lpLVItem->mask & LVIF_TEXT) 3423 3662 { 3424 lpLVItem->pszText = lpSubItem->pszText;3663 strncpy(lpLVItem->pszText, lpSubItem->pszText, lpLVItem->cchTextMax); 3425 3664 } 3426 3665 } … … 4536 4775 (WPARAM)nColumn, (LPARAM)&hdi); 4537 4776 4777 /* Need to reset the item width when inserting a new column */ 4778 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 4779 4538 4780 LISTVIEW_UpdateScroll(hwnd); 4539 4781 InvalidateRect(hwnd, NULL, FALSE); … … 5458 5700 infoPtr->iconSpacing.cy = GetSystemMetrics(SM_CYICONSPACING); 5459 5701 ZeroMemory(&infoPtr->rcList, sizeof(RECT)); 5702 infoPtr->hwndEdit = 0; 5703 infoPtr->lpeditItem = NULL; 5460 5704 5461 5705 /* get default font (icon title) */ … … 5564 5808 * DESCRIPTION: 5565 5809 * Performs vertical scrolling. 5566 * 5810 * 5567 5811 * PARAMETER(S): 5568 5812 * [I] HWND : window handle 5569 5813 * [I] INT : scroll code 5570 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5814 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5571 5815 * or SB_THUMBTRACK. 5572 5816 * [I] HWND : scrollbar control window handle … … 5578 5822 HWND hScrollWnd) 5579 5823 { 5580 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;5581 5824 SCROLLINFO scrollInfo; 5582 5825 5583 5826 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 5584 5827 scrollInfo.cbSize = sizeof(SCROLLINFO); 5585 scrollInfo.fMask = /*SIF_PAGE |*/SIF_POS | SIF_RANGE;5586 5828 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; 5829 5587 5830 if (GetScrollInfo(hwnd, SB_VERT, &scrollInfo) != FALSE) 5588 5831 { … … 5596 5839 } 5597 5840 break; 5598 5841 5599 5842 case SB_LINEDOWN: 5600 5843 if (scrollInfo.nPos < scrollInfo.nMax) … … 5603 5846 } 5604 5847 break; 5605 5848 5606 5849 case SB_PAGEUP: 5607 5850 if (scrollInfo.nPos > scrollInfo.nMin) 5608 5851 { 5609 INT nPage = 0; 5610 5611 if (uView == LVS_REPORT) 5612 { 5613 nPage = LISTVIEW_GetCountPerColumn(hwnd); 5614 } 5615 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 5616 { 5617 nPage = 10; 5618 } 5619 5620 if (scrollInfo.nPos >= nPage) 5621 { 5622 scrollInfo.nPos -= nPage; 5852 5853 if (scrollInfo.nPos >= scrollInfo.nPage) 5854 { 5855 scrollInfo.nPos -= scrollInfo.nPage; 5623 5856 } 5624 5857 else … … 5628 5861 } 5629 5862 break; 5630 5863 5631 5864 case SB_PAGEDOWN: 5632 5865 if (scrollInfo.nPos < scrollInfo.nMax) 5633 5866 { 5634 INT nPage = 0; 5635 5636 if (uView == LVS_REPORT) 5637 { 5638 nPage = LISTVIEW_GetCountPerColumn(hwnd); 5639 } 5640 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 5641 { 5642 nPage = 10; 5643 } 5644 5645 if (scrollInfo.nPos <= scrollInfo.nMax - nPage) 5646 { 5647 scrollInfo.nPos += nPage; 5867 if (scrollInfo.nPos <= scrollInfo.nMax - scrollInfo.nPage) 5868 { 5869 scrollInfo.nPos += scrollInfo.nPage; 5648 5870 } 5649 5871 else … … 5654 5876 break; 5655 5877 5656 case SB_THUMBPOSITION: 5878 case SB_THUMBTRACK: 5879 scrollInfo.nPos = nCurrentPos; 5657 5880 break; 5658 5881 } … … 5662 5885 scrollInfo.fMask = SIF_POS; 5663 5886 SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE); 5664 InvalidateRect(hwnd, NULL, FALSE);5665 } 5666 } 5667 5887 InvalidateRect(hwnd, NULL, TRUE); 5888 } 5889 } 5890 5668 5891 return 0; 5669 5892 } … … 5672 5895 * DESCRIPTION: 5673 5896 * Performs horizontal scrolling. 5674 * 5897 * 5675 5898 * PARAMETER(S): 5676 5899 * [I] HWND : window handle 5677 5900 * [I] INT : scroll code 5678 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5901 * [I] SHORT : current scroll position if scroll code is SB_THIMBPOSITION 5679 5902 * or SB_THUMBTRACK. 5680 5903 * [I] HWND : scrollbar control window handle … … 5686 5909 HWND hScrollWnd) 5687 5910 { 5688 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;5689 5911 SCROLLINFO scrollInfo; 5690 5912 5691 5913 ZeroMemory(&scrollInfo, sizeof(SCROLLINFO)); 5692 5914 scrollInfo.cbSize = sizeof(SCROLLINFO); 5693 scrollInfo.fMask = /*SIF_PAGE |*/SIF_POS | SIF_RANGE;5694 5915 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; 5916 5695 5917 if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 5696 5918 { … … 5705 5927 } 5706 5928 break; 5707 5929 5708 5930 case SB_LINERIGHT: 5709 5931 if (scrollInfo.nPos < scrollInfo.nMax) … … 5712 5934 } 5713 5935 break; 5714 5936 5715 5937 case SB_PAGELEFT: 5716 5938 if (scrollInfo.nPos > scrollInfo.nMin) 5717 5939 { 5718 INT nPage = 0; 5719 5720 if (uView == LVS_LIST) 5721 { 5722 nPage = LISTVIEW_GetCountPerRow(hwnd); 5723 } 5724 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 5725 { 5726 nPage = 10; 5727 } 5728 5729 if (scrollInfo.nPos >= nPage) 5730 { 5731 scrollInfo.nPos -= nPage; 5940 if (scrollInfo.nPos >= scrollInfo.nPage) 5941 { 5942 scrollInfo.nPos -= scrollInfo.nPage; 5732 5943 } 5733 5944 else … … 5737 5948 } 5738 5949 break; 5739 5950 5740 5951 case SB_PAGERIGHT: 5741 5952 if (scrollInfo.nPos < scrollInfo.nMax) 5742 5953 { 5743 INT nPage = 0; 5744 5745 if (uView == LVS_LIST) 5746 { 5747 nPage = LISTVIEW_GetCountPerRow(hwnd); 5748 } 5749 else if ((uView == LVS_ICON) || (uView == LVS_SMALLICON)) 5750 { 5751 nPage = 10; 5752 } 5753 5754 if (scrollInfo.nPos <= scrollInfo.nMax - nPage) 5755 { 5756 scrollInfo.nPos += nPage; 5954 if (scrollInfo.nPos <= scrollInfo.nMax - scrollInfo.nPage) 5955 { 5956 scrollInfo.nPos += scrollInfo.nPage; 5757 5957 } 5758 5958 else … … 5763 5963 break; 5764 5964 5765 case SB_THUMBPOSITION: 5965 case SB_THUMBTRACK: 5966 scrollInfo.nPos = nCurrentPos; 5766 5967 break; 5767 5968 } … … 5769 5970 if (nOldScrollPos != scrollInfo.nPos) 5770 5971 { 5972 UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 5771 5973 scrollInfo.fMask = SIF_POS; 5772 5974 SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 5773 InvalidateRect(hwnd, NULL, FALSE); 5774 } 5775 } 5776 5975 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; 5976 GetScrollInfo(hwnd, SB_HORZ, &scrollInfo); 5977 if(uView == LVS_REPORT) 5978 { 5979 LISTVIEW_UpdateHeaderSize(hwnd, scrollInfo.nPos, nOldScrollPos); 5980 } 5981 InvalidateRect(hwnd, NULL, TRUE); 5982 } 5983 } 5984 5777 5985 return 0; 5778 5986 } … … 6146 6354 * DESCRIPTION: 6147 6355 * Handles notifications from children. 6148 * 6356 * 6149 6357 * PARAMETER(S): 6150 6358 * [I] HWND : window handle 6151 6359 * [I] INT : control identifier 6152 6360 * [I] LPNMHDR : notification information 6153 * 6361 * 6154 6362 * RETURN: 6155 6363 * Zero … … 6158 6366 { 6159 6367 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 6160 6161 if (lpnmh->hwndFrom == infoPtr->hwndHeader) 6368 6369 if (lpnmh->hwndFrom == infoPtr->hwndHeader) 6162 6370 { 6163 6371 /* handle notification from header control */ … … 6165 6373 { 6166 6374 infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd); 6167 InvalidateRect(hwnd, NULL, FALSE); 6168 } 6375 InvalidateRect(hwnd, NULL, TRUE); 6376 } 6377 else if(lpnmh->code == HDN_ITEMCLICKA) 6378 { 6379 /* Handle sorting by Header Column */ 6380 NMLISTVIEW nmlv; 6381 LPNMHEADERA pnmHeader = (LPNMHEADERA) lpnmh; 6382 LONG lCtrlId = GetWindowLongA(hwnd, GWL_ID); 6383 6384 ZeroMemory(&nmlv, sizeof(NMLISTVIEW)); 6385 nmlv.hdr.hwndFrom = hwnd; 6386 nmlv.hdr.idFrom = lCtrlId; 6387 nmlv.hdr.code = LVN_COLUMNCLICK; 6388 nmlv.iItem = -1; 6389 nmlv.iSubItem = pnmHeader->iItem; 6390 6391 ListView_LVNotify(GetParent(hwnd),lCtrlId, &nmlv); 6392 6393 } 6394 else if(lpnmh->code == NM_RELEASEDCAPTURE) 6395 { 6396 /* Idealy this should be done in HDN_ENDTRACKA 6397 * but since SetItemBounds in Header.c is called after 6398 * the notification is sent, it is neccessary to handle the 6399 * update of the scroll bar here (Header.c works fine as it is, 6400 * no need to disturb it) 6401 */ 6402 LISTVIEW_UpdateScroll(hwnd); 6403 InvalidateRect(hwnd, NULL, TRUE); 6404 } 6405 6169 6406 } 6170 6407 … … 6673 6910 return LISTVIEW_DeleteItem(hwnd, (INT)wParam); 6674 6911 6675 /* case LVM_EDITLABEL: */ 6912 case LVM_EDITLABELW: 6913 case LVM_EDITLABELA: 6914 return LISTVIEW_EditLabelA(hwnd, (INT)wParam); 6676 6915 6677 6916 case LVM_ENSUREVISIBLE: … … 6705 6944 return LISTVIEW_GetCountPerPage(hwnd); 6706 6945 6707 /* case LVM_GETEDITCONTROL: */ 6946 case LVM_GETEDITCONTROL: 6947 return LISTVIEW_GetEditControl(hwnd); 6948 6708 6949 case LVM_GETEXTENDEDLISTVIEWSTYLE: 6709 6950 return LISTVIEW_GetExtendedListViewStyle(hwnd); … … 6889 7130 6890 7131 /* case WM_CHAR: */ 6891 /* case WM_COMMAND: */ 7132 case WM_COMMAND: 7133 return LISTVIEW_Command(hwnd, wParam, lParam); 6892 7134 6893 7135 case WM_CREATE: … … 7038 7280 } 7039 7281 7282 /*** 7283 * DESCRIPTION: 7284 * Handle any WM_COMMAND messages 7285 * 7286 * PARAMETER(S): 7287 * 7288 * RETURN: 7289 */ 7290 static LRESULT LISTVIEW_Command(HWND hwnd, WPARAM wParam, LPARAM lParam) 7291 { 7292 switch (HIWORD(wParam)) 7293 { 7294 case EN_UPDATE: 7295 { 7296 /* 7297 * Adjust the edit window size 7298 */ 7299 char buffer[1024]; 7300 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 7301 HDC hdc = GetDC(infoPtr->hwndEdit); 7302 RECT rect; 7303 SIZE sz; 7304 7305 GetWindowTextA(infoPtr->hwndEdit, buffer, 1024); 7306 GetWindowRect(infoPtr->hwndEdit, &rect); 7307 if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz)) 7308 { 7309 SetWindowPos ( 7310 infoPtr->hwndEdit, 7311 HWND_TOP, 7312 0, 7313 0, 7314 sz.cx + 15, 7315 rect.bottom - rect.top, 7316 SWP_DRAWFRAME|SWP_NOMOVE); 7317 } 7318 ReleaseDC(hwnd, hdc); 7319 7320 break; 7321 } 7322 7323 default: 7324 return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam); 7325 } 7326 7327 return 0; 7328 } 7329 7330 7331 /*** 7332 * DESCRIPTION: 7333 * Subclassed edit control windproc function 7334 * 7335 * PARAMETER(S): 7336 * 7337 * RETURN: 7338 */ 7339 LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg, 7340 WPARAM wParam, LPARAM lParam) 7341 { 7342 BOOL cancel = TRUE; 7343 EDITLABEL_ITEM *einfo = 7344 (EDITLABEL_ITEM *) GetWindowLongA(hwnd, GWL_USERDATA); 7345 7346 switch (uMsg) 7347 { 7348 case WM_KILLFOCUS: 7349 break; 7350 7351 case WM_CHAR: 7352 if (VK_RETURN == (INT)wParam) 7353 { 7354 cancel = FALSE; 7355 break; 7356 } 7357 else if (VK_ESCAPE == (INT)wParam) 7358 break; 7359 7360 default: 7361 return CallWindowProcA(einfo->EditWndProc, hwnd, 7362 uMsg, wParam, lParam); 7363 } 7364 7365 SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)einfo->EditWndProc); 7366 if (einfo->EditLblCb) 7367 { 7368 char *buffer = NULL; 7369 7370 if (!cancel) 7371 { 7372 int len = 1 + GetWindowTextLengthA(hwnd); 7373 7374 if (len > 1) 7375 { 7376 if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char)))) 7377 { 7378 GetWindowTextA(hwnd, buffer, len); 7379 } 7380 } 7381 } 7382 7383 einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param); 7384 7385 if (buffer) 7386 COMCTL32_Free(buffer); 7387 } 7388 7389 COMCTL32_Free(einfo); 7390 PostMessageA(hwnd, WM_CLOSE, 0, 0); 7391 return TRUE; 7392 } 7393 7394 7395 /*** 7396 * DESCRIPTION: 7397 * Creates a subclassed edit cotrol 7398 * 7399 * PARAMETER(S): 7400 * 7401 * RETURN: 7402 */ 7403 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 7404 INT width, INT height, HWND parent, HINSTANCE hinst, 7405 EditlblCallback EditLblCb, DWORD param) 7406 { 7407 HWND hedit; 7408 EDITLABEL_ITEM *einfo; 7409 7410 if (NULL == (einfo = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM)))) 7411 return 0; 7412 7413 style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER; 7414 if (!(hedit = CreateWindowA("Edit", text, style, x, y, width, height, 7415 parent, 0, hinst, 0))) 7416 { 7417 COMCTL32_Free(einfo); 7418 return 0; 7419 } 7420 7421 einfo->param = param; 7422 einfo->EditLblCb = EditLblCb; 7423 einfo->EditWndProc = (WNDPROC)SetWindowLongA(hedit, 7424 GWL_WNDPROC, (LONG) EditLblWndProc); 7425 7426 SetWindowLongA(hedit, GWL_USERDATA, (LONG)einfo); 7427 7428 return hedit; 7429 } -
trunk/src/comctl32/propsheet.c
r1402 r1565 1 /* $Id: propsheet.c,v 1.1 0 1999-10-22 18:04:11 sandervlExp $ */1 /* $Id: propsheet.c,v 1.11 1999-11-02 21:44:02 achimha Exp $ */ 2 2 /* 3 3 * Property Sheets … … 13 13 */ 14 14 15 /* WINE 99 0923level */15 /* WINE 991031 level */ 16 16 17 17 /* CB: Odin problems: … … 117 117 static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText); 118 118 static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText); 119 static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg); 119 120 static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, 120 121 int index, … … 214 215 HGLOBAL hTemplate = LoadResource(lppsp->hInstance, 215 216 hResource); 216 pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);217 pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate); 217 218 } 218 219 … … 265 266 p += lstrlenW( (LPCWSTR)p ) + 1; 266 267 break; 267 } 268 } 268 269 269 270 /* class */ … … 283 284 /* Extract the caption */ 284 285 psInfo->proppage[index].pszText = (LPCWSTR)p; 285 // TRACE( propsheet,"Tab %d %s\n",index,debugstr_w((LPCWSTR)p));286 // TRACE("Tab %d %s\n",index,debugstr_w((LPCWSTR)p)); 286 287 p += lstrlenW((LPCWSTR)p) + 1; 287 288 288 289 if (dwFlags & PSP_USETITLE) 289 290 { 290 //AH: todo 291 // psInfo->proppage[index].pszText = HEAP_strdupAtoW(GetProcessHeap(), 292 // 0, 293 // lppsp->pszTitle); 291 if ( !HIWORD( lppsp->pszTitle ) ) 292 { 293 char szTitle[256]; 294 295 if ( !LoadStringA( lppsp->hInstance, (UINT) lppsp->pszTitle, szTitle, 256 ) ) 296 return FALSE; 297 298 //AH: TODO 299 // psInfo->proppage[index].pszText = HEAP_strdupAtoW( GetProcessHeap(), 300 // 0, szTitle ); 301 } 302 //AH: TODO 303 // else 304 // psInfo->proppage[index].pszText = HEAP_strdupAtoW(GetProcessHeap(), 305 // 0, 306 // lppsp->pszTitle); 294 307 } 295 308 … … 297 310 * Build the image list for icons 298 311 */ 299 if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) 312 if ((dwFlags & PSP_USEHICON) || (dwFlags & PSP_USEICONID)) 300 313 { 301 314 HICON hIcon; … … 876 889 PropPageInfo* ppInfo = psInfo->proppage; 877 890 PADDING_INFO padding; 878 HWND hwndAfter; 879 880 // TRACE(propsheet, "index %d\n", index); 891 892 TRACE("index %d\n", index); 881 893 882 894 if (ppshpage->dwFlags & PSP_DLGINDIRECT) … … 908 920 pTemplate->style &= ~WS_POPUP; 909 921 pTemplate->style &= ~WS_DISABLED; 910 911 922 } 912 923 … … 917 928 918 929 hwndPage = CreateDialogIndirectParamA(ppshpage->hInstance, 919 pTemplate,920 hwndParent,921 ppshpage->pfnDlgProc,922 (LPARAM)ppshpage);930 pTemplate, 931 hwndParent, 932 ppshpage->pfnDlgProc, 933 (LPARAM)ppshpage); 923 934 924 935 ppInfo[index].hwndPage = hwndPage; … … 932 943 933 944 if (psInfo->ppshheader->dwFlags & PSH_WIZARD) 934 {935 GetWindowRect(hwndParent, &rc);936 945 padding = PROPSHEET_GetPaddingInfoWizard(hwndParent); 937 hwndAfter = hwndParent;938 }939 946 else 940 947 { … … 946 953 SendMessageA(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&rc); 947 954 padding = PROPSHEET_GetPaddingInfo(hwndParent); 948 hwndAfter = HWND_TOP; 949 } 950 951 SetWindowPos(hwndPage, hwndAfter, 955 } 956 957 SetWindowPos(hwndPage, HWND_TOP, 952 958 rc.left + padding.x, 953 959 rc.top + padding.y, … … 1038 1044 PropSheetInfoStr); 1039 1045 1046 hdr.hwndFrom = hwndDlg; 1040 1047 hdr.code = PSN_WIZNEXT; 1041 1048 … … 1044 1051 msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1045 1052 1046 //TRACE("msg result %ld\n", msgResult);1053 TRACE("msg result %ld\n", msgResult); 1047 1054 1048 1055 if (msgResult == -1) 1049 1056 return FALSE; 1050 1057 1051 PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page + 1, 0); 1058 if(PROPSHEET_CanSetCurSel(hwndDlg) != FALSE) 1059 { 1060 PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page + 1, 0); 1061 } 1052 1062 1053 1063 return TRUE; … … 1065 1075 PropSheetInfoStr); 1066 1076 1077 hdr.hwndFrom = hwndDlg; 1067 1078 hdr.code = PSN_WIZFINISH; 1068 1079 … … 1071 1082 msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1072 1083 1073 //TRACE("msg result %ld\n", msgResult);1084 TRACE("msg result %ld\n", msgResult); 1074 1085 1075 1086 if (msgResult != 0) … … 1206 1217 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, 1207 1218 PropSheetInfoStr); 1208 1219 if ( !psInfo ) return; 1209 1220 for (i = 0; i < psInfo->nPages; i++) 1210 1221 { … … 1259 1270 } 1260 1271 1272 /************************************************************************* 1273 * BOOL PROPSHEET_CanSetCurSel [Internal] 1274 * 1275 * Test weither the current page can be changed by sending a PSN_KILLACTIVE 1276 * 1277 * PARAMS 1278 * hwndDlg [I] handle to a Dialog hWnd 1279 * 1280 * RETURNS 1281 * TRUE if Current Selection can change 1282 * 1283 * NOTES 1284 */ 1285 static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg) 1286 { 1287 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, 1288 PropSheetInfoStr); 1289 HWND hwndPage; 1290 NMHDR hdr; 1291 1292 if (!psInfo) 1293 return FALSE; 1294 1295 /* 1296 * Notify the current page. 1297 */ 1298 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1299 1300 hdr.hwndFrom = hwndDlg; 1301 hdr.code = PSN_KILLACTIVE; 1302 1303 return !SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1304 } 1305 1261 1306 /****************************************************************************** 1262 1307 * PROPSHEET_SetCurSel … … 1272 1317 NMHDR hdr; 1273 1318 1274 /*1275 * Notify the current page.1276 */1277 1319 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1278 1320 1279 1321 hdr.hwndFrom = hwndDlg; 1280 hdr.code = PSN_KILLACTIVE;1281 1282 if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr))1283 return FALSE;1284 1285 1322 /* 1286 1323 * hpage takes precedence over index. … … 1292 1329 if (index == -1) 1293 1330 { 1294 //TRACE("Could not find page to remove!\n");1331 TRACE("Could not find page to remove!\n"); 1295 1332 return FALSE; 1296 1333 } … … 1310 1347 result = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1311 1348 /* 1312 * TODO: check return value. 1349 * TODO: check return value. 1313 1350 */ 1314 1351 } … … 1469 1506 psInfo->nPages++; 1470 1507 1471 return FALSE;1508 return TRUE; 1472 1509 } 1473 1510 … … 1482 1519 PropSheetInfoStr); 1483 1520 HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); 1484 PropPageInfo* oldPages = psInfo->proppage; 1485 1521 PropPageInfo* oldPages; 1522 1523 if (!psInfo) { 1524 FIXME("No psInfo for propertysheet at windows 0x%04x, returning FALSE...\n", hwndDlg); 1525 return FALSE; 1526 } 1527 oldPages = psInfo->proppage; 1486 1528 /* 1487 1529 * hpage takes precedence over index. … … 1490 1532 { 1491 1533 index = PROPSHEET_GetPageIndex(hpage, psInfo); 1492 1493 if (index == -1) 1534 } 1535 1536 /* Make shure that index is within range */ 1537 if (index < 0 || index >= psInfo->nPages) 1494 1538 { 1495 // TRACE(propsheet,"Could not find page to remove!\n");1539 TRACE("Could not find page to remove!\n"); 1496 1540 return FALSE; 1497 1541 } 1498 } 1499 1500 // TRACE(propsheet, "total pages %d removing page %d active page %d\n", 1501 // psInfo->nPages, index, psInfo->active_page); 1542 1543 TRACE("total pages %d removing page %d active page %d\n", 1544 psInfo->nPages, index, psInfo->active_page); 1502 1545 /* 1503 1546 * Check if we're removing the active page. … … 1520 1563 else 1521 1564 { 1522 // TRACE(propsheet,"Removing the only page, close the dialog!\n");1565 TRACE("Removing the only page, close the dialog!\n"); 1523 1566 1524 1567 if (psInfo->isModeless) … … 1534 1577 psInfo->active_page--; 1535 1578 1579 /* Destroy page dialog window. 1580 * If it's last page in modal dialog, it has been destroyed by EndDialog 1581 */ 1582 if (psInfo->isModeless || psInfo->nPages > 1) 1583 DestroyWindow(psInfo->proppage[index].hwndPage); 1584 1536 1585 /* Remove the tab */ 1537 1586 SendMessageA(hwndTabControl, TCM_DELETEITEM, index, 0); … … 1540 1589 psInfo->proppage = COMCTL32_Alloc(sizeof(PropPageInfo) * psInfo->nPages); 1541 1590 1542 if (index > 0) 1591 if (index > 0) 1543 1592 memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo)); 1544 1593 … … 1764 1813 GetWindowTextA(hwnd, psInfo->strPropertiesFor, MAX_CAPTION_LENGTH); 1765 1814 1815 PROPSHEET_CreateTabControl(hwnd, psInfo); 1816 1766 1817 if (psInfo->ppshheader->dwFlags & PSH_WIZARD) 1767 1818 { … … 1780 1831 else 1781 1832 { 1782 PROPSHEET_CreateTabControl(hwnd, psInfo);1783 1784 1833 if (PROPSHEET_IsTooSmall(hwnd, psInfo)) 1785 1834 { … … 1789 1838 } 1790 1839 1840 if (psInfo->useCallback) 1841 (*(psInfo->ppshheader->pfnCallback))(hwnd, 1842 PSCB_INITIALIZED, (LPARAM)0); 1843 1791 1844 ppshpage = PROPSHEET_GetPSPPage(psInfo, psInfo->active_page); 1792 1845 PROPSHEET_CreatePage(hwnd, psInfo->active_page, psInfo, ppshpage, TRUE); … … 1797 1850 SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo); 1798 1851 1799 PROPSHEET_SetTitleA(hwnd, 1800 psInfo->ppshheader->dwFlags, 1801 psInfo->ppshheader->pszCaption); 1852 1853 if (!HIWORD(psInfo->ppshheader->pszCaption) && 1854 psInfo->ppshheader->hInstance) 1855 { 1856 char szText[256]; 1857 1858 if (LoadStringA(psInfo->ppshheader->hInstance, 1859 (UINT)psInfo->ppshheader->pszCaption, szText, 255)) 1860 PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader->dwFlags, szText); 1861 } 1862 else 1863 { 1864 PROPSHEET_SetTitleA(hwnd, psInfo->ppshheader->dwFlags, 1865 psInfo->ppshheader->pszCaption); 1866 } 1802 1867 1803 1868 return TRUE; … … 1884 1949 } 1885 1950 1951 if(pnmh->code == TCN_SELCHANGING) 1952 { 1953 BOOL bRet = PROPSHEET_CanSetCurSel(hwnd); 1954 SetWindowLongA(hwnd, DWL_MSGRESULT, !bRet); 1955 return TRUE; 1956 } 1957 1958 1886 1959 return 0; 1887 1960 } … … 1922 1995 BOOL msgResult; 1923 1996 1924 msgResult = PROPSHEET_SetCurSel(hwnd, 1925 (int)wParam, 1926 (HPROPSHEETPAGE)lParam); 1997 msgResult = PROPSHEET_CanSetCurSel(hwnd); 1998 if(msgResult != FALSE) 1999 { 2000 msgResult = PROPSHEET_SetCurSel(hwnd, 2001 (int)wParam, 2002 (HPROPSHEETPAGE)lParam); 2003 } 1927 2004 1928 2005 SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult); … … 1983 2060 1984 2061 case PSM_ADDPAGE: 1985 PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam); 2062 { 2063 /* 2064 * Note: MSVC++ 6.0 documentation says that PSM_ADDPAGE does not have 2065 * a return value. This is not true. PSM_ADDPAGE returns TRUE 2066 * on success or FALSE otherwise, as specified on MSDN Online. 2067 * Also see the MFC code for 2068 * CPropertySheet::AddPage(CPropertyPage* pPage). 2069 */ 2070 2071 BOOL msgResult = PROPSHEET_AddPage(hwnd, (HPROPSHEETPAGE)lParam); 2072 2073 SetWindowLongA(hwnd, DWL_MSGRESULT, msgResult); 2074 1986 2075 return TRUE; 2076 } 1987 2077 1988 2078 case PSM_REMOVEPAGE: … … 1992 2082 case PSM_ISDIALOGMESSAGE: 1993 2083 { 1994 //FIXME("Unimplemented msg PSM_ISDIALOGMESSAGE\n");2084 FIXME("Unimplemented msg PSM_ISDIALOGMESSAGE\n"); 1995 2085 return 0; 1996 2086 } … … 2009 2099 2010 2100 case PSM_SETTITLEW: 2011 //FIXME("Unimplemented msg PSM_SETTITLE32W\n");2101 FIXME("Unimplemented msg PSM_SETTITLE32W\n"); 2012 2102 return 0; 2013 2103 case PSM_SETCURSELID: 2014 //FIXME("Unimplemented msg PSM_SETCURSELID\n");2104 FIXME("Unimplemented msg PSM_SETCURSELID\n"); 2015 2105 return 0; 2016 2106 case PSM_SETFINISHTEXTW: 2017 //FIXME("Unimplemented msg PSM_SETFINISHTEXT32W\n");2107 FIXME("Unimplemented msg PSM_SETFINISHTEXT32W\n"); 2018 2108 return 0; 2019 2109 -
trunk/src/comctl32/rsrc.rc
r1424 r1565 5 5 6 6 IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 292, 159 7 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 7 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 8 8 CAPTION "Properties for " 9 9 FONT 8, "MS Sans Serif" … … 14 14 PUSHBUTTON "Help", IDHELP,235,138,50,14 15 15 CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS,7,7,278,125 16 END 17 18 19 IDD_WIZARD DIALOG DISCARDABLE 0, 0, 292, 159 20 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE 21 CAPTION "Wizard" 22 FONT 8, "MS Sans Serif" 23 BEGIN 24 DEFPUSHBUTTON "Finish", IDC_FINISH_BUTTON,121,138,50,14 25 DEFPUSHBUTTON "&Next >", IDC_NEXT_BUTTON,121,138,50,14 26 PUSHBUTTON "< &Back", IDC_BACK_BUTTON,71,138,50,14 27 PUSHBUTTON "Cancel", IDCANCEL,178,138,50,14 28 PUSHBUTTON "Help", IDHELP,235,138,50,14 29 LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN 30 CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 16 31 END 17 32 -
trunk/src/comctl32/tab.c
r1431 r1565 1 /* $Id: tab.c,v 1.1 5 1999-10-24 22:49:47 sandervlExp $ */1 /* $Id: tab.c,v 1.16 1999-11-02 21:44:03 achimha Exp $ */ 2 2 /* 3 3 * Tab control … … 15 15 */ 16 16 17 /* WINE 99 0823level */17 /* WINE 991031 level */ 18 18 19 19 #include <string.h> … … 115 115 INT iItem=(INT) wParam; 116 116 INT prevItem; 117 117 118 118 prevItem=-1; 119 119 if ((iItem >= 0) && (iItem < infoPtr->uNumItem)) { 120 120 prevItem=infoPtr->iSelected; 121 121 infoPtr->iSelected=iItem; 122 TAB_EnsureSelectionVisible(hwnd, infoPtr); 123 TAB_InvalidateTabArea(hwnd, infoPtr); 122 124 } 123 125 return prevItem; … … 376 378 { 377 379 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 380 POINT pt; 381 INT newItem,dummy; 378 382 379 383 if (infoPtr->hwndToolTip) 380 384 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 381 WM_LBUTTONDOWN, wParam, lParam);385 WM_LBUTTONDOWN, wParam, lParam); 382 386 383 387 if (GetWindowLongA(hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { 384 388 SetFocus (hwnd); 389 } 390 391 if (infoPtr->hwndToolTip) 392 TAB_RelayEvent (infoPtr->hwndToolTip, hwnd, 393 WM_LBUTTONDOWN, wParam, lParam); 394 395 pt.x = (INT)LOWORD(lParam); 396 pt.y = (INT)HIWORD(lParam); 397 398 newItem=TAB_InternalHitTest (hwnd, infoPtr,pt,&dummy); 399 400 TRACE("On Tab, item %d\n", newItem); 401 402 if ( (newItem!=-1) && 403 (infoPtr->iSelected != newItem) ) 404 { 405 if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE) 406 { 407 infoPtr->iSelected = newItem; 408 infoPtr->uFocus = newItem; 409 TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE); 410 411 TAB_EnsureSelectionVisible(hwnd, infoPtr); 412 413 TAB_InvalidateTabArea(hwnd, infoPtr); 414 } 385 415 } 386 416 return 0; -
trunk/src/comctl32/toolbar.c
r1431 r1565 1 /* $Id: toolbar.c,v 1.1 6 1999-10-24 22:49:47 sandervlExp $ */1 /* $Id: toolbar.c,v 1.17 1999-11-02 21:44:03 achimha Exp $ */ 2 2 /* 3 3 * Toolbar control … … 26 26 * - Microsofts controlspy examples. 27 27 */ 28 29 /* WINE 991031 level */ 28 30 29 31 /* CB: Odin32/WINE bugs … … 3461 3463 } 3462 3464 3465 static LRESULT 3466 TOOLBAR_GetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) 3467 { 3468 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 3469 3470 return infoPtr->hFont; 3471 } 3463 3472 3464 3473 static LRESULT … … 4125 4134 return TOOLBAR_EraseBackground (hwnd, wParam, lParam); 4126 4135 4127 /* case WM_GETFONT: */ 4136 case WM_GETFONT: 4137 return TOOLBAR_GetFont (hwnd, wParam, lParam); 4138 4128 4139 /* case WM_KEYDOWN: */ 4129 4140 /* case WM_KILLFOCUS: */ -
trunk/src/comctl32/tooltips.c
r1431 r1565 1 /* $Id: tooltips.c,v 1.1 5 1999-10-24 22:49:49 sandervlExp $ */1 /* $Id: tooltips.c,v 1.16 1999-11-02 21:44:03 achimha Exp $ */ 2 2 /* 3 3 * Tool tip control … … 22 22 */ 23 23 24 /* WINE 99 0923level */24 /* WINE 991031 level */ 25 25 26 26 #include <string.h> … … 253 253 } 254 254 255 static VOID 256 TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize) 257 { 258 HDC hdc; 259 HFONT hOldFont; 260 UINT uFlags = DT_EXTERNALLEADING | DT_CALCRECT; 261 RECT rc = {0, 0, 0, 0}; 262 263 if (infoPtr->nMaxTipWidth > -1) { 264 rc.right = infoPtr->nMaxTipWidth; 265 uFlags |= DT_WORDBREAK; 266 } 267 if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX) 268 uFlags |= DT_NOPREFIX; 269 // TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText)); 270 271 hdc = GetDC (hwnd); 272 hOldFont = SelectObject (hdc, infoPtr->hFont); 273 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags); 274 SelectObject (hdc, hOldFont); 275 ReleaseDC (hwnd, hdc); 276 277 lpSize->cx = rc.right - rc.left + 4 + 278 infoPtr->rcMargin.left + infoPtr->rcMargin.right; 279 lpSize->cy = rc.bottom - rc.top + 4 + 280 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top; 281 } 255 282 256 283 static VOID … … 258 285 { 259 286 TTTOOL_INFO *toolPtr; 260 RECT rect; 287 RECT rect, wndrect; 288 SIZE size; 261 289 HDC hdc; 262 290 NMHDR hdr; 263 291 264 if (infoPtr->nTool == -1) 265 { 266 // TRACE (tooltips, "invalid tool (-1)!\n"); 267 return; 292 if (infoPtr->nTool == -1) { 293 TRACE("invalid tool (-1)!\n"); 294 return; 268 295 } 269 296 270 297 infoPtr->nCurrentTool = infoPtr->nTool; 271 298 272 // TRACE (tooltips,"Show tooltip pre %d!\n", infoPtr->nTool);273 TOOLTIPS_GetTipText(hwnd,infoPtr,infoPtr->nCurrentTool); 274 275 if (infoPtr->szTipText[0] == '\0') 276 {277 infoPtr->nCurrentTool = -1;278 return;279 } 280 281 // TRACE (tooltips,"Show tooltip %d!\n", infoPtr->nCurrentTool);299 TRACE("Show tooltip pre %d!\n", infoPtr->nTool); 300 301 TOOLTIPS_GetTipText (hwnd, infoPtr, infoPtr->nCurrentTool); 302 303 if (infoPtr->szTipText[0] == L'\0') { 304 infoPtr->nCurrentTool = -1; 305 return; 306 } 307 308 TRACE("Show tooltip %d!\n", infoPtr->nCurrentTool); 282 309 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool]; 283 310 … … 285 312 hdr.idFrom = toolPtr->uId; 286 313 hdr.code = TTN_SHOW; 287 SendMessageA(toolPtr->hwnd,WM_NOTIFY, 288 (WPARAM)toolPtr->uId,(LPARAM)&hdr); 289 290 // TRACE (tooltips, "\"%s\"\n", debugstr_w(infoPtr->szTipText)); 291 292 TOOLTIPS_CalcTipRect(hwnd,infoPtr,toolPtr,&rect); 293 294 SetWindowPos (hwnd,HWND_TOP,rect.left,rect.top, 295 rect.right-rect.left,rect.bottom-rect.top, 296 SWP_SHOWWINDOW | SWP_NOACTIVATE); 314 SendMessageA (toolPtr->hwnd, WM_NOTIFY, 315 (WPARAM)toolPtr->uId, (LPARAM)&hdr); 316 317 // TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText)); 318 319 TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size); 320 TRACE("size %d - %d\n", size.cx, size.cy); 321 322 if (toolPtr->uFlags & TTF_CENTERTIP) { 323 RECT rc; 324 325 if (toolPtr->uFlags & TTF_IDISHWND) 326 GetWindowRect ((HWND)toolPtr->uId, &rc); 327 else { 328 rc = toolPtr->rect; 329 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); 330 } 331 rect.left = (rc.left + rc.right - size.cx) / 2; 332 rect.top = rc.bottom + 2; 333 } 334 else { 335 GetCursorPos ((LPPOINT)&rect); 336 rect.top += 20; 337 } 338 339 TRACE("pos %d - %d\n", rect.left, rect.top); 340 341 rect.right = rect.left + size.cx; 342 rect.bottom = rect.top + size.cy; 343 344 /* check position */ 345 wndrect.right = GetSystemMetrics( SM_CXSCREEN ); 346 if( rect.right > wndrect.right ) { 347 rect.left -= rect.right - wndrect.right + 2; 348 rect.right = wndrect.right - 2; 349 } 350 wndrect.bottom = GetSystemMetrics( SM_CYSCREEN ); 351 if( rect.bottom > wndrect.bottom ) { 352 RECT rc; 353 354 if (toolPtr->uFlags & TTF_IDISHWND) 355 GetWindowRect ((HWND)toolPtr->uId, &rc); 356 else { 357 rc = toolPtr->rect; 358 MapWindowPoints (toolPtr->hwnd, (HWND)0, (LPPOINT)&rc, 2); 359 } 360 rect.bottom = rc.top - 2; 361 rect.top = rect.bottom - size.cy; 362 } 363 364 AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), 365 FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); 366 367 SetWindowPos (hwnd, HWND_TOP, rect.left, rect.top, 368 rect.right - rect.left, rect.bottom - rect.top, 369 SWP_SHOWWINDOW | SWP_NOACTIVATE); 297 370 298 371 /* repaint the tooltip */ 299 hdc = GetDC (hwnd);300 TOOLTIPS_Refresh (hwnd,hdc);301 ReleaseDC (hwnd,hdc);302 303 SetTimer (hwnd, ID_TIMERPOP,infoPtr->nAutoPopTime,0);372 hdc = GetDC (hwnd); 373 TOOLTIPS_Refresh (hwnd, hdc); 374 ReleaseDC (hwnd, hdc); 375 376 SetTimer (hwnd, ID_TIMERPOP, infoPtr->nAutoPopTime, 0); 304 377 } 305 378 -
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 TEXTMETRICA tm;950 HBRUSH hbrBk;951 TEXTMETRICA tm; 952 HBRUSH hbrBk; 951 953 RECT rect; 952 HDC hdc;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 hdc=GetDC (hwnd);959 TRACE("\n"); 960 961 hdc=GetDC (hwnd); 960 962 961 963 if (infoPtr->Timer & TV_REFRESH_TIMER_SET) { 962 KillTimer (hwnd, TV_REFRESH_TIMER);963 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET;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 (hwnd, CDDS_PREPAINT, hdc, rect);972 973 if (infoPtr->cdmode==CDRF_SKIPDEFAULT) {974 ReleaseDC (hwnd, hdc);975 return;976 }977 978 infoPtr->uVisibleHeight= rect.bottom-rect.top;979 infoPtr->uVisibleWidth= rect.right-rect.left;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 prevItem=wineItem;1002 prevItem=wineItem; 1003 1003 wineItem= & infoPtr->items[iItem]; 1004 wineItem->iLevel=indent;1004 wineItem->iLevel=indent; 1005 1005 1006 1006 ImageList_GetIconSize (infoPtr->himlNormal, &cx, &itemHeight); 1007 1007 if (infoPtr->uItemHeight>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; 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 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 }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 } /* while */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 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 }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 ShowScrollBar (hwnd, SB_VERT, FALSE);1088 infoPtr->uInternalStatus &= ~TV_VSCROLL;1089 }1090 1091 1092 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) 1093 infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify1094 (hwnd, CDDS_POSTPAINT, hdc, rect);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.
