Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1331 lines
42 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. All Rights Reserved
  4. Module Name:
  5. cpsuidat.c
  6. Abstract:
  7. This module contains all the predefined data
  8. --*/
  9. #include "precomp.h"
  10. #pragma hdrstop
  11. #define DBG_CPSUIFILENAME DbgTVPage
  12. #define DBG_TVTESTCB 0x00000001
  13. #define DBG_PUSHDLGPROC 0x00000002
  14. DEFINE_DBGVAR(0);
  15. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  16. HINSTANCE hInstApp = NULL;
  17. TCHAR TitleName[] = TEXT("Common Property Sheet UI Sample");
  18. TCHAR ClassName[] = TEXT("CPSUISampleClass");
  19. TCHAR MenuName[] = TEXT("CPSUISampleMenu");
  20. TCHAR OptItemName[] = TEXT("CPSUI TreeView Sample");
  21. TCHAR szWinSpool[] = TEXT("WinSpool.Drv");
  22. CHAR szDocPropSheets[] = "DocumentPropertySheets";
  23. BOOL UpdatePermission = TRUE;
  24. BOOL UseStdAbout = TRUE;
  25. INT_PTR
  26. CALLBACK
  27. PushButtonProc(
  28. HWND hDlg,
  29. UINT Msg,
  30. WPARAM wParam,
  31. LPARAM lParam
  32. );
  33. CPSUICALLBACK
  34. TVTestCallBack(
  35. PCPSUICBPARAM pCPSUICBParam
  36. );
  37. OPTPARAM NoYesOP[] = {
  38. {
  39. sizeof(OPTPARAM), // cbSize
  40. 0, // OPTPF_xxx
  41. 0, // style
  42. (LPTSTR)IDS_CPSUI_NO, // pData
  43. IDI_CPSUI_NO, // IconID
  44. 0 // lParam
  45. },
  46. {
  47. sizeof(OPTPARAM), // cbSize
  48. 0, // OPTPF_xxx
  49. 0, // style
  50. (LPTSTR)IDS_CPSUI_YES, // pData
  51. IDI_CPSUI_YES, // IconID
  52. 1 // lParam
  53. }
  54. };
  55. EXTCHKBOX ECB_EP_ECB = {
  56. sizeof(EXTCHKBOX),
  57. 0,
  58. TEXT("Include Icon"),
  59. (LPTSTR)IDS_CPSUI_SLASH_SEP,
  60. TEXT("Icon"),
  61. IDI_CPSUI_GRAPHIC };
  62. OPTPARAM ECB_EP_OP[] = {
  63. {
  64. sizeof(OPTPARAM), // cbSize
  65. 0, // OPTPF_xxx
  66. 0, // style
  67. TEXT("None"), // pData
  68. IDI_CPSUI_EMPTY, // IconID
  69. 0 // lParam
  70. },
  71. {
  72. sizeof(OPTPARAM), // cbSize
  73. 0, // OPTPF_xxx
  74. 0, // style
  75. TEXT("Extended CheckBox"), // pData
  76. IDI_CPSUI_EMPTY, // IconID
  77. 1 // lParam
  78. },
  79. {
  80. sizeof(OPTPARAM), // cbSize
  81. 0, // OPTPF_xxx
  82. 0, // style
  83. TEXT("Extended Push"), // pData
  84. IDI_CPSUI_EMPTY, // IconID
  85. 0 // lParam
  86. }
  87. };
  88. OPTTYPE ECB_EP_OT = {
  89. sizeof(OPTTYPE), // cbSize
  90. TVOT_3STATES, // Type
  91. 0, // Flags OPTTF_xxxx
  92. 3, // Count
  93. 0, // BegCtrlID
  94. ECB_EP_OP, // pOptParam
  95. 0 // Style, OTS_xxxx
  96. };
  97. OPTTYPE NoYesOT = {
  98. sizeof(OPTTYPE), // cbSize
  99. TVOT_2STATES, // Type
  100. 0, // Flags OPTTF_xxxx
  101. 2, // Count
  102. 0, // BegCtrlID
  103. NoYesOP, // pOptParam
  104. 0 // Style, OTS_xxxx
  105. };
  106. OPTPARAM TVOT3StatesOP[] = {
  107. {
  108. sizeof(OPTPARAM), // cbSize
  109. 0, // OPTPF_xxx
  110. 0, // style
  111. TEXT("States 1"), // pData
  112. IDI_CPSUI_PORTRAIT, // IconID
  113. 0 // lParam
  114. },
  115. {
  116. sizeof(OPTPARAM), // cbSize
  117. 0, // OPTPF_xxx
  118. 0, // style
  119. TEXT("States 2"), // pData
  120. IDI_CPSUI_LANDSCAPE, // IconID
  121. 1 // lParam
  122. },
  123. {
  124. sizeof(OPTPARAM), // cbSize
  125. 0, // OPTPF_xxx
  126. 0, // style
  127. TEXT("States 3"), // pData
  128. IDI_CPSUI_ROT_LAND, // IconID
  129. 0 // lParam
  130. }
  131. };
  132. OPTTYPE TVOT2StatesOT = {
  133. sizeof(OPTTYPE), // cbSize
  134. TVOT_2STATES, // Type
  135. 0, // Flags OPTTF_xxxx
  136. 2, // Count
  137. 0, // BegCtrlID
  138. TVOT3StatesOP, // pOptParam
  139. 0 // Style, OTS_xxxx
  140. };
  141. OPTTYPE TVOT3StatesOT = {
  142. sizeof(OPTTYPE), // cbSize
  143. TVOT_3STATES, // Type
  144. 0, // Flags OPTTF_xxxx
  145. 3, // Count
  146. 0, // BegCtrlID
  147. TVOT3StatesOP, // pOptParam
  148. 0 // Style, OTS_xxxx
  149. };
  150. OPTPARAM MinRangeOP[] = {
  151. {
  152. sizeof(OPTPARAM), // cbSize
  153. 0, // OPTPF_xxx
  154. 0, // style
  155. TEXT(""), // pData (postfix)
  156. IDI_CPSUI_EMPTY, // IconID
  157. 0 // lParam
  158. },
  159. {
  160. sizeof(OPTPARAM), // cbSize
  161. 0, // OPTPF_xxx
  162. 0, // style
  163. NULL, // pData (help line)
  164. (DWORD)MIN_INT, // IconID
  165. MAX_INT // lParam
  166. }
  167. };
  168. OPTTYPE MinRangeOT = {
  169. sizeof(OPTTYPE), // cbSize
  170. TVOT_UDARROW, // Type
  171. 0, // Flags OPTTF_xxxx
  172. 2, // Count
  173. 0, // BegCtrlID
  174. MinRangeOP, // pOptParam
  175. 0 // Style, OTS_xxxx
  176. };
  177. OPTPARAM MaxRangeOP[] = {
  178. {
  179. sizeof(OPTPARAM), // cbSize
  180. 0, // OPTPF_xxx
  181. 0, // style
  182. TEXT(""), // pData (postfix)
  183. IDI_CPSUI_EMPTY, // IconID
  184. 0 // lParam
  185. },
  186. {
  187. sizeof(OPTPARAM), // cbSize
  188. 0, // OPTPF_xxx
  189. 0, // style
  190. NULL, // pData (help line)
  191. (DWORD)MIN_INT, // IconID
  192. MAX_INT // lParam
  193. }
  194. };
  195. OPTTYPE MaxRangeOT = {
  196. sizeof(OPTTYPE), // cbSize
  197. TVOT_UDARROW, // Type
  198. 0, // Flags OPTTF_xxxx
  199. 2, // Count
  200. 0, // BegCtrlID
  201. MaxRangeOP, // pOptParam
  202. 0 // Style, OTS_xxxx
  203. };
  204. OPTPARAM MinMaxRangeOP[] = {
  205. {
  206. sizeof(OPTPARAM), // cbSize
  207. 0, // OPTPF_xxx
  208. 0, // style
  209. TEXT("%"), // pData (postfix)
  210. IDI_CPSUI_SCALING, // IconID
  211. 0 // lParam
  212. },
  213. {
  214. sizeof(OPTPARAM), // cbSize
  215. 0, // OPTPF_xxx
  216. 0, // style
  217. NULL, // pData (help line)
  218. (DWORD)MIN_INT, // IconID
  219. MAX_INT // lParam
  220. },
  221. {
  222. sizeof(OPTPARAM), // cbSize
  223. 0, // OPTPF_xxx
  224. 0, // style
  225. NULL, // pData (help line)
  226. 2, // IconID
  227. 50 // lParam
  228. }
  229. };
  230. OPTTYPE TVOTUDArrowOT = {
  231. sizeof(OPTTYPE), // cbSize
  232. TVOT_UDARROW, // Type
  233. 0, // Flags OPTTF_xxxx
  234. 2, // Count
  235. 0, // BegCtrlID
  236. MinMaxRangeOP, // pOptParam
  237. 0 // Style, OTS_xxxx
  238. };
  239. OPTTYPE TVOTTrackBarOT = {
  240. sizeof(OPTTYPE), // cbSize
  241. TVOT_TRACKBAR, // Type
  242. 0, // Flags OPTTF_xxxx
  243. 3, // Count
  244. 0, // BegCtrlID
  245. MinMaxRangeOP, // pOptParam
  246. 0 // Style, OTS_xxxx
  247. };
  248. OPTTYPE TVOTScrollBarOT = {
  249. sizeof(OPTTYPE), // cbSize
  250. TVOT_SCROLLBAR, // Type
  251. 0, // Flags OPTTF_xxxx
  252. 3, // Count
  253. 0, // BegCtrlID
  254. MinMaxRangeOP, // pOptParam
  255. 0 // Style, OTS_xxxx
  256. };
  257. OPTPARAM TVOTLBCBOP[] = {
  258. {
  259. sizeof(OPTPARAM), // cbSize
  260. 0, // OPTPF_xxx
  261. 0, // style
  262. (LPTSTR)IDS_CPSUI_NOTINSTALLED, // pData
  263. IDI_CPSUI_SEL_NONE, // IconID
  264. 0 // lParam
  265. },
  266. {
  267. sizeof(OPTPARAM), // cbSize
  268. 0, // OPTPF_xxx
  269. 0, // style
  270. TEXT(" 1 MB"), // pData
  271. IDI_CPSUI_MEM, // IconID
  272. 0 // lParam
  273. },
  274. {
  275. sizeof(OPTPARAM), // cbSize
  276. 0, // OPTPF_xxx
  277. 0, // style
  278. TEXT(" 2 MB"), // pData
  279. IDI_CPSUI_MEM, // IconID
  280. 0 // lParam
  281. },
  282. {
  283. sizeof(OPTPARAM), // cbSize
  284. 0, // OPTPF_xxx
  285. 0, // style
  286. TEXT(" 4 MB"), // pData
  287. IDI_CPSUI_MEM, // IconID
  288. 0 // lParam
  289. },
  290. {
  291. sizeof(OPTPARAM), // cbSize
  292. 0, // OPTPF_xxx
  293. 0, // style
  294. TEXT(" 6 MB"), // pData
  295. IDI_CPSUI_MEM, // IconID
  296. 0 // lParam
  297. },
  298. {
  299. sizeof(OPTPARAM), // cbSize
  300. 0, // OPTPF_xxx
  301. 0, // style
  302. TEXT(" 8 MB"), // pData
  303. IDI_CPSUI_MEM, // IconID
  304. 0 // lParam
  305. },
  306. {
  307. sizeof(OPTPARAM), // cbSize
  308. 0, // OPTPF_xxx
  309. 0, // style
  310. TEXT("10 MB"), // pData
  311. IDI_CPSUI_MEM, // IconID
  312. 0 // lParam
  313. },
  314. {
  315. sizeof(OPTPARAM), // cbSize
  316. 0, // OPTPF_xxx
  317. 0, // style
  318. TEXT("12 MB"), // pData
  319. IDI_CPSUI_MEM, // IconID
  320. 0 // lParam
  321. },
  322. {
  323. sizeof(OPTPARAM), // cbSize
  324. 0, // OPTPF_xxx
  325. 0, // style
  326. TEXT("14 MB"), // pData
  327. IDI_CPSUI_MEM, // IconID
  328. 0 // lParam
  329. },
  330. {
  331. sizeof(OPTPARAM), // cbSize
  332. 0, // OPTPF_xxx
  333. 0, // style
  334. TEXT("16 MB"), // pData
  335. IDI_CPSUI_MEM, // IconID
  336. 0 // lParam
  337. },
  338. {
  339. sizeof(OPTPARAM), // cbSize
  340. 0, // OPTPF_xxx
  341. 0, // style
  342. TEXT("18 MB"), // pData
  343. IDI_CPSUI_MEM, // IconID
  344. 0 // lParam
  345. },
  346. {
  347. sizeof(OPTPARAM), // cbSize
  348. 0, // OPTPF_xxx
  349. 0, // style
  350. TEXT("20 MB"), // pData
  351. IDI_CPSUI_MEM, // IconID
  352. 0 // lParam
  353. },
  354. {
  355. sizeof(OPTPARAM), // cbSize
  356. 0, // OPTPF_xxx
  357. 0, // style
  358. TEXT("24 MB"), // pData
  359. IDI_CPSUI_MEM, // IconID
  360. 0 // lParam
  361. },
  362. {
  363. sizeof(OPTPARAM), // cbSize
  364. 0, // OPTPF_xxx
  365. 0, // style
  366. TEXT("32 MB"), // pData
  367. IDI_CPSUI_MEM, // IconID
  368. 0 // lParam
  369. },
  370. {
  371. sizeof(OPTPARAM), // cbSize
  372. 0, // OPTPF_xxx
  373. 0, // style
  374. TEXT("48 MB"), // pData
  375. IDI_CPSUI_MEM, // IconID
  376. 0 // lParam
  377. },
  378. {
  379. sizeof(OPTPARAM), // cbSize
  380. 0, // OPTPF_xxx
  381. 0, // style
  382. TEXT("64 MB"), // pData
  383. IDI_CPSUI_MEM, // IconID
  384. 0 // lParam
  385. },
  386. };
  387. OPTTYPE TVOTListBoxOT = {
  388. sizeof(OPTTYPE), // cbSize
  389. TVOT_LISTBOX, // Type
  390. 0, // Flags OPTTF_xxxx
  391. COUNT_ARRAY(TVOTLBCBOP), // Count
  392. 0, // BegCtrlID
  393. TVOTLBCBOP, // pOptParam
  394. 0 // Style, OTS_xxxx
  395. };
  396. OPTTYPE TVOTComboBoxOT = {
  397. sizeof(OPTTYPE), // cbSize
  398. TVOT_COMBOBOX, // Type
  399. 0, // Flags OPTTF_xxxx
  400. COUNT_ARRAY(TVOTLBCBOP), // Count
  401. 0, // BegCtrlID
  402. TVOTLBCBOP, // pOptParam
  403. 0 // Style, OTS_xxxx
  404. };
  405. TCHAR TVOTEditBoxBuf[128] = TEXT("Confidential");
  406. OPTPARAM TVOTEditBoxOP[] = {
  407. {
  408. sizeof(OPTPARAM), // cbSize
  409. 0, // OPTPF_xxx
  410. 0, // style
  411. TEXT("*Mark*"), // pData
  412. IDI_CPSUI_WATERMARK, // IconID
  413. 0 // lParam
  414. },
  415. {
  416. sizeof(OPTPARAM), // cbSize
  417. 0, // OPTPF_xxx
  418. 0, // style
  419. TEXT("Type in WaterMark text"), // pData
  420. COUNT_ARRAY(TVOTEditBoxBuf), // IconID
  421. 0 // lParam
  422. }
  423. };
  424. OPTTYPE TVOTEditBoxOT = {
  425. sizeof(OPTTYPE), // cbSize
  426. TVOT_EDITBOX, // Type
  427. 0, // Flags OPTTF_xxxx
  428. 2, // Count
  429. 0, // BegCtrlID
  430. TVOTEditBoxOP, // pOptParam
  431. 0 // Style, OTS_xxxx
  432. };
  433. OPTPARAM TVOTPushButtonOP[] = {
  434. {
  435. sizeof(OPTPARAM), // cbSize
  436. 0, // OPTPF_xxx
  437. PUSHBUTTON_TYPE_DLGPROC, // style
  438. (LPTSTR)PushButtonProc, // pData
  439. IDI_CPSUI_RUN_DIALOG, // IconID
  440. PUSHBUTTON_DLG // lParam
  441. }
  442. };
  443. OPTTYPE TVOTPushButtonOT = {
  444. sizeof(OPTTYPE), // cbSize
  445. TVOT_PUSHBUTTON, // Type
  446. 0, // Flags OPTTF_xxxx
  447. 1, // Count
  448. 0, // BegCtrlID
  449. TVOTPushButtonOP, // pOptParam
  450. 0 // Style, OTS_xxxx
  451. };
  452. OPTPARAM TVOTChkBoxOP[] = {
  453. {
  454. sizeof(OPTPARAM), // cbSize
  455. 0, // OPTPF_xxx
  456. CHKBOXS_FALSE_TRUE, // style
  457. TEXT("Let's do it!"), // pData
  458. IDI_CPSUI_TELEPHONE, // IconID
  459. 0 // lParam
  460. }
  461. };
  462. OPTTYPE TVOTChkBoxOT = {
  463. sizeof(OPTTYPE), // cbSize
  464. TVOT_CHKBOX, // Type
  465. 0, // Flags OPTTF_xxxx
  466. 1, // Count
  467. 0, // BegCtrlID
  468. TVOTChkBoxOP, // pOptParam
  469. 0 // Style, OTS_xxxx
  470. };
  471. OPTPARAM ChkBoxTypeOP[] = {
  472. {
  473. sizeof(OPTPARAM), // cbSize
  474. 0, // OPTPF_xxx
  475. 0, // style
  476. TEXT("CHKBOXS_FALSE_TRUE"), // pData
  477. IDI_CPSUI_EMPTY, // IconID
  478. CHKBOXS_FALSE_TRUE // lParam
  479. },
  480. {
  481. sizeof(OPTPARAM), // cbSize
  482. 0, // OPTPF_xxx
  483. 0, // style
  484. TEXT("CHKBOXS_NO_YES"), // pData
  485. IDI_CPSUI_EMPTY, // IconID
  486. CHKBOXS_NO_YES // lParam
  487. },
  488. {
  489. sizeof(OPTPARAM), // cbSize
  490. 0, // OPTPF_xxx
  491. 0, // style
  492. TEXT("CHKBOXS_OFF_ON"), // pData
  493. IDI_CPSUI_EMPTY, // IconID
  494. CHKBOXS_OFF_ON // lParam
  495. },
  496. {
  497. sizeof(OPTPARAM), // cbSize
  498. 0, // OPTPF_xxx
  499. 0, // style
  500. TEXT("CHKBOXS_FALSE_PDATA"), // pData
  501. IDI_CPSUI_EMPTY, // IconID
  502. CHKBOXS_FALSE_PDATA // lParam
  503. },
  504. {
  505. sizeof(OPTPARAM), // cbSize
  506. 0, // OPTPF_xxx
  507. 0, // style
  508. TEXT("CHKBOXS_NO_PDATA"), // pData
  509. IDI_CPSUI_EMPTY, // IconID
  510. CHKBOXS_NO_PDATA // lParam
  511. },
  512. {
  513. sizeof(OPTPARAM), // cbSize
  514. 0, // OPTPF_xxx
  515. 0, // style
  516. TEXT("CHKBOXS_OFF_PDATA"), // pData
  517. IDI_CPSUI_EMPTY, // IconID
  518. CHKBOXS_OFF_PDATA // lParam
  519. },
  520. {
  521. sizeof(OPTPARAM), // cbSize
  522. 0, // OPTPF_xxx
  523. 0, // style
  524. TEXT("CHKBOXS_NONE_PDATA"), // pData
  525. IDI_CPSUI_EMPTY, // IconID
  526. CHKBOXS_NONE_PDATA // lParam
  527. }
  528. };
  529. OPTTYPE ChkBoxTypeOT = {
  530. sizeof(OPTTYPE), // cbSize
  531. TVOT_LISTBOX, // Type
  532. 0, // Flags OPTTF_xxxx
  533. COUNT_ARRAY(ChkBoxTypeOP), // Count
  534. 0, // BegCtrlID
  535. ChkBoxTypeOP, // pOptParam
  536. 0 // Style, OTS_xxxx
  537. };
  538. EXTCHKBOX TV_ECB = {
  539. sizeof(EXTCHKBOX),
  540. ECBF_OVERLAY_WARNING_ICON,
  541. TEXT("Extended CheckBox Test"),
  542. (LPTSTR)IDS_CPSUI_SLASH_SEP,
  543. TEXT("Got Checked!!!"),
  544. IDI_APPLE };
  545. EXTPUSH TV_EP = {
  546. sizeof(EXTPUSH),
  547. 0,
  548. TEXT("Extended Push Test"),
  549. NULL, //DLGPROC
  550. IDI_APPLE,
  551. 0 };
  552. OPTITEM TVTestOptItems[] = {
  553. { sizeof(OPTITEM), LEVEL_0, 0, OPTIF_NONE, 0,
  554. (LPTSTR)TEXT("TreeView Test"), IDI_CPSUI_QUESTION, NULL,
  555. NULL, 0, DMPUB_TVTEST },
  556. { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_COLLAPSE, 0,
  557. (LPTSTR)TEXT("CPSUI Options"), 0, NULL,
  558. NULL, 0, DMPUB_TVOPT },
  559. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  560. (LPTSTR)TEXT("Extended Type"), 0, &ECB_EP_ECB,
  561. &ECB_EP_OT, 0, DMPUB_TVOPT_ECB_EP },
  562. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  563. (LPTSTR)TEXT("Disabled Extended"), 0, NULL,
  564. &NoYesOT, 0, DMPUB_EXT_DISABLED },
  565. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  566. (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL,
  567. &NoYesOT, 0, DMPUB_EXT_OVERLAY_WARNING },
  568. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  569. (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL,
  570. &NoYesOT, 0, DMPUB_EXT_OVERLAY_STOP },
  571. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  572. (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL,
  573. &NoYesOT, 0, DMPUB_EXT_OVERLAY_NO },
  574. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0,
  575. (LPTSTR)TEXT("OptItem/OptType"), 0, NULL,
  576. NULL, 0, DMPUB_TVOPT },
  577. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  578. (LPTSTR)TEXT("Disabled OptType"), 0, NULL,
  579. &NoYesOT, 0, DMPUB_TVOPT_DISABLED },
  580. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  581. (LPTSTR)TEXT("Overlay 'Warning' Icon"), 0, NULL,
  582. &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_WARNING },
  583. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  584. (LPTSTR)TEXT("Overlay 'Stop' Icon"), 0, NULL,
  585. &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_STOP },
  586. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  587. (LPTSTR)TEXT("Overlay 'No' Icon"), 0, NULL,
  588. &NoYesOT, 0, DMPUB_TVOPT_OVERLAY_NO },
  589. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_COLLAPSE, 0,
  590. (LPTSTR)TEXT("ScrollBar/TrackBar Ranges"), 0, NULL,
  591. NULL, 0, DMPUB_TVOPT },
  592. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  593. TEXT("Min Range"), MIN_INT, NULL,
  594. &MinRangeOT, 0, DMPUB_MINRANGE },
  595. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  596. TEXT("Max. Range"), MAX_INT, NULL,
  597. &MaxRangeOT, 0, DMPUB_MAXRANGE },
  598. { sizeof(OPTITEM), LEVEL_1, 0, OPTIF_NONE, 0,
  599. TEXT("TVOT Test"), IDI_CPSUI_QUESTION, NULL,
  600. NULL, 0, DMPUB_TVOPT_TEST },
  601. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  602. (LPTSTR)TEXT("TVOT_2STATES"), 0, NULL,
  603. &TVOT2StatesOT, 0, DMPUB_2STATES },
  604. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  605. TEXT("TVOT_3STATES"), 0, NULL,
  606. &TVOT3StatesOT, 0, DMPUB_3STATES },
  607. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  608. TEXT("TVOT_UDARROW"), 55, NULL,
  609. &TVOTUDArrowOT, 0, DMPUB_UDARROW },
  610. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  611. TEXT("TVOT_TRACKBAR"), 100, NULL,
  612. &TVOTTrackBarOT, 0, DMPUB_TRACKBAR },
  613. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  614. TEXT("TVOT_SCROLLBAR"), 210, NULL,
  615. &TVOTScrollBarOT, 0, DMPUB_SCROLLBAR },
  616. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  617. TEXT("TVOT_LISTBOX"), 2, NULL,
  618. &TVOTListBoxOT, 0, DMPUB_LISTBOX },
  619. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  620. (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL,
  621. &NoYesOT, 0, DMPUB_TVOPT_ICONS },
  622. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  623. TEXT("TVOT_COMBOBOX"), 4, NULL,
  624. &TVOTComboBoxOT, 0, DMPUB_COMBOBOX },
  625. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK | OPTIF_COLLAPSE, 0,
  626. (LPTSTR)TEXT("Include 16x16 Icons"), 1, NULL,
  627. &NoYesOT, 0, DMPUB_TVOPT_ICONS },
  628. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  629. TEXT("TVOT_EDITBOX"), 0, NULL, // fill in TVOTEditBoxBuf later
  630. &TVOTEditBoxOT, 0, DMPUB_EDITBOX },
  631. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  632. TEXT("TVOT_PUSHBUTTON"), 0, NULL,
  633. &TVOTPushButtonOT, 0, DMPUB_PUSHBUTTON },
  634. { sizeof(OPTITEM), LEVEL_2, 0, OPTIF_CALLBACK, 0,
  635. TEXT("TVOT_CHKBOX"), 0, NULL,
  636. &TVOTChkBoxOT, 0, DMPUB_CHKBOX },
  637. { sizeof(OPTITEM), LEVEL_3, 0, OPTIF_CALLBACK, 0,
  638. TEXT("CheckBox Type"), 0, NULL,
  639. &ChkBoxTypeOT, 0, DMPUB_CHKBOX_TYPE }
  640. };
  641. INT_PTR
  642. CALLBACK
  643. PushButtonProc(
  644. HWND hDlg,
  645. UINT Msg,
  646. WPARAM wParam,
  647. LPARAM lParam
  648. )
  649. {
  650. switch (Msg) {
  651. case WM_INITDIALOG: /* message: initialize dialog box */
  652. CPSUIDBG(DBG_PUSHDLGPROC,
  653. ("PushButtonProc lParam=%s", (LPSTR)lParam));
  654. break;
  655. case WM_COMMAND:
  656. switch(LOWORD(wParam)) {
  657. case IDOK:
  658. case IDCANCEL:
  659. EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK));
  660. return(TRUE);
  661. }
  662. }
  663. return(FALSE);
  664. }
  665. INT_PTR
  666. APIENTRY
  667. MyAboutProc(
  668. HWND hDlg,
  669. UINT Msg,
  670. WPARAM wParam,
  671. LPARAM lParam
  672. )
  673. /*++
  674. Routine Description:
  675. This is the about... callback which pop up appliation's own about
  676. --*/
  677. {
  678. PCOMPROPSHEETUI pCPSUI;
  679. TCHAR Buf[128];
  680. switch (Msg) {
  681. case WM_INITDIALOG: /* message: initialize dialog box */
  682. pCPSUI = (PCOMPROPSHEETUI)lParam;
  683. StringCchPrintf(Buf, ARRAYSIZE(Buf), TEXT("About %s"), pCPSUI->pCallerName);
  684. SetWindowText(hDlg, Buf);
  685. StringCchPrintf(Buf, ARRAYSIZE(Buf),
  686. TEXT("%s Version %u.%u"),
  687. pCPSUI->pCallerName,
  688. (UINT)HIBYTE(pCPSUI->CallerVersion),
  689. (UINT)LOBYTE(pCPSUI->CallerVersion));
  690. SetDlgItemText(hDlg, IDD_ABOUT1, Buf);
  691. StringCchPrintf(Buf, ARRAYSIZE(Buf),
  692. TEXT("%s Version %u.%u"),
  693. pCPSUI->pOptItemName,
  694. (UINT)HIBYTE(pCPSUI->OptItemVersion),
  695. (UINT)LOBYTE(pCPSUI->OptItemVersion));
  696. SetDlgItemText(hDlg, IDD_ABOUT2, Buf);
  697. break;
  698. case WM_COMMAND:
  699. switch(LOWORD(wParam)) {
  700. case IDOK:
  701. case IDCANCEL:
  702. EndDialog(hDlg, (BOOL)(LOWORD(wParam) == IDOK));
  703. return(TRUE);
  704. }
  705. }
  706. return (FALSE);
  707. }
  708. POPTITEM
  709. FindOptItem(
  710. POPTITEM pOptItem,
  711. UINT cOptItem,
  712. BYTE DMPubID
  713. )
  714. {
  715. while (cOptItem--) {
  716. if (pOptItem->DMPubID == DMPubID) {
  717. return(pOptItem);
  718. }
  719. ++pOptItem;
  720. }
  721. return(NULL);
  722. }
  723. CPSUICALLBACK
  724. TVTestCallBack(
  725. PCPSUICBPARAM pCPSUICBParam
  726. )
  727. {
  728. POPTITEM pCurItem = pCPSUICBParam->pCurItem;
  729. POPTITEM pItem;
  730. BYTE DMPubID;
  731. BYTE Flags;
  732. LONG Sel;
  733. LONG Action = CPSUICB_ACTION_NONE;
  734. DMPubID = pCurItem->DMPubID;
  735. Sel = pCurItem->Sel;
  736. switch (pCPSUICBParam->Reason) {
  737. case CPSUICB_REASON_OPTITEM_SETFOCUS:
  738. CPSUIDBG(DBG_TVTESTCB, ("Got OPTITEM_SETFOCUS CallBack now"));
  739. switch (DMPubID) {
  740. case DMPUB_MINRANGE:
  741. if (pItem = FindOptItem(pCPSUICBParam->pOptItem,
  742. pCPSUICBParam->cOptItem,
  743. DMPUB_MAXRANGE)) {
  744. pCurItem->pOptType->pOptParam[1].lParam = (LONG)pItem->Sel;
  745. }
  746. break;
  747. case DMPUB_MAXRANGE:
  748. if (pItem = FindOptItem(pCPSUICBParam->pOptItem,
  749. pCPSUICBParam->cOptItem,
  750. DMPUB_MINRANGE)) {
  751. pCurItem->pOptType->pOptParam[1].IconID = (DWORD)pItem->Sel;
  752. }
  753. break;
  754. }
  755. break;
  756. case CPSUICB_REASON_ABOUT:
  757. DialogBoxParam(hInstApp,
  758. MAKEINTRESOURCE(DLGABOUT),
  759. pCPSUICBParam->hDlg,
  760. MyAboutProc,
  761. (LPARAM)(pCPSUICBParam->pOldSel));
  762. break;
  763. case CPSUICB_REASON_ECB_CHANGED:
  764. CPSUIDBG(DBG_TVTESTCB, ("Got ECB_CHANGED CallBack now"));
  765. switch (DMPubID) {
  766. case DMPUB_TVOPT_ECB_EP:
  767. if (pCurItem->Flags & OPTIF_ECB_CHECKED) {
  768. TV_EP.IconID =
  769. TV_ECB.IconID = IDI_APPLE;
  770. } else {
  771. TV_EP.IconID =
  772. TV_ECB.IconID = 0;
  773. }
  774. Action = CPSUICB_ACTION_OPTIF_CHANGED;
  775. break;
  776. default:
  777. break;
  778. }
  779. break;
  780. case CPSUICB_REASON_SEL_CHANGED:
  781. CPSUIDBG(DBG_TVTESTCB, ("Got SEL_CHANGED CallBack now"));
  782. switch (DMPubID) {
  783. case DMPUB_CHKBOX_TYPE:
  784. if (pItem = FindOptItem(pCPSUICBParam->pOptItem,
  785. pCPSUICBParam->cOptItem,
  786. DMPUB_CHKBOX)) {
  787. pItem->pOptType->pOptParam[0].Style = (BYTE)pCurItem->Sel;
  788. pItem->Flags |= OPTIF_CHANGED;
  789. Action = CPSUICB_ACTION_OPTIF_CHANGED;
  790. }
  791. break;
  792. case DMPUB_TVOPT_ICONS:
  793. pItem = pCurItem - 1;
  794. if (Sel) {
  795. pItem->pOptType->Style &= ~OTS_LBCB_NO_ICON16_IN_ITEM;
  796. } else {
  797. pItem->pOptType->Style |= OTS_LBCB_NO_ICON16_IN_ITEM;
  798. }
  799. break;
  800. case DMPUB_EXT_OVERLAY_WARNING:
  801. if (Sel) {
  802. TV_EP.Flags |= EPF_OVERLAY_WARNING_ICON;
  803. TV_ECB.Flags |= ECBF_OVERLAY_WARNING_ICON;
  804. } else {
  805. TV_EP.Flags &= ~EPF_OVERLAY_WARNING_ICON;
  806. TV_ECB.Flags &= ~ECBF_OVERLAY_WARNING_ICON;
  807. }
  808. break;
  809. case DMPUB_EXT_OVERLAY_STOP:
  810. if (Sel) {
  811. TV_EP.Flags |= EPF_OVERLAY_STOP_ICON;
  812. TV_ECB.Flags |= ECBF_OVERLAY_STOP_ICON;
  813. } else {
  814. TV_EP.Flags &= ~EPF_OVERLAY_STOP_ICON;
  815. TV_ECB.Flags &= ~ECBF_OVERLAY_STOP_ICON;
  816. }
  817. break;
  818. case DMPUB_EXT_OVERLAY_NO:
  819. if (Sel) {
  820. TV_EP.Flags |= EPF_OVERLAY_NO_ICON;
  821. TV_ECB.Flags |= ECBF_OVERLAY_NO_ICON;
  822. } else {
  823. TV_EP.Flags &= ~EPF_OVERLAY_NO_ICON;
  824. TV_ECB.Flags &= ~ECBF_OVERLAY_NO_ICON;
  825. }
  826. break;
  827. case DMPUB_MINRANGE:
  828. MinMaxRangeOP[1].IconID = (DWORD)Sel;
  829. break;
  830. case DMPUB_MAXRANGE:
  831. MinMaxRangeOP[1].lParam = (LONG)Sel;
  832. break;
  833. case DMPUB_TVOPT_OVERLAY_WARNING:
  834. case DMPUB_TVOPT_OVERLAY_STOP:
  835. case DMPUB_TVOPT_OVERLAY_NO:
  836. Action = CPSUICB_ACTION_REINIT_ITEMS;
  837. case DMPUB_TVOPT_ECB_EP:
  838. if (Sel) {
  839. pCurItem->Flags &= ~OPTIF_EXT_DISABLED;
  840. } else {
  841. pCurItem->Flags |= OPTIF_EXT_DISABLED;
  842. }
  843. pCurItem->Flags |= OPTIF_CHANGED;
  844. Action = CPSUICB_ACTION_OPTIF_CHANGED;
  845. //
  846. // Fall through
  847. //
  848. case DMPUB_TVOPT_DISABLED:
  849. case DMPUB_EXT_DISABLED:
  850. if (pItem = FindOptItem(pCPSUICBParam->pOptItem,
  851. pCPSUICBParam->cOptItem,
  852. DMPUB_2STATES)) {
  853. do {
  854. if ((pItem->DMPubID >= DMPUB_2STATES) &&
  855. (pItem->DMPubID <= DMPUB_CHKBOX)) {
  856. switch (DMPubID) {
  857. case DMPUB_TVOPT_OVERLAY_WARNING:
  858. if (Sel) {
  859. pItem->Flags |= OPTIF_OVERLAY_WARNING_ICON;
  860. } else {
  861. pItem->Flags &= ~OPTIF_OVERLAY_WARNING_ICON;
  862. }
  863. break;
  864. case DMPUB_TVOPT_OVERLAY_STOP:
  865. if (Sel) {
  866. pItem->Flags |= OPTIF_OVERLAY_STOP_ICON;
  867. } else {
  868. pItem->Flags &= ~OPTIF_OVERLAY_STOP_ICON;
  869. }
  870. break;
  871. case DMPUB_TVOPT_OVERLAY_NO:
  872. if (Sel) {
  873. pItem->Flags |= OPTIF_OVERLAY_NO_ICON;
  874. } else {
  875. pItem->Flags &= ~OPTIF_OVERLAY_NO_ICON;
  876. }
  877. break;
  878. case DMPUB_TVOPT_DISABLED:
  879. if (Sel) {
  880. pItem->pOptType->Flags |= OPTTF_TYPE_DISABLED;
  881. } else {
  882. pItem->pOptType->Flags &= ~OPTTF_TYPE_DISABLED;
  883. }
  884. break;
  885. case DMPUB_EXT_DISABLED:
  886. if (Sel) {
  887. pItem->Flags |= OPTIF_EXT_DISABLED;
  888. } else {
  889. pItem->Flags &= ~OPTIF_EXT_DISABLED;
  890. }
  891. break;
  892. case DMPUB_TVOPT_ECB_EP:
  893. switch (Sel) {
  894. case 0:
  895. pItem->Flags |= OPTIF_EXT_HIDE;
  896. break;
  897. case 1:
  898. pItem->Flags &= ~(OPTIF_EXT_HIDE |
  899. OPTIF_EXT_IS_EXTPUSH);
  900. pItem->pExtChkBox = &TV_ECB;
  901. break;
  902. case 2:
  903. pItem->Flags &= ~OPTIF_EXT_HIDE;
  904. pItem->Flags |= OPTIF_EXT_IS_EXTPUSH;
  905. pItem->pExtPush = &TV_EP;
  906. break;
  907. }
  908. }
  909. }
  910. pItem->Flags |= OPTIF_CHANGED;
  911. } while ((pItem++)->DMPubID != DMPUB_CHKBOX);
  912. }
  913. break;
  914. default:
  915. break;
  916. }
  917. break;
  918. case CPSUICB_REASON_PUSHBUTTON:
  919. CPSUIDBG(DBG_TVTESTCB, ("Got PUSH Button CallBack now"));
  920. break;
  921. case CPSUICB_REASON_EXTPUSH:
  922. DialogBoxParam(hInstApp,
  923. MAKEINTRESOURCE(EXTPUSH_DLG),
  924. pCPSUICBParam->hDlg,
  925. PushButtonProc,
  926. (LPARAM)(pCPSUICBParam->pOldSel));
  927. break;
  928. default:
  929. break;
  930. }
  931. return(Action);
  932. }
  933. BOOL
  934. SetupComPropSheetUI(
  935. PCOMPROPSHEETUI pCPSUI
  936. )
  937. {
  938. static BOOL UpdateEditBox = TRUE;
  939. UINT i;
  940. ZeroMemory(pCPSUI, sizeof(COMPROPSHEETUI));
  941. pCPSUI->cbSize = sizeof(COMPROPSHEETUI);
  942. pCPSUI->hInstCaller = hInstApp;
  943. pCPSUI->pCallerName = (LPTSTR)TitleName;
  944. pCPSUI->CallerVersion = 0x100;
  945. pCPSUI->pOptItemName = (LPTSTR)OptItemName;
  946. pCPSUI->OptItemVersion = 0x400;
  947. pCPSUI->UserData = (ULONG_PTR)pCPSUI;
  948. pCPSUI->pHelpFile = (LPTSTR)TEXT("CPSUISam.hlp");
  949. pCPSUI->pfnCallBack = TVTestCallBack;
  950. pCPSUI->pOptItem = TVTestOptItems;
  951. pCPSUI->cOptItem = COUNT_ARRAY(TVTestOptItems);
  952. pCPSUI->Flags = 0;
  953. pCPSUI->pDlgPage = CPSUI_PDLGPAGE_TREEVIWONLY;
  954. pCPSUI->cDlgPage = 0;
  955. if (UpdateEditBox) {
  956. //
  957. // Fixup compiler warning for the LPSTR and LONG
  958. //
  959. for (i = 0; i < COUNT_ARRAY(TVTestOptItems); i++) {
  960. if (TVTestOptItems[i].DMPubID == DMPUB_EDITBOX) {
  961. TVTestOptItems[i].pSel = (LPTSTR)TVOTEditBoxBuf;
  962. UpdateEditBox = FALSE;
  963. break;
  964. }
  965. }
  966. }
  967. if (UpdatePermission) {
  968. pCPSUI->Flags |= CPSUIF_UPDATE_PERMISSION;
  969. }
  970. if (!UseStdAbout) {
  971. pCPSUI->Flags |= CPSUIF_ABOUT_CALLBACK;
  972. }
  973. return(TRUE);
  974. }