OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ |
9 | 9 |
10 #include "xfa/fwl/core/fwl_formimp.h" | 10 #include "xfa/fwl/core/fwl_formimp.h" |
11 #include "xfa/fwl/core/fwl_widgetimp.h" | 11 #include "xfa/fwl/core/fwl_widgetimp.h" |
12 #include "xfa/fwl/core/ifwl_timer.h" | 12 #include "xfa/fwl/core/ifwl_timer.h" |
13 | 13 |
14 class CFWL_WidgetImpProperties; | 14 class CFWL_WidgetImpProperties; |
15 class IFWL_Widget; | 15 class IFWL_Widget; |
16 class CFWL_ToolTipImpDelegate; | 16 class CFWL_ToolTipImpDelegate; |
17 | 17 |
18 class CFWL_ToolTipImp : public CFWL_FormImp { | 18 class CFWL_ToolTipImp : public CFWL_FormImp { |
19 public: | 19 public: |
20 CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, | 20 CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, |
21 IFWL_Widget* pOuter); | 21 IFWL_Widget* pOuter); |
22 virtual ~CFWL_ToolTipImp(); | 22 virtual ~CFWL_ToolTipImp(); |
23 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 23 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; |
24 virtual FX_DWORD GetClassID() const; | 24 virtual uint32_t GetClassID() const; |
25 virtual FWL_ERR Initialize(); | 25 virtual FWL_ERR Initialize(); |
26 virtual FWL_ERR Finalize(); | 26 virtual FWL_ERR Finalize(); |
27 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 27 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
28 virtual FWL_ERR Update(); | 28 virtual FWL_ERR Update(); |
29 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | 29 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, |
30 const CFX_Matrix* pMatrix = NULL); | 30 const CFX_Matrix* pMatrix = NULL); |
31 virtual FWL_ERR SetStates(FX_DWORD dwStates, FX_BOOL bSet); | 31 virtual FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet); |
32 virtual FWL_ERR GetClientRect(CFX_RectF& rect); | 32 virtual FWL_ERR GetClientRect(CFX_RectF& rect); |
33 FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); | 33 FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); |
34 FWL_ERR Show(); | 34 FWL_ERR Show(); |
35 FWL_ERR Hide(); | 35 FWL_ERR Hide(); |
36 | 36 |
37 protected: | 37 protected: |
38 void DrawBkground(CFX_Graphics* pGraphics, | 38 void DrawBkground(CFX_Graphics* pGraphics, |
39 IFWL_ThemeProvider* pTheme, | 39 IFWL_ThemeProvider* pTheme, |
40 const CFX_Matrix* pMatrix); | 40 const CFX_Matrix* pMatrix); |
41 void DrawText(CFX_Graphics* pGraphics, | 41 void DrawText(CFX_Graphics* pGraphics, |
42 IFWL_ThemeProvider* pTheme, | 42 IFWL_ThemeProvider* pTheme, |
43 const CFX_Matrix* pMatrix); | 43 const CFX_Matrix* pMatrix); |
44 void UpdateTextOutStyles(); | 44 void UpdateTextOutStyles(); |
45 void RefreshToolTipPos(); | 45 void RefreshToolTipPos(); |
46 class CFWL_ToolTipTimer : public IFWL_Timer { | 46 class CFWL_ToolTipTimer : public IFWL_Timer { |
47 public: | 47 public: |
48 CFWL_ToolTipTimer() {} | 48 CFWL_ToolTipTimer() {} |
49 ~CFWL_ToolTipTimer() {} | 49 ~CFWL_ToolTipTimer() {} |
50 CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip); | 50 CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip); |
51 virtual int32_t Run(FWL_HTIMER hTimer); | 51 virtual int32_t Run(FWL_HTIMER hTimer); |
52 CFWL_ToolTipImp* m_pToolTip; | 52 CFWL_ToolTipImp* m_pToolTip; |
53 }; | 53 }; |
54 CFX_RectF m_rtClient; | 54 CFX_RectF m_rtClient; |
55 CFX_RectF m_rtCaption; | 55 CFX_RectF m_rtCaption; |
56 FX_BOOL m_bBtnDown; | 56 FX_BOOL m_bBtnDown; |
57 FX_DWORD m_dwTTOStyles; | 57 uint32_t m_dwTTOStyles; |
58 int32_t m_iTTOAlign; | 58 int32_t m_iTTOAlign; |
59 CFX_RectF m_rtAnchor; | 59 CFX_RectF m_rtAnchor; |
60 FWL_HTIMER m_hTimerShow; | 60 FWL_HTIMER m_hTimerShow; |
61 FWL_HTIMER m_hTimerHide; | 61 FWL_HTIMER m_hTimerHide; |
62 CFWL_ToolTipTimer* m_pTimer; | 62 CFWL_ToolTipTimer* m_pTimer; |
63 CFWL_ToolTipTimer m_TimerShow; | 63 CFWL_ToolTipTimer m_TimerShow; |
64 CFWL_ToolTipTimer m_TimerHide; | 64 CFWL_ToolTipTimer m_TimerHide; |
65 friend class CFWL_ToolTipImpDelegate; | 65 friend class CFWL_ToolTipImpDelegate; |
66 friend class CFWL_ToolTipTimer; | 66 friend class CFWL_ToolTipTimer; |
67 }; | 67 }; |
68 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { | 68 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { |
69 public: | 69 public: |
70 CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); | 70 CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); |
71 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 71 int32_t OnProcessMessage(CFWL_Message* pMessage) override; |
72 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | 72 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; |
73 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 73 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, |
74 const CFX_Matrix* pMatrix = NULL) override; | 74 const CFX_Matrix* pMatrix = NULL) override; |
75 | 75 |
76 protected: | 76 protected: |
77 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 77 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
78 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 78 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
79 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 79 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
80 void OnMouseMove(CFWL_MsgMouse* pMsg); | 80 void OnMouseMove(CFWL_MsgMouse* pMsg); |
81 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 81 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
82 void OnKeyDown(CFWL_MsgKey* pMsg); | 82 void OnKeyDown(CFWL_MsgKey* pMsg); |
83 CFWL_ToolTipImp* m_pOwner; | 83 CFWL_ToolTipImp* m_pOwner; |
84 }; | 84 }; |
85 | 85 |
86 #endif // XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | 86 #endif // XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ |
OLD | NEW |