home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / banner / bannview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  4.1 KB  |  135 lines

  1. // BannerView.h : interface of the CBannerView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_BANNERVIEW_H__ACA52AA3_9CE1_11D1_87E0_006097BA8D75__INCLUDED_)
  6. #define AFX_BANNERVIEW_H__ACA52AA3_9CE1_11D1_87E0_006097BA8D75__INCLUDED_
  7.  
  8. #include "BannDlg.h"    // Added by ClassView
  9. #if _MSC_VER >= 1000
  10. #pragma once
  11. #endif // _MSC_VER >= 1000
  12.  
  13. #include "Metrics.h"
  14.  
  15. class CBannerView : public CScrollView
  16. {
  17. protected: // create from serialization only
  18.     CBannerView();
  19.     DECLARE_DYNCREATE(CBannerView)
  20.  
  21. // Attributes
  22. public:
  23.     CBannerDoc* GetDocument();
  24.  
  25. // Operations
  26. public:
  27.  
  28. // Overrides
  29.     // ClassWizard generated virtual function overrides
  30.     //{{AFX_VIRTUAL(CBannerView)
  31.     public:
  32.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  33.     protected:
  34.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  35.     virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE);
  36.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  37.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  38.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo);
  39.     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  40.     virtual void OnEndPrinting(CDC*, CPrintInfo* pInfo);
  41.     virtual void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  42.     //}}AFX_VIRTUAL
  43.  
  44. // Implementation
  45. public:
  46.     int m_nCurrZoom; // an index into CBannerMetrics zoom array
  47.     BOOL GetCenterH()      
  48.         { return m_BannerDlg.m_bCenterH; }
  49.     BOOL GetCenterV()      
  50.         { return m_BannerDlg.m_bCenterV; }
  51.     BOOL GetBorder()       
  52.         { return m_BannerDlg.m_bBorder; }
  53.     CString GetBannerText()   
  54.         { return m_BannerDlg.m_strBannerText; }
  55.     CSize GetTextSize(CDC *pDC, int nCurrZoom = -1) 
  56.         { return m_BannerDlg.GetTextSize(pDC, nCurrZoom); }
  57.     BOOL CreateBannerFont(CDC *pDC, CFont *pFont, int nCurrZoom = -1) 
  58.         { return m_BannerDlg.CreateFont(pDC, pFont, nCurrZoom); }
  59.     void ComputeSizes(CDC *pdcPrinter = NULL);
  60.  
  61.     // GetMargins()
  62.     //    CRect m_rcMargins; // In 1000ths of inches
  63.  
  64.     virtual ~CBannerView();
  65. #ifdef _DEBUG
  66.     virtual void AssertValid() const;
  67.     virtual void Dump(CDumpContext& dc) const;
  68. #endif
  69.  
  70. // Generated message map functions
  71. protected:
  72.     CFont m_fontScreen;
  73.     CFont m_fontPrinter;
  74.     CRect m_rcMarginsScreen;
  75.     CRect m_rcMarginsPrinter;
  76.     CRect m_rcMarginsPrintDlg;
  77.     CSize m_sizePageScreen; 
  78.     CSize m_sizePagePrinter; 
  79.     CSize m_sizeTextScreen;  
  80.     CSize m_sizeViewScreen;  
  81.     CSize m_sizeTextPrinter; 
  82.     CSize m_sizeViewPrinter; 
  83.     CSize m_sizePageCount;
  84.     BOOL  m_bRuler;
  85.     BOOL  m_bPageBreaks;
  86.  
  87.     CSize ScaleSize(CSize& base, CSize& num, CSize& den)
  88.     {
  89.         ASSERT((den.cx != 0) && (den.cy != 0));
  90.         return CSize(base.cx * num.cx / den.cx,
  91.                      base.cy * num.cy / den.cy);
  92.     }
  93.  
  94.     CRect ScaleSize(CRect& base, CSize& num, CSize& den)
  95.     {
  96.         ASSERT((den.cx != 0) && (den.cy != 0));
  97.         return CRect(base.left   * num.cx / den.cx, 
  98.                      base.top    * num.cy / den.cy,
  99.                      base.right  * num.cx / den.cx, 
  100.                      base.bottom * num.cy / den.cy);
  101.     }
  102.  
  103.     static int s_nRulerNumberSize;
  104.     static int s_nRulerTickSize;
  105.     
  106.     //{{AFX_MSG(CBannerView)
  107.     afx_msg void OnBannerText();
  108.     afx_msg void OnPageBreaks();
  109.     afx_msg void OnRuler();
  110.     afx_msg void OnUpdateRuler(CCmdUI* pCmdUI);
  111.     afx_msg void OnUpdatePageBreaks(CCmdUI* pCmdUI);
  112.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  113.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  114.     //}}AFX_MSG
  115.     DECLARE_MESSAGE_MAP()
  116. private:
  117.     CBannerDlg m_BannerDlg;
  118.  
  119.     void DrawBanner    (CDC *pDC, CSize& scroll, CBannerMetrics& mx);
  120.     void DrawRuler     (CDC *pDC, CSize& scroll, CBannerMetrics& mx);
  121.     void DrawPageBreaks(CDC *pDC, CSize& scroll, CBannerMetrics& mx);
  122. };
  123.  
  124. #ifndef _DEBUG  // debug version in BannerView.cpp
  125. inline CBannerDoc* CBannerView::GetDocument()
  126.    { return (CBannerDoc*)m_pDocument; }
  127. #endif
  128.  
  129. /////////////////////////////////////////////////////////////////////////////
  130.  
  131. //{{AFX_INSERT_LOCATION}}
  132. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  133.  
  134. #endif // !defined(AFX_BANNERVIEW_H__ACA52AA3_9CE1_11D1_87E0_006097BA8D75__INCLUDED_)
  135.