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.

78 lines
2.0 KiB

  1. // AddUpgrd.cpp : implementation file
  2. //
  3. #include "precomp.hxx"
  4. #ifdef _DEBUG
  5. #define new DEBUG_NEW
  6. #undef THIS_FILE
  7. static char THIS_FILE[] = __FILE__;
  8. #endif
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CAddUpgrade dialog
  11. CAddUpgrade::CAddUpgrade(CWnd* pParent /*=NULL*/)
  12. : CDialog(CAddUpgrade::IDD, pParent)
  13. {
  14. //{{AFX_DATA_INIT(CAddUpgrade)
  15. m_iUpgradeType = 1; // default to rip-and-replace
  16. m_iSource = 0; // default to current container
  17. //}}AFX_DATA_INIT
  18. }
  19. void CAddUpgrade::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CDialog::DoDataExchange(pDX);
  22. //{{AFX_DATA_MAP(CAddUpgrade)
  23. DDX_Radio(pDX, IDC_RADIO4, m_iUpgradeType);
  24. DDX_Radio(pDX, IDC_RADIO1, m_iSource);
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(CAddUpgrade, CDialog)
  28. //{{AFX_MSG_MAP(CAddUpgrade)
  29. ON_LBN_DBLCLK(IDC_LIST1, OnOK)
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CAddUpgrade message handlers
  34. BOOL CAddUpgrade::OnInitDialog()
  35. {
  36. CListBox * pList = (CListBox *)GetDlgItem(IDC_LIST1);
  37. // add all elements that aren't already in the upgrade list
  38. std::map<CString, long>::iterator i;
  39. for (i = m_pNameIndex->begin(); i != m_pNameIndex->end(); i++)
  40. {
  41. if (m_pUpgradeList->end() == m_pUpgradeList->find(i->second))
  42. {
  43. pList->AddString(i->first);
  44. }
  45. }
  46. pList->SetCurSel(0);
  47. CDialog::OnInitDialog();
  48. return TRUE; // return TRUE unless you set the focus to a control
  49. // EXCEPTION: OCX Property Pages should return FALSE
  50. }
  51. void CAddUpgrade::OnOK()
  52. {
  53. CListBox * pList = (CListBox *)GetDlgItem(IDC_LIST1);
  54. int iSel = pList->GetCurSel();
  55. if (iSel != LB_ERR)
  56. {
  57. CString sz;
  58. pList->GetText(iSel, sz);
  59. m_cookie = (*m_pNameIndex)[sz];
  60. m_fUninstall = (m_iUpgradeType == 1);
  61. // only allow the dialog to close with IDOK if a selection has been made
  62. CDialog::OnOK();
  63. }
  64. }