// LogScrollView.h : interface of the LogScrollView class // ///////////////////////////////////////////////////////////////////////////// #ifndef _LOG_TWIPS_SCROLL_VIEW #define _LOG_TWIPS_SCROLL_VIEW #define CX_BORDER 1 #define CY_BORDER 1 class CLogScrollView : public CView { DECLARE_DYNAMIC(CLogScrollView) // Constructors protected: CLogScrollView(); public: void SetLogScrollSizes(SIZE sizeTotal); // in logical units // Attributes public: CPoint GetScrollPosition() const; // upper corner of scrolling CSize GetTotalSize() const; // logical size // for device units CPoint GetDeviceScrollPosition() const; // Operations public: void ScrollToPosition(POINT pt); // set upper left position void FillOutsideRect(CDC* pDC, CBrush* pBrush); void ResizeParentToFit(BOOL bShrinkOnly = TRUE); // Implementation protected: CSize m_totalLog; // total size in logical units (no rounding) CSize m_totalDev; // total size in device units CSize m_pageDev; // per page scroll size in device units CSize m_lineDev; // per line scroll size in device units BOOL m_bCenter; // Center output if larger than total size BOOL m_bInsideUpdate; // internal state for OnSize callback void CenterOnPoint(CPoint ptCenter); void ScrollToDevicePosition(POINT ptDev); // explicit scrolling no checking protected: virtual void OnDraw(CDC* pDC) = 0; // pass on pure virtual void UpdateBars(); // adjust scrollbars etc BOOL GetTrueClientSize(CSize& size, CSize& sizeSb); // size with no bars void GetScrollBarSizes(CSize& sizeSb); void GetScrollBarState(CSize sizeClient, CSize& needSb, CSize& sizeRange, CPoint& ptMove, BOOL bInsideClient); public: virtual ~CLogScrollView(); #ifdef _DEBUG virtual void Dump(CDumpContext&) const; #endif //_DEBUG virtual void CalcWindowRect(LPRECT lpClientRect, UINT nAdjustType = adjustBorder); virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL); // scrolling implementation support for OLE virtual BOOL OnScroll(UINT nScrollCode, UINT nPos, BOOL bDoScroll = TRUE); virtual BOOL OnScrollBy(CSize sizeScroll, BOOL bDoScroll = TRUE); //{{AFX_MSG(CLogScrollView) afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #endif _LOG_TWIPS_SCROLL_VIEW