Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: xfa/fwl/core/ifwl_tooltip.cpp

Issue 2511183002: Remove IFWL_ToolTipDP (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_tooltip.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fwl/core/ifwl_tooltip.h" 7 #include "xfa/fwl/core/ifwl_tooltip.h"
8 8
9 #include "third_party/base/ptr_util.h" 9 #include "third_party/base/ptr_util.h"
10 #include "xfa/fde/tto/fde_textout.h" 10 #include "xfa/fde/tto/fde_textout.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if (!bAutoSize) { 43 if (!bAutoSize) {
44 rect = m_pProperties->m_rtWidget; 44 rect = m_pProperties->m_rtWidget;
45 return; 45 return;
46 } 46 }
47 47
48 rect.Set(0, 0, 0, 0); 48 rect.Set(0, 0, 0, 0);
49 if (!m_pProperties->m_pThemeProvider) 49 if (!m_pProperties->m_pThemeProvider)
50 m_pProperties->m_pThemeProvider = GetAvailableTheme(); 50 m_pProperties->m_pThemeProvider = GetAvailableTheme();
51 51
52 CFX_WideString wsCaption; 52 CFX_WideString wsCaption;
53 IFWL_ToolTipDP* pData = 53 if (m_pProperties->m_pDataProvider)
54 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider); 54 m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
55 if (pData)
56 pData->GetCaption(this, wsCaption);
57 55
58 int32_t iLen = wsCaption.GetLength(); 56 int32_t iLen = wsCaption.GetLength();
59 if (iLen > 0) { 57 if (iLen > 0) {
60 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider); 58 CFX_SizeF sz = CalcTextSize(wsCaption, m_pProperties->m_pThemeProvider);
61 rect.Set(0, 0, sz.x, sz.y); 59 rect.Set(0, 0, sz.x, sz.y);
62 rect.width += 25; 60 rect.width += 25;
63 rect.height += 16; 61 rect.height += 16;
64 } 62 }
65 IFWL_Widget::GetWidgetRect(rect, true); 63 IFWL_Widget::GetWidgetRect(rect, true);
66 } 64 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 145
148 void IFWL_ToolTip::UpdateTextOutStyles() { 146 void IFWL_ToolTip::UpdateTextOutStyles() {
149 m_iTTOAlign = FDE_TTOALIGNMENT_Center; 147 m_iTTOAlign = FDE_TTOALIGNMENT_Center;
150 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; 148 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
151 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) 149 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading)
152 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; 150 m_dwTTOStyles |= FDE_TTOSTYLE_RTL;
153 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_Multiline) 151 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_Multiline)
154 m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine; 152 m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine;
155 } 153 }
156 154
157 void IFWL_ToolTip::SetStates(uint32_t dwStates, bool bSet) {
158 if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
159 IFWL_ToolTipDP* pData =
160 static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
161 int32_t nAutoPopDelay = pData->GetAutoPopDelay(this);
162 m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
163 }
164 IFWL_Widget::SetStates(dwStates, bSet);
165 }
166
167 void IFWL_ToolTip::RefreshToolTipPos() { 155 void IFWL_ToolTip::RefreshToolTipPos() {
168 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) { 156 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) {
169 CFX_RectF rtPopup; 157 CFX_RectF rtPopup;
170 CFX_RectF rtWidget(m_pProperties->m_rtWidget); 158 CFX_RectF rtWidget(m_pProperties->m_rtWidget);
171 CFX_RectF rtAnchor(m_rtAnchor); 159 CFX_RectF rtAnchor(m_rtAnchor);
172 rtPopup.Set(0, 0, 0, 0); 160 rtPopup.Set(0, 0, 0, 0);
173 FX_FLOAT fx = rtAnchor.Center().x + 20; 161 FX_FLOAT fx = rtAnchor.Center().x + 20;
174 FX_FLOAT fy = rtAnchor.Center().y + 20; 162 FX_FLOAT fy = rtAnchor.Center().y + 20;
175 rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height()); 163 rtPopup.Set(fx, fy, rtWidget.Width(), rtWidget.Height());
176 164
(...skipping 29 matching lines...) Expand all
206 pToolTip->m_pTimerInfoShow = nullptr; 194 pToolTip->m_pTimerInfoShow = nullptr;
207 return; 195 return;
208 } 196 }
209 } 197 }
210 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) { 198 if (pToolTip->m_pTimerInfoHide == pTimerInfo && pToolTip->m_pTimerInfoHide) {
211 pToolTip->SetStates(FWL_WGTSTATE_Invisible, true); 199 pToolTip->SetStates(FWL_WGTSTATE_Invisible, true);
212 pToolTip->m_pTimerInfoHide->StopTimer(); 200 pToolTip->m_pTimerInfoHide->StopTimer();
213 pToolTip->m_pTimerInfoHide = nullptr; 201 pToolTip->m_pTimerInfoHide = nullptr;
214 } 202 }
215 } 203 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_tooltip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698