Annotation of mstools/samples/gridfont/view.hxx, revision 1.1.1.1

1.1       root        1: #ifndef __VIEW_HXX_
                      2: #define __VIEW_HXX_
                      3: 
                      4: #include "canvas.hxx"
                      5: 
                      6: //--------------------------------------------------------------------
                      7: // File: View.hxx
                      8: //
                      9: // Classes: 
                     10: //      CView          - Base class for Views 
                     11: //      CScrollaleView - Scrollable View
                     12: //
                     13: //      CPrintCanvas  - Device context for printing
                     14: //      CPrintRequest  - Print Job
                     15: //
                     16: // History: 22-Jan-1993 Asmusf  Created
                     17: //
                     18: // Copyright (c) 1993 Microsoft Corp. All Rights reserved
                     19: //
                     20: //--------------------------------------------------------------------
                     21: 
                     22: class CModel;
                     23: 
                     24: //======== CView ============================================
                     25: class CView
                     26: {
                     27: public:
                     28:         CView(int cx, int cy);
                     29:         void SetSize( int cx, int cy);
                     30:         BOOL Paint(CCanvas& canvas, CModel * _pModel, RECT rc);
                     31:         UINT Hittest(CCanvas& canvas, POINT pt, CModel * _pModel);
                     32:         void Invalidate(HWND hwnd, LPRECT lpRect=NULL);
                     33: protected:
                     34:         void Scroll(CCanvas &canvas);
                     35:         SIZE _size;
                     36:         UINT _iScale;
                     37:         POINT _ptOrg;
                     38:         POINT _ptScroll;
                     39:         POINT _ptClient;
                     40: };
                     41: 
                     42: //======== CScrollableView ==================================
                     43: class CScrollableView : public CView 
                     44: {
                     45: public:
                     46:         CScrollableView(int cx, int cy):CView(cx,cy){};
                     47:         void GetScale(UINT &iScale);
                     48:         void SetScale(UINT iScale);
                     49:         void SetVScrollPos(HWND hwnd, WPARAM wParam, LPARAM lParam,
                     50:                                 CModel * pModel);
                     51:         void SetHScrollPos(HWND hwnd, WPARAM wParam, LPARAM lParam,
                     52:                                 CModel * pModel);
                     53: protected:
                     54:         int _nHScrollPos;
                     55:         int _nVScrollPos;
                     56: };
                     57: 
                     58: 
                     59: inline void CScrollableView::GetScale(UINT &iScale)
                     60: {
                     61:         iScale=_iScale;
                     62: };
                     63: 
                     64: inline void CScrollableView::SetScale(UINT iScale)
                     65: {
                     66:         _iScale=iScale;
                     67: };
                     68: 
                     69: 
                     70: //======== CPrintRequest =======================================
                     71: 
                     72: #define PREQ_SUCCESS   NULL
                     73: #define PREQ_CANCEL       1
                     74: #define PREQ_USERABORT    2
                     75: #define PREQ_ERRENDPAGE   4
                     76: #define PREQ_ERRSTARTPAGE 8
                     77: #define PREQ_ERRSTARTDOC  16
                     78: #define PREQ_ERROR        32
                     79: 
                     80: 
                     81: class CPrintRequest
                     82: {
                     83: friend class CPrintCanvas;
                     84: public:
                     85:         CPrintRequest(HWND hwnd, UINT minPage=1, UINT maxPage=1);
                     86:         ~CPrintRequest();
                     87: 
                     88:         UINT Print(HINSTANCE hInst, CCanvas &canvas, CModel *pModel);
                     89:         BOOL Cancelled() { return _status == PREQ_CANCEL; };    
                     90:         BOOL Error()     { return _status != PREQ_SUCCESS; };   
                     91: 
                     92: protected:
                     93:         HDC    _hdc;
                     94:         HWND   _hwnd;
                     95:         UINT   _nFromPage;
                     96:         UINT   _nToPage;
                     97:         UINT   _status;
                     98:         HANDLE _hDevNames;
                     99:         CModel* _pModel;
                    100:         CView * _pView;
                    101: };
                    102: 
                    103: 
                    104: //======== CPrintCanvas =======================================
                    105: 
                    106: class CPrintCanvas : public CCanvas
                    107: {
                    108: public:
                    109:         CPrintCanvas(CPrintRequest &pr)
                    110:         {
                    111:             Init(pr._hdc);
                    112:             pr._hdc = 0;
                    113:         }
                    114:         ~CPrintCanvas()
                    115:         {            
                    116:             DeleteDC(_hdc);     
                    117:         }
                    118: };
                    119: 
                    120: 
                    121: extern "C" {
                    122: BOOL CALLBACK PrintDlgProc
                    123:    ( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
                    124: 
                    125: BOOL CALLBACK AbortProc
                    126:    (HDC hdcPrn, short nCode);
                    127: }
                    128: 
                    129: class CPrintAux
                    130: {
                    131: friend class CPrintRequest;
                    132: friend BOOL CALLBACK PrintDlgProc
                    133:    ( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam );
                    134: friend BOOL CALLBACK AbortProc (HDC hdcPrn, short nCode);
                    135: 
                    136:         BOOL _bUserAbort;
                    137:         HWND _hDlgPrint;
                    138: };
                    139: 
                    140: 
                    141: 
                    142: #endif

unix.superglobalmegacorp.com

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