- Timestamp:
- Jul 4, 1999, 11:06:00 PM (26 years ago)
- Location:
- trunk/src/comctl32
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/propsheet.c
r180 r267 1 /* $Id: propsheet.c,v 1. 4 1999-06-24 16:37:44cbratschi Exp $ */1 /* $Id: propsheet.c,v 1.5 1999-07-04 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Property Sheets … … 13 13 * - Unicode property sheets 14 14 */ 15 16 /* CB: Odin problems: 17 - trap in PROPSHEET_DialogProc (tab control creation) 18 - LockResource traps 19 */ 15 20 16 21 #include <string.h> … … 201 206 HGLOBAL hTemplate = LoadResource(lppsp->hInstance, 202 207 hResource); 203 pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate);208 //pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate); //CB: trap, fix it 204 209 } 205 210 … … 287 292 HRSRC hRes; 288 293 294 if (psInfo->useCallback) 295 (*(psInfo->ppshheader->pfnCallback))(0, PSCB_PRECREATE, (LPARAM)template); 296 297 //load OS/2 dialog 298 299 if (psInfo->ppshheader->dwFlags & PSH_MODELESS) 300 ret = NativeCreateDlgIP(COMCTL32_hModule, 301 psInfo->ppshheader->hInstance, 302 MAKEINTRESOURCEA(IDD_PROPSHEET), 303 psInfo->ppshheader->hwndParent, 304 (DLGPROC)PROPSHEET_DialogProc, 305 (LPARAM)psInfo); 306 else 307 ret = NativeDlgBoxIP(COMCTL32_hModule, 308 psInfo->ppshheader->hInstance, 309 MAKEINTRESOURCEA(IDD_PROPSHEET), 310 psInfo->ppshheader->hwndParent, 311 (DLGPROC)PROPSHEET_DialogProc, 312 (LPARAM)psInfo); 313 314 if (ret == (INT)-1) return FALSE; 315 316 /* //CB: original WINE code 289 317 if (!(hRes = FindResourceA(COMCTL32_hModule, 290 318 MAKEINTRESOURCEA(IDD_PROPSHEET), … … 310 338 (DLGPROC) PROPSHEET_DialogProc, 311 339 (LPARAM)psInfo); 340 */ 312 341 313 342 return ret; -
trunk/src/comctl32/status.c
r252 r267 1 /* $Id: status.c,v 1. 7 1999-06-30 15:52:17cbratschi Exp $ */1 /* $Id: status.c,v 1.8 1999-07-04 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Interface code to StatusWindow widget/control … … 27 27 */ 28 28 29 /* CB: Odin problems 30 - DrawText: DT_VCENTER doesn't work 31 */ 32 29 33 #define _MAX(a,b) (((a)>(b))?(a):(b)) 30 34 #define _MIN(a,b) (((a)>(b))?(b):(a)) … … 32 36 #define HORZ_BORDER 0 33 37 #define VERT_BORDER 2 38 #define VERT_SPACE 2 //space between boder and text 34 39 #define HORZ_GAP 2 40 #define TOP_MARGIN 2 41 #define ICON_SPACE 2 42 #define TEXT_SPACE 3 35 43 36 44 #define STATUSBAR_GetInfoPtr(hwnd) ((STATUSWINDOWINFO *)GetWindowLongA (hwnd, 0)) … … 87 95 DrawEdge(hdc, &r, border, BF_RECT|BF_ADJUST); 88 96 97 r.bottom -= VERT_SPACE; 98 r.top += VERT_SPACE; 99 89 100 /* draw the icon */ 90 101 if (part->hIcon) { 91 102 INT cy = r.bottom - r.top; 92 103 93 r.left += 2;104 r.left += ICON_SPACE; 94 105 DrawIconEx (hdc, r.left, r.top, part->hIcon, cy, cy, 0, 0, DI_NORMAL); 95 106 r.left += cy; … … 110 121 } 111 122 } 112 r.left += 3;123 r.left += TEXT_SPACE; 113 124 DrawTextW (hdc, p, lstrlenW (p), &r, align|DT_VCENTER|DT_SINGLELINE); 114 125 if (oldbkmode != TRANSPARENT) … … 232 243 GetClientRect (hwnd, &rect); 233 244 234 rect.top += VERT_BORDER;245 rect.top += TOP_MARGIN; 235 246 236 247 /* set bounds for simple rectangle */ … … 638 649 int style; 639 650 LPSTR text; 651 LPWSTR newText; 640 652 int len; 641 653 HDC hdc; … … 651 663 if (!part) return FALSE; 652 664 653 if (!(part->style & SBT_OWNERDRAW) && part->text) 654 COMCTL32_Free (part->text); 655 part->text = 0; 656 657 if (style & SBT_OWNERDRAW) { 658 part->text = (LPWSTR)text; 659 } 660 else { 661 /* duplicate string */ 662 if (text && (len = lstrlenA(text))) { 663 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 664 lstrcpyAtoW (part->text, text); 665 } 665 if (style & SBT_OWNERDRAW) 666 { 667 part->text = (LPWSTR)text; 668 } else 669 { 670 //compare 671 if (text && (len = lstrlenA(text))) 672 { 673 newText = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 674 lstrcpyAtoW (newText,text); 675 } else newText = NULL; 676 if (lstrcmpW(part->text,newText) == 0) 677 { 678 COMCTL32_Free(newText); 679 if (part->style != style) 680 { 681 hdc = GetDC(hwnd); 682 STATUSBAR_RefreshPart(hwnd,part,hdc); 683 ReleaseDC(hwnd, hdc); 684 } 685 return TRUE; 686 } 687 688 COMCTL32_Free(part->text); 689 part->text = newText; 666 690 } 667 691 part->style = style; … … 694 718 if (!part) return FALSE; 695 719 696 if (!(part->style & SBT_OWNERDRAW) && part->text) 697 COMCTL32_Free (part->text); 698 part->text = 0; 699 700 if (style & SBT_OWNERDRAW) { 701 part->text = text; 702 } 703 else { 704 /* duplicate string */ 705 if (text && (len = lstrlenW(text))) { 706 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 707 lstrcpyW(part->text, text); 708 } 720 if (style & SBT_OWNERDRAW) 721 { 722 part->text = text; 723 } else 724 { 725 if (lstrcmpW(part->text,text) == 0) 726 { 727 if (part->style != style) 728 { 729 hdc = GetDC(hwnd); 730 STATUSBAR_RefreshPart(hwnd,part,hdc); 731 ReleaseDC(hwnd, hdc); 732 } 733 return TRUE; 734 } 735 736 /* duplicate string */ 737 COMCTL32_Free(part->text); 738 if (text && (len = lstrlenW(text))) 739 { 740 part->text = COMCTL32_Alloc((len+1)*sizeof(WCHAR)); 741 lstrcpyW(part->text,text); 742 } 709 743 } 710 744 part->style = style; … … 837 871 if (IsWindowUnicode (hwnd)) { 838 872 self->bUnicode = TRUE; 839 if ((len = lstrlenW ((LPCWSTR)lpCreate->lpszName))) { 873 len = lstrlenW ((LPCWSTR)lpCreate->lpszName); 874 if (len) { 840 875 self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 841 876 lstrcpyW (self->parts[0].text, (LPCWSTR)lpCreate->lpszName); … … 843 878 } 844 879 else { 845 if ((len = lstrlenA ((LPCSTR)lpCreate->lpszName))) { 880 len = lstrlenA ((LPCSTR)lpCreate->lpszName); 881 if (len) { 846 882 self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR)); 847 lstrcpyAtoW (self->parts[0].text, (LPCSTR)lpCreate->lpszName); 848 } 849 } 850 851 if ((hdc = GetDC (0))) { 883 lstrcpyAtoW (self->parts[0].text, (char*)lpCreate->lpszName); 884 } 885 } 886 887 hdc = GetDC(hwnd); 888 if (hdc) { 852 889 TEXTMETRICA tm; 853 890 HFONT hOldFont; … … 857 894 self->textHeight = tm.tmHeight; 858 895 SelectObject (hdc, hOldFont); 859 ReleaseDC( 0, hdc);896 ReleaseDC(hwnd, hdc); 860 897 } 861 898 … … 883 920 GetClientRect (GetParent (hwnd), &rect); 884 921 width = rect.right - rect.left; 885 self->height = self->textHeight + 4 + VERT_BORDER;922 self->height = self->textHeight+2*VERT_BORDER+2*VERT_SPACE; 886 923 MoveWindow (hwnd, lpCreate->x, lpCreate->y-1, 887 924 width, self->height, FALSE); … … 1057 1094 if (lParam && (len = lstrlenA((LPCSTR)lParam))) { 1058 1095 part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1059 lstrcpyAtoW (part->text, ( LPCSTR)lParam);1096 lstrcpyAtoW (part->text, (char*)lParam); 1060 1097 } 1061 1098 } -
trunk/src/comctl32/tab.c
r252 r267 1 /* $Id: tab.c,v 1. 7 1999-06-30 15:52:17cbratschi Exp $ */1 /* $Id: tab.c,v 1.8 1999-07-04 21:05:59 cbratschi Exp $ */ 2 2 /* 3 3 * Tab control … … 12 12 * Image list support 13 13 * Multiline support 14 * Unicode support15 14 */ 16 15 … … 20 19 #include "commctrl.h" 21 20 #include "tab.h" 21 #include "comctl32.h" 22 22 23 23 … … 709 709 * Calculate how wide the tab is depending on the text it contains 710 710 */ 711 GetTextExtentPoint32 A(hdc, infoPtr->items[curItem].pszText,712 lstrlen A(infoPtr->items[curItem].pszText), &size);711 GetTextExtentPoint32W(hdc, infoPtr->items[curItem].pszText, 712 lstrlenW(infoPtr->items[curItem].pszText), &size); 713 713 714 714 infoPtr->items[curItem].rect.right = infoPtr->items[curItem].rect.left + … … 934 934 * Draw the text; 935 935 */ 936 DrawText A(hdc,936 DrawTextW(hdc, 937 937 infoPtr->items[iItem].pszText, 938 lstrlen A(infoPtr->items[iItem].pszText),938 lstrlenW(infoPtr->items[iItem].pszText), 939 939 &r, 940 940 DT_LEFT|DT_SINGLELINE|DT_VCENTER); … … 1238 1238 } 1239 1239 1240 static LRESULT 1241 TAB_InsertItem (HWND hwnd, WPARAM wParam, LPARAM lParam) 1240 static LRESULT TAB_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1242 1241 { 1243 1242 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); … … 1286 1285 if (pti->mask & TCIF_TEXT) { 1287 1286 len = lstrlenA (pti->pszText); 1288 infoPtr->items[iItem].pszText = COMCTL32_Alloc (len+1); 1289 lstrcpyA (infoPtr->items[iItem].pszText, pti->pszText); 1287 infoPtr->items[iItem].pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1288 lstrcpyAtoW (infoPtr->items[iItem].pszText, pti->pszText); 1289 infoPtr->items[iItem].cchTextMax = pti->cchTextMax; 1290 } 1291 1292 if (pti->mask & TCIF_IMAGE) 1293 infoPtr->items[iItem].iImage = pti->iImage; 1294 1295 if (pti->mask & TCIF_PARAM) 1296 infoPtr->items[iItem].lParam = pti->lParam; 1297 1298 TAB_InvalidateTabArea(hwnd, infoPtr); 1299 1300 // TRACE(tab, "[%04x]: added item %d '%s'\n", 1301 // hwnd, iItem, infoPtr->items[iItem].pszText); 1302 1303 TAB_SetItemBounds(hwnd); 1304 return iItem; 1305 } 1306 1307 static LRESULT TAB_InsertItemW(HWND hwnd, WPARAM wParam, LPARAM lParam) 1308 { 1309 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1310 TCITEMW *pti; 1311 INT iItem, len; 1312 RECT rect; 1313 1314 GetClientRect (hwnd, &rect); 1315 // TRACE(tab, "Rect: %x T %i, L %i, B %i, R %i\n", hwnd, 1316 // rect.top, rect.left, rect.bottom, rect.right); 1317 1318 pti = (TCITEMW*)lParam; 1319 iItem = (INT)wParam; 1320 1321 if (iItem < 0) return -1; 1322 if (iItem > infoPtr->uNumItem) 1323 iItem = infoPtr->uNumItem; 1324 1325 if (infoPtr->uNumItem == 0) { 1326 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM)); 1327 infoPtr->uNumItem++; 1328 } 1329 else { 1330 TAB_ITEM *oldItems = infoPtr->items; 1331 1332 infoPtr->uNumItem++; 1333 infoPtr->items = COMCTL32_Alloc (sizeof (TAB_ITEM) * infoPtr->uNumItem); 1334 1335 /* pre insert copy */ 1336 if (iItem > 0) { 1337 memcpy (&infoPtr->items[0], &oldItems[0], 1338 iItem * sizeof(TAB_ITEM)); 1339 } 1340 1341 /* post insert copy */ 1342 if (iItem < infoPtr->uNumItem - 1) { 1343 memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], 1344 (infoPtr->uNumItem - iItem - 1) * sizeof(TAB_ITEM)); 1345 1346 } 1347 1348 COMCTL32_Free (oldItems); 1349 } 1350 1351 infoPtr->items[iItem].mask = pti->mask; 1352 if (pti->mask & TCIF_TEXT) { 1353 len = lstrlenW (pti->pszText); 1354 infoPtr->items[iItem].pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); 1355 lstrcpyW (infoPtr->items[iItem].pszText, pti->pszText); 1290 1356 infoPtr->items[iItem].cchTextMax = pti->cchTextMax; 1291 1357 } … … 1353 1419 len = lstrlenA (tabItem->pszText); 1354 1420 if (len>wineItem->cchTextMax) 1355 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, len+1); 1356 lstrcpynA (wineItem->pszText, tabItem->pszText, len+1); 1421 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, (len+1)*sizeof(WCHAR)); 1422 lstrcpynAtoW (wineItem->pszText, tabItem->pszText, len+1); 1423 } 1424 1425 return TRUE; 1426 } 1427 1428 static LRESULT TAB_SetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 1429 { 1430 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1431 TCITEMW *tabItem; 1432 TAB_ITEM *wineItem; 1433 INT iItem,len; 1434 1435 iItem=(INT) wParam; 1436 tabItem=(LPTCITEMW) lParam; 1437 // TRACE (tab,"%d %p\n",iItem, tabItem); 1438 if ((iItem<0) || (iItem>infoPtr->uNumItem)) return FALSE; 1439 1440 wineItem=& infoPtr->items[iItem]; 1441 1442 if (tabItem->mask & TCIF_IMAGE) 1443 wineItem->iImage=tabItem->iImage; 1444 1445 if (tabItem->mask & TCIF_PARAM) 1446 wineItem->lParam=tabItem->lParam; 1447 1448 // if (tabItem->mask & TCIF_RTLREADING) 1449 // FIXME (tab,"TCIF_RTLREADING\n"); 1450 1451 if (tabItem->mask & TCIF_STATE) 1452 wineItem->dwState=tabItem->dwState; 1453 1454 if (tabItem->mask & TCIF_TEXT) { 1455 len = lstrlenW (tabItem->pszText); 1456 if (len>wineItem->cchTextMax) 1457 wineItem->pszText = COMCTL32_ReAlloc (wineItem->pszText, (len+1)*sizeof(WCHAR)); 1458 lstrcpynW (wineItem->pszText, tabItem->pszText, len+1); 1357 1459 } 1358 1460 … … 1397 1499 1398 1500 if (tabItem->mask & TCIF_TEXT) 1399 lstrcpynA (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax); 1501 lstrcpynWtoA (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax); 1502 1503 return TRUE; 1504 } 1505 1506 static LRESULT TAB_GetItemW (HWND hwnd, WPARAM wParam, LPARAM lParam) 1507 { 1508 TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); 1509 TCITEMW *tabItem; 1510 TAB_ITEM *wineItem; 1511 INT iItem; 1512 1513 iItem=(INT) wParam; 1514 tabItem=(LPTCITEMW) lParam; 1515 // TRACE (tab,"\n"); 1516 if ((iItem<0) || (iItem>infoPtr->uNumItem)) return FALSE; 1517 1518 wineItem=& infoPtr->items[iItem]; 1519 1520 if (tabItem->mask & TCIF_IMAGE) 1521 tabItem->iImage=wineItem->iImage; 1522 1523 if (tabItem->mask & TCIF_PARAM) 1524 tabItem->lParam=wineItem->lParam; 1525 1526 // if (tabItem->mask & TCIF_RTLREADING) 1527 // FIXME (tab, "TCIF_RTLREADING\n"); 1528 1529 if (tabItem->mask & TCIF_STATE) 1530 tabItem->dwState=wineItem->dwState; 1531 1532 if (tabItem->mask & TCIF_TEXT) 1533 lstrcpynW (tabItem->pszText, wineItem->pszText, tabItem->cchTextMax); 1400 1534 1401 1535 return TRUE; … … 1668 1802 1669 1803 case TCM_GETITEMW: 1670 // FIXME (tab, "Unimplemented msg TCM_GETITEMW\n"); 1671 return 0; 1804 return TAB_GetItemW(hwnd,wParam,lParam); 1672 1805 1673 1806 case TCM_SETITEMA: … … 1675 1808 1676 1809 case TCM_SETITEMW: 1677 // FIXME (tab, "Unimplemented msg TCM_SETITEMW\n"); 1678 return 0; 1810 return TAB_SetItemW(hwnd,wParam,lParam); 1679 1811 1680 1812 case TCM_DELETEITEM: … … 1697 1829 1698 1830 case TCM_INSERTITEMA: 1699 return TAB_InsertItem (hwnd, wParam,lParam);1831 return TAB_InsertItemA(hwnd,wParam,lParam); 1700 1832 1701 1833 case TCM_INSERTITEMW: 1702 // FIXME (tab, "Unimplemented msg TCM_INSERTITEM32W\n"); 1703 return 0; 1834 return TAB_InsertItemW(hwnd,wParam,lParam); 1704 1835 1705 1836 case TCM_SETITEMEXTRA: -
trunk/src/comctl32/toolbar.c
r252 r267 1 /* $Id: toolbar.c,v 1. 8 1999-06-30 15:52:18cbratschi Exp $ */1 /* $Id: toolbar.c,v 1.9 1999-07-04 21:06:00 cbratschi Exp $ */ 2 2 /* 3 3 * Toolbar control … … 14 14 * - Fix TB_SETROWS. 15 15 * - Tooltip support (almost complete). 16 * - Unicode suppport.17 16 * - Internal COMMCTL32 bitmaps. 18 17 * - Fix TOOLBAR_SetButtonInfo32A. … … 36 35 37 36 #include "winbase.h" 38 #include "winuser.h"39 #include "wingdi.h"40 37 #include "commctrl.h" 41 38 #include "cache.h" 42 39 #include "comctl32.h" 43 40 #include "toolbar.h" 44 45 41 46 42 #define SEPARATOR_WIDTH 8 … … 732 728 TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 733 729 { 734 TOOLBAR_INFO *infoPtr = (TOOLBAR_INFO *)GetWindowLongA (hwnd, DWL_USER);730 TOOLBAR_INFO *infoPtr; 735 731 static HDSA hDsa = NULL; 736 732 … … 804 800 // lpdis->itemAction, lpdis->itemState); 805 801 802 infoPtr = (TOOLBAR_INFO *)GetWindowLongA(hwnd,DWL_USER); 803 806 804 if (lpdis->itemState & ODS_FOCUS) 807 805 { … … 853 851 { 854 852 MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam; 853 854 infoPtr = (TOOLBAR_INFO *)GetWindowLongA(hwnd,DWL_USER); 855 855 856 856 if (infoPtr) … … 1014 1014 } 1015 1015 1016 1017 static LRESULT TOOLBAR_AddButtonsW(HWND hwnd,WPARAM wParam,LPARAM lParam) 1018 { 1019 //CB: just call AddButtonsA, no Unicode used?!? 1020 1021 return TOOLBAR_AddButtonsA(hwnd,wParam,lParam); 1022 } 1016 1023 1017 1024 /* << TOOLBAR_AddButtons32W >> */ … … 1306 1313 } 1307 1314 1308 1309 1315 static LRESULT 1310 1316 TOOLBAR_Customize (HWND hwnd) … … 1324 1330 (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); 1325 1331 1332 //load OS/2 dialog 1333 1334 ret = NativeDlgBoxIP(COMCTL32_hModule, 1335 GetWindowLongA(hwnd,GWL_HINSTANCE), 1336 MAKEINTRESOURCEA(IDD_TBCUSTOMIZE), 1337 hwnd, 1338 (DLGPROC)TOOLBAR_CustomizeDialogProc, 1339 (LPARAM)infoPtr); 1340 1341 if (ret == (INT)-1) return FALSE; 1342 1343 /* //original WINE code 1326 1344 if (!(hRes = FindResourceA (COMCTL32_hModule, 1327 1345 MAKEINTRESOURCEA(IDD_TBCUSTOMIZE), … … 1337 1355 (DLGPROC)TOOLBAR_CustomizeDialogProc, 1338 1356 (LPARAM)infoPtr); 1357 */ 1339 1358 1340 1359 /* send TBN_ENDADJUST notification */ … … 1516 1535 if (lpTbInfo->dwMask & TBIF_TEXT) { 1517 1536 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) 1518 lstrcpyn A (lpTbInfo->pszText,1519 (LPSTR)infoPtr->strings[btnPtr->iString],1537 lstrcpynWtoA (lpTbInfo->pszText, 1538 infoPtr->strings[btnPtr->iString], 1520 1539 lpTbInfo->cchText); 1521 1540 } … … 1524 1543 } 1525 1544 1526 1527 /* << TOOLBAR_GetButtonInfo32W >> */ 1528 1529 1530 static LRESULT 1531 TOOLBAR_GetButtonSize (HWND hwnd) 1532 { 1533 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1534 1535 return MAKELONG((WORD)infoPtr->nButtonWidth, 1536 (WORD)infoPtr->nButtonHeight); 1537 } 1538 1539 1540 static LRESULT 1541 TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1542 { 1543 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1544 INT nIndex, nStringIndex; 1545 static LRESULT TOOLBAR_GetButtonInfoW(HWND hwnd,WPARAM wParam,LPARAM lParam) 1546 { 1547 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1548 LPTBBUTTONINFOW lpTbInfo = (LPTBBUTTONINFOW)lParam; 1549 TBUTTON_INFO *btnPtr; 1550 INT nIndex; 1551 1552 if (infoPtr == NULL) 1553 return -1; 1554 if (lpTbInfo == NULL) 1555 return -1; 1556 if (lpTbInfo->cbSize < sizeof(TBBUTTONINFOW)) 1557 return -1; 1545 1558 1546 1559 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); … … 1548 1561 return -1; 1549 1562 1563 btnPtr = &infoPtr->buttons[nIndex]; 1564 1565 if (lpTbInfo->dwMask & TBIF_COMMAND) 1566 lpTbInfo->idCommand = btnPtr->idCommand; 1567 if (lpTbInfo->dwMask & TBIF_IMAGE) 1568 lpTbInfo->iImage = btnPtr->iBitmap; 1569 if (lpTbInfo->dwMask & TBIF_LPARAM) 1570 lpTbInfo->lParam = btnPtr->dwData; 1571 if (lpTbInfo->dwMask & TBIF_SIZE) 1572 lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); 1573 if (lpTbInfo->dwMask & TBIF_STATE) 1574 lpTbInfo->fsState = btnPtr->fsState; 1575 if (lpTbInfo->dwMask & TBIF_STYLE) 1576 lpTbInfo->fsStyle = btnPtr->fsStyle; 1577 if (lpTbInfo->dwMask & TBIF_TEXT) { 1578 if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) 1579 lstrcpynW (lpTbInfo->pszText, 1580 infoPtr->strings[btnPtr->iString], 1581 lpTbInfo->cchText); 1582 } 1583 1584 return nIndex; 1585 } 1586 1587 /* << TOOLBAR_GetButtonInfo32W >> */ 1588 1589 1590 static LRESULT 1591 TOOLBAR_GetButtonSize (HWND hwnd) 1592 { 1593 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1594 1595 return MAKELONG((WORD)infoPtr->nButtonWidth, 1596 (WORD)infoPtr->nButtonHeight); 1597 } 1598 1599 1600 static LRESULT 1601 TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) 1602 { 1603 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1604 INT nIndex, nStringIndex; 1605 1606 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1607 if (nIndex == -1) 1608 return -1; 1609 1550 1610 nStringIndex = infoPtr->buttons[nIndex].iString; 1551 1611 … … 1557 1617 if (lParam == 0) return -1; 1558 1618 1559 lstrcpyA ((LPSTR)lParam, (LPSTR)infoPtr->strings[nStringIndex]); 1560 1561 return lstrlenA ((LPSTR)infoPtr->strings[nStringIndex]); 1562 } 1563 1619 lstrcpyWtoA ((LPSTR)lParam, infoPtr->strings[nStringIndex]); 1620 1621 return lstrlenW (infoPtr->strings[nStringIndex]); 1622 } 1623 1624 static LRESULT TOOLBAR_GetButtonTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) 1625 { 1626 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 1627 INT nIndex, nStringIndex; 1628 1629 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 1630 if (nIndex == -1) 1631 return -1; 1632 1633 nStringIndex = infoPtr->buttons[nIndex].iString; 1634 1635 // TRACE (toolbar, "index=%d stringIndex=%d\n", nIndex, nStringIndex); 1636 1637 if ((nStringIndex < 0) || (nStringIndex >= infoPtr->nNumStrings)) 1638 return -1; 1639 1640 if (lParam == 0) return -1; 1641 1642 lstrcpyW ((LPWSTR)lParam, infoPtr->strings[nStringIndex]); 1643 1644 return lstrlenW (infoPtr->strings[nStringIndex]); 1645 } 1564 1646 1565 1647 /* << TOOLBAR_GetButtonText32W >> */ … … 1898 1980 } 1899 1981 1982 static LRESULT TOOLBAR_InsertButtonW (HWND hwnd, WPARAM wParam, LPARAM lParam) 1983 { 1984 //CB: just call InsertButtonA, no Unicode used?!? 1985 1986 return TOOLBAR_InsertButtonA(hwnd,wParam,lParam); 1987 } 1900 1988 1901 1989 /* << TOOLBAR_InsertButton32W >> */ … … 2051 2139 } 2052 2140 2141 static LRESULT TOOLBAR_SaveRestoreW(HWND hwnd,WPARAM wParam,LPARAM lParam) 2142 { 2143 #if 0 2144 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2145 LPTBSAVEPARAMSW lpSave = (LPTBSAVEPARAMSW)lParam; 2146 2147 if (lpSave == NULL) return 0; 2148 2149 if ((BOOL)wParam) { 2150 /* save toolbar information */ 2151 // FIXME (toolbar, "save to \"%s\" \"%s\"\n", 2152 // lpSave->pszSubKey, lpSave->pszValueName); 2153 2154 2155 } 2156 else { 2157 /* restore toolbar information */ 2158 2159 // FIXME (toolbar, "restore from \"%s\" \"%s\"\n", 2160 // lpSave->pszSubKey, lpSave->pszValueName); 2161 2162 2163 } 2164 #endif 2165 2166 return 0; 2167 } 2053 2168 2054 2169 /* << TOOLBAR_SaveRestore32W >> */ … … 2061 2176 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2062 2177 2063 if (( LOWORD(lParam) <= 0) || (HIWORD(lParam) <= 0)) return FALSE;2178 if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE; 2064 2179 2065 2180 infoPtr->nBitmapWidth = (INT)LOWORD(lParam); … … 2105 2220 (btnPtr->iString < infoPtr->nNumStrings)) { 2106 2221 #if 0 2107 CHAR **lpString = &infoPtr->strings[btnPtr->iString]; 2222 CHAR **lpString = &infoPtr->strings[btnPtr->iString]; //wrong, it's Unicode!!! 2108 2223 INT len = lstrlenA (lptbbi->pszText); 2109 2224 *lpString = COMCTL32_ReAlloc (lpString, sizeof(char)*(len+1)); … … 2118 2233 } 2119 2234 2235 static LRESULT TOOLBAR_SetButtonInfoW (HWND hwnd, WPARAM wParam, LPARAM lParam) 2236 { 2237 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2238 LPTBBUTTONINFOW lptbbi = (LPTBBUTTONINFOW)lParam; 2239 TBUTTON_INFO *btnPtr; 2240 INT nIndex; 2241 2242 if (lptbbi == NULL) 2243 return FALSE; 2244 if (lptbbi->cbSize < sizeof(TBBUTTONINFOW)) 2245 return FALSE; 2246 2247 nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam); 2248 if (nIndex == -1) 2249 return FALSE; 2250 2251 btnPtr = &infoPtr->buttons[nIndex]; 2252 if (lptbbi->dwMask & TBIF_COMMAND) 2253 btnPtr->idCommand = lptbbi->idCommand; 2254 if (lptbbi->dwMask & TBIF_IMAGE) 2255 btnPtr->iBitmap = lptbbi->iImage; 2256 if (lptbbi->dwMask & TBIF_LPARAM) 2257 btnPtr->dwData = lptbbi->lParam; 2258 /* if (lptbbi->dwMask & TBIF_SIZE) */ 2259 /* btnPtr->cx = lptbbi->cx; */ 2260 if (lptbbi->dwMask & TBIF_STATE) 2261 btnPtr->fsState = lptbbi->fsState; 2262 if (lptbbi->dwMask & TBIF_STYLE) 2263 btnPtr->fsStyle = lptbbi->fsStyle; 2264 2265 if (lptbbi->dwMask & TBIF_TEXT) { 2266 if ((btnPtr->iString >= 0) || 2267 (btnPtr->iString < infoPtr->nNumStrings)) { 2268 #if 0 2269 WCHAR **lpString = &infoPtr->strings[btnPtr->iString]; 2270 INT len = lstrlenW (lptbbi->pszText); 2271 *lpString = COMCTL32_ReAlloc (lpString, sizeof(wchar)*(len+1)); 2272 #endif 2273 2274 /* this is the ultimate sollution */ 2275 /* Str_SetPtrW (&infoPtr->strings[btnPtr->iString], lptbbi->pszText); */ 2276 } 2277 } 2278 2279 return TRUE; 2280 } 2120 2281 2121 2282 /* << TOOLBAR_SetButtonInfo32W >> */ … … 2127 2288 TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); 2128 2289 2129 if (( LOWORD(lParam) <= 0) || (HIWORD(lParam) <= 0)) return FALSE;2290 if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE; 2130 2291 2131 2292 infoPtr->nButtonWidth = (INT)LOWORD(lParam); … … 2966 3127 return TOOLBAR_AddButtonsA (hwnd, wParam, lParam); 2967 3128 2968 /* case TB_ADDBUTTONSW: */ 3129 case TB_ADDBUTTONSW: 3130 return TOOLBAR_AddButtonsW(hwnd,wParam,lParam); 2969 3131 2970 3132 case TB_ADDSTRINGA: … … 3015 3177 return TOOLBAR_GetButtonInfoA (hwnd, wParam, lParam); 3016 3178 3017 /* case TB_GETBUTTONINFOW: */ /* 4.71 */ 3179 case TB_GETBUTTONINFOW: /* 4.71 */ 3180 return TOOLBAR_GetButtonInfoW(hwnd,wParam,lParam); 3018 3181 3019 3182 case TB_GETBUTTONSIZE: … … 3023 3186 return TOOLBAR_GetButtonTextA (hwnd, wParam, lParam); 3024 3187 3025 /* case TB_GETBUTTONTEXTW: */ 3188 case TB_GETBUTTONTEXTW: 3189 return TOOLBAR_GetButtonTextW(hwnd,wParam,lParam); 3190 3026 3191 /* case TB_GETCOLORSCHEME: */ /* 4.71 */ 3027 3192 … … 3085 3250 return TOOLBAR_InsertButtonA (hwnd, wParam, lParam); 3086 3251 3087 /* case TB_INSERTBUTTONW: */ 3252 case TB_INSERTBUTTONW: 3253 return TOOLBAR_InsertButtonW(hwnd,wParam,lParam); 3254 3088 3255 /* case TB_INSERTMARKHITTEST: */ /* 4.71 */ 3089 3256 … … 3120 3287 return TOOLBAR_SaveRestoreA (hwnd, wParam, lParam); 3121 3288 3122 /* case TB_SAVERESTOREW: */ 3289 case TB_SAVERESTOREW: 3290 return TOOLBAR_SaveRestoreW(hwnd,wParam,lParam); 3291 3123 3292 /* case TB_SETANCHORHIGHLIGHT: */ /* 4.71 */ 3124 3293 … … 3129 3298 return TOOLBAR_SetButtonInfoA (hwnd, wParam, lParam); 3130 3299 3131 /* case TB_SETBUTTONINFOW: */ /* 4.71 */ 3300 case TB_SETBUTTONINFOW: /* 4.71 */ 3301 return TOOLBAR_SetButtonInfoW(hwnd,wParam,lParam); 3132 3302 3133 3303 case TB_SETBUTTONSIZE: -
trunk/src/comctl32/tooltips.c
r252 r267 1 /* $Id: tooltips.c,v 1. 9 1999-06-30 15:52:18cbratschi Exp $ */1 /* $Id: tooltips.c,v 1.10 1999-07-04 21:06:00 cbratschi Exp $ */ 2 2 /* 3 3 * Tool tip control … … 1997 1997 infoPtr->hFont = (HFONT)wParam; 1998 1998 1999 if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) { 2000 // FIXME (tooltips, "full redraw needed!\n"); 1999 if ((LOWORD(lParam)) & (infoPtr->nCurrentTool != -1)) 2000 { 2001 /* force repaint */ 2002 if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr); 2003 else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr); 2001 2004 } 2002 2005 -
trunk/src/comctl32/trackbar.c
r252 r267 1 /* $Id: trackbar.c,v 1.1 0 1999-06-30 15:52:18cbratschi Exp $ */1 /* $Id: trackbar.c,v 1.11 1999-07-04 21:06:00 cbratschi Exp $ */ 2 2 /* 3 3 * Trackbar control … … 1159 1159 newMax = (INT)HIWORD(lParam); 1160 1160 1161 if (newMin >= newMax) return 0; 1161 if (newMin == newMax) return 0; 1162 if (newMin > newMax) 1163 { //exchange 1164 int x; 1165 1166 x = newMin; 1167 newMin = newMax; 1168 newMax = x; 1169 } 1162 1170 if (newMin == infoPtr->nRangeMin && newMax == infoPtr->nRangeMax) return 0; 1163 1171
Note:
See TracChangeset
for help on using the changeset viewer.