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.

92 lines
1.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. TimesList.cpp : implementation file
  5. File History:
  6. JonY Apr-96 created
  7. --*/
  8. #include "stdafx.h"
  9. #include "Speckle.h"
  10. #include "TimeList.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CTimesList
  18. CTimesList::CTimesList()
  19. {
  20. }
  21. CTimesList::~CTimesList()
  22. {
  23. }
  24. BEGIN_MESSAGE_MAP(CTimesList, CListBox)
  25. //{{AFX_MSG_MAP(CTimesList)
  26. // NOTE - the ClassWizard will add and remove mapping macros here.
  27. //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CTimesList message handlers
  31. void CTimesList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
  32. {
  33. CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
  34. USHORT dwValue = (USHORT)GetItemData(lpDrawItemStruct->itemID);
  35. switch (lpDrawItemStruct->itemAction)
  36. {
  37. case ODA_SELECT:
  38. {
  39. if (dwValue == 1)
  40. {
  41. SetItemData(lpDrawItemStruct->itemID, 0);
  42. InvalidateRect(&lpDrawItemStruct->rcItem);
  43. }
  44. else
  45. {
  46. SetItemData(lpDrawItemStruct->itemID, 1);
  47. InvalidateRect(&lpDrawItemStruct->rcItem);
  48. }
  49. }
  50. break;
  51. case ODA_DRAWENTIRE:
  52. if (dwValue == 0)
  53. {
  54. pDC->FillRect(&(lpDrawItemStruct->rcItem),
  55. CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_CAPTIONTEXT))));
  56. pDC->DrawEdge(&lpDrawItemStruct->rcItem,
  57. BDR_RAISEDOUTER | BDR_SUNKENINNER,
  58. BF_BOTTOM | BF_BOTTOMRIGHT);
  59. }
  60. else
  61. {
  62. pDC->FillRect(&(lpDrawItemStruct->rcItem),
  63. CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_ACTIVECAPTION))));
  64. pDC->DrawEdge(&lpDrawItemStruct->rcItem,
  65. BDR_RAISEDINNER | BDR_SUNKENOUTER,
  66. BF_BOTTOM | BF_BOTTOMRIGHT);
  67. }
  68. break;
  69. }
  70. }