| 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 #include "xfa/include/fwl/lightwidget/tooltipctrl.h" | 7 #include "xfa/fwl/lightwidget/cfwl_tooltip.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "xfa/fwl/core/fwl_formimp.h" | 11 #include "xfa/fwl/core/fwl_formimp.h" |
| 12 #include "xfa/fwl/core/fwl_noteimp.h" | 12 #include "xfa/fwl/core/fwl_noteimp.h" |
| 13 #include "xfa/fwl/core/fwl_panelimp.h" | 13 #include "xfa/fwl/core/fwl_panelimp.h" |
| 14 #include "xfa/fwl/core/fwl_targetimp.h" | 14 #include "xfa/fwl/core/fwl_targetimp.h" |
| 15 #include "xfa/fwl/core/fwl_threadimp.h" | 15 #include "xfa/fwl/core/fwl_threadimp.h" |
| 16 #include "xfa/fwl/core/fwl_widgetimp.h" | 16 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 17 | 17 |
| 18 CFWL_ToolTip* CFWL_ToolTip::Create() { | 18 CFWL_ToolTip* CFWL_ToolTip::Create() { |
| 19 return new CFWL_ToolTip; | 19 return new CFWL_ToolTip; |
| 20 } | 20 } |
| 21 |
| 21 FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { | 22 FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { |
| 22 if (m_pIface) | 23 if (m_pIface) |
| 23 return FWL_ERR_Indefinite; | 24 return FWL_ERR_Indefinite; |
| 24 if (pProperties) { | 25 if (pProperties) { |
| 25 *m_pProperties = *pProperties; | 26 *m_pProperties = *pProperties; |
| 26 } | 27 } |
| 27 std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( | 28 std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( |
| 28 m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); | 29 m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); |
| 29 FWL_ERR ret = pToolTip->Initialize(); | 30 FWL_ERR ret = pToolTip->Initialize(); |
| 30 if (ret != FWL_ERR_Succeeded) { | 31 if (ret != FWL_ERR_Succeeded) { |
| 31 return ret; | 32 return ret; |
| 32 } | 33 } |
| 33 m_pIface = pToolTip.release(); | 34 m_pIface = pToolTip.release(); |
| 34 CFWL_Widget::Initialize(); | 35 CFWL_Widget::Initialize(); |
| 35 return FWL_ERR_Succeeded; | 36 return FWL_ERR_Succeeded; |
| 36 } | 37 } |
| 38 |
| 37 FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { | 39 FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { |
| 38 wsCaption = m_tooltipData.m_wsCaption; | 40 wsCaption = m_tooltipData.m_wsCaption; |
| 39 return FWL_ERR_Succeeded; | 41 return FWL_ERR_Succeeded; |
| 40 } | 42 } |
| 43 |
| 41 FWL_ERR CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { | 44 FWL_ERR CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { |
| 42 m_tooltipData.m_wsCaption = wsCaption; | 45 m_tooltipData.m_wsCaption = wsCaption; |
| 43 return FWL_ERR_Succeeded; | 46 return FWL_ERR_Succeeded; |
| 44 } | 47 } |
| 48 |
| 45 int32_t CFWL_ToolTip::GetInitialDelay() { | 49 int32_t CFWL_ToolTip::GetInitialDelay() { |
| 46 return m_tooltipData.m_nInitDelayTime; | 50 return m_tooltipData.m_nInitDelayTime; |
| 47 } | 51 } |
| 52 |
| 48 int32_t CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { | 53 int32_t CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { |
| 49 m_tooltipData.m_nInitDelayTime = nDelayTime; | 54 m_tooltipData.m_nInitDelayTime = nDelayTime; |
| 50 return FWL_ERR_Succeeded; | 55 return FWL_ERR_Succeeded; |
| 51 } | 56 } |
| 57 |
| 52 int32_t CFWL_ToolTip::GetAutoPopDelay() { | 58 int32_t CFWL_ToolTip::GetAutoPopDelay() { |
| 53 return m_tooltipData.m_nAutoPopDelayTime; | 59 return m_tooltipData.m_nAutoPopDelayTime; |
| 54 } | 60 } |
| 61 |
| 55 int32_t CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { | 62 int32_t CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { |
| 56 m_tooltipData.m_nAutoPopDelayTime = nDelayTime; | 63 m_tooltipData.m_nAutoPopDelayTime = nDelayTime; |
| 57 return FWL_ERR_Succeeded; | 64 return FWL_ERR_Succeeded; |
| 58 } | 65 } |
| 66 |
| 59 CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { | 67 CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { |
| 60 return m_tooltipData.m_pBitmap; | 68 return m_tooltipData.m_pBitmap; |
| 61 } | 69 } |
| 70 |
| 62 FWL_ERR CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { | 71 FWL_ERR CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { |
| 63 m_tooltipData.m_pBitmap = pBitmap; | 72 m_tooltipData.m_pBitmap = pBitmap; |
| 64 return FWL_ERR_Succeeded; | 73 return FWL_ERR_Succeeded; |
| 65 } | 74 } |
| 75 |
| 66 CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { | 76 CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { |
| 67 return m_tooltipData.m_fIconSize; | 77 return m_tooltipData.m_fIconSize; |
| 68 } | 78 } |
| 79 |
| 69 FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { | 80 FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { |
| 70 m_tooltipData.m_fIconSize = fSize; | 81 m_tooltipData.m_fIconSize = fSize; |
| 71 return FWL_ERR_Succeeded; | 82 return FWL_ERR_Succeeded; |
| 72 } | 83 } |
| 84 |
| 73 FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { | 85 FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { |
| 74 return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); | 86 return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); |
| 75 } | 87 } |
| 88 |
| 76 FWL_ERR CFWL_ToolTip::Show() { | 89 FWL_ERR CFWL_ToolTip::Show() { |
| 77 return static_cast<IFWL_ToolTip*>(m_pIface)->Show(); | 90 return static_cast<IFWL_ToolTip*>(m_pIface)->Show(); |
| 78 } | 91 } |
| 92 |
| 79 FWL_ERR CFWL_ToolTip::Hide() { | 93 FWL_ERR CFWL_ToolTip::Hide() { |
| 80 return static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); | 94 return static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); |
| 81 } | 95 } |
| 96 |
| 82 CFWL_ToolTip::CFWL_ToolTip() {} | 97 CFWL_ToolTip::CFWL_ToolTip() {} |
| 98 |
| 83 CFWL_ToolTip::~CFWL_ToolTip() {} | 99 CFWL_ToolTip::~CFWL_ToolTip() {} |
| 100 |
| 84 CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { | 101 CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { |
| 85 m_wsCaption = L""; | 102 m_wsCaption = L""; |
| 86 m_nInitDelayTime = 500; | 103 m_nInitDelayTime = 500; |
| 87 m_nAutoPopDelayTime = 50000; | 104 m_nAutoPopDelayTime = 50000; |
| 88 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | 105 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); |
| 89 } | 106 } |
| 107 |
| 90 FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, | 108 FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, |
| 91 CFX_WideString& wsCaption) { | 109 CFX_WideString& wsCaption) { |
| 92 wsCaption = m_wsCaption; | 110 wsCaption = m_wsCaption; |
| 93 return FWL_ERR_Succeeded; | 111 return FWL_ERR_Succeeded; |
| 94 } | 112 } |
| 113 |
| 95 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 114 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { |
| 96 return m_nInitDelayTime; | 115 return m_nInitDelayTime; |
| 97 } | 116 } |
| 117 |
| 98 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | 118 int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { |
| 99 return m_nAutoPopDelayTime; | 119 return m_nAutoPopDelayTime; |
| 100 } | 120 } |
| 121 |
| 101 CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon( | 122 CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon( |
| 102 IFWL_Widget* pWidget) { | 123 IFWL_Widget* pWidget) { |
| 103 return m_pBitmap; | 124 return m_pBitmap; |
| 104 } | 125 } |
| 126 |
| 105 CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize( | 127 CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize( |
| 106 IFWL_Widget* pWidget) { | 128 IFWL_Widget* pWidget) { |
| 107 return m_fIconSize; | 129 return m_fIconSize; |
| 108 } | 130 } |
| 131 |
| 109 CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() { | 132 CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() { |
| 110 return m_fAnchor; | 133 return m_fAnchor; |
| 111 } | 134 } |
| OLD | NEW |