| 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/cfwl_listbox.h" | 7 #include "xfa/fwl/cfwl_listbox.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 case FWL_STYLEEXT_LTB_RightAlign: { | 63 case FWL_STYLEEXT_LTB_RightAlign: { |
| 64 m_iTTOAligns = FDE_TTOALIGNMENT_CenterRight; | 64 m_iTTOAligns = FDE_TTOALIGNMENT_CenterRight; |
| 65 break; | 65 break; |
| 66 } | 66 } |
| 67 case FWL_STYLEEXT_LTB_CenterAlign: | 67 case FWL_STYLEEXT_LTB_CenterAlign: |
| 68 default: { | 68 default: { |
| 69 m_iTTOAligns = FDE_TTOALIGNMENT_Center; | 69 m_iTTOAligns = FDE_TTOALIGNMENT_Center; |
| 70 break; | 70 break; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) | |
| 74 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; | |
| 75 | |
| 76 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; | 73 m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; |
| 77 m_fScorllBarWidth = GetScrollWidth(); | 74 m_fScorllBarWidth = GetScrollWidth(); |
| 78 CalcSize(false); | 75 CalcSize(false); |
| 79 } | 76 } |
| 80 | 77 |
| 81 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { | 78 FWL_WidgetHit CFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) { |
| 82 if (IsShowScrollBar(false)) { | 79 if (IsShowScrollBar(false)) { |
| 83 CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect(); | 80 CFX_RectF rect = m_pHorzScrollBar->GetWidgetRect(); |
| 84 if (rect.Contains(fx, fy)) | 81 if (rect.Contains(fx, fy)) |
| 85 return FWL_WidgetHit::HScrollBar; | 82 return FWL_WidgetHit::HScrollBar; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 | 502 |
| 506 int32_t iCount = CountItems(this); | 503 int32_t iCount = CountItems(this); |
| 507 CFX_SizeF fs; | 504 CFX_SizeF fs; |
| 508 for (int32_t i = 0; i < iCount; i++) { | 505 for (int32_t i = 0; i < iCount; i++) { |
| 509 CFWL_ListItem* htem = GetItem(this, i); | 506 CFWL_ListItem* htem = GetItem(this, i); |
| 510 UpdateItemSize(htem, fs, fWidth, m_fItemHeight, bAutoSize); | 507 UpdateItemSize(htem, fs, fWidth, m_fItemHeight, bAutoSize); |
| 511 } | 508 } |
| 512 if (bAutoSize) | 509 if (bAutoSize) |
| 513 return fs; | 510 return fs; |
| 514 | 511 |
| 515 FX_FLOAT iWidth = m_rtClient.width - rtUIMargin.left - rtUIMargin.width; | |
| 516 FX_FLOAT iHeight = m_rtClient.height; | 512 FX_FLOAT iHeight = m_rtClient.height; |
| 517 bool bShowVertScr = false; | 513 bool bShowVertScr = false; |
| 518 bool bShowHorzScr = false; | 514 bool bShowHorzScr = false; |
| 519 if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll)) | 515 if (!bShowVertScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll)) |
| 520 bShowVertScr = (fs.y > iHeight); | 516 bShowVertScr = (fs.y > iHeight); |
| 521 if (!bShowHorzScr && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll)) | |
| 522 bShowHorzScr = (fs.x > iWidth); | |
| 523 | 517 |
| 524 CFX_SizeF szRange; | 518 CFX_SizeF szRange; |
| 525 if (bShowVertScr) { | 519 if (bShowVertScr) { |
| 526 if (!m_pVertScrollBar) | 520 if (!m_pVertScrollBar) |
| 527 InitVerticalScrollBar(); | 521 InitVerticalScrollBar(); |
| 528 | 522 |
| 529 CFX_RectF rtScrollBar; | 523 CFX_RectF rtScrollBar; |
| 530 rtScrollBar.Set(m_rtClient.right() - m_fScorllBarWidth, m_rtClient.top, | 524 rtScrollBar.Set(m_rtClient.right() - m_fScorllBarWidth, m_rtClient.top, |
| 531 m_fScorllBarWidth, m_rtClient.height - 1); | 525 m_fScorllBarWidth, m_rtClient.height - 1); |
| 532 if (bShowHorzScr) | 526 if (bShowHorzScr) |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 if (CFWL_ListItem* item = GetItem(this, iSel)) | 948 if (CFWL_ListItem* item = GetItem(this, iSel)) |
| 955 item->SetStates(item->GetStates() | FWL_ITEMSTATE_LTB_Selected); | 949 item->SetStates(item->GetStates() | FWL_ITEMSTATE_LTB_Selected); |
| 956 } | 950 } |
| 957 | 951 |
| 958 m_ItemArray.erase(m_ItemArray.begin() + nIndex); | 952 m_ItemArray.erase(m_ItemArray.begin() + nIndex); |
| 959 } | 953 } |
| 960 | 954 |
| 961 void CFWL_ListBox::DeleteAll() { | 955 void CFWL_ListBox::DeleteAll() { |
| 962 m_ItemArray.clear(); | 956 m_ItemArray.clear(); |
| 963 } | 957 } |
| OLD | NEW |