home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / activex / inetsdk / samples / urlpad / ipframe.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  2.8 KB  |  110 lines

  1. //=------------------------------------------------------------------------=
  2. // IPFrame.Cpp
  3. //=------------------------------------------------------------------------=
  4. // Copyright 1992-1996 Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // implementation of the CInPlaceFrame class
  13. //
  14.  
  15. #include "stdafx.h"
  16. #include "superpad.h"
  17. #include "ipframe.h"
  18.  
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CInPlaceFrame
  26.  
  27. IMPLEMENT_DYNCREATE(CInPlaceFrame, COleIPFrameWnd)
  28.  
  29. BEGIN_MESSAGE_MAP(CInPlaceFrame, COleIPFrameWnd)
  30.     //{{AFX_MSG_MAP(CInPlaceFrame)
  31.     ON_WM_CREATE()
  32.     //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // arrays of IDs used to initialize control bars
  37.  
  38. // toolbar buttons - IDs are command buttons
  39. static UINT BASED_CODE buttons[] =
  40. {
  41.     // same order as in the bitmap 'toolbar.bmp'
  42.     ID_EDIT_CUT,
  43.     ID_EDIT_COPY,
  44.     ID_EDIT_PASTE,
  45.         ID_SEPARATOR,
  46.     ID_APP_ABOUT,
  47. };
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CInPlaceFrame construction/destruction
  51.  
  52. CInPlaceFrame::CInPlaceFrame()
  53. {
  54. }
  55.  
  56. CInPlaceFrame::~CInPlaceFrame()
  57. {
  58. }
  59.  
  60. int CInPlaceFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  61. {
  62.     if (COleIPFrameWnd::OnCreate(lpCreateStruct) == -1)
  63.         return -1;
  64.  
  65.     if (!m_wndResizeBar.Create(this))
  66.     {
  67.         TRACE0("Failed to create resize bar\n");
  68.         return -1;      // fail to create
  69.     }
  70.     return 0;
  71. }
  72.  
  73. // OnCreateControlBars is called by the framework to create control
  74. //  bars on the client applications windows.
  75. BOOL CInPlaceFrame::OnCreateControlBars(CWnd* pWndFrame, CWnd* /*pWndDoc*/)
  76. {
  77.     // create toolbar on client's frame window
  78.     if (!m_wndToolBar.Create(pWndFrame) ||
  79.         !m_wndToolBar.LoadBitmap(IDR_TEXTTYPE_INPLACE) ||
  80.         !m_wndToolBar.SetButtons(buttons,
  81.           sizeof(buttons)/sizeof(UINT)))
  82.     {
  83.         TRACE0("Failed to create toolbar\n");
  84.         return FALSE;
  85.     }
  86.  
  87.     // set owner to this window, so messages are delivered to correct app
  88.     m_wndToolBar.SetOwner(this);
  89.     return TRUE;
  90. }
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CInPlaceFrame diagnostics
  94.  
  95. #ifdef _DEBUG
  96. void CInPlaceFrame::AssertValid() const
  97. {
  98.     COleIPFrameWnd::AssertValid();
  99. }
  100.  
  101. void CInPlaceFrame::Dump(CDumpContext& dc) const
  102. {
  103.     COleIPFrameWnd::Dump(dc);
  104. }
  105.  
  106. #endif //_DEBUG
  107.  
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CInPlaceFrame commands
  110.