|
|
1.1 root 1: // This is a part of the Microsoft Foundation Classes C++ library.
2: // Copyright (C) 1992 Microsoft Corporation
3: // All rights reserved.
4: //
5: // This source code is only intended as a supplement to the
6: // Microsoft Foundation Classes Reference and Microsoft
7: // QuickHelp documentation provided with the library.
8: // See these sources for detailed information regarding the
9: // Microsoft Foundation Classes product.
10:
11: // class CMainWnd - the main frame window for this app
12:
13: class CItemWnd;
14: class CMainWnd;
15:
16: class CMainDocument : public COleClientDoc
17: {
18: CMainWnd* m_pView;
19: public:
20: CMainDocument(CMainWnd* pView)
21: { m_pView = pView; }
22:
23: // iterator for contained items
24: virtual COleClientItem* GetNextItem(POSITION& rPosition,
25: BOOL* pIsSelected);
26: };
27:
28:
29: class CMainWnd : public CFrameWnd
30: {
31: public:
32: CString m_title; // title of window
33: CString m_fileName; // file name (may be empty)
34:
35: public:
36: CMainWnd();
37:
38: // Attributes
39: CItemWnd* GetSelection() const;
40: void SetSelection(CItemWnd* pNewSel);
41:
42: const CMainDocument* GetDocument() const;
43: CMainDocument* GetDocument();
44:
45: // Operations
46: void Hourglass(BOOL bOn);
47: void ErrorMessage(UINT id);
48:
49: void Dirty();
50:
51: // File helpers
52: BOOL SaveAsNeeded();
53: void InitFile(BOOL fOpen);
54: BOOL DoSave(const char* szFileName);
55: BOOL DoFileDlg(CString& fileName, UINT nIDTitle, DWORD lFlags);
56:
57: // naming/registering
58: void SetTitle();
59: void DeregisterDoc();
60:
61: // reading-writing content
62: virtual void Serialize(CArchive& ar); // from CObject
63: #ifdef _DEBUG
64: virtual void AssertValid() const;
65: #endif
66:
67: // Callbacks
68: // windows messages
69: afx_msg void OnInitMenuPopup(CMenu*, UINT, BOOL);
70: afx_msg void OnDestroy();
71: afx_msg void OnClose();
72: afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
73: afx_msg BOOL OnQueryEndSession();
74:
75: // callback helpers
76: BOOL DoCopySelection();
77: BOOL DoPaste(BOOL fLink);
78: void ClearAll();
79:
80: // commands
81: afx_msg void OnFileNew();
82: afx_msg void OnFileOpen();
83: afx_msg void OnFileSave();
84: afx_msg void OnFileSaveAs();
85: afx_msg void OnExit();
86: afx_msg void OnAbout();
87:
88: afx_msg void OnCut();
89: afx_msg void OnCopy();
90: afx_msg void OnPaste();
91: afx_msg void OnPasteLink();
92: afx_msg void OnClear();
93: afx_msg void OnClearAll();
94: afx_msg void OnInsertObject();
95: afx_msg void OnEditLinks();
96:
97: // Implementation
98: protected:
99: virtual BOOL OnCommand(UINT wParam, LONG lParam);
100: CItemWnd* m_pSelection;
101: BOOL m_fDirty;
102:
103: CMainDocument m_document;
104:
105: DECLARE_MESSAGE_MAP()
106: };
107:
108: // inlines
109: inline void CMainWnd::Dirty()
110: { m_fDirty = TRUE; }
111: inline const CMainDocument* CMainWnd::GetDocument() const
112: { return &m_document; }
113: inline CMainDocument* CMainWnd::GetDocument()
114: { return &m_document; }
115: inline CItemWnd* CMainWnd::GetSelection() const
116: { return m_pSelection; } // Just the top-most window
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.