|
|
1.1 ! root 1: // about2.h : Declares the class interfaces for the About2 application. ! 2: // This application demonstrates typical modal dialog use, ! 3: // painting special graphics on a modal dialog, and when ! 4: // compared to the original C code, shows equivalent ! 5: // functionality between C code and C++ Foundation code. ! 6: // ! 7: // This is a part of the Microsoft Foundation Classes C++ library. ! 8: // Copyright (C) 1992 Microsoft Corporation ! 9: // All rights reserved. ! 10: // ! 11: // This source code is only intended as a supplement to the ! 12: // Microsoft Foundation Classes Reference and Microsoft ! 13: // QuickHelp documentation provided with the library. ! 14: // See these sources for detailed information regarding the ! 15: // Microsoft Foundation Classes product. ! 16: // ! 17: // Based on the About2 application by Charles Petzold. ! 18: // The original application appeared in ! 19: // "Programming Windows", Second Edition (pp. 417-423), ! 20: // Copyright (C) 1990 Charles Petzold, ! 21: // published by Microsoft Press. Used with permission. ! 22: ! 23: #ifndef __ABOUT2_H__ ! 24: #define __ABOUT2_H__ ! 25: ! 26: ///////////////////////////////////////////////////////////////////////////// ! 27: ! 28: // CAbout2Dlg: ! 29: // This class is the "AboutBox" modal dialog. The dialog's controls ! 30: // are defined in the dialog editor resource script, about2.dlg. ! 31: // ! 32: class CAbout2Dlg : public CModalDialog ! 33: { ! 34: private: ! 35: // These are used to keep information for the duration of the dialog. ! 36: short m_nColor; ! 37: short m_nFigure; ! 38: CWnd* m_ctrl; ! 39: ! 40: public: ! 41: // Constructor. We have to pass a parent window to the ! 42: // CModalDialog constructor. We know that we correspond ! 43: // to the "AboutBox" dialog template (see about2.rc). ! 44: // When we construct the about box object we set the ! 45: // internal state variables to the color and figure requested. ! 46: // ! 47: CAbout2Dlg(CWnd* pParentWnd, short nColor, short nFigure ) ! 48: : CModalDialog("AboutBox", pParentWnd) ! 49: { m_nColor = nColor; ! 50: m_nFigure = nFigure; } ! 51: ! 52: // Messages we handle. ! 53: // ! 54: afx_msg BOOL OnInitDialog(); ! 55: afx_msg void OnColor(); ! 56: afx_msg void OnFigure(); ! 57: afx_msg void OnPaint(); ! 58: ! 59: // Data Access Functions ! 60: short GetColor() { return m_nColor; } ! 61: short GetFigure() { return m_nFigure; } ! 62: ! 63: // Message map defined in the .cpp file. ! 64: // ! 65: DECLARE_MESSAGE_MAP() ! 66: private: ! 67: short nCurrentColor; ! 68: short nCurrentFigure; ! 69: }; ! 70: ! 71: ///////////////////////////////////////////////////////////////////////////// ! 72: ! 73: // CMainWnd: ! 74: // This is the main window of the application. It has a small menu, ! 75: // with a "Help" popup and an "About About2..." item (see about2.rc). ! 76: // The main window draws the current figure in its client area. ! 77: // ! 78: class CMainWnd : public CFrameWnd ! 79: { ! 80: public: ! 81: // Constructor. ! 82: // ! 83: CMainWnd(); ! 84: ! 85: // Messages we handle. ! 86: // ! 87: afx_msg void OnAbout(); ! 88: afx_msg void OnPaint(); ! 89: ! 90: // Message map defined in the .cpp file. ! 91: // ! 92: DECLARE_MESSAGE_MAP(); ! 93: private: ! 94: short m_nCurrentColor; ! 95: short m_nCurrentFigure; ! 96: }; ! 97: ! 98: ///////////////////////////////////////////////////////////////////////////// ! 99: ! 100: // CAbout2App: ! 101: // This class represents the application as a whole. The base class CWinApp ! 102: // does most of this for us, such as creating and running the message loop. ! 103: // ! 104: class CAbout2App : public CWinApp ! 105: { ! 106: public: ! 107: // This member function is called automatically, so we can set up ! 108: // our application-specific information. ! 109: // ! 110: BOOL InitInstance(); ! 111: }; ! 112: ! 113: ///////////////////////////////////////////////////////////////////////////// ! 114: ! 115: #endif // __ABOUT2_H__ ! 116:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.