ChildFrm.cpp
上传用户:cding2008
上传日期:2007-01-03
资源大小:1812k
文件大小:4k
- /////////////////////////////////////////////////////////////////////////////
- // ChildFrm.cpp : implementation of the CChildFrame class
- //
- // ModelMagic 3D and 'glOOP' (OpenGL Object Oriented Programming library)
- // Copyright (c) Craig Fahrnbach 1997, 1999
- //
- // OpenGL is a registered trademark of Silicon Graphics
- //
- //
- // This program is provided for educational and personal use only and
- // is provided without guarantee or warrantee expressed or implied.
- //
- // Commercial use is strickly prohibited without written permission
- // from ImageWare Development.
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "ModelMagic3D.h"
- #include "ChildFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame
- IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
- BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
- //{{AFX_MSG_MAP(CChildFrame)
- ON_WM_PALETTECHANGED()
- ON_WM_QUERYNEWPALETTE()
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame construction/destruction
- CChildFrame::CChildFrame()
- {
- m_bWndInitialized = FALSE;
- }
- CChildFrame::~CChildFrame()
- {
- }
- BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CMDIChildWnd::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame diagnostics
- #ifdef _DEBUG
- void CChildFrame::AssertValid() const
- {
- CMDIChildWnd::AssertValid();
- }
- void CChildFrame::Dump(CDumpContext& dc) const
- {
- CMDIChildWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CChildFrame message handlers
- void CChildFrame::ActivateFrame(int nCmdShow)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(!m_bWndInitialized) {
- m_bWndInitialized = TRUE;
-
- // Get the last setting of the window position from
- // the ini file and restore
- WINDOWPLACEMENT wp;
- GetWindowPlacement(&wp);
- if(!ReadWindowPlacement(&wp, "Settings", "ChildWindowPos"))
- {
- // The ini file is corrupt or does not exist, so position the
- // child frame to allow for our floating dialog bars.
- wp.rcNormalPosition.top = 0;
- wp.rcNormalPosition.bottom = 100;
- wp.rcNormalPosition.left = 0;
- wp.rcNormalPosition.right = 50;
- }
-
- // Now restore (or set) our window position
- SetWindowPlacement(&wp);
- }
- CMDIChildWnd::ActivateFrame(nCmdShow);
- }
- void CChildFrame::OnDestroy()
- {
- CMDIChildWnd::OnDestroy();
-
- // TODO: Add your message handler code here
- // Save the state of our CView window
- WINDOWPLACEMENT wp;
- wp.length = sizeof wp;
- if (GetWindowPlacement(&wp))
- {
- wp.flags = 0;
- if (::IsZoomed(m_hWnd))
- wp.flags |= WPF_RESTORETOMAXIMIZED;
- // and write it to the .INI file
- WriteWindowPlacement(&wp, "Settings", "ChildWindowPos");
- }
- }
- void CChildFrame::OnPaletteChanged(CWnd* pFocusWnd)
- {
- CMDIChildWnd::OnPaletteChanged(pFocusWnd);
-
- // Route message to CView derived class
- CView* pView = GetActiveView();
- if (pView) {
- // OnPaletteChanged is not public, so send a message.
- pView->SendMessage(WM_PALETTECHANGED,
- (WPARAM)(pFocusWnd->GetSafeHwnd()),
- (LPARAM)0);
- }
-
- }
- BOOL CChildFrame::OnQueryNewPalette()
- {
- // Route message to CView derived class
- CView* pView = GetActiveView();
- if (pView) {
- // OnPaletteChanged is not public, so send a message.
- pView->SendMessage(WM_QUERYNEWPALETTE,
- (WPARAM)0,
- (LPARAM)0);
- }
- // return FALSE;
-
- return CMDIChildWnd::OnQueryNewPalette();
- }