MainFrm.cpp
上传用户:fjqzjn
上传日期:2008-01-21
资源大小:2764k
文件大小:5k
- /******************************************************************************
- ** Copyright (C) 2004. Intel Corporation. All Rights Reserved.
- **
- ** The source code contained or described herein and all documents related to the
- ** source code ("Material") are owned by Intel Corporation or its suppliers or
- ** licensors. Title to the Material remains with Intel Corporation or its suppliers
- ** and licensors. The Material contains trade secrets and proprietary and
- ** confidential information of Intel or its suppliers and licensors. The Material
- ** is protected by worldwide copyright and trade secret laws and treaty provisions.
- ** No part of the Material may be used, copied, reproduced, modified, published,
- ** uploaded, posted, transmitted, distributed, or disclosed in any way without
- ** Intel抯 prior express written permission.
- **
- ** No license under any patent, copyright, trade secret or other intellectual
- ** property right is granted to or conferred upon you by disclosure or delivery
- ** of the Materials, either expressly, by implication, inducement, estoppel or
- ** otherwise. Any license under such intellectual property rights must be express
- ** and approved by Intel in writing.
- ******************************************************************************/
- // MainFrm.cpp : implementation of the CMainFrame class
- //
- #include "stdafx.h"
- #include "DispDemo1.h"
- #include "MainFrm.h"
- #include "DemoGDI.h"
- #include "DemoCustom.h"
- #include "DemoVideo.h"
- #include "DispDemo1Doc.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- // Array tbSTDButton contains relevant buttons of bitmap IDB_STD_SMALL_COLOR
- static TBBUTTON tbButtons[] = {
- {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0},
- {0, ID_FILE_NEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {1, ID_FILE_OPEN, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {2, ID_FILE_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
- {3, ID_EDIT_CUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {4, ID_EDIT_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {5, ID_EDIT_PASTE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, -1},
- {6, ID_APP_ABOUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
- {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0, 0}
- };
- const int nNumButtons = sizeof(tbButtons)/sizeof(TBBUTTON);
- const int nNumImages = 7;
- const DWORD dwAdornmentFlags = 0; // exit button
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_COMMAND(ID_DEMO_CUSTOM, OnDemoCustom)
- ON_COMMAND(ID_CFG_QVGA, OnCfgQVGA)
- ON_COMMAND(ID_CFG_VGA, OnCfgVGA)
- ON_COMMAND(ID_CFG_SVGA, OnCfgSVGA)
- ON_COMMAND(ID_CFG_SXGA, OnCfgSXGA)
- ON_COMMAND(ID_CFG_XGA, OnCfgXGA)
- ON_COMMAND(IDM_DEMO_GDI, OnDemoGdi)
- ON_COMMAND(IDM_DEMO_VIDEO, OnDemoVideo)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
- CMainFrame::CMainFrame()
- {
- m_wExternalWidth = 1024;
- m_wExternalHeight = 768;
- }
- CMainFrame::~CMainFrame()
- {
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
-
- // Add the buttons and adornments to the CommandBar.
- if (/*!InsertButtons(tbButtons, nNumButtons, IDR_MAINFRAME, nNumImages) ||*/
- !AddAdornments(dwAdornmentFlags))
- {
- TRACE0("Failed to add toolbar buttonsn");
- return -1;
- }
- return 0;
- }
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( !CFrameWnd::PreCreateWindow(cs) )
- return FALSE;
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame diagnostics
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CFrameWnd::AssertValid();
- }
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CFrameWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame message handlers
- void CMainFrame::OnCfgQVGA()
- {
- SetExternalRes(320, 240);
- }
- void CMainFrame::OnCfgVGA()
- {
- SetExternalRes(640, 480);
- }
- void CMainFrame::OnCfgSVGA()
- {
- SetExternalRes(800, 600);
- }
- void CMainFrame::OnCfgXGA()
- {
- SetExternalRes(1024, 768);
- }
- void CMainFrame::OnCfgSXGA()
- {
- SetExternalRes(1280, 1024);
- }
- void CMainFrame::SetExternalRes(WORD wWidth, WORD wHeight)
- {
- m_wExternalWidth = wWidth;
- m_wExternalHeight = wHeight;
- ((CDispDemo1Doc*)GetActiveDocument())->m_cs1.Format(L"%d x %d selected.", wWidth, wHeight) ;
- ((CDispDemo1Doc*)GetActiveDocument())->m_cs2 = L"Now select from the Demo menu ";
- GetActiveDocument()->UpdateAllViews(NULL);
- }
- void CMainFrame::OnDemoGdi()
- {
- CDemoGDI demo(m_wExternalWidth, m_wExternalHeight);
- }
- void CMainFrame::OnDemoCustom()
- {
- CDemoCustom demo(m_wExternalWidth, m_wExternalHeight);
- }
- void CMainFrame::OnDemoVideo()
- {
- CDemoVideo demo(m_wExternalWidth, m_wExternalHeight);
- }