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.

136 lines
3.3 KiB

  1. // NewSystemShortcutDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "snapin.h"
  5. #include "NewSystemShortcutDlg.h"
  6. #include <mmc.h>
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CNewSystemShortcutDlg dialog
  14. CNewSystemShortcutDlg::CNewSystemShortcutDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CNewSystemShortcutDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CNewSystemShortcutDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void CNewSystemShortcutDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CNewSystemShortcutDlg)
  25. DDX_Control(pDX, IDC_BUTTON_DESELECT_ALL, m_DeselectAllButton);
  26. DDX_Control(pDX, IDC_BUTTON_SELECT_ALL, m_SelectAllButton);
  27. DDX_Control(pDX, IDC_LIST_SYSTEMS, m_Systems);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CNewSystemShortcutDlg, CDialog)
  31. //{{AFX_MSG_MAP(CNewSystemShortcutDlg)
  32. ON_BN_CLICKED(IDC_BUTTON_HELP, OnButtonHelp)
  33. ON_BN_CLICKED(IDC_BUTTON_SELECT_ALL, OnButtonSelectAll)
  34. ON_BN_CLICKED(IDC_BUTTON_DESELECT_ALL, OnButtonDeselectAll)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CNewSystemShortcutDlg message handlers
  39. BOOL CNewSystemShortcutDlg::OnInitDialog()
  40. {
  41. CDialog::OnInitDialog();
  42. CString sTitleFmt;
  43. GetDlgItem(IDC_STATIC_TITLE)->GetWindowText(sTitleFmt);
  44. CString sTitle;
  45. sTitle.Format(sTitleFmt,m_sGroupName);
  46. GetDlgItem(IDC_STATIC_TITLE)->SetWindowText(sTitle);
  47. // create the tooltip
  48. EnableToolTips();
  49. m_ToolTip.Create(this,TTS_ALWAYSTIP);
  50. m_ToolTip.AddTool(&m_SelectAllButton,IDS_STRING_TOOLTIP_SELECT_ALL);
  51. m_ToolTip.AddTool(&m_DeselectAllButton,IDS_STRING_TOOLTIP_DESELECT_ALL);
  52. m_ToolTip.Activate(TRUE);
  53. // create bitmaps and init each bitmap button
  54. CBitmap bitmap;
  55. bitmap.LoadBitmap(IDB_BITMAP_SELECT_ALL);
  56. m_hSelectAllBitmap = (HBITMAP)bitmap.Detach();
  57. bitmap.LoadBitmap(IDB_BITMAP_DESELECT_ALL);
  58. m_hDeselectAllBitmap = (HBITMAP)bitmap.Detach();
  59. SendDlgItemMessage(IDC_BUTTON_SELECT_ALL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)m_hSelectAllBitmap);
  60. SendDlgItemMessage(IDC_BUTTON_DESELECT_ALL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)m_hDeselectAllBitmap);
  61. // initialize the list view
  62. m_Systems.SetExtendedStyle(LVS_EX_CHECKBOXES);
  63. for( int i = 0; i < m_saSystems.GetSize(); i++ )
  64. {
  65. int iIndex = m_Systems.InsertItem(0,m_saSystems[i]);
  66. m_Systems.SetCheck(iIndex,m_uaIncludeFlags[i]);
  67. }
  68. return TRUE; // return TRUE unless you set the focus to a control
  69. // EXCEPTION: OCX Property Pages should return FALSE
  70. }
  71. void CNewSystemShortcutDlg::OnOK()
  72. {
  73. for( int i = 0; i < m_Systems.GetItemCount(); i++ )
  74. {
  75. m_saSystems.SetAt(i,m_Systems.GetItemText(i,0));
  76. if( m_Systems.GetCheck(i) )
  77. {
  78. m_uaIncludeFlags.SetAt(i,1);
  79. }
  80. else
  81. {
  82. m_uaIncludeFlags.SetAt(i,0);
  83. }
  84. }
  85. CDialog::OnOK();
  86. }
  87. void CNewSystemShortcutDlg::OnButtonHelp()
  88. {
  89. MMCPropertyHelp(_T("HMon21.chm::/daddsh.htm")); // 62212
  90. }
  91. void CNewSystemShortcutDlg::OnButtonSelectAll()
  92. {
  93. for( int i = 0; i < m_Systems.GetItemCount(); i++ )
  94. {
  95. m_Systems.SetCheck(i,TRUE);
  96. }
  97. }
  98. void CNewSystemShortcutDlg::OnButtonDeselectAll()
  99. {
  100. for( int i = 0; i < m_Systems.GetItemCount(); i++ )
  101. {
  102. m_Systems.SetCheck(i,FALSE);
  103. }
  104. }