home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-18  |  3.3 KB  |  146 lines

  1. // This code and information is provided "as is" without warranty of
  2. // any kind, either expressed or implied, including but not limited to
  3. // the implied warranties of merchantability and/or fitness for a
  4. // particular purpose.
  5.  
  6. // Copyright (C) 1996 Intel corporation.  All rights reserved.
  7.  
  8. // mainfrm.cpp : implementation of the CMainFrame class
  9. //
  10.  
  11. #include "stdafx.h"
  12. #include "IPlay.h"
  13. #include "IPlayDoc.h"
  14.  
  15. #include "mainfrm.h"
  16.  
  17. #ifdef _DEBUG
  18. #undef THIS_FILE
  19. static char BASED_CODE THIS_FILE[] = __FILE__;
  20. #endif
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CMainFrame
  24.  
  25. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  26.  
  27. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  28.     //{{AFX_MSG_MAP(CMainFrame)
  29.     ON_WM_CREATE()
  30.     ON_COMMAND(ID_MEDIA_INDEO, OnMediaIndeo)
  31.     ON_UPDATE_COMMAND_UI(ID_MEDIA_INDEO, OnUpdateMediaIndeo)
  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_FILE_OPEN,
  43.         ID_SEPARATOR,
  44.     ID_MEDIA_PLAY,
  45.     ID_MEDIA_PAUSE,
  46.     ID_MEDIA_STOP,
  47.         ID_SEPARATOR,
  48.     ID_MEDIA_LOOP,
  49.     ID_MEDIA_ZOOMX2,
  50.         ID_SEPARATOR,
  51.         ID_SEPARATOR,
  52.         ID_SEPARATOR,
  53.     ID_MEDIA_INDEO
  54. };
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CMainFrame construction/destruction
  58.  
  59. CMainFrame::CMainFrame()
  60. {
  61.     EnableDocking(CBRS_FLOAT_MULTI);
  62. }
  63.  
  64. CMainFrame::~CMainFrame()
  65. {
  66. }
  67.  
  68. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  69. {
  70.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  71.         return -1;
  72.     
  73.     if (!m_wndToolBar.Create(this) ||
  74.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  75.         !m_wndToolBar.SetButtons(buttons,
  76.           sizeof(buttons)/sizeof(UINT)))
  77.     {
  78.         TRACE0("Failed to create toolbar\n");
  79.         return -1;      // fail to create
  80.     }
  81.  
  82.     m_wndToolBar.SetSizes( CSize( 40, 40 ), CSize( 32, 32 ) );
  83.     m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);
  84.  
  85.     // Enable tool tips
  86.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
  87.         CBRS_TOOLTIPS | CBRS_FLYBY);
  88.  
  89.     // Position window in upper, left corner
  90.     SetWindowPos( NULL, 0, 0, 424, 96, SWP_NOZORDER );
  91.     m_bIndeo = FALSE;
  92.     return 0;
  93. }
  94.  
  95.  
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CMainFrame diagnostics
  99.  
  100. #ifdef _DEBUG
  101. void CMainFrame::AssertValid() const
  102. {
  103.     CFrameWnd::AssertValid();
  104. }
  105.  
  106. void CMainFrame::Dump(CDumpContext& dc) const
  107. {
  108.     CFrameWnd::Dump(dc);
  109. }
  110.  
  111. #endif //_DEBUG
  112.  
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CMainFrame message handlers
  115.  
  116.  
  117.  
  118. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
  119. {
  120.     // Set optimum size for view
  121.     cs.cx = 424;
  122.     cs.cy = 524;
  123.  
  124.     cs.style = WS_OVERLAPPED | WS_CAPTION | 
  125.                WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX;
  126.  
  127.     return CFrameWnd::PreCreateWindow(cs);
  128. }
  129.  
  130.  
  131. void CMainFrame::OnMediaIndeo() 
  132. {
  133.     m_bIndeo = !m_bIndeo;
  134.     if (m_bIndeo) 
  135.         SetWindowPos(NULL, 0, 0, 424, 524, SWP_NOMOVE | SWP_NOZORDER );
  136.     else
  137.         SetWindowPos(NULL, 0, 0, 424, 96, SWP_NOMOVE | SWP_NOZORDER );
  138.     
  139. }
  140.  
  141. void CMainFrame::OnUpdateMediaIndeo(CCmdUI* pCmdUI) 
  142. {
  143.     pCmdUI->SetCheck( m_bIndeo );
  144.     
  145. }
  146.