| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | // IpFrame.cpp : implementation of the CInPlaceFrame class |
| 20 | // |
| 21 | |
| 22 | #include "stdafx.h" |
| 23 | #include "editor.h" |
| 24 | |
| 25 | #include "IpFrame.h" |
| 26 | |
| 27 | #ifdef _DEBUG |
| 28 | #define new DEBUG_NEW |
| 29 | #undef THIS_FILE |
| 30 | static char THIS_FILE[] = __FILE__; |
| 31 | #endif |
| 32 | |
| 33 | ///////////////////////////////////////////////////////////////////////////// |
| 34 | // CInPlaceFrame |
| 35 | |
| 36 | IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd) |
| 37 | |
| 38 | BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd) |
| 39 | //{{AFX_MSG_MAP(CInPlaceFrame) |
| 40 | ON_WM_CREATE() |
| 41 | //}}AFX_MSG_MAP |
| 42 | END_MESSAGE_MAP() |
| 43 | |
| 44 | ///////////////////////////////////////////////////////////////////////////// |
| 45 | // CInPlaceFrame construction/destruction |
| 46 | |
| 47 | CInPlaceFrame::CInPlaceFrame() {} |
| 48 | |
| 49 | CInPlaceFrame::~CInPlaceFrame() {} |
| 50 | |
| 51 | int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { |
| 52 | if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1) |
| 53 | return -1; |
| 54 | |
| 55 | // CResizeBar implements in-place resizing. |
| 56 | if (!m_wndResizeBar.Create(this)) { |
| 57 | TRACE0("Failed to create resize bar\n"); |
| 58 | return -1; // fail to create |
| 59 | } |
| 60 | |
| 61 | // By default, it is a good idea to register a drop-target that does |
| 62 | // nothing with your frame window. This prevents drops from |
| 63 | // "falling through" to a container that supports drag-drop. |
| 64 | m_dropTarget.Register(this); |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | // OnCreateControlBars is called by the framework to create control bars on the |
| 70 | // container application's windows. pWndFrame is the top level frame window of |
| 71 | // the container and is always non-NULL. pWndDoc is the doc level frame window |
| 72 | // and will be NULL when the container is an SDI application. A server |
| 73 | // application can place MFC control bars on either window. |
| 74 | BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd *pWndFrame, CFrameWnd *pWndDoc) { |
| 75 | // Remove this if you use pWndDoc |
| 76 | UNREFERENCED_PARAMETER(pWndDoc); |
| 77 | |
| 78 | // Set owner to this window, so messages are delivered to correct app |
| 79 | m_wndToolBar.SetOwner(this); |
| 80 | |
| 81 | // Create toolbar on client's frame window |
| 82 | if (!m_wndToolBar.Create(pWndFrame) || !m_wndToolBar.LoadToolBar(IDR_SRVR_INPLACE)) { |
| 83 | TRACE0("Failed to create toolbar\n"); |
| 84 | return FALSE; |
| 85 | } |
| 86 | |
| 87 | // TODO: Remove this if you don't want tool tips or a resizeable toolbar |
| 88 | m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); |
| 89 | |
| 90 | // TODO: Delete these three lines if you don't want the toolbar to |
| 91 | // be dockable |
| 92 | m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); |
| 93 | pWndFrame->EnableDocking(CBRS_ALIGN_ANY); |
| 94 | pWndFrame->DockControlBar(&m_wndToolBar); |
| 95 | |
| 96 | return TRUE; |
| 97 | } |
| 98 | |
| 99 | BOOL CInPlaceFrame::PreCreateWindow(CREATESTRUCT &cs) { |
| 100 | // TODO: Modify the Window class or styles here by modifying |
| 101 | // the CREATESTRUCT cs |
| 102 | |
| 103 | return COleIPFrameWnd::PreCreateWindow(cs); |
| 104 | } |
| 105 | |
| 106 | ///////////////////////////////////////////////////////////////////////////// |
| 107 | // CInPlaceFrame diagnostics |
| 108 | |
| 109 | #ifdef _DEBUG |
| 110 | void CInPlaceFrame::AssertValid() const { COleIPFrameWnd::AssertValid(); } |
| 111 | |
| 112 | void CInPlaceFrame::Dump(CDumpContext &dc) const { COleIPFrameWnd::Dump(dc); } |
| 113 | #endif //_DEBUG |
| 114 | |
| 115 | ///////////////////////////////////////////////////////////////////////////// |
| 116 | // CInPlaceFrame commands |