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