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_SRC_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | |
8 #define XFA_SRC_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | |
9 | |
10 #include "xfa/include/fwl/core/fwl_timer.h" | |
11 #include "xfa/src/fwl/core/fwl_formimp.h" | |
12 #include "xfa/src/fwl/core/fwl_widgetimp.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 virtual ~CFWL_ToolTipImp(); | |
23 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | |
24 virtual FX_DWORD GetClassID() const; | |
25 virtual FWL_ERR Initialize(); | |
26 virtual FWL_ERR Finalize(); | |
27 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | |
28 virtual FWL_ERR Update(); | |
29 virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, | |
30 const CFX_Matrix* pMatrix = NULL); | |
31 virtual FWL_ERR SetStates(FX_DWORD dwStates, FX_BOOL bSet); | |
32 virtual FWL_ERR GetClientRect(CFX_RectF& rect); | |
33 FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); | |
34 FWL_ERR Show(); | |
35 FWL_ERR Hide(); | |
36 | |
37 protected: | |
38 void DrawBkground(CFX_Graphics* pGraphics, | |
39 IFWL_ThemeProvider* pTheme, | |
40 const CFX_Matrix* pMatrix); | |
41 void DrawText(CFX_Graphics* pGraphics, | |
42 IFWL_ThemeProvider* pTheme, | |
43 const CFX_Matrix* pMatrix); | |
44 void UpdateTextOutStyles(); | |
45 void RefreshToolTipPos(); | |
46 class CFWL_ToolTipTimer : public IFWL_Timer { | |
47 public: | |
48 CFWL_ToolTipTimer() {} | |
49 ~CFWL_ToolTipTimer() {} | |
50 CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip); | |
51 virtual int32_t Run(FWL_HTIMER hTimer); | |
52 CFWL_ToolTipImp* m_pToolTip; | |
53 }; | |
54 CFX_RectF m_rtClient; | |
55 CFX_RectF m_rtCaption; | |
56 FX_BOOL m_bBtnDown; | |
57 FX_DWORD m_dwTTOStyles; | |
58 int32_t m_iTTOAlign; | |
59 CFX_RectF m_rtAnchor; | |
60 FWL_HTIMER m_hTimerShow; | |
61 FWL_HTIMER m_hTimerHide; | |
62 CFWL_ToolTipTimer* m_pTimer; | |
63 CFWL_ToolTipTimer m_TimerShow; | |
64 CFWL_ToolTipTimer m_TimerHide; | |
65 friend class CFWL_ToolTipImpDelegate; | |
66 friend class CFWL_ToolTipTimer; | |
67 }; | |
68 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { | |
69 public: | |
70 CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); | |
71 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | |
72 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | |
73 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | |
74 const CFX_Matrix* pMatrix = NULL) override; | |
75 | |
76 protected: | |
77 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | |
78 void OnLButtonDown(CFWL_MsgMouse* pMsg); | |
79 void OnLButtonUp(CFWL_MsgMouse* pMsg); | |
80 void OnMouseMove(CFWL_MsgMouse* pMsg); | |
81 void OnMouseLeave(CFWL_MsgMouse* pMsg); | |
82 void OnKeyDown(CFWL_MsgKey* pMsg); | |
83 CFWL_ToolTipImp* m_pOwner; | |
84 }; | |
85 | |
86 #endif // XFA_SRC_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | |
OLD | NEW |