| 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_CORE_IFWL_TOOLTIP_H_ |
| 8 #define XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | 8 #define XFA_FWL_CORE_IFWL_TOOLTIP_H_ |
| 9 | 9 |
| 10 #include "xfa/fwl/core/fwl_formimp.h" | 10 #include "xfa/fwl/core/ifwl_form.h" |
| 11 #include "xfa/fwl/core/fwl_widgetimp.h" | |
| 12 #include "xfa/fwl/core/ifwl_timer.h" | 11 #include "xfa/fwl/core/ifwl_timer.h" |
| 13 | 12 |
| 14 class CFWL_WidgetImpProperties; | 13 class CFWL_WidgetImpProperties; |
| 15 class IFWL_Widget; | 14 class IFWL_Widget; |
| 16 class CFWL_ToolTipImpDelegate; | 15 class CFWL_ToolTipImpDelegate; |
| 17 | 16 |
| 18 class CFWL_ToolTipImp : public CFWL_FormImp { | 17 #define FWL_CLASS_ToolTip L"FWL_TOOLTIP" |
| 18 #define FWL_STYLEEXT_TTP_Rectangle (0L << 3) |
| 19 #define FWL_STYLEEXT_TTP_RoundCorner (1L << 3) |
| 20 #define FWL_STYLEEXT_TTP_Balloon (1L << 4) |
| 21 #define FWL_STYLEEXT_TTP_Multiline (1L << 5) |
| 22 #define FWL_STYLEEXT_TTP_NoAnchor (1L << 6) |
| 23 |
| 24 class IFWL_ToolTipDP : public IFWL_DataProvider { |
| 19 public: | 25 public: |
| 20 CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, | 26 // IFWL_DataProvider |
| 21 IFWL_Widget* pOuter); | 27 FWL_Error GetCaption(IFWL_Widget* pWidget, |
| 22 ~CFWL_ToolTipImp() override; | 28 CFX_WideString& wsCaption) override = 0; |
| 23 | 29 |
| 24 // CFWL_WidgetImp | 30 virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; |
| 31 virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; |
| 32 virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; |
| 33 virtual CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) = 0; |
| 34 }; |
| 35 |
| 36 class IFWL_ToolTip : public IFWL_Form { |
| 37 public: |
| 38 static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties, |
| 39 IFWL_Widget* pOuter); |
| 40 |
| 41 IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
| 42 ~IFWL_ToolTip() override; |
| 43 |
| 44 // IFWL_Widget |
| 25 FWL_Error GetClassName(CFX_WideString& wsClass) const override; | 45 FWL_Error GetClassName(CFX_WideString& wsClass) const override; |
| 26 FWL_Type GetClassID() const override; | 46 FWL_Type GetClassID() const override; |
| 27 FWL_Error Initialize() override; | 47 FWL_Error Initialize() override; |
| 28 FWL_Error Finalize() override; | 48 FWL_Error Finalize() override; |
| 29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 49 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
| 30 FWL_Error Update() override; | 50 FWL_Error Update() override; |
| 31 FWL_Error DrawWidget(CFX_Graphics* pGraphics, | 51 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 32 const CFX_Matrix* pMatrix = nullptr) override; | 52 const CFX_Matrix* pMatrix = nullptr) override; |
| 33 void SetStates(uint32_t dwStates, FX_BOOL bSet) override; | 53 void SetStates(uint32_t dwStates, FX_BOOL bSet) override; |
| 34 FWL_Error GetClientRect(CFX_RectF& rect) override; | 54 FWL_Error GetClientRect(CFX_RectF& rect) override; |
| 35 | 55 |
| 36 void SetAnchor(const CFX_RectF& rtAnchor); | 56 void SetAnchor(const CFX_RectF& rtAnchor); |
| 37 void Show(); | 57 void Show(); |
| 38 void Hide(); | 58 void Hide(); |
| 39 | 59 |
| 40 protected: | 60 protected: |
| 41 friend class CFWL_ToolTipImpDelegate; | 61 friend class CFWL_ToolTipImpDelegate; |
| 42 friend class CFWL_ToolTipTimer; | 62 friend class CFWL_ToolTipTimer; |
| 43 | 63 |
| 44 class CFWL_ToolTipTimer : public IFWL_Timer { | 64 class CFWL_ToolTipTimer : public IFWL_Timer { |
| 45 public: | 65 public: |
| 46 CFWL_ToolTipTimer() {} | 66 CFWL_ToolTipTimer() {} |
| 47 explicit CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip); | 67 explicit CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip); |
| 48 ~CFWL_ToolTipTimer() override {} | 68 ~CFWL_ToolTipTimer() override {} |
| 49 | 69 |
| 50 void Run(IFWL_TimerInfo* pTimerInfo) override; | 70 void Run(IFWL_TimerInfo* pTimerInfo) override; |
| 51 | 71 |
| 52 CFWL_ToolTipImp* m_pToolTip; | 72 IFWL_ToolTip* m_pToolTip; |
| 53 }; | 73 }; |
| 54 | 74 |
| 55 void DrawBkground(CFX_Graphics* pGraphics, | 75 void DrawBkground(CFX_Graphics* pGraphics, |
| 56 IFWL_ThemeProvider* pTheme, | 76 IFWL_ThemeProvider* pTheme, |
| 57 const CFX_Matrix* pMatrix); | 77 const CFX_Matrix* pMatrix); |
| 58 void DrawText(CFX_Graphics* pGraphics, | 78 void DrawText(CFX_Graphics* pGraphics, |
| 59 IFWL_ThemeProvider* pTheme, | 79 IFWL_ThemeProvider* pTheme, |
| 60 const CFX_Matrix* pMatrix); | 80 const CFX_Matrix* pMatrix); |
| 61 void UpdateTextOutStyles(); | 81 void UpdateTextOutStyles(); |
| 62 void RefreshToolTipPos(); | 82 void RefreshToolTipPos(); |
| 63 | 83 |
| 64 CFX_RectF m_rtClient; | 84 CFX_RectF m_rtClient; |
| 65 CFX_RectF m_rtCaption; | 85 CFX_RectF m_rtCaption; |
| 66 FX_BOOL m_bBtnDown; | 86 FX_BOOL m_bBtnDown; |
| 67 uint32_t m_dwTTOStyles; | 87 uint32_t m_dwTTOStyles; |
| 68 int32_t m_iTTOAlign; | 88 int32_t m_iTTOAlign; |
| 69 CFX_RectF m_rtAnchor; | 89 CFX_RectF m_rtAnchor; |
| 70 IFWL_TimerInfo* m_pTimerInfoShow; | 90 IFWL_TimerInfo* m_pTimerInfoShow; |
| 71 IFWL_TimerInfo* m_pTimerInfoHide; | 91 IFWL_TimerInfo* m_pTimerInfoHide; |
| 72 CFWL_ToolTipTimer m_TimerShow; | 92 CFWL_ToolTipTimer m_TimerShow; |
| 73 CFWL_ToolTipTimer m_TimerHide; | 93 CFWL_ToolTipTimer m_TimerHide; |
| 74 }; | 94 }; |
| 75 | 95 |
| 76 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { | 96 class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { |
| 77 public: | 97 public: |
| 78 CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); | 98 CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner); |
| 79 void OnProcessMessage(CFWL_Message* pMessage) override; | 99 void OnProcessMessage(CFWL_Message* pMessage) override; |
| 80 void OnProcessEvent(CFWL_Event* pEvent) override; | 100 void OnProcessEvent(CFWL_Event* pEvent) override; |
| 81 void OnDrawWidget(CFX_Graphics* pGraphics, | 101 void OnDrawWidget(CFX_Graphics* pGraphics, |
| 82 const CFX_Matrix* pMatrix = nullptr) override; | 102 const CFX_Matrix* pMatrix = nullptr) override; |
| 83 | 103 |
| 84 protected: | 104 protected: |
| 85 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); | 105 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); |
| 86 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 106 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
| 87 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 107 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
| 88 void OnMouseMove(CFWL_MsgMouse* pMsg); | 108 void OnMouseMove(CFWL_MsgMouse* pMsg); |
| 89 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 109 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
| 90 void OnKeyDown(CFWL_MsgKey* pMsg); | 110 void OnKeyDown(CFWL_MsgKey* pMsg); |
| 91 CFWL_ToolTipImp* m_pOwner; | 111 IFWL_ToolTip* m_pOwner; |
| 92 }; | 112 }; |
| 93 | 113 |
| 94 #endif // XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_ | 114 #endif // XFA_FWL_CORE_IFWL_TOOLTIP_H_ |
| OLD | NEW |