OptionsSheet.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #include "QuickPasteKeyboard.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. /////////////////////////////////////////////////////////////////////////////
  22. // COptionsSheet
  23. IMPLEMENT_DYNAMIC(COptionsSheet, CPropertySheet)
  24. COptionsSheet::COptionsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  25. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  26. {
  27. m_themeChanged = FALSE;
  28. m_pKeyBoardOptions = NULL;
  29. m_pGeneralOptions = NULL;
  30. //m_pQuickPasteOptions = NULL;
  31. m_pCopyBuffers = NULL;
  32. m_pStats = NULL;
  33. m_pTypes = NULL;
  34. m_pAbout = NULL;
  35. m_pFriends = NULL;
  36. m_pCopyBuffers = NULL;
  37. m_pQuickPasteShortCuts = NULL;
  38. m_pUtilites = NULL;
  39. m_hWndParent = NULL;
  40. EnableStackedTabs(TRUE);
  41. m_pGeneralOptions = new COptionsGeneral;
  42. m_pKeyBoardOptions = new COptionsKeyBoard;
  43. //m_pQuickPasteOptions = new COptionsQuickPaste;
  44. m_pQuickPasteShortCuts = new CQuickPasteKeyboard;
  45. m_pCopyBuffers = new COptionsCopyBuffers;
  46. m_pStats = new COptionsStats;
  47. m_pTypes = new COptionsTypes;
  48. m_pAbout = new CAbout;
  49. AddPage(m_pGeneralOptions);
  50. AddPage(m_pTypes);
  51. AddPage(m_pKeyBoardOptions);
  52. AddPage(m_pCopyBuffers);
  53. //AddPage(m_pQuickPasteOptions);
  54. AddPage(m_pQuickPasteShortCuts);
  55. if(g_Opt.GetAllowFriends())
  56. {
  57. m_pFriends = new COptionFriends;
  58. AddPage(m_pFriends);
  59. }
  60. AddPage(m_pStats);
  61. AddPage(m_pAbout);
  62. }
  63. COptionsSheet::~COptionsSheet()
  64. {
  65. delete m_pGeneralOptions;
  66. delete m_pKeyBoardOptions;
  67. //delete m_pQuickPasteOptions;
  68. delete m_pCopyBuffers;
  69. delete m_pStats;
  70. delete m_pTypes;
  71. delete m_pAbout;
  72. delete m_pFriends;
  73. delete m_pUtilites;
  74. delete m_pQuickPasteShortCuts;
  75. }
  76. BEGIN_MESSAGE_MAP(COptionsSheet, CPropertySheet)
  77. //{{AFX_MSG_MAP(COptionsSheet)
  78. // NOTE - the ClassWizard will add and remove mapping macros here.
  79. ON_WM_DESTROY()
  80. ON_WM_NCDESTROY()
  81. //ON_WM_CLOSE()
  82. //}}AFX_MSG_MAP
  83. END_MESSAGE_MAP()
  84. /////////////////////////////////////////////////////////////////////////////
  85. // COptionsSheet message handlers
  86. void COptionsSheet::OnDestroy()
  87. {
  88. CPropertySheet::OnDestroy();
  89. }
  90. void COptionsSheet::SetNotifyWnd(HWND hWnd)
  91. {
  92. m_hWndParent = hWnd;
  93. }
  94. BOOL COptionsSheet::OnInitDialog()
  95. {
  96. m_bModeless = FALSE;
  97. m_nFlags |= WF_CONTINUEMODAL;
  98. HICON b = (HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 64, 64, LR_SHARED);
  99. SetIcon(b, TRUE);
  100. BOOL bResult = CPropertySheet::OnInitDialog();
  101. SetWindowText(_T("Options"));
  102. theApp.m_Language.UpdateOptionsSheet(this);
  103. ::ShowWindow(::GetDlgItem(m_hWnd, ID_APPLY_NOW), SW_HIDE);
  104. m_bModeless = TRUE;
  105. m_nFlags &= ~WF_CONTINUEMODAL;
  106. return bResult;
  107. }
  108. void COptionsSheet::OnNcDestroy()
  109. {
  110. CPropertySheet::OnNcDestroy();
  111. ::PostMessage(m_hWndParent, WM_OPTIONS_CLOSED, m_themeChanged, 0);
  112. }