| 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 "../../include/pdfwindow/PDFWindow.h" | 7 #include "../../include/pdfwindow/PDFWindow.h" |
| 8 #include "../../include/pdfwindow/PWL_Wnd.h" | 8 #include "../../include/pdfwindow/PWL_Wnd.h" |
| 9 #include "../../include/pdfwindow/PWL_ListCtrl.h" | 9 #include "../../include/pdfwindow/PWL_ListCtrl.h" |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return m_ptScroll; | 45 return m_ptScroll; |
| 46 } | 46 } |
| 47 | 47 |
| 48 CPDF_Rect CPWL_ListCtrl::GetScrollArea() const | 48 CPDF_Rect CPWL_ListCtrl::GetScrollArea() const |
| 49 { | 49 { |
| 50 return m_rcContent; | 50 return m_rcContent; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CPWL_ListCtrl::ResetFace() | 53 void CPWL_ListCtrl::ResetFace() |
| 54 { | 54 { |
| 55 » ResetAll(FALSE, 0); | 55 » ResetAll(false, 0); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CPWL_ListCtrl::ResetContent(int32_t nStart) | 58 void CPWL_ListCtrl::ResetContent(int32_t nStart) |
| 59 { | 59 { |
| 60 if (nStart < 0) | 60 if (nStart < 0) |
| 61 nStart = 0; | 61 nStart = 0; |
| 62 if (nStart >= 0 && nStart < m_aChildren.GetSize()) | 62 if (nStart >= 0 && nStart < m_aChildren.GetSize()) |
| 63 » » ResetAll(TRUE, nStart); | 63 » » ResetAll(true, nStart); |
| 64 } | 64 } |
| 65 | 65 |
| 66 FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) | 66 FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) |
| 67 { | 67 { |
| 68 FX_FLOAT fRet = m_fTopSpace; | 68 FX_FLOAT fRet = m_fTopSpace; |
| 69 | 69 |
| 70 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); | 70 FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); |
| 71 | 71 |
| 72 if (fLimitWidth > fBorderWidth* 2) | 72 if (fLimitWidth > fBorderWidth* 2) |
| 73 { | 73 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 fRet -= m_fItemSpace; | 86 fRet -= m_fItemSpace; |
| 87 } | 87 } |
| 88 | 88 |
| 89 fRet += m_fBottomSpace; | 89 fRet += m_fBottomSpace; |
| 90 | 90 |
| 91 return fRet; | 91 return fRet; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void CPWL_ListCtrl::ResetAll(FX_BOOL bMove, int32_t nStart) | 94 void CPWL_ListCtrl::ResetAll(bool bMove, int32_t nStart) |
| 95 { | 95 { |
| 96 CPDF_Rect rcClient = GetClientRect(); | 96 CPDF_Rect rcClient = GetClientRect(); |
| 97 | 97 |
| 98 FX_FLOAT fWidth = rcClient.Width(); | 98 FX_FLOAT fWidth = rcClient.Width(); |
| 99 | 99 |
| 100 FX_FLOAT fy = 0.0f - m_fTopSpace; | 100 FX_FLOAT fy = 0.0f - m_fTopSpace; |
| 101 | 101 |
| 102 if (nStart-1 >= 0 && nStart-1 < m_aChildren.GetSize()) | 102 if (nStart-1 >= 0 && nStart-1 < m_aChildren.GetSize()) |
| 103 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart-1)) | 103 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart-1)) |
| 104 fy = pChild->GetWindowRect().bottom - m_fItemSpace; | 104 fy = pChild->GetWindowRect().bottom - m_fItemSpace; |
| 105 | 105 |
| 106 for (int32_t i=nStart,sz=m_aChildren.GetSize(); i<sz; i++) | 106 for (int32_t i=nStart,sz=m_aChildren.GetSize(); i<sz; i++) |
| 107 { | 107 { |
| 108 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) | 108 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) |
| 109 { | 109 { |
| 110 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); | 110 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); |
| 111 FX_FLOAT fRight = pChild->GetItemRightMargin(); | 111 FX_FLOAT fRight = pChild->GetItemRightMargin(); |
| 112 | 112 |
| 113 pChild->SetChildMatrix( | 113 pChild->SetChildMatrix( |
| 114 CPDF_Matrix(1,0,0,1, | 114 CPDF_Matrix(1,0,0,1, |
| 115 rcClient.left - m_ptScroll.x, | 115 rcClient.left - m_ptScroll.x, |
| 116 rcClient.top - m_ptScroll.y) | 116 rcClient.top - m_ptScroll.y) |
| 117 ); | 117 ); |
| 118 | 118 |
| 119 if (bMove) | 119 if (bMove) |
| 120 { | 120 { |
| 121 FX_FLOAT fItemHeight = pChild->GetItemHeight(fWi
dth - fLeft - fRight); | 121 FX_FLOAT fItemHeight = pChild->GetItemHeight(fWi
dth - fLeft - fRight); |
| 122 » » » » pChild->Move(CPDF_Rect(fLeft, fy-fItemHeight, fW
idth - fRight, fy), TRUE, FALSE); | 122 » » » » pChild->Move(CPDF_Rect(fLeft, fy-fItemHeight, fW
idth - fRight, fy), true, false); |
| 123 fy -= fItemHeight; | 123 fy -= fItemHeight; |
| 124 fy -= m_fItemSpace; | 124 fy -= m_fItemSpace; |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 fy += m_fItemSpace; | 129 fy += m_fItemSpace; |
| 130 | 130 |
| 131 fy -= m_fBottomSpace; | 131 fy -= m_fBottomSpace; |
| 132 | 132 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 CPDF_Rect CPWL_ListCtrl::OutToIn(const CPDF_Rect& rect) const | 236 CPDF_Rect CPWL_ListCtrl::OutToIn(const CPDF_Rect& rect) const |
| 237 { | 237 { |
| 238 CPDF_Rect rcClient = GetClientRect(); | 238 CPDF_Rect rcClient = GetClientRect(); |
| 239 | 239 |
| 240 return CPDF_Rect(rect.left - rcClient.left + m_ptScroll.x, | 240 return CPDF_Rect(rect.left - rcClient.left + m_ptScroll.x, |
| 241 rect.bottom - rcClient.top + m_ptScroll.y, | 241 rect.bottom - rcClient.top + m_ptScroll.y, |
| 242 rect.right - rcClient.left + m_ptScroll.x, | 242 rect.right - rcClient.left + m_ptScroll.x, |
| 243 rect.top - rcClient.top + m_ptScroll.y); | 243 rect.top - rcClient.top + m_ptScroll.y); |
| 244 } | 244 } |
| 245 | 245 |
| OLD | NEW |