Source code of Windows XP (NT5)
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.

95 lines
2.8 KiB

  1. //------------------------------------------------------------------------
  2. //
  3. // File: shell\themes\test\ctlperf\Mainfrm.h
  4. //
  5. // Contents: Main frame window.
  6. // This file was generated by the WTL wizard.
  7. //
  8. // Classes: CMainFrame
  9. //
  10. //------------------------------------------------------------------------
  11. #pragma once
  12. //-----------------------------------------------------------
  13. //
  14. // Class: CMainFrame
  15. //
  16. // Synopsis: Main application frame window.
  17. //
  18. //-----------------------------------------------------------
  19. class CMainFrame
  20. : public CFrameWindowImpl<CMainFrame> // Main base class
  21. , public CUpdateUI<CMainFrame> // For enabling/disabling menus
  22. {
  23. public:
  24. DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
  25. BEGIN_MSG_MAP(CMainFrame)
  26. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  27. MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
  28. COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
  29. COMMAND_ID_HANDLER(ID_VIEW_STATUS_BAR, OnViewStatusBar)
  30. COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
  31. CHAIN_CLIENT_COMMANDS() // We're chaining WM_COMMAND to the view (in m_hWndClient)
  32. CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
  33. CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
  34. END_MSG_MAP()
  35. BEGIN_UPDATE_UI_MAP(CMainFrame)
  36. UPDATE_ELEMENT(ID_VIEW_STATUS_BAR, UPDUI_MENUPOPUP)
  37. END_UPDATE_UI_MAP()
  38. LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  39. {
  40. CreateSimpleStatusBar();
  41. m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
  42. if (m_view.IsWindow())
  43. {
  44. m_view.SetStatusBar(m_hWndStatusBar); // Communicate the status bar to the view
  45. }
  46. UISetCheck(ID_VIEW_STATUS_BAR, 1);
  47. return 0;
  48. }
  49. LRESULT OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  50. {
  51. if (m_view.IsWindow())
  52. {
  53. return m_view.SendMessage(uMsg, wParam, lParam); // Forward to the view
  54. }
  55. bHandled = FALSE;
  56. return 1;
  57. }
  58. LRESULT OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  59. {
  60. PostMessage(WM_CLOSE);
  61. return 0;
  62. }
  63. LRESULT OnViewStatusBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  64. {
  65. BOOL bVisible = !::IsWindowVisible(m_hWndStatusBar);
  66. ::ShowWindow(m_hWndStatusBar, bVisible ? SW_SHOWNOACTIVATE : SW_HIDE);
  67. UISetCheck(ID_VIEW_STATUS_BAR, bVisible);
  68. UpdateLayout();
  69. return 0;
  70. }
  71. LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  72. {
  73. CAboutDlg dlg;
  74. dlg.DoModal();
  75. return 0;
  76. }
  77. private:
  78. CCtlPerfView m_view;
  79. };