home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / adpipeax / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-03  |  3.6 KB  |  138 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "VCsample.h"
  6.  
  7. #include "MainFrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMainFrame
  17.  
  18. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  21.     ON_COMMAND_EX(CG_ID_VIEW_MYDIALOGBAR, OnBarCheck)
  22.     ON_UPDATE_COMMAND_UI(CG_ID_VIEW_MYDIALOGBAR, OnUpdateControlBarMenu)
  23.     //{{AFX_MSG_MAP(CMainFrame)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code !
  26.     ON_WM_CREATE()
  27.     //}}AFX_MSG_MAP
  28. END_MESSAGE_MAP()
  29.  
  30. static UINT indicators[] =
  31. {
  32.     ID_SEPARATOR,           // status line indicator
  33.     ID_INDICATOR_CAPS,
  34.     ID_INDICATOR_NUM,
  35.     ID_INDICATOR_SCRL,
  36. };
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // CMainFrame construction/destruction
  40.  
  41. CMainFrame::CMainFrame()
  42. {
  43.     // TODO: add member initialization code here
  44.     
  45. }
  46.  
  47. CMainFrame::~CMainFrame()
  48. {
  49. }
  50.  
  51. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  52. {
  53.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  54.         return -1;
  55.     
  56.     if (!m_wndToolBar.Create(this) ||
  57.         !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
  58.     {
  59.         TRACE0("Failed to create toolbar\n");
  60.         return -1;      // fail to create
  61.     }
  62.  
  63.     if (!m_wndStatusBar.Create(this) ||
  64.         !m_wndStatusBar.SetIndicators(indicators,
  65.           sizeof(indicators)/sizeof(UINT)))
  66.     {
  67.         TRACE0("Failed to create status bar\n");
  68.         return -1;      // fail to create
  69.     }
  70.  
  71.     // TODO: Remove this if you don't want tool tips or a resizeable toolbar
  72.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  73.         CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
  74.  
  75.     // TODO: Delete these three lines if you don't want the toolbar to
  76.     //  be dockable
  77.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  78.     EnableDocking(CBRS_ALIGN_ANY);
  79.     DockControlBar(&m_wndToolBar);
  80.  
  81.     // TODO: Add a menu item that will toggle the visibility of the
  82.     // dialog bar named "My Dialog Bar":
  83.     //   1. In ResourceView, open the menu resource that is used by
  84.     //      the CMainFrame class
  85.     //   2. Select the View submenu
  86.     //   3. Double-click on the blank item at the bottom of the submenu
  87.     //   4. Assign the new item an ID: CG_ID_VIEW_MYDIALOGBAR
  88.     //   5. Assign the item a Caption: My Dialog Bar
  89.  
  90.     // TODO: Change the value of CG_ID_VIEW_MYDIALOGBAR to an appropriate value:
  91.     //   1. Open the file resource.h
  92.     // CG: The following block was inserted by the 'Dialog Bar' component
  93.     {
  94.         // Initialize dialog bar m_wndMyDialogBar
  95.         if (!m_wndMyDialogBar.Create(this, CG_IDD_MYDIALOGBAR,
  96.             CBRS_BOTTOM | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_HIDE_INPLACE,
  97.             CG_ID_VIEW_MYDIALOGBAR))
  98.         {
  99.             TRACE0("Failed to create dialog bar m_wndMyDialogBar\n");
  100.             return -1;        // fail to create
  101.         }
  102.  
  103.         m_wndMyDialogBar.EnableDocking(CBRS_ALIGN_BOTTOM | CBRS_ALIGN_TOP);
  104.         EnableDocking(CBRS_ALIGN_ANY);
  105.         DockControlBar(&m_wndMyDialogBar);
  106.  
  107.     }
  108.  
  109.     return 0;
  110. }
  111.  
  112. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  113. {
  114.     // TODO: Modify the Window class or styles here by modifying
  115.     //  the CREATESTRUCT cs
  116.  
  117.     return CMDIFrameWnd::PreCreateWindow(cs);
  118. }
  119.  
  120. /////////////////////////////////////////////////////////////////////////////
  121. // CMainFrame diagnostics
  122.  
  123. #ifdef _DEBUG
  124. void CMainFrame::AssertValid() const
  125. {
  126.     CMDIFrameWnd::AssertValid();
  127. }
  128.  
  129. void CMainFrame::Dump(CDumpContext& dc) const
  130. {
  131.     CMDIFrameWnd::Dump(dc);
  132. }
  133.  
  134. #endif //_DEBUG
  135.  
  136. /////////////////////////////////////////////////////////////////////////////
  137. // CMainFrame message handlers
  138.