home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / WTJ9403.ZIP / OTEXT / IPFRAME.CPP < prev    next >
C/C++ Source or Header  |  1994-01-02  |  3KB  |  116 lines

  1. // ipframe.cpp : implementation of the CInPlaceFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "otext.h"
  6.  
  7. #include "ipframe.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CInPlaceFrame
  16.  
  17. IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
  20.     //{{AFX_MSG_MAP(CInPlaceFrame)
  21.     ON_WM_CREATE()
  22.     //}}AFX_MSG_MAP
  23.     // Global help commands
  24.     ON_COMMAND(ID_HELP_INDEX, COleIPFrameWnd::OnHelpIndex)
  25.     ON_COMMAND(ID_HELP_USING, COleIPFrameWnd::OnHelpUsing)
  26.     ON_COMMAND(ID_HELP, COleIPFrameWnd::OnHelp)
  27.     ON_COMMAND(ID_DEFAULT_HELP, COleIPFrameWnd::OnHelpIndex)
  28.     ON_COMMAND(ID_CONTEXT_HELP, COleIPFrameWnd::OnContextHelp)
  29. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // arrays of IDs used to initialize control bars
  33.  
  34. // toolbar buttons - IDs are command buttons
  35. static UINT BASED_CODE buttons[] =
  36. {
  37.     // same order as in the bitmap 'itoolbar.bmp'
  38.     ID_EDIT_CUT,
  39.     ID_EDIT_COPY,
  40.     ID_EDIT_PASTE,
  41.         ID_SEPARATOR,
  42.     ID_APP_ABOUT,
  43.     ID_CONTEXT_HELP,
  44. };
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CInPlaceFrame construction/destruction
  48.  
  49. CInPlaceFrame::CInPlaceFrame()
  50. {
  51. }
  52.  
  53. CInPlaceFrame::~CInPlaceFrame()
  54. {
  55. }
  56.  
  57. int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  58. {
  59.     if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
  60.         return -1;
  61.  
  62.     // CResizeBar implements in-place resizing.
  63.     if (!m_wndResizeBar.Create(this))
  64.     {
  65.         TRACE("Failed to create resize bar\n");
  66.         return -1;      // fail to create
  67.     }
  68.  
  69.     // By default, it is a good idea to register a drop-target that does
  70.     //  nothing with your frame window.  This prevents drops from
  71.     //  "falling through" to a container that supports drag-drop.
  72.     m_dropTarget.Register(this);
  73.  
  74.     return 0;
  75. }
  76.  
  77. // OnCreateControlBars is called by the framework to create control bars on the
  78. //  container application's windows.  pWndFrame is the top level frame window of
  79. //  the container and is always non-NULL.  pWndDoc is the doc level frame window
  80. //  and will be NULL when the container is an SDI application.  A server
  81. //  application can place MFC control bars on either window.
  82. BOOL CInPlaceFrame::OnCreateControlBars(CWnd* pWndFrame, CWnd* pWndDoc)
  83. {
  84.     // Create toolbar on client's frame window
  85.     if (!m_wndToolBar.Create(pWndFrame) ||
  86.         !m_wndToolBar.LoadBitmap(IDR_SRVR_INPLACE) ||
  87.         !m_wndToolBar.SetButtons(buttons, sizeof(buttons)/sizeof(UINT)))
  88.     {
  89.         TRACE("Failed to create toolbar\n");
  90.         return FALSE;
  91.     }
  92.     // Set owner to this window, so messages are delivered to correct app
  93.     m_wndToolBar.SetOwner(this);
  94.  
  95.     return TRUE;
  96. }
  97.  
  98. /////////////////////////////////////////////////////////////////////////////
  99. // CInPlaceFrame diagnostics
  100.  
  101. #ifdef _DEBUG
  102. void CInPlaceFrame::AssertValid() const
  103. {
  104.     COleIPFrameWnd::AssertValid();
  105. }
  106.  
  107. void CInPlaceFrame::Dump(CDumpContext& dc) const
  108. {
  109.     COleIPFrameWnd::Dump(dc);
  110. }
  111. #endif //_DEBUG
  112.  
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CInPlaceFrame commands
  115.  
  116.