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.

132 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // MainFrm.cpp : implementation of the CMainFrame class
  9. //
  10. #include "stdafx.h"
  11. #include "vkeyedit.h"
  12. #include "vkeyeditView.h"
  13. #include "Vkeylistview.h"
  14. #include "MainFrm.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMainFrame
  22. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  23. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  24. //{{AFX_MSG_MAP(CMainFrame)
  25. // NOTE - the ClassWizard will add and remove mapping macros here.
  26. // DO NOT EDIT what you see in these blocks of generated code !
  27. ON_WM_CREATE()
  28. //}}AFX_MSG_MAP
  29. END_MESSAGE_MAP()
  30. static UINT indicators[] =
  31. {
  32. ID_SEPARATOR, // status line indicator
  33. ID_INDICATOR_CAPS,
  34. ID_INDICATOR_NUM,
  35. ID_INDICATOR_SCRL,
  36. };
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CMainFrame construction/destruction
  39. CMainFrame::CMainFrame()
  40. {
  41. // TODO: add member initialization code here
  42. }
  43. CMainFrame::~CMainFrame()
  44. {
  45. }
  46. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  47. {
  48. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  49. return -1;
  50. if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
  51. | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
  52. !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  53. {
  54. TRACE0("Failed to create toolbar\n");
  55. return -1; // fail to create
  56. }
  57. if (!m_wndStatusBar.Create(this) ||
  58. !m_wndStatusBar.SetIndicators(indicators,
  59. sizeof(indicators)/sizeof(UINT)))
  60. {
  61. TRACE0("Failed to create status bar\n");
  62. return -1; // fail to create
  63. }
  64. // TODO: Delete these three lines if you don't want the toolbar to
  65. // be dockable
  66. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  67. EnableDocking(CBRS_ALIGN_ANY);
  68. DockControlBar(&m_wndToolBar);
  69. return 0;
  70. }
  71. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  72. {
  73. if( !CFrameWnd::PreCreateWindow(cs) )
  74. return FALSE;
  75. // TODO: Modify the Window class or styles here by modifying
  76. // the CREATESTRUCT cs
  77. return TRUE;
  78. }
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMainFrame diagnostics
  81. #ifdef _DEBUG
  82. void CMainFrame::AssertValid() const
  83. {
  84. CFrameWnd::AssertValid();
  85. }
  86. void CMainFrame::Dump(CDumpContext& dc) const
  87. {
  88. CFrameWnd::Dump(dc);
  89. }
  90. #endif //_DEBUG
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMainFrame message handlers
  93. BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
  94. {
  95. // create splitter window
  96. if (!m_wndSplitter.CreateStatic(this, 1, 2))
  97. return FALSE;
  98. if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CVkeyeditView), CSize(100, 100), pContext) ||
  99. !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CVkeylistview), CSize(100, 100), pContext))
  100. {
  101. m_wndSplitter.DestroyWindow();
  102. return FALSE;
  103. }
  104. return TRUE;
  105. }