- Timestamp:
- Sep 26, 1999, 1:01:11 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/comctl32.c
r925 r1058 1 /* $Id: comctl32.c,v 1. 9 1999-09-13 18:49:02 cbratschiExp $ */1 /* $Id: comctl32.c,v 1.10 1999-09-26 11:01:08 achimha Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 11 11 * 12 12 */ 13 14 /* WINE 990923 level (commctrl.c) */ 13 15 14 16 #include "comctl32.h" … … 167 169 break; 168 170 171 case WM_COMMAND : 172 // TRACE("WM_COMMAND wParam=0x%X lParam=0x%lX\n", 173 // wParam, lParam); 174 /* WM_COMMAND is not invalid since it is documented 175 * in the windows api reference. So don't output 176 * any FIXME for WM_COMMAND 177 */ 178 // WARN("We don't care about the WM_COMMAND\n"); 179 break; 180 169 181 default: 170 182 // FIXME (commctrl, "Invalid Message 0x%x!\n", uMsg); … … 646 658 LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo; 647 659 UINT nSize, nColorTableSize; 648 DWORD *pColorTable;660 RGBQUAD *pColorTable; 649 661 INT iColor, i, iMaps, nWidth, nHeight; 650 662 HDC hdcScreen; 651 663 HBITMAP hbm; 652 664 LPCOLORMAP sysColorMap; 665 COLORREF cRef; 653 666 COLORMAP internalColorMap[4] = 654 667 {{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}}; … … 685 698 RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize); 686 699 687 pColorTable = ( DWORD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize);700 pColorTable = (RGBQUAD*)(((LPBYTE)lpBitmapInfo)+(UINT)lpBitmapInfo->biSize); 688 701 689 702 for (iColor = 0; iColor < nColorTableSize; iColor++) { 690 703 for (i = 0; i < iMaps; i++) { 691 if (pColorTable[iColor] == sysColorMap[i].from) { 704 cRef = RGB(pColorTable[iColor].rgbRed, 705 pColorTable[iColor].rgbGreen, 706 pColorTable[iColor].rgbBlue); 707 if ( cRef == sysColorMap[i].from) { 692 708 #if 0 693 709 if (wFlags & CBS_MASKED) { … … 697 713 else 698 714 #endif 699 pColorTable[iColor] = sysColorMap[i].to; 715 pColorTable[iColor].rgbBlue = GetBValue(sysColorMap[i].to); 716 pColorTable[iColor].rgbGreen = GetGValue(sysColorMap[i].to); 717 pColorTable[iColor].rgbRed = GetRValue(sysColorMap[i].to); 700 718 break; 701 719 } 702 720 } 703 721 } 704 705 722 nWidth = (INT)lpBitmapInfo->biWidth; 706 723 nHeight = (INT)lpBitmapInfo->biHeight; -
trunk/src/comctl32/comctl32.h
r496 r1058 1 /* $Id: comctl32.h,v 1. 7 1999-08-14 16:13:10 cbratschiExp $ */1 /* $Id: comctl32.h,v 1.8 1999-09-26 11:01:08 achimha Exp $ */ 2 2 /* 3 3 * Win32 common controls implementation … … 11 11 * 12 12 */ 13 14 /* Status: WINE 990923 */ 13 15 14 16 #ifndef _H_COMCTL32 … … 55 57 #define IDC_TABCONTROL 12320 56 58 #define IDC_APPLY_BUTTON 12321 59 #define IDC_BACK_BUTTON 12323 60 #define IDC_NEXT_BUTTON 12324 61 #define IDC_FINISH_BUTTON 12325 62 #define IDC_SUNKEN_LINE 12326 57 63 58 64 /* Toolbar customization dialog */ -
trunk/src/comctl32/comctl32undoc.c
r722 r1058 1 /* $Id: comctl32undoc.c,v 1.1 1 1999-08-28 09:25:56achimha Exp $ */1 /* $Id: comctl32undoc.c,v 1.12 1999-09-26 11:01:08 achimha Exp $ */ 2 2 /* 3 3 * Undocumented functions from COMCTL32.DLL … … 12 12 */ 13 13 14 /* WINE 990 815level */14 /* WINE 990923 level */ 15 15 16 16 /* CB: todo … … 689 689 /* resize the block of memory */ 690 690 nNewItems = 691 hdsa->nGrow * ((INT)((nIndex- 1) / hdsa->nGrow) + 1);691 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1); 692 692 nSize = hdsa->nItemSize * nNewItems; 693 693 … … 1195 1195 /* resize the block of memory */ 1196 1196 INT nNewItems = 1197 hdpa->nGrow * ((INT)((i- 1) / hdpa->nGrow) + 1);1197 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1); 1198 1198 INT nSize = nNewItems * sizeof(LPVOID); 1199 1199 -
trunk/src/comctl32/imagelist.c
r496 r1058 1 /* $Id: imagelist.c,v 1. 6 1999-08-14 16:13:11 cbratschiExp $ */1 /* $Id: imagelist.c,v 1.7 1999-09-26 11:01:09 achimha Exp $ */ 2 2 /* 3 3 * ImageList implementation … … 30 30 */ 31 31 32 /* WINE 990923 level */ 33 32 34 /* This must be defined because the HIMAGELIST type is just a pointer 33 35 * to the _IMAGELIST data structure. But M$ does not want us to know … … 206 208 HBITMAP hOldBitmapImage, hOldBitmapMask; 207 209 HIMAGELIST himlLocal = pimldp->himl; 210 COLORREF oldBkColor, oldFgColor; 208 211 209 212 bUseCustomBackground = (himlLocal->clrBk != CLR_NONE); … … 238 241 || bBlendFlag) 239 242 { 243 /* to obtain a transparent look, background color should be set 244 to white and foreground color to black when blting the 245 monochrome mask. */ 246 oldBkColor = SetBkColor(pimldp->hdcDst, RGB(0xff, 0xff, 0xff)); 247 oldFgColor = SetTextColor(pimldp->hdcDst, RGB(0, 0, 0)); 248 240 249 BitBlt(pimldp->hdcDst, 241 250 pimldp->x, pimldp->y, cx, cy, … … 249 258 himlLocal->cx * pimldp->i, 0, 250 259 SRCPAINT); 260 261 SetBkColor(pimldp->hdcDst, oldBkColor); 262 SetTextColor(pimldp->hdcDst, oldFgColor); 251 263 } 252 264 /* Draw the image when no Background is specified … … 889 901 // TRACE(imagelist, "Image: %d Bits per Pixel\n", himl->uBitsPixel); 890 902 891 himl->hbmImage = 892 CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 903 if (himl->cMaxImage > 0) { 904 himl->hbmImage = 905 CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 893 906 1, himl->uBitsPixel, NULL); 894 if (himl->hbmImage == 0) { 895 // ERR(imagelist, "Error creating image bitmap!\n"); 896 return NULL; 897 } 898 899 if (himl->flags & ILC_MASK) { 907 if (himl->hbmImage == 0) { 908 // ERR("Error creating image bitmap!\n"); 909 return NULL; 910 } 911 } 912 else 913 himl->hbmImage = 0; 914 915 if ( (himl->cMaxImage > 0) && (himl->flags & ILC_MASK)) { 900 916 himl->hbmMask = CreateBitmap (himl->cx * himl->cMaxImage, himl->cy, 901 917 1, 1, NULL); … … 2107 2123 HDC hdcImageList, hdcImage; 2108 2124 INT nIndex; 2125 HICON hBestFitIcon; 2109 2126 HBITMAP hbmOldSrc, hbmOldDst; 2110 2127 ICONINFO ii; … … 2118 2135 return -1; 2119 2136 2120 GetIconInfo (hIcon, &ii); 2137 hBestFitIcon = CopyImage( 2138 hIcon, IMAGE_ICON, 2139 himl->cx, himl->cy, 2140 LR_COPYFROMRESOURCE); 2141 2142 GetIconInfo (hBestFitIcon, &ii); 2121 2143 // if (ii.hbmMask == 0) 2122 2144 // ERR (imagelist, "no mask!\n"); … … 2162 2184 SelectObject (hdcImageList, hbmOldDst); 2163 2185 2186 if(hBestFitIcon) 2187 DestroyIcon(hBestFitIcon); 2164 2188 if (hdcImageList) 2165 2189 DeleteDC (hdcImageList); -
trunk/src/comctl32/listview.c
r496 r1058 43 43 * LISTVIEW_Update : not completed 44 44 */ 45 46 /* WINE 990923 level */ 45 47 46 48 #include <string.h> … … 3576 3578 HDC hdc; 3577 3579 HFONT hOldFont; 3578 INT n MaxWidth;3580 INT nLeftPos; 3579 3581 INT nLabelWidth; 3580 3582 TEXTMETRICA tm; … … 3682 3684 { 3683 3685 bResult = TRUE; 3684 n MaxWidth = lprc->left = ptItem.x + ptOrigin.x;3686 nLeftPos = lprc->left = ptItem.x + ptOrigin.x; 3685 3687 lprc->top = ptItem.y + ptOrigin.y; 3686 3688 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3697 3699 3698 3700 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3699 if (lprc->left + nLabelWidth < n MaxWidth+ infoPtr->nItemWidth)3701 if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 3700 3702 { 3701 3703 lprc->right = lprc->left + nLabelWidth; … … 3703 3705 else 3704 3706 { 3705 lprc->right = n MaxWidth+ infoPtr->nItemWidth;3707 lprc->right = nLeftPos + infoPtr->nItemWidth; 3706 3708 } 3707 3709 } … … 3710 3712 { 3711 3713 bResult = TRUE; 3712 lprc->left = ptItem.x;3714 nLeftPos = lprc->left = ptItem.x; 3713 3715 lprc->top = ptItem.y; 3714 3716 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3724 3726 } 3725 3727 3726 lprc->right = lprc->left + LISTVIEW_GetLabelWidth(hwnd, nItem); 3728 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3729 if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 3730 { 3731 lprc->right = lprc->left + nLabelWidth; 3732 } 3733 else 3734 { 3735 lprc->right = nLeftPos + infoPtr->nItemWidth; 3736 } 3727 3737 } 3728 3738 break; … … 3777 3787 } 3778 3788 3779 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3789 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3790 if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth) 3791 { 3792 lprc->right += nLabelWidth; 3793 } 3794 else 3795 { 3796 lprc->right = lprc->left + infoPtr->nItemWidth; 3797 } 3780 3798 } 3781 3799 break; … … 3801 3819 { 3802 3820 bResult = TRUE; 3803 lprc->left = ptItem.x + ptOrigin.x;3821 nLeftPos= lprc->left = ptItem.x + ptOrigin.x; 3804 3822 lprc->top = ptItem.y + ptOrigin.y; 3805 3823 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3817 3835 } 3818 3836 3819 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3837 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3838 if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth) 3839 { 3840 lprc->right += nLabelWidth; 3841 } 3842 else 3843 { 3844 lprc->right = lprc->left + infoPtr->nItemWidth; 3845 } 3820 3846 } 3821 3847 } … … 3823 3849 { 3824 3850 bResult = TRUE; 3825 lprc->left = ptItem.x;3851 nLeftPos = lprc->left = ptItem.x; 3826 3852 lprc->top = ptItem.y; 3827 3853 lprc->bottom = lprc->top + infoPtr->nItemHeight; … … 3839 3865 } 3840 3866 3841 lprc->right += LISTVIEW_GetLabelWidth(hwnd, nItem); 3867 nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem); 3868 if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth) 3869 { 3870 lprc->right += nLabelWidth; 3871 } 3872 else 3873 { 3874 lprc->right = nLeftPos + infoPtr->nItemWidth; 3875 } 3842 3876 } 3843 3877 break; … … 3860 3894 * FAILURE : zero 3861 3895 */ 3862 staticINT LISTVIEW_GetLabelWidth(HWND hwnd, INT nItem)3896 INT LISTVIEW_GetLabelWidth(HWND hwnd, INT nItem) 3863 3897 { 3864 3898 CHAR szDispText[DISP_TEXT_SIZE]; … … 3892 3926 * Horizontal + vertical spacing 3893 3927 */ 3894 staticLRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall)3928 LRESULT LISTVIEW_GetItemSpacing(HWND hwnd, BOOL bSmall) 3895 3929 { 3896 3930 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); … … 3922 3956 * State specified by the mask. 3923 3957 */ 3924 staticLRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask)3958 LRESULT LISTVIEW_GetItemState(HWND hwnd, INT nItem, UINT uMask) 3925 3959 { 3926 3960 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); … … 3956 3990 * FAILURE : 0 3957 3991 */ 3958 staticLRESULT LISTVIEW_GetItemTextA(HWND hwnd, INT nItem, LPLVITEMA lpLVItem)3992 LRESULT LISTVIEW_GetItemTextA(HWND hwnd, INT nItem, LPLVITEMA lpLVItem) 3959 3993 { 3960 3994 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); … … 4509 4543 } 4510 4544 4511 /* LISTVIEW_InsertColumnW */ 4545 static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn, 4546 LPLVCOLUMNW lpColumn) 4547 { 4548 LVCOLUMNA lvca; 4549 LRESULT lres; 4550 4551 memcpy(&lvca,lpColumn,sizeof(lvca)); 4552 //AH: todo 4553 // if (lpColumn->mask & LVCF_TEXT) 4554 // lvca.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpColumn->pszText); 4555 lres = LISTVIEW_InsertColumnA(hwnd,nColumn,&lvca); 4556 if (lpColumn->mask & LVCF_TEXT) 4557 HeapFree(GetProcessHeap(),0,lvca.pszText); 4558 return lres; 4559 } 4512 4560 4513 4561 /*** … … 4609 4657 } 4610 4658 4611 /* LISTVIEW_InsertItemW */ 4659 static LRESULT LISTVIEW_InsertItemW(HWND hwnd, LPLVITEMW lpLVItem) { 4660 LVITEMA lvia; 4661 LRESULT lres; 4662 4663 memcpy(&lvia,lpLVItem,sizeof(LVITEMA)); 4664 if (lvia.mask & LVIF_TEXT) { 4665 if (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) 4666 lvia.pszText = LPSTR_TEXTCALLBACKA; 4667 //AH: todo 4668 // else 4669 // lvia.pszText = HEAP_strdupWtoA(GetProcessHeap(),0,lpLVItem->pszText); 4670 } 4671 lres = LISTVIEW_InsertItemA(hwnd, &lvia); 4672 if (lvia.mask & LVIF_TEXT) { 4673 if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW) 4674 HeapFree(GetProcessHeap(),0,lvia.pszText); 4675 } 4676 return lres; 4677 } 4612 4678 4613 4679 /*** … … 6323 6389 infoPtr->bFocus = TRUE; 6324 6390 6391 InvalidateRect(hwnd, NULL, TRUE); 6392 UpdateWindow(hwnd); 6393 6325 6394 return 0; 6326 6395 } … … 6722 6791 6723 6792 case LVM_INSERTCOLUMNA: 6724 return LISTVIEW_InsertColumnA(hwnd, (INT)wParam, 6725 (LPLVCOLUMNA)lParam); 6726 6727 /* case LVM_INSERTCOLUMNW: */ 6793 return LISTVIEW_InsertColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam); 6794 6795 case LVM_INSERTCOLUMNW: 6796 return LISTVIEW_InsertColumnW(hwnd, (INT)wParam, (LPLVCOLUMNW)lParam); 6728 6797 6729 6798 case LVM_INSERTITEMA: 6730 6799 return LISTVIEW_InsertItemA(hwnd, (LPLVITEMA)lParam); 6731 6800 6732 /* case LVM_INSERTITEMW: */ 6801 case LVM_INSERTITEMW: 6802 return LISTVIEW_InsertItemW(hwnd, (LPLVITEMW)lParam); 6733 6803 6734 6804 case LVM_REDRAWITEMS: … … 6827 6897 6828 6898 case WM_GETDLGCODE: 6829 return DLGC_WANT TAB| DLGC_WANTARROWS;6899 return DLGC_WANTCHARS | DLGC_WANTARROWS; 6830 6900 6831 6901 case WM_GETFONT: -
trunk/src/comctl32/propsheet.c
r722 r1058 1 /* $Id: propsheet.c,v 1. 8 1999-08-28 09:25:56achimha Exp $ */1 /* $Id: propsheet.c,v 1.9 1999-09-26 11:01:10 achimha Exp $ */ 2 2 /* 3 3 * Property Sheets … … 9 9 * 10 10 * TODO: 11 * - Modeless mode 12 * - Wizard mode 11 * - Tab order 13 12 * - Unicode property sheets 14 13 */ 15 14 16 /* WINE 990 815level */15 /* WINE 990923 level */ 17 16 18 17 /* CB: Odin problems: … … 108 107 static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo); 109 108 static PADDING_INFO PROPSHEET_GetPaddingInfo(HWND hwndDlg); 109 static BOOL PROPSHEET_Back(HWND hwndDlg); 110 static BOOL PROPSHEET_Next(HWND hwndDlg); 111 static BOOL PROPSHEET_Finish(HWND hwndDlg); 110 112 static BOOL PROPSHEET_Apply(HWND hwndDlg); 111 113 static void PROPSHEET_Cancel(HWND hwndDlg); … … 114 116 static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage); 115 117 static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID); 118 static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText); 116 119 static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText); 117 120 static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, … … 130 133 static void PROPSHEET_CleanUp(); 131 134 static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, PropSheetInfo* psInfo); 135 static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags); 136 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg); 132 137 133 138 BOOL WINAPI … … 282 287 p += lstrlenW((LPCWSTR)p) + 1; 283 288 289 if (dwFlags & PSP_USETITLE) 290 { 291 //AH: todo 292 // psInfo->proppage[index].pszText = HEAP_strdupAtoW(GetProcessHeap(), 293 // 0, 294 // lppsp->pszTitle); 295 } 296 284 297 /* 285 298 * Build the image list for icons … … 311 324 * Creates the actual property sheet. 312 325 */ 326 327 //AH: WINE 990923 not merged due to changes from CB 328 313 329 BOOL PROPSHEET_CreateDialog(PropSheetInfo* psInfo) 314 330 { … … 407 423 408 424 /****************************************************************************** 425 * PROPSHEET_IsTooSmallWizard 426 * 427 * Verify that the default property sheet is big enough. 428 */ 429 static BOOL PROPSHEET_IsTooSmallWizard(HWND hwndDlg, PropSheetInfo* psInfo) 430 { 431 RECT rcSheetRect, rcPage, rcLine, rcSheetClient; 432 HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); 433 PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg); 434 435 GetClientRect(hwndDlg, &rcSheetClient); 436 GetWindowRect(hwndDlg, &rcSheetRect); 437 GetWindowRect(hwndLine, &rcLine); 438 439 /* Remove the space below the sunken line */ 440 rcSheetClient.bottom -= (rcSheetRect.bottom - rcLine.top); 441 442 /* Remove the buffer zone all around the edge */ 443 rcSheetClient.bottom -= (padding.y * 2); 444 rcSheetClient.right -= (padding.x * 2); 445 446 /* 447 * Biggest page size. 448 */ 449 rcPage.left = psInfo->x; 450 rcPage.top = psInfo->y; 451 rcPage.right = psInfo->width; 452 rcPage.bottom = psInfo->height; 453 454 MapDialogRect(hwndDlg, &rcPage); 455 // TRACE("biggest page %d %d %d %d\n", rcPage.left, rcPage.top, 456 // rcPage.right, rcPage.bottom); 457 458 if (rcPage.right > rcSheetClient.right) 459 return TRUE; 460 461 if (rcPage.bottom > rcSheetClient.bottom) 462 return TRUE; 463 464 return FALSE; 465 } 466 467 /****************************************************************************** 409 468 * PROPSHEET_AdjustSize 410 469 * … … 453 512 rc.right += ((padding.x * 2) + tabOffsetX); 454 513 rc.bottom += (buttonHeight + (3 * padding.y) + tabOffsetY); 514 515 /* 516 * Resize the property sheet. 517 */ 518 SetWindowPos(hwndDlg, 0, 0, 0, rc.right, rc.bottom, 519 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); 520 521 return TRUE; 522 } 523 524 /****************************************************************************** 525 * PROPSHEET_AdjustSizeWizard 526 * 527 * Resizes the property sheet to fit the largest page. 528 */ 529 static BOOL PROPSHEET_AdjustSizeWizard(HWND hwndDlg, PropSheetInfo* psInfo) 530 { 531 HWND hwndButton = GetDlgItem(hwndDlg, IDCANCEL); 532 HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); 533 RECT rc; 534 int buttonHeight, lineHeight; 535 PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg); 536 537 /* Get the height of buttons */ 538 GetClientRect(hwndButton, &rc); 539 buttonHeight = rc.bottom; 540 541 GetClientRect(hwndLine, &rc); 542 lineHeight = rc.bottom; 543 544 /* 545 * Biggest page size. 546 */ 547 rc.left = psInfo->x; 548 rc.top = psInfo->y; 549 rc.right = psInfo->width; 550 rc.bottom = psInfo->height; 551 552 MapDialogRect(hwndDlg, &rc); 553 554 // TRACE("Biggest page %d %d %d %d\n", rc.left, rc.top, rc.right, rc.bottom); 555 556 /* Make room */ 557 rc.right += (padding.x * 2); 558 rc.bottom += (buttonHeight + (5 * padding.y) + lineHeight); 455 559 456 560 /* … … 559 663 560 664 /****************************************************************************** 665 * PROPSHEET_AdjustButtonsWizard 666 * 667 * Adjusts the buttons' positions. 668 */ 669 static BOOL PROPSHEET_AdjustButtonsWizard(HWND hwndParent, 670 PropSheetInfo* psInfo) 671 { 672 HWND hwndButton = GetDlgItem(hwndParent, IDCANCEL); 673 HWND hwndLine = GetDlgItem(hwndParent, IDC_SUNKEN_LINE); 674 RECT rcSheet; 675 int x, y; 676 int num_buttons = 3; 677 int buttonWidth, buttonHeight, lineHeight, lineWidth; 678 PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndParent); 679 680 if (psInfo->hasHelp) 681 num_buttons++; 682 683 /* 684 * Obtain the size of the buttons. 685 */ 686 GetClientRect(hwndButton, &rcSheet); 687 buttonWidth = rcSheet.right; 688 buttonHeight = rcSheet.bottom; 689 690 GetClientRect(hwndLine, &rcSheet); 691 lineHeight = rcSheet.bottom; 692 693 /* 694 * Get the size of the property sheet. 695 */ 696 GetClientRect(hwndParent, &rcSheet); 697 698 /* 699 * All buttons will be at this y coordinate. 700 */ 701 y = rcSheet.bottom - (padding.y + buttonHeight); 702 703 /* 704 * Position the Next and the Finish buttons. 705 */ 706 hwndButton = GetDlgItem(hwndParent, IDC_NEXT_BUTTON); 707 708 x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 1)); 709 710 SetWindowPos(hwndButton, 0, x, y, 0, 0, 711 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 712 713 hwndButton = GetDlgItem(hwndParent, IDC_FINISH_BUTTON); 714 715 SetWindowPos(hwndButton, 0, x, y, 0, 0, 716 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 717 718 ShowWindow(hwndButton, SW_HIDE); 719 720 /* 721 * Position the Back button. 722 */ 723 hwndButton = GetDlgItem(hwndParent, IDC_BACK_BUTTON); 724 725 x -= buttonWidth; 726 727 SetWindowPos(hwndButton, 0, x, y, 0, 0, 728 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 729 730 /* 731 * Position the Cancel button. 732 */ 733 hwndButton = GetDlgItem(hwndParent, IDCANCEL); 734 735 x = rcSheet.right - ((padding.x + buttonWidth) * (num_buttons - 2)); 736 737 SetWindowPos(hwndButton, 0, x, y, 0, 0, 738 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 739 740 /* 741 * Position Help button. 742 */ 743 hwndButton = GetDlgItem(hwndParent, IDHELP); 744 745 if (psInfo->hasHelp) 746 { 747 x = rcSheet.right - (padding.x + buttonWidth); 748 749 SetWindowPos(hwndButton, 0, x, y, 0, 0, 750 SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); 751 } 752 else 753 ShowWindow(hwndButton, SW_HIDE); 754 755 /* 756 * Position and resize the sunken line. 757 */ 758 x = padding.x; 759 y = rcSheet.bottom - ((padding.y * 2) + buttonHeight + lineHeight); 760 761 GetClientRect(hwndParent, &rcSheet); 762 lineWidth = rcSheet.right - (padding.x * 2); 763 764 SetWindowPos(hwndLine, 0, x, y, lineWidth, 2, 765 SWP_NOZORDER | SWP_NOACTIVATE); 766 767 return TRUE; 768 } 769 770 /****************************************************************************** 561 771 * PROPSHEET_GetPaddingInfo 562 772 * … … 579 789 padding.x = tl.x; 580 790 padding.y = tl.y; 791 792 return padding; 793 } 794 795 /****************************************************************************** 796 * PROPSHEET_GetPaddingInfoWizard 797 * 798 * Returns the layout information. 799 * Horizontal spacing is the distance between the Cancel and Help buttons. 800 * Vertical spacing is the distance between the line and the buttons. 801 */ 802 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg) 803 { 804 PADDING_INFO padding; 805 RECT rc; 806 HWND hwndControl; 807 POINT ptHelp, ptCancel, ptLine; 808 809 /* Help button */ 810 hwndControl = GetDlgItem(hwndDlg, IDHELP); 811 GetWindowRect(hwndControl, &rc); 812 813 ptHelp.x = rc.left; 814 ptHelp.y = rc.top; 815 816 ScreenToClient(hwndDlg, &ptHelp); 817 818 /* Cancel button */ 819 hwndControl = GetDlgItem(hwndDlg, IDCANCEL); 820 GetWindowRect(hwndControl, &rc); 821 822 ptCancel.x = rc.right; 823 ptCancel.y = rc.top; 824 825 ScreenToClient(hwndDlg, &ptCancel); 826 827 /* Line */ 828 hwndControl = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE); 829 GetWindowRect(hwndControl, &rc); 830 831 ptLine.x = 0; 832 ptLine.y = rc.bottom; 833 834 ScreenToClient(hwndDlg, &ptLine); 835 836 padding.x = ptHelp.x - ptCancel.x; 837 padding.y = ptHelp.y - ptLine.y; 581 838 582 839 return padding; … … 640 897 RECT rc; 641 898 PropPageInfo* ppInfo = psInfo->proppage; 642 PADDING_INFO padding = PROPSHEET_GetPaddingInfo(hwndParent);643 HWND hwnd TabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL);899 PADDING_INFO padding; 900 HWND hwndAfter; 644 901 645 902 // TRACE(propsheet, "index %d\n", index); … … 696 953 MapDialogRect(hwndParent, &rc); 697 954 698 /* 699 * Ask the Tab control to fit this page in. 700 */ 701 SendMessageA(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&rc); 702 703 SetWindowPos(hwndPage, HWND_TOP, 955 if (psInfo->ppshheader->dwFlags & PSH_WIZARD) 956 { 957 GetWindowRect(hwndParent, &rc); 958 padding = PROPSHEET_GetPaddingInfoWizard(hwndParent); 959 hwndAfter = hwndParent; 960 } 961 else 962 { 963 /* 964 * Ask the Tab control to fit this page in. 965 */ 966 967 HWND hwndTabCtrl = GetDlgItem(hwndParent, IDC_TABCONTROL); 968 SendMessageA(hwndTabCtrl, TCM_ADJUSTRECT, FALSE, (LPARAM)&rc); 969 padding = PROPSHEET_GetPaddingInfo(hwndParent); 970 hwndAfter = HWND_TOP; 971 } 972 973 SetWindowPos(hwndPage, hwndAfter, 704 974 rc.left + padding.x, 705 975 rc.top + padding.y, … … 747 1017 748 1018 psInfo->active_page = index; 1019 1020 return TRUE; 1021 } 1022 1023 /****************************************************************************** 1024 * PROPSHEET_Back 1025 */ 1026 static BOOL PROPSHEET_Back(HWND hwndDlg) 1027 { 1028 BOOL res; 1029 NMHDR hdr; 1030 HWND hwndPage; 1031 HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); 1032 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, 1033 PropSheetInfoStr); 1034 1035 hdr.code = PSN_WIZBACK; 1036 1037 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1038 1039 if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr) == -1) 1040 return FALSE; 1041 1042 res = PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page - 1, 0); 1043 1044 /* if we went to page 0, disable Back button */ 1045 if (res && (psInfo->active_page == 0)) 1046 EnableWindow(hwndBack, FALSE); 1047 1048 return TRUE; 1049 } 1050 1051 /****************************************************************************** 1052 * PROPSHEET_Next 1053 */ 1054 static BOOL PROPSHEET_Next(HWND hwndDlg) 1055 { 1056 NMHDR hdr; 1057 HWND hwndPage; 1058 LRESULT msgResult = 0; 1059 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, 1060 PropSheetInfoStr); 1061 1062 hdr.code = PSN_WIZNEXT; 1063 1064 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1065 1066 msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1067 1068 // TRACE("msg result %ld\n", msgResult); 1069 1070 if (msgResult == -1) 1071 return FALSE; 1072 1073 PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page + 1, 0); 1074 1075 return TRUE; 1076 } 1077 1078 /****************************************************************************** 1079 * PROPSHEET_Finish 1080 */ 1081 static BOOL PROPSHEET_Finish(HWND hwndDlg) 1082 { 1083 NMHDR hdr; 1084 HWND hwndPage; 1085 LRESULT msgResult = 0; 1086 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, 1087 PropSheetInfoStr); 1088 1089 hdr.code = PSN_WIZFINISH; 1090 1091 hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; 1092 1093 msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &hdr); 1094 1095 // TRACE("msg result %ld\n", msgResult); 1096 1097 if (msgResult != 0) 1098 return FALSE; 1099 1100 if (psInfo->isModeless) 1101 psInfo->active_page = -1; 1102 else 1103 EndDialog(hwndDlg, TRUE); 749 1104 750 1105 return TRUE; … … 903 1258 break; 904 1259 case PSBTN_BACK: 905 // FIXME(propsheet, "Wizard mode not implemented.\n");1260 PROPSHEET_Back(hwndDlg); 906 1261 break; 907 1262 case PSBTN_CANCEL: … … 909 1264 break; 910 1265 case PSBTN_FINISH: 911 // FIXME(propsheet, "Wizard mode not implemented.\n");1266 PROPSHEET_Finish(hwndDlg); 912 1267 break; 913 1268 case PSBTN_HELP: … … 915 1270 break; 916 1271 case PSBTN_NEXT: 917 // FIXME(propsheet, "Wizard mode not implemented.\n");1272 PROPSHEET_Next(hwndDlg); 918 1273 break; 919 1274 case PSBTN_OK: … … 1016 1371 else 1017 1372 SetWindowTextA(hwndDlg, lpszText); 1373 } 1374 1375 /****************************************************************************** 1376 * PROPSHEET_SetFinishTextA 1377 */ 1378 static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText) 1379 { 1380 HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); 1381 1382 /* Set text, show and enable the Finish button */ 1383 SetWindowTextA(hwndButton, lpszText); 1384 ShowWindow(hwndButton, SW_SHOW); 1385 EnableWindow(hwndButton, TRUE); 1386 1387 /* Make it default pushbutton */ 1388 SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); 1389 1390 /* Hide Back button */ 1391 hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); 1392 ShowWindow(hwndButton, SW_HIDE); 1393 1394 /* Hide Next button */ 1395 hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); 1396 ShowWindow(hwndButton, SW_HIDE); 1018 1397 } 1019 1398 … … 1196 1575 1197 1576 /****************************************************************************** 1577 * PROPSHEET_SetWizButtons 1578 * 1579 * This code will work if (and assumes that) the Next button is on top of the 1580 * Finish button. ie. Finish comes after Next in the Z order. 1581 * This means make sure the dialog template reflects this. 1582 * 1583 */ 1584 static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) 1585 { 1586 HWND hwndButton; 1587 1588 // TRACE("%ld\n", dwFlags); 1589 1590 if (dwFlags & PSWIZB_BACK) 1591 { 1592 hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); 1593 EnableWindow(hwndButton, TRUE); 1594 } 1595 1596 if (dwFlags & PSWIZB_NEXT) 1597 { 1598 /* Hide the Finish button */ 1599 hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); 1600 ShowWindow(hwndButton, SW_HIDE); 1601 1602 /* Show and enable the Next button */ 1603 hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); 1604 1605 ShowWindow(hwndButton, SW_SHOW); 1606 EnableWindow(hwndButton, TRUE); 1607 1608 /* Set the Next button as the default pushbutton */ 1609 SendMessageA(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); 1610 } 1611 1612 if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH)) 1613 { 1614 /* Hide the Next button */ 1615 hwndButton = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); 1616 ShowWindow(hwndButton, SW_HIDE); 1617 1618 /* Show the Finish button */ 1619 hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); 1620 ShowWindow(hwndButton, SW_SHOW); 1621 1622 if (dwFlags & PSWIZB_FINISH) 1623 EnableWindow(hwndButton, TRUE); 1624 else 1625 EnableWindow(hwndButton, FALSE); 1626 1627 /* Set the Finish button as the default pushbutton */ 1628 SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); 1629 } 1630 } 1631 1632 /****************************************************************************** 1198 1633 * PROPSHEET_GetPageIndex 1199 1634 * … … 1322 1757 LPCPROPSHEETPAGEA ppshpage; 1323 1758 1759 /* 1760 * Small icon in the title bar. 1761 */ 1762 if ((psInfo->ppshheader->dwFlags & PSH_USEICONID) || 1763 (psInfo->ppshheader->dwFlags & PSH_USEHICON)) 1764 { 1765 HICON hIcon; 1766 int icon_cx = GetSystemMetrics(SM_CXSMICON); 1767 int icon_cy = GetSystemMetrics(SM_CYSMICON); 1768 1769 if (psInfo->ppshheader->dwFlags & PSH_USEICONID) 1770 hIcon = LoadImageA(psInfo->ppshheader->hInstance, 1771 psInfo->ppshheader->u1.pszIcon, 1772 IMAGE_ICON, 1773 icon_cx, icon_cy, 1774 LR_DEFAULTCOLOR); 1775 else 1776 hIcon = psInfo->ppshheader->u1.hIcon; 1777 1778 SendMessageA(hwnd, WM_SETICON, 0, hIcon); 1779 } 1780 1781 if (psInfo->ppshheader->dwFlags & PSH_USEHICON) 1782 SendMessageA(hwnd, WM_SETICON, 0, psInfo->ppshheader->u1.hIcon); 1783 1324 1784 psInfo->strPropertiesFor = strCaption; 1325 1785 1326 1786 GetWindowTextA(hwnd, psInfo->strPropertiesFor, MAX_CAPTION_LENGTH); 1327 1787 1328 PROPSHEET_CreateTabControl(hwnd, psInfo); 1329 1330 if (PROPSHEET_IsTooSmall(hwnd, psInfo)) 1788 if (psInfo->ppshheader->dwFlags & PSH_WIZARD) 1331 1789 { 1332 PROPSHEET_AdjustSize(hwnd, psInfo); 1333 PROPSHEET_AdjustButtons(hwnd, psInfo); 1790 HWND hwndBack = GetDlgItem(hwnd, IDC_BACK_BUTTON); 1791 1792 if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo)) 1793 { 1794 PROPSHEET_AdjustSizeWizard(hwnd, psInfo); 1795 PROPSHEET_AdjustButtonsWizard(hwnd, psInfo); 1796 } 1797 1798 /* Disable Back button if we start at page 0 */ 1799 if (psInfo->active_page == 0) 1800 EnableWindow(hwndBack, FALSE); 1334 1801 } 1335 1336 ppshpage = PROPSHEET_GetPSPPage(psInfo, psInfo->active_page); 1802 else 1803 { 1804 PROPSHEET_CreateTabControl(hwnd, psInfo); 1805 1806 if (PROPSHEET_IsTooSmall(hwnd, psInfo)) 1807 { 1808 PROPSHEET_AdjustSize(hwnd, psInfo); 1809 PROPSHEET_AdjustButtons(hwnd, psInfo); 1810 } 1811 } 1812 1813 ppshpage = PROPSHEET_GetPSPPage(psInfo, psInfo->active_page); 1337 1814 PROPSHEET_CreatePage(hwnd, psInfo->active_page, psInfo, ppshpage, TRUE); 1338 SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0); 1815 1816 if (!(psInfo->ppshheader->dwFlags & PSH_WIZARD)) 1817 SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0); 1339 1818 1340 1819 SetPropA(hwnd, PropSheetInfoStr, (HANDLE)psInfo); … … 1393 1872 } 1394 1873 1874 case IDC_BACK_BUTTON: 1875 PROPSHEET_Back(hwnd); 1876 break; 1877 1878 case IDC_NEXT_BUTTON: 1879 PROPSHEET_Next(hwnd); 1880 break; 1881 1882 case IDC_FINISH_BUTTON: 1883 PROPSHEET_Finish(hwnd); 1884 break; 1885 1395 1886 case IDCANCEL: 1396 1887 PROPSHEET_Cancel(hwnd); … … 1484 1975 case PSM_REBOOTSYSTEM: 1485 1976 { 1486 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd, 1977 PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwnd, 1487 1978 PropSheetInfoStr); 1488 1979 … … 1523 2014 case PSM_ISDIALOGMESSAGE: 1524 2015 { 1525 // FIXME (propsheet,"Unimplemented msg PSM_ISDIALOGMESSAGE\n");2016 // FIXME("Unimplemented msg PSM_ISDIALOGMESSAGE\n"); 1526 2017 return 0; 1527 2018 } … … 1531 2022 return TRUE; 1532 2023 2024 case PSM_SETFINISHTEXTA: 2025 PROPSHEET_SetFinishTextA(hwnd, (LPCSTR) lParam); 2026 return TRUE; 2027 2028 case PSM_SETWIZBUTTONS: 2029 PROPSHEET_SetWizButtons(hwnd, (DWORD)lParam); 2030 return TRUE; 2031 1533 2032 case PSM_SETTITLEW: 1534 // FIXME (propsheet, "Unimplemented msg PSM_SETTITLE32W\n"); 1535 return 0; 1536 case PSM_SETWIZBUTTONS: 1537 // FIXME (propsheet, "Unimplemented msg PSM_SETWIZBUTTONS\n"); 2033 // FIXME("Unimplemented msg PSM_SETTITLE32W\n"); 1538 2034 return 0; 1539 2035 case PSM_SETCURSELID: 1540 // FIXME (propsheet, "Unimplemented msg PSM_SETCURSELID\n"); 1541 return 0; 1542 case PSM_SETFINISHTEXTA: 1543 // FIXME (propsheet, "Unimplemented msg PSM_SETFINISHTEXT32A\n"); 2036 // FIXME("Unimplemented msg PSM_SETCURSELID\n"); 1544 2037 return 0; 1545 2038 case PSM_SETFINISHTEXTW: 1546 // FIXME (propsheet,"Unimplemented msg PSM_SETFINISHTEXT32W\n");2039 // FIXME("Unimplemented msg PSM_SETFINISHTEXT32W\n"); 1547 2040 return 0; 1548 2041 -
trunk/src/comctl32/status.c
r496 r1058 1 /* $Id: status.c,v 1.1 0 1999-08-14 16:13:12 cbratschiExp $ */1 /* $Id: status.c,v 1.11 1999-09-26 11:01:10 achimha Exp $ */ 2 2 /* 3 3 * Interface code to StatusWindow widget/control … … 8 8 * Copyright 1999 Christoph Bratschi 9 9 */ 10 11 /* WINE 990923 level */ 10 12 11 13 #include "winbase.h" … … 838 840 LPCREATESTRUCTA lpCreate = (LPCREATESTRUCTA)lParam; 839 841 NONCLIENTMETRICSA nclm; 840 RECT 841 int 842 HDC 842 RECT rect; 843 int width, len; 844 HDC hdc; 843 845 STATUSWINDOWINFO *self; 844 846 … … 873 875 874 876 if (IsWindowUnicode (hwnd)) { 875 876 len = lstrlenW ((LPCWSTR)lpCreate->lpszName); 877 if (len) {878 879 880 877 self->bUnicode = TRUE; 878 if (lpCreate->lpszName && 879 (len = lstrlenW ((LPCWSTR)lpCreate->lpszName))) { 880 self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 881 lstrcpyW (self->parts[0].text, (LPCWSTR)lpCreate->lpszName); 882 } 881 883 } 882 884 else { 883 len = lstrlenA ((LPCSTR)lpCreate->lpszName); 884 if (len) { 885 self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 886 lstrcpyAtoW (self->parts[0].text, (char*)lpCreate->lpszName); 887 } 888 } 889 890 hdc = GetDC(hwnd); 891 if (hdc) { 892 TEXTMETRICA tm; 893 HFONT hOldFont; 894 895 hOldFont = SelectObject (hdc,self->hDefaultFont); 896 GetTextMetricsA(hdc, &tm); 897 self->textHeight = tm.tmHeight; 898 SelectObject (hdc, hOldFont); 899 ReleaseDC(hwnd, hdc); 885 if (lpCreate->lpszName && 886 (len = lstrlenA ((LPCSTR)lpCreate->lpszName))) { 887 self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 888 lstrcpyAtoW (self->parts[0].text, (LPCSTR)lpCreate->lpszName); 889 } 890 } 891 892 if ((hdc = GetDC (0))) { 893 TEXTMETRICA tm; 894 HFONT hOldFont; 895 896 hOldFont = SelectObject (hdc,self->hDefaultFont); 897 GetTextMetricsA(hdc, &tm); 898 self->textHeight = tm.tmHeight; 899 SelectObject (hdc, hOldFont); 900 ReleaseDC(0, hdc); 900 901 } 901 902 902 903 if (GetWindowLongA (hwnd, GWL_STYLE) & SBT_TOOLTIPS) { 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 904 self->hwndToolTip = 905 CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, 906 CW_USEDEFAULT, CW_USEDEFAULT, 907 CW_USEDEFAULT, CW_USEDEFAULT, 908 hwnd, 0, 909 GetWindowLongA (hwnd, GWL_HINSTANCE), NULL); 910 911 if (self->hwndToolTip) { 912 NMTOOLTIPSCREATED nmttc; 913 914 nmttc.hdr.hwndFrom = hwnd; 915 nmttc.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID); 916 nmttc.hdr.code = NM_TOOLTIPSCREATED; 917 nmttc.hwndToolTips = self->hwndToolTip; 918 919 SendMessageA (GetParent (hwnd), WM_NOTIFY, 920 (WPARAM)nmttc.hdr.idFrom, (LPARAM)&nmttc); 921 } 921 922 } 922 923 923 924 GetClientRect (GetParent (hwnd), &rect); 924 925 width = rect.right - rect.left; 925 self->height = self->textHeight +2*VERT_BORDER+2*VERT_SPACE;926 self->height = self->textHeight + 4 + VERT_BORDER; 926 927 MoveWindow (hwnd, lpCreate->x, lpCreate->y-1, 927 928 width, self->height, FALSE); 928 929 STATUSBAR_SetPartBounds (hwnd); 929 930 -
trunk/src/comctl32/tab.c
r722 r1058 1 /* $Id: tab.c,v 1.1 2 1999-08-28 09:25:56achimha Exp $ */1 /* $Id: tab.c,v 1.13 1999-09-26 11:01:11 achimha Exp $ */ 2 2 /* 3 3 * Tab control … … 15 15 */ 16 16 17 /* WINE 9908 15level */17 /* WINE 990823 level */ 18 18 19 19 #include <string.h> … … 130 130 INT iItem=(INT) wParam; 131 131 132 if ((iItem < 0) || (iItem > infoPtr->uNumItem)) return 0;132 if ((iItem < 0) || (iItem >= infoPtr->uNumItem)) return 0; 133 133 134 134 infoPtr->uFocus=iItem; … … 1301 1301 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM)); 1302 1302 infoPtr->uNumItem++; 1303 infoPtr->iSelected = 0; 1303 1304 } 1304 1305 else { … … 1320 1321 1321 1322 } 1323 1324 if (iItem <= infoPtr->iSelected) 1325 infoPtr->iSelected++; 1322 1326 1323 1327 COMCTL32_Free (oldItems); … … 1530 1534 tabItem=(LPTCITEMA) lParam; 1531 1535 // TRACE (tab,"\n"); 1532 if ((iItem<0) || (iItem> infoPtr->uNumItem)) return FALSE;1536 if ((iItem<0) || (iItem>=infoPtr->uNumItem)) return FALSE; 1533 1537 1534 1538 wineItem=& infoPtr->items[iItem]; … … 1616 1620 infoPtr->iSelected--; 1617 1621 1622 if (infoPtr->uNumItem == 0) 1623 infoPtr->iSelected = -1; 1624 1618 1625 /* 1619 1626 * Reposition and repaint tabs. … … 1634 1641 1635 1642 COMCTL32_Free (infoPtr->items); 1636 infoPtr->uNumItem=0; 1643 infoPtr->uNumItem = 0; 1644 infoPtr->iSelected = -1; 1637 1645 1638 1646 return TRUE; … … 1747 1755 infoPtr->items = 0; 1748 1756 infoPtr->hcurArrow = LoadCursorA (0, IDC_ARROWA); 1749 infoPtr->iSelected = 0;1757 infoPtr->iSelected = -1; 1750 1758 infoPtr->uFocus = 0; 1751 1759 infoPtr->hwndToolTip = 0; -
trunk/src/comctl32/tooltips.c
r496 r1058 1 /* $Id: tooltips.c,v 1.1 3 1999-08-14 16:13:15 cbratschiExp $ */1 /* $Id: tooltips.c,v 1.14 1999-09-26 11:01:11 achimha Exp $ */ 2 2 /* 3 3 * Tool tip control … … 21 21 - CS_SAVEBITS: window movements are slow, bug in Open32? 22 22 */ 23 24 /* WINE 990923 level */ 23 25 24 26 #include <string.h> … … 834 836 toolPtr = &infoPtr->tools[nTool]; 835 837 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 836 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) 838 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 839 (HIWORD((INT)toolPtr->lpszText) != 0) ) 837 840 COMCTL32_Free (toolPtr->lpszText); 838 841 } … … 891 894 toolPtr = &infoPtr->tools[nTool]; 892 895 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 893 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) 896 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 897 (HIWORD((INT)toolPtr->lpszText) != 0) ) 894 898 COMCTL32_Free (toolPtr->lpszText); 895 899 } … … 1573 1577 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1574 1578 else { 1575 if (toolPtr->lpszText) { 1579 if ( (toolPtr->lpszText) && 1580 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1576 1581 COMCTL32_Free (toolPtr->lpszText); 1577 1582 toolPtr->lpszText = NULL; … … 1627 1632 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1628 1633 else { 1629 if (toolPtr->lpszText) { 1634 if ( (toolPtr->lpszText) && 1635 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1630 1636 COMCTL32_Free (toolPtr->lpszText); 1631 1637 toolPtr->lpszText = NULL; … … 1711 1717 1712 1718 1713 static LRESULT1714 1719 TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1715 1720 { … … 1719 1724 INT nTool; 1720 1725 1721 if (lpToolInfo == NULL) return 0; 1722 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE; 1723 1724 nTool = TOOLTIPS_GetToolFromInfoA(infoPtr,lpToolInfo); 1726 if (lpToolInfo == NULL) 1727 return 0; 1728 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) 1729 return FALSE; 1730 1731 nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); 1725 1732 if (nTool == -1) return 0; 1726 1733 1727 // TRACE (tooltips,"tool %d\n", nTool);1734 // TRACE("tool %d\n", nTool); 1728 1735 1729 1736 toolPtr = &infoPtr->tools[nTool]; … … 1732 1739 toolPtr->hinst = lpToolInfo->hinst; 1733 1740 1734 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)) 1735 { 1736 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1737 } else if (lpToolInfo->lpszText) 1738 { 1739 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1740 else 1741 { 1742 if (toolPtr->lpszText) 1743 { 1744 COMCTL32_Free(toolPtr->lpszText); 1745 toolPtr->lpszText = NULL; 1746 } 1747 if (lpToolInfo->lpszText) 1748 { 1749 INT len = lstrlenA(lpToolInfo->lpszText); 1750 toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 1751 lstrcpyAtoW(toolPtr->lpszText,lpToolInfo->lpszText); 1752 } 1753 } 1741 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1742 toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText; 1743 } 1744 else if (lpToolInfo->lpszText) { 1745 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) 1746 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1747 else { 1748 if ( (toolPtr->lpszText) && 1749 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1750 COMCTL32_Free (toolPtr->lpszText); 1751 toolPtr->lpszText = NULL; 1752 } 1753 if (lpToolInfo->lpszText) { 1754 INT len = lstrlenA (lpToolInfo->lpszText); 1755 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1756 lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText); 1757 } 1758 } 1754 1759 } 1755 1760 1756 1761 /* force repaint */ 1757 if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr); 1758 else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr); 1762 if (infoPtr->bActive) 1763 TOOLTIPS_Show (hwnd, infoPtr); 1764 else if (infoPtr->bTrackActive) 1765 TOOLTIPS_TrackShow (hwnd, infoPtr); 1759 1766 1760 1767 return 0; … … 1771 1778 1772 1779 if (lpToolInfo == NULL) 1773 1780 return 0; 1774 1781 if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW) 1775 1782 return FALSE; 1776 1783 1777 1784 nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo); 1778 1785 if (nTool == -1) 1779 1780 1781 // TRACE (tooltips,"tool %d\n", nTool);1786 return 0; 1787 1788 // TRACE("tool %d\n", nTool); 1782 1789 1783 1790 toolPtr = &infoPtr->tools[nTool]; … … 1787 1794 1788 1795 if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){ 1789 1796 toolPtr->lpszText = lpToolInfo->lpszText; 1790 1797 } 1791 1798 else if (lpToolInfo->lpszText) { 1792 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) 1793 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1794 else { 1795 if (toolPtr->lpszText) { 1796 COMCTL32_Free (toolPtr->lpszText); 1797 toolPtr->lpszText = NULL; 1798 } 1799 if (lpToolInfo->lpszText) { 1800 INT len = lstrlenW (lpToolInfo->lpszText); 1801 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1802 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 1803 } 1804 } 1799 if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW) 1800 toolPtr->lpszText = LPSTR_TEXTCALLBACKW; 1801 else { 1802 if ( (toolPtr->lpszText) && 1803 (HIWORD((INT)toolPtr->lpszText) != 0) ) { 1804 COMCTL32_Free (toolPtr->lpszText); 1805 toolPtr->lpszText = NULL; 1806 } 1807 if (lpToolInfo->lpszText) { 1808 INT len = lstrlenW (lpToolInfo->lpszText); 1809 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1810 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText); 1811 } 1812 } 1805 1813 } 1806 1814 1807 1815 /* force repaint */ 1808 1816 if (infoPtr->bActive) 1809 1817 TOOLTIPS_Show (hwnd, infoPtr); 1810 1818 else if (infoPtr->bTrackActive) 1811 1819 TOOLTIPS_TrackShow (hwnd, infoPtr); 1812 1820 1813 1821 return 0; … … 1882 1890 1883 1891 /* free tools */ 1884 if (infoPtr->tools) 1885 { 1886 for (i = 0;i < infoPtr->uNumTools;i++) 1887 { 1888 toolPtr = &infoPtr->tools[i]; 1889 if ((toolPtr->hinst) && (toolPtr->lpszText)) 1890 { 1891 if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText); 1892 } 1893 1894 /* remove subclassing */ 1895 TOOLTIPS_Desubclass(toolPtr); 1896 1892 if (infoPtr->tools) { 1893 for (i = 0; i < infoPtr->uNumTools; i++) { 1894 toolPtr = &infoPtr->tools[i]; 1895 if ((toolPtr->hinst) && (toolPtr->lpszText)) { 1896 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) && 1897 (HIWORD((INT)toolPtr->lpszText) != 0) ) 1898 { 1899 COMCTL32_Free (toolPtr->lpszText); 1900 toolPtr->lpszText = NULL; 1901 } 1902 } 1903 1904 /* remove subclassing */ 1905 if (toolPtr->uFlags & TTF_SUBCLASS) { 1906 LPTT_SUBCLASS_INFO lpttsi; 1907 1908 if (toolPtr->uFlags & TTF_IDISHWND) 1909 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1910 else 1911 lpttsi = (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass); 1912 1913 if (lpttsi) { 1914 SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC, 1915 (LONG)lpttsi->wpOrigProc); 1916 RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass); 1917 COMCTL32_Free (&lpttsi); 1918 } 1919 } 1897 1920 } 1898 1921 COMCTL32_Free (infoPtr->tools);
Note:
See TracChangeset
for help on using the changeset viewer.