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.

102 lines
2.6 KiB

  1. // filenewd.cpp : implementation file
  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 "wordpad.h"
  14. #include "filenewd.h"
  15. #include "filedlg.h"
  16. #include "helpids.h"
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21. DWORD const CFileNewDialog::m_nHelpIDs[] =
  22. {
  23. IDC_DATEDIALOG_LIST, IDH_WORDPAD_FILENEW_DOC,
  24. IDC_STATIC_HEADING, IDH_WORDPAD_FILENEW_DOC,
  25. 0, 0
  26. };
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CFileNewDialog dialog
  29. CFileNewDialog::CFileNewDialog(CWnd* pParent /*=NULL*/)
  30. : CCSDialog(CFileNewDialog::IDD, pParent)
  31. {
  32. //{{AFX_DATA_INIT(CFileNewDialog)
  33. m_nSel = -1;
  34. //}}AFX_DATA_INIT
  35. }
  36. void CFileNewDialog::DoDataExchange(CDataExchange* pDX)
  37. {
  38. CCSDialog::DoDataExchange(pDX);
  39. //{{AFX_DATA_MAP(CFileNewDialog)
  40. DDX_Control(pDX, IDC_DATEDIALOG_LIST, m_listbox);
  41. DDX_LBIndex(pDX, IDC_DATEDIALOG_LIST, m_nSel);
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP(CFileNewDialog, CCSDialog)
  45. //{{AFX_MSG_MAP(CFileNewDialog)
  46. ON_LBN_DBLCLK(IDC_DATEDIALOG_LIST, OnDblclkDatedialogList)
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CFileNewDialog message handlers
  51. BOOL CFileNewDialog::OnInitDialog()
  52. {
  53. CCSDialog::OnInitDialog();
  54. static const struct
  55. {
  56. int rdType;
  57. int idsType;
  58. }
  59. FileTypes[] =
  60. {
  61. {RD_RICHTEXT, IDS_RTF_DOCUMENT},
  62. {RD_TEXT, IDS_TEXT_DOCUMENT},
  63. {RD_UNICODETEXT, IDS_UNICODETEXT_DOCUMENT}
  64. };
  65. CString str;
  66. int i;
  67. int defType = CWordpadFileDialog::GetDefaultFileType();
  68. int iSelected = 0;
  69. for (i = 0; i < sizeof(FileTypes)/sizeof(FileTypes[0]); i++)
  70. {
  71. VERIFY(str.LoadString(FileTypes[i].idsType));
  72. m_listbox.AddString(str);
  73. if (FileTypes[i].rdType == defType)
  74. iSelected = i;
  75. }
  76. m_listbox.SetCurSel(iSelected);
  77. return TRUE; // return TRUE unless you set the focus to a control
  78. // EXCEPTION: OCX Property Pages should return FALSE
  79. }
  80. void CFileNewDialog::OnDblclkDatedialogList()
  81. {
  82. OnOK();
  83. }