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.

123 lines
3.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. // do all the necessary dc stuff
  67. // Create a compatible memory DC
  68. CDC memdc;
  69. f = memdc.CreateCompatibleDC( &cdc );
  70. // Select the bitmap into the DC
  71. CBitmap *poldbmp;
  72. poldbmp = memdc.SelectObject( &m_bitmapCheck );
  73. // test
  74. RECT r;
  75. r.left = r.top = 0;
  76. r.right = r.bottom = 7;
  77. memdc.Ellipse( &r );
  78. memdc.InvertRect( &r );
  79. // for readability...
  80. int l = rcSection.left + 2; // left
  81. int t = rcSection.top + 2; // top
  82. int w = rcSection.right - rcSection.left; // width
  83. int h = rcSection.bottom - rcSection.top; // height
  84. // Copy (BitBlt) bitmap from memory DC to screen DC
  85. f = cdc.BitBlt( l, t, w, h, &memdc, 0, 0, SRCCOPY );
  86. // f = cdc.StretchBlt( l, t, w, h, &memdc, 0, 0, 7, 7, SRCCOPY );
  87. // restore the old selected bitmap
  88. memdc.SelectObject( poldbmp );
  89. */
  90. }
  91. // cleanup the CDC object
  92. cdc.Detach();
  93. // draw the rest of it
  94. CListSelRowCtrl::DrawItem( lpDrawItemStruct );
  95. }