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