Source code of Windows XP (NT5)
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.

120 lines
3.1 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // SUMMARY.CPP / Tuneup
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1998
  7. // All rights reserved
  8. //
  9. // Functions for the summary wizard page.
  10. //
  11. // 8/98 - Jason Cohen (JCOHEN)
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14. // Include file(s).
  15. //
  16. #include "main.h"
  17. #include <shellapi.h>
  18. #include "schedwiz.H"
  19. VOID InitSummaryList(HWND hwndLb, LPTASKDATA lpTasks)
  20. {
  21. LPTSTR lpTime,
  22. lpSummary;
  23. SHFILEINFO SHFileInfo;
  24. INT iIndex;
  25. SendMessage(hwndLb, LB_RESETCONTENT, 0, 0L );
  26. while (lpTasks)
  27. {
  28. if ( !(g_dwFlags & TUNEUP_CUSTOM) || (lpTasks->dwOptions & TASK_SCHEDULED) )
  29. {
  30. if ( lpTime = GetNextRunTimeText(lpTasks->pTask, lpTasks->dwFlags) )
  31. {
  32. // Get the text to use for the summary. The summary text is preffered,
  33. // but may be NULL so then we would have to use the title, which is required.
  34. //
  35. if ( lpTasks->lpSummary )
  36. lpSummary = lpTasks->lpSummary;
  37. else
  38. lpSummary = lpTasks->lpTitle;
  39. // Add the summary line to the list box.
  40. //
  41. if ( (iIndex = (INT)SendMessage(hwndLb, LB_ADDSTRING, 0, (LPARAM) lpSummary)) >= 0 )
  42. {
  43. SHGetFileInfo(lpTasks->lpFullPathName, 0, &SHFileInfo, sizeof(SHFILEINFO), SHGFI_ICON | SHGFI_SMALLICON);
  44. SendMessage(hwndLb, LB_SETITEMDATA, iIndex, (LPARAM) SHFileInfo.hIcon);
  45. SendMessage(hwndLb, LB_ADDSTRING, 0, (LPARAM) lpTime);
  46. }
  47. //SendMessage(hwndLb, LB_ADDSTRING, 0, (LPARAM) _T(""));
  48. #if 0
  49. if ( lpAll = (LPTSTR) MALLOC(sizeof(TCHAR) * (lstrlen(lpSummary) + lstrlen(lpTime) + 2)) )
  50. {
  51. wsprintf(lpAll, _T("%s\n%s"), lpSummary, lpTime);
  52. SendMessage(hwndLb, LB_ADDSTRING, 0, (LPARAM) lpAll);
  53. FREE(lpAll);
  54. }
  55. #endif
  56. FREE(lpTime);
  57. }
  58. }
  59. lpTasks = lpTasks->lpNext;
  60. }
  61. }
  62. BOOL SummaryDrawItem(HWND hWnd, const DRAWITEMSTRUCT * lpDrawItem)
  63. {
  64. TCHAR szBuffer[MAX_PATH];
  65. DWORD dwColor;
  66. HBRUSH hbrBack;
  67. HICON hIcon;
  68. if ( lpDrawItem->itemAction != ODA_DRAWENTIRE )
  69. return TRUE;
  70. // Get the window color so we can clear the listbox item.
  71. //
  72. dwColor = GetSysColor(COLOR_WINDOW);
  73. // Fill entire item rectangle with the appropriate color.
  74. //
  75. hbrBack = CreateSolidBrush(dwColor);
  76. FillRect(lpDrawItem->hDC, &(lpDrawItem->rcItem), hbrBack);
  77. DeleteObject(hbrBack);
  78. // Display the icon associated with the item.
  79. //
  80. if ( hIcon = (HICON) SendMessage(lpDrawItem->hwndItem, LB_GETITEMDATA, lpDrawItem->itemID, (LPARAM) 0) )
  81. {
  82. // Draw the file icon.
  83. //
  84. DrawIconEx( lpDrawItem->hDC,
  85. lpDrawItem->rcItem.left,
  86. lpDrawItem->rcItem.top,
  87. hIcon,
  88. lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
  89. lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
  90. 0,
  91. 0,
  92. DI_NORMAL);
  93. }
  94. // Display the text associated with the item.
  95. //
  96. SendMessage(lpDrawItem->hwndItem, LB_GETTEXT, lpDrawItem->itemID, (LPARAM) szBuffer);
  97. TextOut( lpDrawItem->hDC,
  98. lpDrawItem->rcItem.left + lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top + 2,
  99. lpDrawItem->rcItem.top + 1,
  100. szBuffer,
  101. lstrlen(szBuffer));
  102. return TRUE;
  103. }