![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Fast Track Visual C++ 6.0 Programming
Listing 2.6 MenusMDIView.h and MenusMDIView.cpp // MenusMDIView.h : interface of the CMenusMDIView class // ///////////////////////////////////////////////////////////////////////////// #if !defined(AFX_MENUSMDIVIEW_H__81CAFB76_9C82_11D1_887F_D42B07C10710__INCLUDED_) #define AFX_MENUSMDIVIEW_H__81CAFB76_9C82_11D1_887F_D42B07C10710__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CMenusMDIView : public CView { protected: // create from serialization only CMenusMDIView(); DECLARE_DYNCREATE(CMenusMDIView) // Attributes public: CMenusMDIDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMenusMDIView) public: virtual void OnDraw(CDC* pDC); // overridden to draw this view virtual BOOL PreCreateWindow(CREATESTRUCT& cs); protected: virtual BOOL OnPreparePrinting(CPrintInfo* pInfo); virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo); virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo); //}}AFX_VIRTUAL // Implementation public: virtual ~CMenusMDIView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CMenusMDIView) afx_msg void OnWindowRestoreviews(); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in MenusMDIView.cpp inline CMenusMDIDoc* CMenusMDIView::GetDocument() { return (CMenusMDIDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MENUSMDIVIEW_H__81CAFB76_9C82_11D1_887F_D42B07C10710__INCLUDED_) void CMenusMDIView::OnWindowRestoreviews() { CMenusMDIDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); POSITION pos = pDoc->GetFirstViewPosition(); while(pos != NULL) { CMenusMDIView* pMDIView = (CMenusMDIView*) pDoc->GetNextView(pos); CMDIChildWnd* parent = (CMDIChildWnd*) pMDIView->GetParent(); parent->MDIRestore(); } // TODO: Add your command handler code here } Whats AheadIn the next chapter, we begin working with some of the different view classes offered by Visual C++: rich edit views, HTML views, Tree views, Splitter windows, and much more. Now that weve had an introduction to multiple views in this chapter, its time to see what kinds of view classes are available.
|
![]() |
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |