home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / FILE_LK.ZIP / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1993-12-18  |  2KB  |  112 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "filelook.h"
  6.  
  7. #include "mainfrm.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMainFrame
  16.  
  17. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  18.  
  19. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  20.     //{{AFX_MSG_MAP(CMainFrame)
  21.     ON_WM_CREATE()
  22.     //}}AFX_MSG_MAP
  23. END_MESSAGE_MAP()
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // arrays of IDs used to initialize control bars
  27.  
  28. // toolbar buttons - IDs are command buttons
  29. static UINT BASED_CODE buttons[] =
  30. {
  31.     // same order as in the bitmap 'toolbar.bmp'
  32.     ID_FILE_OPEN,
  33.     ID_FILE_CLOSE,
  34.     ID_APP_ABOUT,
  35.         ID_SEPARATOR,
  36.     ID_APP_EXIT,
  37. };
  38.  
  39. static UINT BASED_CODE indicators[] =
  40. {
  41.     ID_SEPARATOR,            // status line indicator
  42.     ID_INDICATOR_CAPS,
  43.     ID_INDICATOR_NUM,
  44.     ID_INDICATOR_SCRL,
  45.     ID_INDICATOR_ROW,
  46.     ID_INDICATOR_COLUMN,
  47.     ID_INDICATOR_FILESIZE
  48. };
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CMainFrame construction/destruction
  52.  
  53. CMainFrame::CMainFrame()
  54. {
  55.     // TODO: add member initialization code here
  56. }
  57.  
  58. CMainFrame::~CMainFrame()
  59. {
  60. }
  61.  
  62. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  63. {
  64.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  65.         return -1;
  66.  
  67.     if (!m_wndToolBar.Create(this) ||
  68.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  69.         !m_wndToolBar.SetButtons(buttons,
  70.           sizeof(buttons)/sizeof(UINT)))
  71.     {
  72.         TRACE("Failed to create toolbar\n");
  73.         return -1;        // fail to create
  74.     }
  75.  
  76.     if (!m_wndStatusBar.Create(this) ||
  77.         !m_wndStatusBar.SetIndicators(indicators,
  78.           sizeof(indicators)/sizeof(UINT)))
  79.     {
  80.         TRACE("Failed to create status bar\n");
  81.         return -1;        // fail to create
  82.     }
  83.     UINT nID, nStyle;
  84.     int cxWidth;
  85.     m_wndStatusBar.GetPaneInfo(PANE_IDX_ROW,nID,nStyle,cxWidth);
  86.     m_wndStatusBar.SetPaneInfo(PANE_IDX_ROW,nID,SBPS_NORMAL,cxWidth);
  87.  
  88.     return 0;
  89. }
  90.  
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CMainFrame diagnostics
  94.  
  95. #ifdef _DEBUG
  96. void CMainFrame::AssertValid() const
  97. {
  98.     CFrameWnd::AssertValid();
  99. }
  100.  
  101. void CMainFrame::Dump(CDumpContext& dc) const
  102. {
  103.     CFrameWnd::Dump(dc);
  104. }
  105.  
  106. #endif //_DEBUG
  107.  
  108. /////////////////////////////////////////////////////////////////////////////
  109. // CMainFrame message handlers
  110.  
  111.  
  112.