96 lines
2.8 KiB
C
96 lines
2.8 KiB
C
|
//------------------------------------------------------------------------
|
||
|
//
|
||
|
// File: shell\themes\test\ctlperf\Mainfrm.h
|
||
|
//
|
||
|
// Contents: Main frame window.
|
||
|
// This file was generated by the WTL wizard.
|
||
|
//
|
||
|
// Classes: CMainFrame
|
||
|
//
|
||
|
//------------------------------------------------------------------------
|
||
|
#pragma once
|
||
|
|
||
|
//-----------------------------------------------------------
|
||
|
//
|
||
|
// Class: CMainFrame
|
||
|
//
|
||
|
// Synopsis: Main application frame window.
|
||
|
//
|
||
|
//-----------------------------------------------------------
|
||
|
class CMainFrame
|
||
|
: public CFrameWindowImpl<CMainFrame> // Main base class
|
||
|
, public CUpdateUI<CMainFrame> // For enabling/disabling menus
|
||
|
{
|
||
|
public:
|
||
|
DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
|
||
|
|
||
|
BEGIN_MSG_MAP(CMainFrame)
|
||
|
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||
|
MESSAGE_HANDLER(WM_GETMINMAXINFO, OnGetMinMaxInfo)
|
||
|
COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit)
|
||
|
COMMAND_ID_HANDLER(ID_VIEW_STATUS_BAR, OnViewStatusBar)
|
||
|
COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
|
||
|
CHAIN_CLIENT_COMMANDS() // We're chaining WM_COMMAND to the view (in m_hWndClient)
|
||
|
CHAIN_MSG_MAP(CUpdateUI<CMainFrame>)
|
||
|
CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame>)
|
||
|
END_MSG_MAP()
|
||
|
|
||
|
BEGIN_UPDATE_UI_MAP(CMainFrame)
|
||
|
UPDATE_ELEMENT(ID_VIEW_STATUS_BAR, UPDUI_MENUPOPUP)
|
||
|
END_UPDATE_UI_MAP()
|
||
|
|
||
|
LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
|
||
|
{
|
||
|
CreateSimpleStatusBar();
|
||
|
|
||
|
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
|
||
|
|
||
|
if (m_view.IsWindow())
|
||
|
{
|
||
|
m_view.SetStatusBar(m_hWndStatusBar); // Communicate the status bar to the view
|
||
|
}
|
||
|
|
||
|
UISetCheck(ID_VIEW_STATUS_BAR, 1);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
LRESULT OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||
|
{
|
||
|
if (m_view.IsWindow())
|
||
|
{
|
||
|
return m_view.SendMessage(uMsg, wParam, lParam); // Forward to the view
|
||
|
}
|
||
|
|
||
|
bHandled = FALSE;
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
LRESULT OnFileExit(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||
|
{
|
||
|
PostMessage(WM_CLOSE);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
LRESULT OnViewStatusBar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||
|
{
|
||
|
BOOL bVisible = !::IsWindowVisible(m_hWndStatusBar);
|
||
|
|
||
|
::ShowWindow(m_hWndStatusBar, bVisible ? SW_SHOWNOACTIVATE : SW_HIDE);
|
||
|
UISetCheck(ID_VIEW_STATUS_BAR, bVisible);
|
||
|
UpdateLayout();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
LRESULT OnAppAbout(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
||
|
{
|
||
|
CAboutDlg dlg;
|
||
|
|
||
|
dlg.DoModal();
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
CCtlPerfView m_view;
|
||
|
};
|