Team Fortress 2 Source Code as on 22/4/2020
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.

183 lines
4.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // AllControlsSheet.cpp : implementation file
  9. //
  10. // This is a part of the Microsoft Foundation Classes C++ library.
  11. // Copyright (C) 1992-1998 Microsoft Corporation
  12. // All rights reserved.
  13. //
  14. // This source code is only intended as a supplement to the
  15. // Microsoft Foundation Classes Reference and related
  16. // electronic documentation provided with the library.
  17. // See these sources for detailed information regarding the
  18. // Microsoft Foundation Classes product.
  19. #include "stdafx.h"
  20. //#include "CmnCtrl2.h"
  21. #include "propsht.h"
  22. //#include "progctrl.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. class CAboutDlg : public CPropertyPage
  29. {
  30. public:
  31. CAboutDlg();
  32. // Dialog Data
  33. //{{AFX_DATA(CAboutDlg)
  34. enum { IDD = IDD_ABOUTBOX };
  35. //}}AFX_DATA
  36. // ClassWizard generated virtual function overrides
  37. //{{AFX_VIRTUAL(CAboutDlg)
  38. protected:
  39. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  40. //}}AFX_VIRTUAL
  41. // Implementation
  42. protected:
  43. //{{AFX_MSG(CAboutDlg)
  44. //}}AFX_MSG
  45. DECLARE_MESSAGE_MAP()
  46. };
  47. CAboutDlg::CAboutDlg() : CPropertyPage(CAboutDlg::IDD)
  48. {
  49. //{{AFX_DATA_INIT(CAboutDlg)
  50. //}}AFX_DATA_INIT
  51. m_psp.dwFlags &= ~PSP_HASHELP;
  52. }
  53. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  54. {
  55. CDialog::DoDataExchange(pDX);
  56. //{{AFX_DATA_MAP(CAboutDlg)
  57. //}}AFX_DATA_MAP
  58. }
  59. BEGIN_MESSAGE_MAP(CAboutDlg, CPropertyPage)
  60. //{{AFX_MSG_MAP(CAboutDlg)
  61. // No message handlers
  62. //}}AFX_MSG_MAP
  63. END_MESSAGE_MAP()
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CAllControlsSheet
  66. IMPLEMENT_DYNAMIC(CAllControlsSheet, CPropertySheet)
  67. CAllControlsSheet::CAllControlsSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
  68. :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  69. {
  70. AddControlPages();
  71. //CButton* okbut=(CButton*)this->GetDlgItem(IDC_OK);
  72. // TODO :: Add the pages for the rest of the controls here.
  73. }
  74. CAllControlsSheet::CAllControlsSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  75. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  76. {
  77. AddControlPages();
  78. //CButton* okbut=(CButton*)this->GetDlgItem(IDC_OK);
  79. }
  80. CAllControlsSheet::~CAllControlsSheet()
  81. {
  82. }
  83. void CAllControlsSheet::AddControlPages()
  84. {
  85. m_psh.dwFlags|=PSH_NOAPPLYNOW;
  86. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  87. m_psh.dwFlags |= PSH_USEHICON;
  88. m_psh.dwFlags &= ~PSH_HASHELP; // Lose the Help button
  89. //m_psh.dwFlags |= PSH_WIZARD;
  90. m_psh.hIcon = m_hIcon;
  91. AddPage(&m_LogPage);
  92. AddPage(&m_SwitchPage);
  93. AddPage(&m_FolderPage);
  94. AddPage(new CAboutDlg);
  95. }
  96. BEGIN_MESSAGE_MAP(CAllControlsSheet, CPropertySheet)
  97. //{{AFX_MSG_MAP(CAllControlsSheet)
  98. ON_WM_QUERYDRAGICON()
  99. ON_WM_SYSCOMMAND()
  100. //}}AFX_MSG_MAP
  101. END_MESSAGE_MAP()
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CAllControlsSheet message handlers
  104. BOOL CAllControlsSheet::OnInitDialog()
  105. {
  106. // Add "About..." menu item to system menu.
  107. // IDM_ABOUTBOX must be in the system command range.
  108. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  109. ASSERT(IDM_ABOUTBOX < 0xF000);
  110. CMenu* pSysMenu = GetSystemMenu(FALSE);
  111. if (pSysMenu != NULL)
  112. {
  113. CString strAboutMenu;
  114. strAboutMenu.LoadString(IDS_ABOUTBOX);
  115. if (!strAboutMenu.IsEmpty())
  116. {
  117. pSysMenu->AppendMenu(MF_SEPARATOR);
  118. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  119. }
  120. }
  121. SetIcon(m_hIcon, TRUE);
  122. SetIcon(m_hIcon, FALSE);
  123. BOOL result= CPropertySheet::OnInitDialog();
  124. this->SetActivePage(1);
  125. this->SetActivePage(2);
  126. this->SetActivePage(3);
  127. this->SetActivePage(0);
  128. return result;
  129. }
  130. HCURSOR CAllControlsSheet::OnQueryDragIcon()
  131. {
  132. return (HCURSOR) m_hIcon;
  133. }
  134. BOOL CAllControlsSheet::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
  135. {
  136. //removing the default DS_CONTEXT_HELP style
  137. // dwStyle= WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | WS_VISIBLE;
  138. return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
  139. }
  140. void CAllControlsSheet::OnSysCommand(UINT nID, LPARAM lParam)
  141. {
  142. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  143. {
  144. CAboutDlg dlgAbout;
  145. dlgAbout.DoModal();
  146. }
  147. else
  148. {
  149. CPropertySheet::OnSysCommand(nID, lParam);
  150. }
  151. }