home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / SCRIB7.PAK / IPFRAME.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  3.7 KB  |  127 lines

  1. // IpFrame.cpp : implementation of the CInPlaceFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "Scribble.h"
  15.  
  16. #include "IpFrame.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CInPlaceFrame
  25.  
  26. IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
  27.  
  28. BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
  29.     //{{AFX_MSG_MAP(CInPlaceFrame)
  30.     ON_WM_CREATE()
  31.     //}}AFX_MSG_MAP
  32.     // Global help commands
  33.     ON_COMMAND(ID_HELP_FINDER, COleIPFrameWnd::OnHelpFinder)
  34.     ON_COMMAND(ID_HELP, COleIPFrameWnd::OnHelp)
  35.     ON_COMMAND(ID_DEFAULT_HELP, COleIPFrameWnd::OnHelpFinder)
  36.     ON_COMMAND(ID_CONTEXT_HELP, COleIPFrameWnd::OnContextHelp)
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CInPlaceFrame construction/destruction
  41.  
  42. CInPlaceFrame::CInPlaceFrame()
  43. {
  44. }
  45.  
  46. CInPlaceFrame::~CInPlaceFrame()
  47. {
  48. }
  49.  
  50. int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  51. {
  52.     if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
  53.         return -1;
  54.  
  55.     // CResizeBar implements in-place resizing.
  56.     if (!m_wndResizeBar.Create(this))
  57.     {
  58.         TRACE0("Failed to create resize bar\n");
  59.         return -1;      // fail to create
  60.     }
  61.  
  62.     // By default, it is a good idea to register a drop-target that does
  63.     //  nothing with your frame window.  This prevents drops from
  64.     //  "falling through" to a container that supports drag-drop.
  65.     m_dropTarget.Register(this);
  66.  
  67.     return 0;
  68. }
  69.  
  70. // OnCreateControlBars is called by the framework to create control bars on the
  71. //  container application's windows.  pWndFrame is the top level frame window of
  72. //  the container and is always non-NULL.  pWndDoc is the doc level frame window
  73. //  and will be NULL when the container is an SDI application.  A server
  74. //  application can place MFC control bars on either window.
  75. BOOL CInPlaceFrame::OnCreateControlBars(CFrameWnd* pWndFrame, CFrameWnd* pWndDoc)
  76. {
  77.     // Set owner to this window, so messages are delivered to correct app
  78.     m_wndToolBar.SetOwner(this);
  79.  
  80.     // Create toolbar on client's frame window
  81.     if (!m_wndToolBar.Create(pWndFrame) ||
  82.         !m_wndToolBar.LoadToolBar(IDR_SCRIBBTYPE_SRVR_IP))
  83.     {
  84.         TRACE0("Failed to create toolbar\n");
  85.         return FALSE;
  86.     }
  87.  
  88.     // TODO: Remove this if you don't want tool tips
  89.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  90.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  91.     
  92.     // TODO: Delete these three lines if you don't want the toolbar to
  93.     //  be dockable
  94.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  95.     pWndFrame->EnableDocking(CBRS_ALIGN_ANY);
  96.     pWndFrame->DockControlBar(&m_wndToolBar);
  97.  
  98.  
  99.     return TRUE;
  100. }
  101.  
  102. BOOL CInPlaceFrame::PreCreateWindow(CREATESTRUCT& cs)
  103. {
  104.     // TODO: Modify the Window class or styles here by modifying
  105.     //  the CREATESTRUCT cs
  106.  
  107.     return COleIPFrameWnd::PreCreateWindow(cs);
  108. }
  109.  
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CInPlaceFrame diagnostics
  112.  
  113. #ifdef _DEBUG
  114. void CInPlaceFrame::AssertValid() const
  115. {
  116.     COleIPFrameWnd::AssertValid();
  117. }
  118.  
  119. void CInPlaceFrame::Dump(CDumpContext& dc) const
  120. {
  121.     COleIPFrameWnd::Dump(dc);
  122. }
  123. #endif //_DEBUG
  124.  
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CInPlaceFrame commands
  127.