[32] | 1 | // IpFrame.cpp : implementation of the CInPlaceFrame class
|
---|
| 2 | //
|
---|
| 3 |
|
---|
| 4 | #include "stdafx.h"
|
---|
| 5 | #include "TestProg.h"
|
---|
| 6 |
|
---|
| 7 | #include "IpFrame.h"
|
---|
| 8 |
|
---|
| 9 | #ifdef _DEBUG
|
---|
| 10 | #define new DEBUG_NEW
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | // CInPlaceFrame
|
---|
| 15 |
|
---|
| 16 | IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
|
---|
| 17 |
|
---|
| 18 | BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
|
---|
| 19 | ON_WM_CREATE()
|
---|
| 20 | END_MESSAGE_MAP()
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | // CInPlaceFrame construction/destruction
|
---|
| 24 |
|
---|
| 25 | CInPlaceFrame::CInPlaceFrame()
|
---|
| 26 | {
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | CInPlaceFrame::~CInPlaceFrame()
|
---|
| 30 | {
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
---|
| 34 | {
|
---|
| 35 | if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
|
---|
| 36 | return -1;
|
---|
| 37 |
|
---|
| 38 | // CResizeBar implements in-place resizing.
|
---|
| 39 | if (!m_wndResizeBar.Create(this))
|
---|
| 40 | {
|
---|
| 41 | TRACE0("Failed to create resize bar\n");
|
---|
| 42 | return -1; // fail to create
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | // By default, it is a good idea to register a drop-target that does
|
---|
| 46 | // nothing with your frame window. This prevents drops from
|
---|
| 47 | // "falling through" to a container that supports drag-drop.
|
---|
| 48 | m_dropTarget.Register(this);
|
---|
| 49 |
|
---|
| 50 | return 0;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | // OnCreateControlBars is called by the framework to create control bars on the
|
---|
| 54 | // container application's windows. pWndFrame is the top level frame window of
|
---|
| 55 | // the container and is always non-NULL. pWndDoc is the doc level frame window
|
---|
| 56 | // and will be NULL when the container is an SDI application. A server
|
---|
| 57 | // application can place MFC control bars on either window.
|
---|
| 58 | BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc)
|
---|
| 59 | {
|
---|
| 60 | // Remove this if you use pWndDoc
|
---|
| 61 | UNREFERENCED_PARAMETER(pWndDoc);
|
---|
| 62 |
|
---|
| 63 | // Set owner to this window, so messages are delivered to correct app
|
---|
| 64 | m_wndToolBar.SetOwner(this);
|
---|
| 65 |
|
---|
| 66 | // Create toolbar on client's frame window
|
---|
| 67 | if (!m_wndToolBar.CreateEx(pWndFrame, TBSTYLE_FLAT,WS_CHILD | WS_VISIBLE | CBRS_TOP
|
---|
| 68 | | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
---|
| 69 | !m_wndToolBar.LoadToolBar(IDR_TestProgTYPE_SRVR_IP))
|
---|
| 70 | {
|
---|
| 71 | TRACE0("Failed to create toolbar\n");
|
---|
| 72 | return FALSE;
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | // TODO: Delete these three lines if you don't want the toolbar to be dockable
|
---|
| 76 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
---|
| 77 | pWndFrame->EnableDocking(CBRS_ALIGN_ANY);
|
---|
| 78 | pWndFrame->DockControlBar(&m_wndToolBar);
|
---|
| 79 |
|
---|
| 80 | return TRUE;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | BOOL CInPlaceFrame::PreCreateWindow(CREATESTRUCT& cs)
|
---|
| 84 | {
|
---|
| 85 | // TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
|
---|
| 86 |
|
---|
| 87 | return COleIPFrameWnd::PreCreateWindow(cs);
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | // CInPlaceFrame diagnostics
|
---|
| 92 |
|
---|
| 93 | #ifdef _DEBUG
|
---|
| 94 | void CInPlaceFrame::AssertValid() const
|
---|
| 95 | {
|
---|
| 96 | COleIPFrameWnd::AssertValid();
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | void CInPlaceFrame::Dump(CDumpContext& dc) const
|
---|
| 100 | {
|
---|
| 101 | COleIPFrameWnd::Dump(dc);
|
---|
| 102 | }
|
---|
| 103 | #endif //_DEBUG
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | // CInPlaceFrame commands
|
---|