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_CORE_IFWL_TOOLTIP_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_TOOLTIP_H_ |
8 #define XFA_FWL_CORE_IFWL_TOOLTIP_H_ | 8 #define XFA_FWL_CORE_IFWL_TOOLTIP_H_ |
9 | 9 |
10 #include "xfa/fwl/core/ifwl_form.h" | 10 #include "xfa/fwl/core/ifwl_form.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 CFX_WideString& wsCaption) override = 0; | 27 CFX_WideString& wsCaption) override = 0; |
28 | 28 |
29 virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; | 29 virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; |
30 virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; | 30 virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; |
31 virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; | 31 virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; |
32 virtual CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) = 0; | 32 virtual CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) = 0; |
33 }; | 33 }; |
34 | 34 |
35 class IFWL_ToolTip : public IFWL_Form { | 35 class IFWL_ToolTip : public IFWL_Form { |
36 public: | 36 public: |
37 IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 37 IFWL_ToolTip(const IFWL_App* app, |
| 38 const CFWL_WidgetImpProperties& properties, |
| 39 IFWL_Widget* pOuter); |
38 ~IFWL_ToolTip() override; | 40 ~IFWL_ToolTip() override; |
39 | 41 |
40 // IFWL_Widget | 42 // IFWL_Widget |
| 43 void Initialize() override; |
| 44 void Finalize() override; |
41 FWL_Type GetClassID() const override; | 45 FWL_Type GetClassID() const override; |
42 FWL_Error Initialize() override; | |
43 void Finalize() override; | |
44 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 46 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
45 FWL_Error Update() override; | 47 FWL_Error Update() override; |
46 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 48 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
47 const CFX_Matrix* pMatrix = nullptr) override; | 49 const CFX_Matrix* pMatrix = nullptr) override; |
48 void SetStates(uint32_t dwStates, FX_BOOL bSet) override; | 50 void SetStates(uint32_t dwStates, FX_BOOL bSet) override; |
49 FWL_Error GetClientRect(CFX_RectF& rect) override; | 51 FWL_Error GetClientRect(CFX_RectF& rect) override; |
50 | 52 |
51 void SetAnchor(const CFX_RectF& rtAnchor); | 53 void SetAnchor(const CFX_RectF& rtAnchor); |
52 void Show(); | 54 void Show(); |
53 void Hide(); | 55 void Hide(); |
54 | 56 |
55 protected: | 57 protected: |
56 friend class CFWL_ToolTipImpDelegate; | 58 friend class CFWL_ToolTipImpDelegate; |
57 friend class CFWL_ToolTipTimer; | |
58 | 59 |
59 class CFWL_ToolTipTimer : public IFWL_Timer { | 60 class Timer : public IFWL_Timer { |
60 public: | 61 public: |
61 CFWL_ToolTipTimer() {} | 62 explicit Timer(IFWL_ToolTip* pToolTip); |
62 explicit CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip); | 63 ~Timer() override {} |
63 ~CFWL_ToolTipTimer() override {} | |
64 | 64 |
65 void Run(IFWL_TimerInfo* pTimerInfo) override; | 65 void Run(IFWL_TimerInfo* pTimerInfo) override; |
66 | |
67 IFWL_ToolTip* m_pToolTip; | |
68 }; | 66 }; |
| 67 friend class IFWL_ToolTip::Timer; |
69 | 68 |
70 void DrawBkground(CFX_Graphics* pGraphics, | 69 void DrawBkground(CFX_Graphics* pGraphics, |
71 IFWL_ThemeProvider* pTheme, | 70 IFWL_ThemeProvider* pTheme, |
72 const CFX_Matrix* pMatrix); | 71 const CFX_Matrix* pMatrix); |
73 void DrawText(CFX_Graphics* pGraphics, | 72 void DrawText(CFX_Graphics* pGraphics, |
74 IFWL_ThemeProvider* pTheme, | 73 IFWL_ThemeProvider* pTheme, |
75 const CFX_Matrix* pMatrix); | 74 const CFX_Matrix* pMatrix); |
76 void UpdateTextOutStyles(); | 75 void UpdateTextOutStyles(); |
77 void RefreshToolTipPos(); | 76 void RefreshToolTipPos(); |
78 | 77 |
79 CFX_RectF m_rtClient; | 78 CFX_RectF m_rtClient; |
80 CFX_RectF m_rtCaption; | 79 CFX_RectF m_rtCaption; |
81 FX_BOOL m_bBtnDown; | 80 FX_BOOL m_bBtnDown; |
82 uint32_t m_dwTTOStyles; | 81 uint32_t m_dwTTOStyles; |
83 int32_t m_iTTOAlign; | 82 int32_t m_iTTOAlign; |
84 CFX_RectF m_rtAnchor; | 83 CFX_RectF m_rtAnchor; |
85 IFWL_TimerInfo* m_pTimerInfoShow; | 84 IFWL_TimerInfo* m_pTimerInfoShow; |
86 IFWL_TimerInfo* m_pTimerInfoHide; | 85 IFWL_TimerInfo* m_pTimerInfoHide; |
87 CFWL_ToolTipTimer m_TimerShow; | 86 IFWL_ToolTip::Timer m_TimerShow; |
88 CFWL_ToolTipTimer m_TimerHide; | 87 IFWL_ToolTip::Timer m_TimerHide; |
89 }; | 88 }; |
90 | 89 |
91 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { | 90 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { |
92 public: | 91 public: |
93 CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner); | 92 CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner); |
94 void OnProcessMessage(CFWL_Message* pMessage) override; | 93 void OnProcessMessage(CFWL_Message* pMessage) override; |
95 void OnProcessEvent(CFWL_Event* pEvent) override; | 94 void OnProcessEvent(CFWL_Event* pEvent) override; |
96 void OnDrawWidget(CFX_Graphics* pGraphics, | 95 void OnDrawWidget(CFX_Graphics* pGraphics, |
97 const CFX_Matrix* pMatrix = nullptr) override; | 96 const CFX_Matrix* pMatrix = nullptr) override; |
98 | 97 |
99 protected: | 98 protected: |
100 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 99 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
101 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 100 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
102 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 101 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
103 void OnMouseMove(CFWL_MsgMouse* pMsg); | 102 void OnMouseMove(CFWL_MsgMouse* pMsg); |
104 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 103 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
105 void OnKeyDown(CFWL_MsgKey* pMsg); | 104 void OnKeyDown(CFWL_MsgKey* pMsg); |
106 IFWL_ToolTip* m_pOwner; | 105 IFWL_ToolTip* m_pOwner; |
107 }; | 106 }; |
108 | 107 |
109 #endif // XFA_FWL_CORE_IFWL_TOOLTIP_H_ | 108 #endif // XFA_FWL_CORE_IFWL_TOOLTIP_H_ |
OLD | NEW |