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.

89 lines
2.3 KiB

  1. // ChkLstCt.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "certmap.h"
  5. #include "ListRow.h"
  6. #include "ChkLstCt.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CCheckListCtrl
  14. //-----------------------------------------------------------------------------------
  15. CCheckListCtrl::CCheckListCtrl()
  16. {
  17. // set the correct start drawing column
  18. m_StartDrawingCol = 1;
  19. }
  20. //-----------------------------------------------------------------------------------
  21. CCheckListCtrl::~CCheckListCtrl()
  22. {
  23. }
  24. //-----------------------------------------------------------------------------------
  25. BEGIN_MESSAGE_MAP(CCheckListCtrl, CListSelRowCtrl)
  26. //{{AFX_MSG_MAP(CCheckListCtrl)
  27. // NOTE - the ClassWizard will add and remove mapping macros here.
  28. //}}AFX_MSG_MAP
  29. END_MESSAGE_MAP()
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CCheckListCtrl message handlers
  32. //-----------------------------------------------------------------------------------
  33. void CCheckListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
  34. {
  35. CRect rcItem = lpDrawItemStruct->rcItem;
  36. CRect rcSection;
  37. UINT itemID = lpDrawItemStruct->itemID;
  38. BOOL f;
  39. CString sz;
  40. LV_COLUMN colData;
  41. // setup the CDC object
  42. CDC cdc;
  43. cdc.Attach( lpDrawItemStruct->hDC );
  44. // clear the columnd buffer
  45. ZeroMemory( &colData, sizeof(colData) );
  46. colData.mask = LVCF_WIDTH;
  47. // get the checkmark bitmap
  48. // f = m_bitmapCheck.LoadBitmap( IDB_CHECK );
  49. // First, we draw the "enabled" column Get the data
  50. // for it first. If there is none, then we can skip it.
  51. sz = GetItemText( itemID, 0 );
  52. f = GetColumn( 0, &colData );
  53. if ( !sz.IsEmpty() )
  54. {
  55. // figure out the sectional rect
  56. rcSection = rcItem;
  57. rcSection.left += 4;
  58. rcSection.top += 3;
  59. rcSection.right = rcSection.left + 9;
  60. rcSection.bottom = rcSection.top + 9;
  61. // draw the circle
  62. cdc.Ellipse( &rcSection );
  63. rcSection.DeflateRect(1, 1);
  64. cdc.Ellipse( &rcSection );
  65. }
  66. cdc.Detach();
  67. // draw the rest of it
  68. CListSelRowCtrl::DrawItem( lpDrawItemStruct );
  69. }