Changeset 1565 for trunk/src/comctl32/propsheet.c
- Timestamp:
- Nov 2, 1999, 10:44:04 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 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 920 921 922 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
Note:
See TracChangeset
for help on using the changeset viewer.