Annotation of mstools/mfc/samples/tutorial/view.h, revision 1.1.1.1

1.1       root        1: // view.h : Declares the interfaces to the application and frame window.
                      2: //
                      3: // This is a part of the Microsoft Foundation Classes C++ library.
                      4: // Copyright (C) 1992 Microsoft Corporation
                      5: // All rights reserved.
                      6: //
                      7: // This source code is only intended as a supplement to the
                      8: // Microsoft Foundation Classes Reference and Microsoft
                      9: // QuickHelp documentation provided with the library.
                     10: // See these sources for detailed information regarding the
                     11: // Microsoft Foundation Classes product.
                     12: 
                     13: #ifndef __VIEW_H__
                     14: #define __VIEW_H__
                     15: 
                     16: /////////////////////////////////////////////////////////////////////////////
                     17: //  CtheApp
                     18: //  Derived from CWinApp in order to allow us to override
                     19: //  the InitInstance member function to create our own window.
                     20: //
                     21: class CTheApp : public CWinApp
                     22: {
                     23: public:
                     24:        virtual BOOL InitInstance();
                     25: };
                     26: 
                     27: /////////////////////////////////////////////////////////////////////////////
                     28: //  CFindDialog
                     29: //  This dialog is a one line entry field for getting a search
                     30: //  string to use as a find filter for the database
                     31: //
                     32: class CFindDialog : public CModalDialog
                     33: {
                     34: private:
                     35:        CString m_szFindName;
                     36:        
                     37: public:
                     38:        CFindDialog( CWnd* pParentWnd = NULL )
                     39:                : CModalDialog( "Find", pParentWnd )
                     40:                { }
                     41: 
                     42:        virtual void OnOK();
                     43:        
                     44:        CString& GetFindString() { return m_szFindName; }
                     45: };
                     46: 
                     47: 
                     48: /////////////////////////////////////////////////////////////////////////////
                     49: //  CEditDialog
                     50: //  Used to add or edit a Person object.
                     51: //
                     52: class CEditDialog : public CModalDialog
                     53: {
                     54: private:
                     55:        CPerson* m_pData;
                     56: 
                     57: public:
                     58:        CEditDialog( CPerson* person, CWnd* pParentWnd = NULL )
                     59:                : CModalDialog( "EditPerson", pParentWnd )
                     60:                { m_pData = person; }
                     61:        
                     62:        virtual BOOL OnInitDialog();
                     63:        virtual void OnOK();
                     64:        
                     65:        CPerson* GetData()
                     66:                { return m_pData; }
                     67: };
                     68: 
                     69: /////////////////////////////////////////////////////////////////////////////
                     70: //  CMainWindow
                     71: //  The window object that WinApp creates.  In this program we
                     72: //  only use one window class.  In that sense this object does
                     73: //  all the work that makes our window a CPersonList viewer.
                     74: //
                     75: class CMainWindow : public CFrameWnd
                     76: {
                     77: private:
                     78:        // Variables that contain the window size, font size and scroll
                     79:        // position.
                     80:        int m_cxChar;
                     81:        int m_cyChar;
                     82:        int m_nHscrollPos;
                     83:        int m_nVscrollPos;
                     84:        int m_cxCaps;
                     85:        int m_nMaxWidth;
                     86:        int m_cxClient;
                     87:        int m_cyClient;
                     88:        int m_nVscrollMax;
                     89:        int m_nHscrollMax;
                     90:        int m_nSelectLine;
                     91:        CDataBase m_people;
                     92: 
                     93:        // Private helpers for the other routines.
                     94:        void SetMenu();
                     95:        BOOL Save( BOOL bNamed=FALSE );
                     96:        BOOL FileDlg( BOOL bOpen, int nMaxFile, LPSTR szFile,
                     97:                        int nMaxFileTitle, LPSTR szFileTitle );
                     98:        BOOL CheckForSave( const char* pszTitle, const char* pszMessage );
                     99:        void InvalidateLine();
                    100: 
                    101: public:
                    102:        // The CMainWindow constructor.
                    103:        CMainWindow();
                    104: 
                    105:        // These routines are all overrides of CWnd.  Windows messages
                    106:        // cause these to be called.
                    107:        afx_msg int  OnCreate( LPCREATESTRUCT cs );
                    108:        afx_msg void OnClose();
                    109:        afx_msg void OnSize( UINT type, int x, int y );
                    110:        afx_msg void OnHScroll( UINT nSBCode, UINT pos, CScrollBar* control );
                    111:        afx_msg void OnVScroll( UINT nSBCode, UINT pos, CScrollBar* control );
                    112:        afx_msg void OnLButtonDown( UINT wParam, CPoint location );
                    113:        afx_msg void OnLButtonDblClk( UINT wParam, CPoint location );
                    114:        afx_msg void OnKeyDown( UINT wParam, UINT, UINT );
                    115:        afx_msg void OnPaint();
                    116: 
                    117:        // These routines are all menu items.  User action causes
                    118:        // these to be called.
                    119:        afx_msg void OnNew();
                    120:        afx_msg void OnOpen();
                    121:        afx_msg void OnSave();
                    122:        afx_msg void OnSaveAs();
                    123:        afx_msg void OnDBClose();
                    124:        afx_msg void OnPrint();
                    125:        afx_msg void OnExit();
                    126:        afx_msg void OnAdd();
                    127:        afx_msg void OnDelete();
                    128:        afx_msg void OnFind();
                    129:        afx_msg void OnFindAll();
                    130:        afx_msg void OnEdit();
                    131:        afx_msg void OnHelp();
                    132:        afx_msg void OnAbout();
                    133:        afx_msg void OnUp();
                    134:        afx_msg void OnDown();
                    135: 
                    136:        DECLARE_MESSAGE_MAP()
                    137: };
                    138: 
                    139: /////////////////////////////////////////////////////////////////////////////
                    140: 
                    141: #endif // __VIEW_H__

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.