?? childfrm.cpp
字號:
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "ResourceEditor.h"
#include "ChildFrm.h"
#include "CoolBar.h"
#include "OutputView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
ON_WM_CLOSE()
ON_WM_CREATE()
ON_WM_MDIACTIVATE()
ON_COMMAND(ID_VIEW_OUT_BAR, OnViewOutBar)
ON_UPDATE_COMMAND_UI(ID_VIEW_OUT_BAR, OnUpdateViewOutBar)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_SHOW_OUTBAR, OnShowOutBar)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
m_ResType = MMI_RT_MAX_NUM;
m_pOutBar = NULL;
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
//*@Hongliang Xin 2006-5-31
//Begin
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
|WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
|WS_MAXIMIZE;
//End //xe*/
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
//g_theApp.SetChildFrame(m_ResType, NULL);
CMDIChildWnd::OnClose();
}
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
g_theApp.SetChildFrame(m_ResType, this);
CRuntimeClass * prtc = RUNTIME_CLASS( CCoolBar );
m_pOutBar = ( CCoolBar * )prtc->CreateObject();
if( NULL == m_pOutBar )
{
TRACE0("Failed to create categorybar object\n");
return -1;
}
int nWidth = lpCreateStruct->cx / 3;
m_pOutBar->m_bAutoDelete = TRUE;
if (!m_pOutBar->Create(_T("Output Bar"), this, CSize(nWidth, 120), 0, TRUE))
{
TRACE0("Failed to create category bar\n");
return -1;
}
HINSTANCE hInstance = AfxGetApp()->m_hInstance;
HCURSOR hHorz = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CUR_HORZ));
HCURSOR hVert = LoadCursor(hInstance, MAKEINTRESOURCE(IDC_CUR_VERT));
m_pOutBar->SetStretchCursor( hHorz, hVert );
LPMDICREATESTRUCT lpmcs = (LPMDICREATESTRUCT)(lpCreateStruct->lpCreateParams);
CCreateContext * pContext = (CCreateContext*)(lpmcs->lParam);
if( !m_pOutBar->AddPage(RUNTIME_CLASS(COutputView), pContext) )
{
TRACE0("Failed to create category view\n");
return -1;
}
m_pOutBar->SetBarStyle( CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC );
m_pOutBar->EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(m_pOutBar, AFX_IDW_DOCKBAR_RIGHT);
ShowControlBar(m_pOutBar, FALSE, TRUE);
return 0;
}
void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
// TODO: Add your message handler code here
if( pActivateWnd == this )
{
g_theApp.SetActiveFrame( m_ResType );
}
else if( NULL == pActivateWnd )
{
g_theApp.SetActiveFrame( MMI_RT_MAX_NUM );
}
}
void CChildFrame::PostNcDestroy()
{
// TODO: Add your specialized code here and/or call the base class
g_theApp.SetChildFrame(m_ResType, NULL);
CMDIChildWnd::PostNcDestroy();
}
void CChildFrame::OnViewOutBar()
{
// TODO: Add your command handler code here
_ASSERTE( m_pOutBar != NULL );
ShowControlBar(m_pOutBar, !(m_pOutBar->GetStyle() & WS_VISIBLE), TRUE);
}
void CChildFrame::OnUpdateViewOutBar(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
pCmdUI->SetCheck(m_pOutBar->GetStyle() & WS_VISIBLE);
}
LRESULT CChildFrame::OnShowOutBar( WPARAM wParam, LPARAM lParam )
{
if( m_pOutBar != NULL )
{
ShowControlBar(m_pOutBar, wParam, TRUE);
}
return 0L;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -