Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fwl / src / basewidget / include / fwl_scrollbarimp.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FWL_SCROLLBAR_IMP_H\r
8 #define _FWL_SCROLLBAR_IMP_H\r
9 class CFWL_WidgetImp;\r
10 class CFWL_WidgetImpProperties;\r
11 class CFWL_WidgetImpDelegate;\r
12 class IFWL_Widget;\r
13 class IFWL_Timer;\r
14 class IFWL_TimerDelegate;\r
15 class CFWL_ScrollBarImp;\r
16 class CFWL_ScrollBarImpDelegate;\r
17 class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer\r
18 {\r
19 public:\r
20     CFWL_ScrollBarImp(IFWL_Widget *pOuter = NULL);\r
21     CFWL_ScrollBarImp(const CFWL_WidgetImpProperties &properties, IFWL_Widget *pOuter = NULL);\r
22     ~CFWL_ScrollBarImp();\r
23     virtual FWL_ERR             GetClassName(CFX_WideString &wsClass) const;\r
24     virtual FX_DWORD    GetClassID() const;\r
25     virtual FWL_ERR             Initialize();\r
26     virtual FWL_ERR     Finalize();\r
27     virtual FWL_ERR             GetWidgetRect(CFX_RectF &rect, FX_BOOL bAutoSize = FALSE);\r
28     virtual     FWL_ERR         Update();\r
29     virtual FWL_ERR             DrawWidget(CFX_Graphics *pGraphics, const CFX_Matrix *pMatrix = NULL);\r
30     virtual FX_BOOL             IsVertical() ;\r
31     virtual FWL_ERR             GetRange(FX_FLOAT &fMin, FX_FLOAT &fMax);\r
32     virtual FWL_ERR             SetRange(FX_FLOAT fMin, FX_FLOAT fMax);\r
33     virtual FX_FLOAT    GetPageSize();\r
34     virtual FWL_ERR             SetPageSize(FX_FLOAT fPageSize);\r
35     virtual FX_FLOAT    GetStepSize();\r
36     virtual FWL_ERR             SetStepSize(FX_FLOAT fStepSize);\r
37     virtual FX_FLOAT    GetPos();\r
38     virtual FWL_ERR             SetPos(FX_FLOAT fPos);\r
39     virtual FX_FLOAT    GetTrackPos();\r
40     virtual FWL_ERR             SetTrackPos(FX_FLOAT fTrackPos);\r
41     virtual FX_BOOL             DoScroll(FX_DWORD dwCode, FX_FLOAT fPos = 0.0f);\r
42     virtual     FWL_ERR         SetOuter(IFWL_Widget *pOuter);\r
43     virtual     FX_INT32        Run(FWL_HTIMER hTimer);\r
44 protected:\r
45     void                DrawTrack(CFX_Graphics *pGraphics, IFWL_ThemeProvider *pTheme, FX_BOOL bLower = TRUE, const CFX_Matrix *pMatrix = NULL);\r
46     void                DrawArrowBtn(CFX_Graphics *pGraphics, IFWL_ThemeProvider *pTheme, FX_BOOL bMinBtn = TRUE, const CFX_Matrix *pMatrix = NULL);\r
47     void                DrawThumb(CFX_Graphics *pGraphics, IFWL_ThemeProvider *pTheme, const CFX_Matrix *pMatrix = NULL);\r
48     void                Layout();\r
49     void                CalcButtonLen();\r
50     void                CalcMinButtonRect(CFX_RectF &rect);\r
51     void                CalcMaxButtonRect(CFX_RectF &rect);\r
52     void                CalcThumbButtonRect(CFX_RectF &rect);\r
53     void                CalcMinTrackRect(CFX_RectF &rect);\r
54     void                CalcMaxTrackRect(CFX_RectF &rect);\r
55 \r
56     FX_FLOAT    GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy);\r
57     void                GetTrackRect(CFX_RectF &rect, FX_BOOL bLower = TRUE);\r
58     FX_BOOL             SendEvent();\r
59     FX_BOOL             OnScroll(FX_DWORD dwCode, FX_FLOAT fPos);\r
60     FWL_HTIMER                          m_hTimer;\r
61     FX_FLOAT                            m_fRangeMin;\r
62     FX_FLOAT                            m_fRangeMax;\r
63     FX_FLOAT                            m_fPageSize;\r
64     FX_FLOAT                            m_fStepSize;\r
65     FX_FLOAT                            m_fPos;\r
66     FX_FLOAT                            m_fTrackPos;\r
67     FX_INT32                            m_iMinButtonState;\r
68     FX_INT32                            m_iMaxButtonState;\r
69     FX_INT32                            m_iThumbButtonState;\r
70     FX_INT32                            m_iMinTrackState;\r
71     FX_INT32                            m_iMaxTrackState;\r
72     FX_FLOAT                            m_fLastTrackPos;\r
73     FX_FLOAT                            m_cpTrackPointX;\r
74     FX_FLOAT                            m_cpTrackPointY;\r
75     FX_INT32                            m_iMouseWheel;\r
76     FX_BOOL                                     m_bTrackMouseLeave;\r
77     FX_BOOL                                     m_bMouseHover;\r
78     FX_BOOL                                     m_bMouseDown;\r
79     FX_BOOL                                     m_bRepaintThumb;\r
80 \r
81     FX_FLOAT                            m_fButtonLen;\r
82     FX_BOOL                                     m_bMinSize;\r
83     CFX_RectF                           m_rtClient;\r
84     CFX_RectF                           m_rtThumb;\r
85     CFX_RectF                           m_rtMinBtn;\r
86     CFX_RectF                           m_rtMaxBtn;\r
87     CFX_RectF                           m_rtMinTrack;\r
88     CFX_RectF                           m_rtMaxTrack;\r
89     FX_BOOL                                     m_bCustomLayout;\r
90     FX_FLOAT                            m_fMinThumb;\r
91     friend class CFWL_ScrollBarImpDelegate;\r
92 };\r
93 class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate\r
94 {\r
95 public:\r
96     CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp *pOwner);\r
97     virtual FX_INT32    OnProcessMessage(CFWL_Message *pMessage);\r
98     virtual FWL_ERR             OnDrawWidget(CFX_Graphics *pGraphics, const CFX_Matrix *pMatrix = NULL);\r
99 protected:\r
100     void                OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);\r
101     void                OnLButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);\r
102     void                OnMouseMove(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy);\r
103     void                OnMouseLeave();\r
104     void                OnMouseWheel(FX_FLOAT fx, FX_FLOAT fy, FX_DWORD dwFlags, FX_FLOAT fDeltaX, FX_FLOAT     fDeltaY);\r
105     void                DoMouseDown(FX_INT32 iItem, const CFX_RectF &rtItem, FX_INT32 &iState, FX_FLOAT fx, FX_FLOAT fy);\r
106     void                DoMouseUp(FX_INT32 iItem, const CFX_RectF &rtItem, FX_INT32 &iState, FX_FLOAT fx, FX_FLOAT fy);\r
107     void                DoMouseMove(FX_INT32 iItem, const CFX_RectF &rtItem, FX_INT32 &iState, FX_FLOAT fx, FX_FLOAT fy);\r
108     void                DoMouseLeave(FX_INT32 iItem, const CFX_RectF &rtItem, FX_INT32 &iState);\r
109     void                DoMouseHover(FX_INT32 iItem, const CFX_RectF &rtItem, FX_INT32 &iState);\r
110 \r
111     CFWL_ScrollBarImp *m_pOwner;\r
112 };\r
113 #endif\r