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