OptionsSheet.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // OptionsSheet.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "OptionsSheet.h"
  6. #include "OptionsKeyBoard.h"
  7. #include "OptionsGeneral.h"
  8. #include "OptionsQuickPaste.h"
  9. #include "OptionsStats.h"
  10. #include "OptionsTypes.h"
  11. #include "About.h"
  12. #include "OptionFriends.h"
  13. #include "OptionsCopyBuffers.h"
  14. #include "Misc.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // COptionsSheet
  22. IMPLEMENT_DYNAMIC(COptionsSheet, CPropertySheet)
  23. COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  24. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  25. {
  26. m_pKeyBoardOptions = NULL;
  27. m_pGeneralOptions = NULL;
  28. m_pQuickPasteOptions = NULL;
  29. m_pCopyBuffers = NULL;
  30. m_pStats = NULL;
  31. m_pTypes = NULL;
  32. m_pAbout = NULL;
  33. m_pFriends = NULL;
  34. m_pCopyBuffers = NULL;
  35. m_pUtilites = NULL;
  36. m_hWndParent = NULL;
  37. EnableStackedTabs(TRUE);
  38. m_pGeneralOptions = new COptionsGeneral;
  39. m_pKeyBoardOptions = new COptionsKeyBoard;
  40. m_pQuickPasteOptions = new COptionsQuickPaste;
  41. m_pCopyBuffers = new COptionsCopyBuffers;
  42. m_pStats = new COptionsStats;
  43. m_pTypes = new COptionsTypes;
  44. m_pAbout = new CAbout;
  45. AddPage(m_pGeneralOptions);
  46. AddPage(m_pTypes);
  47. AddPage(m_pKeyBoardOptions);
  48. AddPage(m_pCopyBuffers);
  49. AddPage(m_pQuickPasteOptions);
  50. if(g_Opt.GetAllowFriends())
  51. {
  52. m_pFriends = new COptionFriends;
  53. AddPage(m_pFriends);
  54. }
  55. AddPage(m_pStats);
  56. AddPage(m_pAbout);
  57. }
  58. COptionsSheet::~COptionsSheet()
  59. {
  60. delete m_pGeneralOptions;
  61. delete m_pKeyBoardOptions;
  62. delete m_pQuickPasteOptions;
  63. delete m_pCopyBuffers;
  64. delete m_pStats;
  65. delete m_pTypes;
  66. delete m_pAbout;
  67. delete m_pFriends;
  68. delete m_pUtilites;
  69. }
  70. BEGIN_MESSAGE_MAP(COptionsSheet, CPropertySheet)
  71. //{{AFX_MSG_MAP(COptionsSheet)
  72. // NOTE - the ClassWizard will add and remove mapping macros here.
  73. ON_WM_DESTROY()
  74. ON_WM_NCDESTROY()
  75. //ON_WM_CLOSE()
  76. //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78. /////////////////////////////////////////////////////////////////////////////
  79. // COptionsSheet message handlers
  80. void COptionsSheet::OnDestroy()
  81. {
  82. CPropertySheet::OnDestroy();
  83. }
  84. void COptionsSheet::SetNotifyWnd(HWND hWnd)
  85. {
  86. m_hWndParent = hWnd;
  87. }
  88. BOOL COptionsSheet::OnInitDialog()
  89. {
  90. m_bModeless = FALSE;
  91. m_nFlags |= WF_CONTINUEMODAL;
  92. BOOL bResult = CPropertySheet::OnInitDialog();
  93. SetWindowText(_T("Ditto"));
  94. theApp.m_Language.UpdateOptionsSheet(this);
  95. ::ShowWindow(::GetDlgItem(m_hWnd, ID_APPLY_NOW), SW_HIDE);
  96. m_bModeless = TRUE;
  97. m_nFlags &= ~WF_CONTINUEMODAL;
  98. return bResult;
  99. }
  100. void COptionsSheet::OnNcDestroy()
  101. {
  102. CPropertySheet::OnNcDestroy();
  103. ::PostMessage(m_hWndParent, WM_OPTIONS_CLOSED, 0, 0);
  104. }