home *** CD-ROM | disk | FTP | other *** search
/ Mastering Microsoft Visual C++ 4 (2nd Edition) / VisualC4.ISO / minidrw5 / mainfrm.cpp next >
Encoding:
C/C++ Source or Header  |  1995-09-30  |  2.6 KB  |  112 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MiniDraw.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_DYNCREATE(CMainFrame, CFrameWnd)
  19.  
  20. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  21.    //{{AFX_MSG_MAP(CMainFrame)
  22.    ON_WM_CREATE()
  23.    //}}AFX_MSG_MAP
  24. END_MESSAGE_MAP()
  25.  
  26. // IDs for status bar indicators:
  27. static UINT IndicatorIDs [] =
  28.    {
  29.    ID_SEPARATOR,    
  30.    ID_INDICATOR_CAPS,
  31.    ID_INDICATOR_NUM,
  32.    ID_INDICATOR_SCRL,
  33.    };   
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CMainFrame construction/destruction
  37.  
  38. CMainFrame::CMainFrame()
  39. {
  40.    // TODO: add member initialization code here
  41.    
  42. }
  43.  
  44. CMainFrame::~CMainFrame()
  45. {
  46. }
  47.  
  48. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  49. {
  50.    // TODO: Modify the Window class or styles here by modifying
  51.    //  the CREATESTRUCT cs
  52.  
  53.    return CFrameWnd::PreCreateWindow(cs);
  54. }
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CMainFrame diagnostics
  58.  
  59. #ifdef _DEBUG
  60. void CMainFrame::AssertValid() const
  61. {
  62.    CFrameWnd::AssertValid();
  63. }
  64.  
  65. void CMainFrame::Dump(CDumpContext& dc) const
  66. {
  67.    CFrameWnd::Dump(dc);
  68. }
  69.  
  70. #endif //_DEBUG
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73. // CMainFrame message handlers
  74.  
  75. BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
  76. {
  77.    // TODO: Add your specialized code here and/or call the base class
  78.    
  79.    return m_SplitterWnd.Create
  80.       (this,           // parent of splitter window
  81.       1,               // maximum rows      
  82.       2,               // maximum columns
  83.       CSize (15, 15),  // minimum view window size
  84.       pContext);       // pass on context information
  85. }
  86.  
  87. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  88. {
  89.    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  90.       return -1;
  91.    
  92.    // TODO: Add your specialized creation code here
  93.    
  94.    if (!m_ToolBar.Create (this) ||
  95.       !m_ToolBar.LoadToolBar(IDR_MAINFRAME))
  96.       return -1;
  97.  
  98.    m_ToolBar.EnableDocking (CBRS_ALIGN_ANY);
  99.    EnableDocking (CBRS_ALIGN_ANY);
  100.    DockControlBar (&m_ToolBar);
  101.  
  102.    m_ToolBar.SetBarStyle (m_ToolBar.GetBarStyle() |
  103.       CBRS_TOOLTIPS | CBRS_FLYBY);
  104.  
  105.    if (!m_StatusBar.Create (this) ||
  106.       !m_StatusBar.SetIndicators (IndicatorIDs, 
  107.       sizeof (IndicatorIDs) / sizeof (UINT)))
  108.       return -1;
  109.  
  110.    return 0;
  111. }
  112.