ipframe.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:5k
- // [!output INPLACE_FRAME_IMPL] : implementation of the [!output INPLACE_FRAME_CLASS] class
- //
- #include "stdafx.h"
- #include "[!output APP_HEADER]"
- #include "[!output INPLACE_FRAME_HEADER]"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // [!output INPLACE_FRAME_CLASS]
- IMPLEMENT_DYNCREATE([!output INPLACE_FRAME_CLASS], [!output INPLACE_FRAME_BASE_CLASS])
- BEGIN_MESSAGE_MAP([!output INPLACE_FRAME_CLASS], [!output INPLACE_FRAME_BASE_CLASS])
- ON_WM_CREATE()
- [!if CONTEXT_HELP]
- // Global help commands
- ON_COMMAND(ID_HELP_FINDER, &[!output INPLACE_FRAME_BASE_CLASS]::OnHelpFinder)
- ON_COMMAND(ID_HELP, &[!output INPLACE_FRAME_BASE_CLASS]::OnHelp)
- ON_COMMAND(ID_DEFAULT_HELP, &[!output INPLACE_FRAME_BASE_CLASS]::OnHelpFinder)
- ON_COMMAND(ID_CONTEXT_HELP, &[!output INPLACE_FRAME_BASE_CLASS]::OnContextHelp)
- [!endif]
- END_MESSAGE_MAP()
- // [!output INPLACE_FRAME_CLASS] construction/destruction
- [!output INPLACE_FRAME_CLASS]::[!output INPLACE_FRAME_CLASS]()
- {
- [!if ACCESSIBILITY]
- EnableActiveAccessibility();
- [!endif]
- }
- [!output INPLACE_FRAME_CLASS]::~[!output INPLACE_FRAME_CLASS]()
- {
- }
- int [!output INPLACE_FRAME_CLASS]::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if ([!output INPLACE_FRAME_BASE_CLASS]::OnCreate(lpCreateStruct) == -1)
- return -1;
- // CResizeBar implements in-place resizing.
- if (!m_wndResizeBar.Create(this))
- {
- TRACE0("Failed to create resize barn");
- return -1; // fail to create
- }
- // By default, it is a good idea to register a drop-target that does
- // nothing with your frame window. This prevents drops from
- // "falling through" to a container that supports drag-drop.
- m_dropTarget.Register(this);
- return 0;
- }
- [!if DOCKING_TOOLBAR]
- // OnCreateControlBars is called by the framework to create control bars on the
- // container application's windows. pWndFrame is the top level frame window of
- // the container and is always non-NULL. pWndDoc is the doc level frame window
- // and will be NULL when the container is an SDI application. A server
- // application can place MFC control bars on either window.
- BOOL [!output INPLACE_FRAME_CLASS]::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc)
- {
- // Remove this if you use pWndDoc
- UNREFERENCED_PARAMETER(pWndDoc);
- // Set owner to this window, so messages are delivered to correct app
- m_wndToolBar.SetOwner(this);
- // Create toolbar on client's frame window
- [!if TOOLBAR_STYLE_REBAR]
- if (!m_wndToolBar.CreateEx(pWndFrame) ||
- [!else]
- if (!m_wndToolBar.CreateEx(pWndFrame, TBSTYLE_FLAT,WS_CHILD | WS_VISIBLE | CBRS_TOP
- | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
- [!endif]
- [!if APP_TYPE_MDI]
- !m_wndToolBar.LoadToolBar(IDR_[!output SAFE_DOC_TYPE_NAME]TYPE_SRVR_IP))
- [!else]
- !m_wndToolBar.LoadToolBar(IDR_SRVR_INPLACE))
- [!endif]
- {
- TRACE0("Failed to create toolbarn");
- return FALSE;
- }
- [!if TOOLBAR_STYLE_REBAR]
- // Set owner to this window, so messages are delivered to correct app
- m_wndDlgBar.SetOwner(this);
- // Create dialog bar on client's frame window
- [!if APP_TYPE_MDI]
- if (!m_wndDlgBar.Create(pWndFrame, IDR_[!output SAFE_DOC_TYPE_NAME]TYPE_SRVR_IP,
- [!else]
- if (!m_wndDlgBar.Create(pWndFrame, IDR_SRVR_INPLACE,
- [!endif]
- CBRS_ALIGN_TOP, AFX_IDW_DIALOGBAR))
- {
- TRACE0("Failed to create dialogbarn");
- return FALSE;
- }
- // Set the owner of this window, so messages are delivered to correct app
- m_wndReBar.SetOwner(this);
- // Create a rebar on client's frame window
- if (!m_wndReBar.Create(pWndFrame) ||
- !m_wndReBar.AddBar(&m_wndToolBar) ||
- !m_wndReBar.AddBar(&m_wndDlgBar))
- {
- TRACE0("Failed to create rebarn");
- return FALSE;
- }
- // TODO: Remove this if you don't want tool tips
- m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY);
- m_wndDlgBar.SetBarStyle(m_wndDlgBar.GetBarStyle() |
- CBRS_TOOLTIPS | CBRS_FLYBY);
- [!else]
- // TODO: Delete these three lines if you don't want the toolbar to be dockable
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- pWndFrame->EnableDocking(CBRS_ALIGN_ANY);
- pWndFrame->DockControlBar(&m_wndToolBar);
- [!endif]
- return TRUE;
- }
- [!endif]
- BOOL [!output INPLACE_FRAME_CLASS]::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
- return [!output INPLACE_FRAME_BASE_CLASS]::PreCreateWindow(cs);
- }
- // [!output INPLACE_FRAME_CLASS] diagnostics
- #ifdef _DEBUG
- void [!output INPLACE_FRAME_CLASS]::AssertValid() const
- {
- [!output INPLACE_FRAME_BASE_CLASS]::AssertValid();
- }
- void [!output INPLACE_FRAME_CLASS]::Dump(CDumpContext& dc) const
- {
- [!output INPLACE_FRAME_BASE_CLASS]::Dump(dc);
- }
- #endif //_DEBUG
- // [!output INPLACE_FRAME_CLASS] commands