Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

RichViewCtrl.h

Go to the documentation of this file.
00001 //
00002 // RichViewCtrl.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #if !defined(AFX_RICHVIEWCTRL_H__EB7BD9A6_8F32_48F1_ACAA_3503B8A61769__INCLUDED_)
00023 #define AFX_RICHVIEWCTRL_H__EB7BD9A6_8F32_48F1_ACAA_3503B8A61769__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CRichDocument;
00028 class CRichElement;
00029 class CRichFragment;
00030 
00031 typedef struct
00032 {
00033         int             nFragment;
00034         int             nOffset;
00035 } RICHPOSITION;
00036 
00037 
00038 class CRichViewCtrl : public CWnd
00039 {
00040 // Construction
00041 public:
00042         CRichViewCtrl();
00043         virtual ~CRichViewCtrl();
00044 
00045 // Attributes
00046 protected:
00047         CSyncObject*    m_pSyncRoot;
00048         BOOL                    m_bSelectable;
00049         BOOL                    m_bFollowBottom;
00050         BOOL                    m_bDefaultLink;
00051 protected:
00052         CRichDocument*  m_pDocument;
00053         DWORD                   m_nCookie;
00054         CPtrArray               m_pFragments;
00055         int                             m_nLength;
00056         int                             m_nScrollWheelLines;
00057 protected:
00058         CRichElement*   m_pHover;
00059         BOOL                    m_bSelecting;
00060         RICHPOSITION    m_pSelStart;
00061         RICHPOSITION    m_pSelEnd;
00062         RICHPOSITION    m_pSelAbsStart;
00063         RICHPOSITION    m_pSelAbsEnd;
00064 protected:
00065         HCURSOR                 m_hcHand;
00066         HCURSOR                 m_hcText;
00067         CBrush                  m_pBrush;
00068 
00069 // Operations
00070 public:
00071         void                    SetSyncObject(CSyncObject* pSyncRoot);
00072         void                    SetSelectable(BOOL bSelectable);
00073         void                    SetFollowBottom(BOOL bFollowBottom);
00074         void                    SetDefaultLink(BOOL bDefaultLink);
00075         void                    SetDocument(CRichDocument* pDocument);
00076         BOOL                    IsModified() const;
00077         void                    InvalidateIfModified();
00078         int                             FullHeightMove(int nX, int nY, int nWidth, BOOL bShow = FALSE);
00079         BOOL                    GetElementRect(CRichElement* pElement, RECT* prc);
00080 protected:
00081         void                    ClearFragments();
00082         void                    Layout(CDC* pDC, CRect* pRect);
00083         void                    WrapLineHelper(CPtrList& pLine, CPoint& pt, int& nLineHeight, int nWidth, int nAlign);
00084         CRichFragment*  PointToFrag(CPoint& pt);
00085         RICHPOSITION    PointToPosition(CPoint& pt);
00086         CPoint                  PositionToPoint(RICHPOSITION& pt);
00087         void                    UpdateSelection();
00088         void                    CopySelection();
00089 protected:
00090         virtual void    OnLayoutComplete() {};
00091         virtual void    OnPaintBegin(CDC* pDC) {};
00092         virtual void    OnPaintComplete(CDC* pDC) {};
00093         virtual void    OnVScrolled() {};
00094 
00095 // Overrides
00096 public:
00097         //{{AFX_VIRTUAL(CRichViewCtrl)
00098         public:
00099         virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00100         //}}AFX_VIRTUAL
00101 
00102 // Implementation
00103 protected:
00104         //{{AFX_MSG(CRichViewCtrl)
00105         afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00106         afx_msg void OnDestroy();
00107         afx_msg BOOL OnEraseBkgnd(CDC* pDC);
00108         afx_msg void OnPaint();
00109         afx_msg void OnSize(UINT nType, int cx, int cy);
00110         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
00111         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00112         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00113         afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
00114         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00115         afx_msg void OnTimer(UINT nIDEvent);
00116         afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00117         //}}AFX_MSG
00118         DECLARE_MESSAGE_MAP()
00119 
00120         friend class CRichFragment;
00121 };
00122 
00123 typedef struct
00124 {
00125         NMHDR                   hdr;
00126         CRichElement*   pElement;
00127 } RVN_ELEMENTEVENT;
00128 
00129 #define RVN_CLICK               100
00130 
00131 //{{AFX_INSERT_LOCATION}}
00132 
00133 #endif // !defined(AFX_RICHVIEWCTRL_H__EB7BD9A6_8F32_48F1_ACAA_3503B8A61769__INCLUDED_)

Generated on Thu Dec 15 10:39:47 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2