Leaked source code of windows server 2003
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.

63 lines
1.7 KiB

  1. // listdlg.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "listdlg.h"
  15. #ifdef _DEBUG
  16. #undef THIS_FILE
  17. static char BASED_CODE THIS_FILE[] = __FILE__;
  18. #endif
  19. BEGIN_MESSAGE_MAP(CListDlg, CDialog)
  20. //{{AFX_MSG_MAP(CListDlg)
  21. ON_LBN_DBLCLK(IDC_LISTDIALOG_LIST, OnOK)
  22. //}}AFX_MSG_MAP
  23. END_MESSAGE_MAP()
  24. CListDlg::CListDlg(UINT idStrDlgTitle, UINT idStrListTitle,
  25. const CStringList& listItems, int nDefSel) : CDialog(CListDlg::IDD),
  26. m_listItems(listItems)
  27. {
  28. VERIFY(m_strDlgTitle.LoadString(idStrDlgTitle));
  29. VERIFY(m_strListTitle.LoadString(idStrListTitle));
  30. m_nSelection = nDefSel;
  31. }
  32. BOOL CListDlg::OnInitDialog()
  33. {
  34. SetWindowText(m_strDlgTitle);
  35. // fix this
  36. SetDlgItemText(IDC_STATIC_HEADING, m_strListTitle);
  37. CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LISTDIALOG_LIST);
  38. ASSERT(pListBox != NULL);
  39. // fill with document templates in list
  40. POSITION pos = m_listItems.GetHeadPosition();
  41. while (pos != NULL)
  42. {
  43. if ( pListBox->AddString(m_listItems.GetNext(pos)) == -1)
  44. return FALSE;
  45. }
  46. pListBox->SetCurSel(m_nSelection);
  47. return CDialog::OnInitDialog();
  48. }
  49. void CListDlg::OnOK()
  50. {
  51. CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LISTDIALOG_LIST);
  52. ASSERT(pListBox != NULL);
  53. m_nSelection = pListBox->GetCurSel();
  54. CDialog::OnOK();
  55. }