home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / VFORM.ZIP / Samples / vfHex / MainFrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-10  |  3.9 KB  |  145 lines

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