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/fwl/basewidget/fwl_scrollbarimp.h" | 7 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" | 9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 m_fButtonLen = IsVertical() ? m_rtClient.width : m_rtClient.height; | 311 m_fButtonLen = IsVertical() ? m_rtClient.width : m_rtClient.height; |
312 FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width; | 312 FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width; |
313 if (fLength < m_fButtonLen * 2) { | 313 if (fLength < m_fButtonLen * 2) { |
314 m_fButtonLen = fLength / 2; | 314 m_fButtonLen = fLength / 2; |
315 m_bMinSize = TRUE; | 315 m_bMinSize = TRUE; |
316 } else { | 316 } else { |
317 m_bMinSize = FALSE; | 317 m_bMinSize = FALSE; |
318 } | 318 } |
319 } | 319 } |
320 void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) { | 320 void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) { |
321 if (m_bCustomLayout) { | 321 if (m_bCustomLayout) |
322 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 322 return; |
323 CFWL_ThemePart pPart; | 323 |
324 pPart.m_rtPart = m_rtMinBtn; | 324 rect.left = m_rtClient.left; |
325 pPart.m_pWidget = m_pInterface; | 325 rect.top = m_rtClient.top; |
326 pPart.m_iPart = CFWL_Part::ForeArrow; | 326 rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; |
327 pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) | 327 rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; |
328 ? CFWL_PartState_Disabled | |
329 : m_iMinButtonState; | |
330 pTheme->GetPartRect(&pPart, rect); | |
331 } else { | |
332 rect.left = m_rtClient.left; | |
333 rect.top = m_rtClient.top; | |
334 rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; | |
335 rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; | |
336 } | |
337 } | 328 } |
| 329 |
338 void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) { | 330 void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) { |
339 if (m_bCustomLayout) { | 331 if (m_bCustomLayout) |
340 IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; | 332 return; |
341 CFWL_ThemePart pPart; | 333 |
342 pPart.m_rtPart = m_rtMaxBtn; | 334 rect.left = |
343 pPart.m_pWidget = m_pInterface; | 335 IsVertical() ? m_rtClient.left : m_rtClient.right() - m_fButtonLen; |
344 pPart.m_iPart = CFWL_Part::BackArrow; | 336 rect.top = IsVertical() ? m_rtClient.bottom() - m_fButtonLen : m_rtClient.top; |
345 pPart.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) | 337 rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; |
346 ? CFWL_PartState_Disabled | 338 rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; |
347 : m_iMaxButtonState; | |
348 pTheme->GetPartRect(&pPart, rect); | |
349 } else { | |
350 rect.left = | |
351 IsVertical() ? m_rtClient.left : m_rtClient.right() - m_fButtonLen; | |
352 rect.top = | |
353 IsVertical() ? m_rtClient.bottom() - m_fButtonLen : m_rtClient.top; | |
354 rect.width = IsVertical() ? m_rtClient.width : m_fButtonLen; | |
355 rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height; | |
356 } | |
357 } | 339 } |
| 340 |
358 void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) { | 341 void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) { |
359 if (!IsEnabled()) { | 342 if (!IsEnabled()) { |
360 m_rtThumb.Reset(); | 343 m_rtThumb.Reset(); |
361 return; | 344 return; |
362 } | 345 } |
363 if (m_bMinSize) { | 346 if (m_bMinSize) { |
364 m_rtThumb.Empty(); | 347 m_rtThumb.Empty(); |
365 return; | 348 return; |
366 } | 349 } |
367 FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; | 350 FX_FLOAT fRange = m_fRangeMax - m_fRangeMin; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 } | 787 } |
805 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, | 788 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, |
806 const CFX_RectF& rtItem, | 789 const CFX_RectF& rtItem, |
807 int32_t& iState) { | 790 int32_t& iState) { |
808 if (iState == CFWL_PartState_Hovered) { | 791 if (iState == CFWL_PartState_Hovered) { |
809 return; | 792 return; |
810 } | 793 } |
811 iState = CFWL_PartState_Hovered; | 794 iState = CFWL_PartState_Hovered; |
812 m_pOwner->Repaint(&rtItem); | 795 m_pOwner->Repaint(&rtItem); |
813 } | 796 } |
OLD | NEW |