Annotation of mstools/samples/gridfont/app.hxx, revision 1.1

1.1     ! root        1: //+--------------------------------------------------------
        !             2: // File:        App.hxx
        !             3: //
        !             4: // Classes:     CController
        !             5: //
        !             6: // Functions:   WinMain
        !             7: //              WndProc
        !             8: //              MakeWindowClass
        !             9: //              AboutDlgProc
        !            10: //
        !            11: // History:     22-Jan-1993     asmusf  created
        !            12: //----------------------------------------------------------
        !            13: 
        !            14: #include <string.h>
        !            15: #include "app.h"
        !            16: #include "view.hxx"
        !            17: #include "grid.hxx"
        !            18: #include "box.hxx"
        !            19: 
        !            20: //----------------------------------------------------------
        !            21: //
        !            22: // Class Hierarchy for Application   --- inheritance
        !            23: //           (approximate)           (x) contains x
        !            24: //
        !            25: //      CGrid
        !            26: //        |                          CBlockFrame(CFont)  
        !            27: //        |                                     (CLineGrid)
        !            28: //        +--CTextGrid(CFont)                   (CCodeGrid)
        !            29: //        |     |                               (CCharGrid)
        !            30: //        |     |
        !            31: //        |     +CCharGrid           CPage(CFont,CCodeGrid[])
        !            32: //   CLineGrid  |                         (CBlockFrame[])
        !            33: //              +CCodeGrid           
        !            34: //                                   CModel(CPage)
        !            35: //                                   
        !            36: //                                   
        !            37: //
        !            38: //      CCanvas                       CView
        !            39: //         |                            |
        !            40: //         |-- CPaintCanvas             |
        !            41: //         |                          CScrollableView
        !            42: //         |-- CScreenCanvas
        !            43: //         |
        !            44: //         +-- CPrintCanvas           CPrintRequest
        !            45: //
        !            46: //
        !            47: //     CController(CScrollableView, CModel, CBox)
        !            48: //
        !            49: //----------------------------------------------------------
        !            50: 
        !            51: #if 0
        !            52: #ifndef WPARAM
        !            53: #define WPARAM WORD
        !            54: #endif
        !            55: #ifndef LPARAM
        !            56: #define LPARAM LONG
        !            57: #endif
        !            58: #endif
        !            59: 
        !            60: // procedures called by Windows
        !            61: 
        !            62: extern "C" {
        !            63: 
        !            64: LRESULT CALLBACK WndProc
        !            65:    ( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
        !            66: 
        !            67: BOOL CALLBACK AboutDlgProc
        !            68:    ( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
        !            69: 
        !            70: }
        !            71: 
        !            72: 
        !            73: // Main function and other functions used in App.cxx
        !            74: 
        !            75: int PASCAL WinMain
        !            76:    ( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdParam, int cmdShow );
        !            77: 
        !            78: void MakeWindowClass ( WNDPROC WndProc, LPTSTR szAppName, HINSTANCE hInst );
        !            79: 
        !            80: 
        !            81: // ==== Class CWindow =============================
        !            82: 
        !            83: class CWindow
        !            84: {
        !            85: public:
        !            86:    CWindow (): _hwnd(0) {}
        !            87:    CWindow ( LPTSTR caption, LPTSTR lpszClassName, HINSTANCE hInstance,
        !            88:             int cx = CW_USEDEFAULT, int cy=CW_USEDEFAULT);
        !            89:    void Show ( int nCmdShow )
        !            90:    {
        !            91:       ShowWindow ( _hwnd, nCmdShow );
        !            92:       UpdateWindow ( _hwnd );
        !            93:    }
        !            94:    operator HWND() { return _hwnd; }
        !            95: protected:
        !            96:    HWND _hwnd;
        !            97: };
        !            98: 
        !            99: inline CWindow::CWindow(LPTSTR caption, LPTSTR lpszClassName, HINSTANCE hInstance,
        !           100: int cx, int cy)
        !           101: {
        !           102:    _hwnd = CreateWindow (
        !           103:       lpszClassName,
        !           104:       caption,
        !           105:       WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
        !           106:       CW_USEDEFAULT,
        !           107:       CW_USEDEFAULT,
        !           108:       cx,
        !           109:       cy,
        !           110:       NULL,
        !           111:       NULL,
        !           112:       hInstance,
        !           113:       NULL );
        !           114: }
        !           115: 
        !           116: // ==== Class Controller ==========================
        !           117: 
        !           118: class CController
        !           119: {
        !           120: public:
        !           121:    void Init(HWND hwnd);
        !           122: 
        !           123:    void Create(HWND hwnd, LPARAM lParam);
        !           124:    void Destroy();
        !           125:    void Size ( LPARAM lParam );
        !           126:    void Paint ( HWND hwnd );
        !           127:    void Command ( HWND hwnd, WPARAM wParam );
        !           128:    void ButtonDown(HWND hwnd, LPARAM lParam );
        !           129:    void ButtonUp(HWND hwnd, LPARAM lParam);
        !           130:    void KeyDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
        !           131:    void KeyUp(HWND hwnd, WPARAM wParam, LPARAM lParam);
        !           132:    void VScroll(HWND hwnd, WPARAM wParam, LPARAM lParam);
        !           133:    void HScroll(HWND hwnd, WPARAM wParam, LPARAM lParam);
        !           134:    void AlertBox(HWND hwnd, UINT ids, UINT fuStyle);
        !           135: 
        !           136: private:
        !           137:    void Page(HWND hwnd, WPARAM wParam);
        !           138: 
        !           139:    HINSTANCE  _hInst;
        !           140:    DLGPROC _funAbout;
        !           141: 
        !           142:    CScrollableView* _pView;
        !           143:    CModel* _pModel;
        !           144:    CBox *  _pBox;
        !           145: };
        !           146: 
        !           147: 
        !           148: inline void CController::Paint ( HWND hwnd )
        !           149: {
        !           150:    CPaintCanvas canvas (hwnd);
        !           151: 
        !           152:    _pView->Paint(canvas, _pModel, canvas.GetRect());
        !           153: }
        !           154: 
        !           155: 

unix.superglobalmegacorp.com

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