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.

187 lines
4.2 KiB

  1. // FilterDialog.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "viewex.h"
  5. #include "fltrdlg.h"
  6. #include "testcore.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CFilterDialog dialog
  14. /***********************************************************
  15. Function:
  16. Arguments:
  17. Return:
  18. Purpose:
  19. Author(s):
  20. Revision:
  21. Date:
  22. ***********************************************************/
  23. CFilterDialog::CFilterDialog(CWnd* pParent /*=NULL*/)
  24. : CDialog(CFilterDialog::IDD, pParent)
  25. {
  26. //{{AFX_DATA_INIT(CFilterDialog)
  27. // NOTE: the ClassWizard will add member initialization here
  28. //}}AFX_DATA_INIT
  29. }
  30. /***********************************************************
  31. Function:
  32. Arguments:
  33. Return:
  34. Purpose:
  35. Author(s):
  36. Revision:
  37. Date:
  38. ***********************************************************/
  39. void CFilterDialog::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CFilterDialog)
  43. DDX_Control(pDX, IDC_DONOTDISPLAYTHIS, m_DoNotDisplayThis);
  44. DDX_Control(pDX, IDC_DISPLAYTHIS, m_DisplayThis);
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CFilterDialog, CDialog)
  48. //{{AFX_MSG_MAP(CFilterDialog)
  49. ON_BN_CLICKED(IDC_TODISPLAY, OnMoveToDisplay)
  50. ON_BN_CLICKED(IDC_TONOTDISPLAY, OnMoveToNotDisplay)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CFilterDialog message handlers
  55. /***********************************************************
  56. Function:
  57. Arguments:
  58. Return:
  59. Purpose:
  60. Author(s):
  61. Revision:
  62. Date:
  63. ***********************************************************/
  64. void CFilterDialog::OnMoveToDisplay()
  65. {
  66. // TODO: Add your control notification handler code here
  67. int nIdx;
  68. DWORD dwItemData;
  69. TCHAR szText[ 128 ];
  70. nIdx = m_DoNotDisplayThis.GetCurSel( );
  71. if( LB_ERR != nIdx )
  72. {
  73. dwItemData = (DWORD)m_DoNotDisplayThis.GetItemData( nIdx );
  74. m_DoNotDisplayThis.DeleteString( nIdx );
  75. StringFromType( dwItemData, szText );
  76. nIdx = m_DisplayThis.AddString( szText );
  77. m_DisplayThis.SetItemData( nIdx, dwItemData );
  78. m_pFilters[ dwItemData ] = TRUE;
  79. }
  80. }
  81. /***********************************************************
  82. Function:
  83. Arguments:
  84. Return:
  85. Purpose:
  86. Author(s):
  87. Revision:
  88. Date:
  89. ***********************************************************/
  90. void CFilterDialog::OnMoveToNotDisplay()
  91. {
  92. // TODO: Add your control notification handler code here
  93. // TODO: Add your control notification handler code here
  94. int nIdx;
  95. DWORD dwItemData;
  96. TCHAR szText[ 128 ];
  97. nIdx = m_DisplayThis.GetCurSel( );
  98. if( LB_ERR != nIdx )
  99. {
  100. dwItemData = (DWORD)m_DisplayThis.GetItemData( nIdx );
  101. m_DisplayThis.DeleteString( nIdx );
  102. StringFromType( dwItemData, szText );
  103. nIdx = m_DoNotDisplayThis.AddString( szText );
  104. m_DoNotDisplayThis.SetItemData( nIdx, dwItemData );
  105. m_pFilters[ dwItemData ] = FALSE;
  106. }
  107. }
  108. /***********************************************************
  109. Function:
  110. Arguments:
  111. Return:
  112. Purpose:
  113. Author(s):
  114. Revision:
  115. Date:
  116. ***********************************************************/
  117. void CFilterDialog::DisplayThisType( DWORD dwType, TCHAR* pszText )
  118. {
  119. CListBox* pListBox;
  120. int nIdx;
  121. if( m_pFilters[ dwType ] )
  122. {
  123. pListBox = &m_DisplayThis;
  124. }
  125. else
  126. {
  127. pListBox = &m_DoNotDisplayThis;
  128. }
  129. nIdx = pListBox->AddString( pszText );
  130. pListBox->SetItemData( nIdx, dwType );
  131. }
  132. /***********************************************************
  133. Function:
  134. Arguments:
  135. Return:
  136. Purpose:
  137. Author(s):
  138. Revision:
  139. Date:
  140. ***********************************************************/
  141. BOOL CFilterDialog::OnInitDialog()
  142. {
  143. CDialog::OnInitDialog();
  144. // TODO: Add extra initialization here
  145. TCHAR szType[ 128 ];
  146. for( DWORD dwType = 0L ; dwType < LIMIT ; dwType++ )
  147. {
  148. if( OTHER == dwType || SCHEMA == dwType )
  149. continue;
  150. StringFromType( dwType, szType );
  151. DisplayThisType( dwType, szType );
  152. }
  153. return TRUE; // return TRUE unless you set the focus to a control
  154. // EXCEPTION: OCX Property Pages should return FALSE
  155. }