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 "fpdfsdk/include/pdfwindow/PDFWindow.h" | 7 #include "fpdfsdk/include/pdfwindow/PDFWindow.h" |
8 #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" | 8 #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" |
9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" | 9 #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 if (nStart - 1 >= 0 && nStart - 1 < m_aChildren.GetSize()) | 89 if (nStart - 1 >= 0 && nStart - 1 < m_aChildren.GetSize()) |
90 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart - 1)) | 90 if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart - 1)) |
91 fy = pChild->GetWindowRect().bottom - m_fItemSpace; | 91 fy = pChild->GetWindowRect().bottom - m_fItemSpace; |
92 | 92 |
93 for (int32_t i = nStart, sz = m_aChildren.GetSize(); i < sz; i++) { | 93 for (int32_t i = nStart, sz = m_aChildren.GetSize(); i < sz; i++) { |
94 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 94 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
95 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); | 95 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); |
96 FX_FLOAT fRight = pChild->GetItemRightMargin(); | 96 FX_FLOAT fRight = pChild->GetItemRightMargin(); |
97 | 97 |
98 pChild->SetChildMatrix(CPDF_Matrix(1, 0, 0, 1, | 98 pChild->SetChildMatrix(CFX_Matrix(1, 0, 0, 1, |
99 rcClient.left - m_ptScroll.x, | 99 rcClient.left - m_ptScroll.x, |
100 rcClient.top - m_ptScroll.y)); | 100 rcClient.top - m_ptScroll.y)); |
101 | 101 |
102 if (bMove) { | 102 if (bMove) { |
103 FX_FLOAT fItemHeight = pChild->GetItemHeight(fWidth - fLeft - fRight); | 103 FX_FLOAT fItemHeight = pChild->GetItemHeight(fWidth - fLeft - fRight); |
104 pChild->Move(CPDF_Rect(fLeft, fy - fItemHeight, fWidth - fRight, fy), | 104 pChild->Move(CPDF_Rect(fLeft, fy - fItemHeight, fWidth - fRight, fy), |
105 TRUE, FALSE); | 105 TRUE, FALSE); |
106 fy -= fItemHeight; | 106 fy -= fItemHeight; |
107 fy -= m_fItemSpace; | 107 fy -= m_fItemSpace; |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
(...skipping 20 matching lines...) Expand all Loading... |
131 | 131 |
132 void CPWL_ListCtrl::SetBottomSpace(FX_FLOAT fSpace) { | 132 void CPWL_ListCtrl::SetBottomSpace(FX_FLOAT fSpace) { |
133 m_fBottomSpace = fSpace; | 133 m_fBottomSpace = fSpace; |
134 } | 134 } |
135 | 135 |
136 void CPWL_ListCtrl::RePosChildWnd() { | 136 void CPWL_ListCtrl::RePosChildWnd() { |
137 ResetFace(); | 137 ResetFace(); |
138 } | 138 } |
139 | 139 |
140 void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, | 140 void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, |
141 CPDF_Matrix* pUser2Device) { | 141 CFX_Matrix* pUser2Device) { |
142 pDevice->SaveState(); | 142 pDevice->SaveState(); |
143 CPDF_Rect rcClient = GetClientRect(); | 143 CPDF_Rect rcClient = GetClientRect(); |
144 CPDF_Rect rcTemp = rcClient; | 144 CPDF_Rect rcTemp = rcClient; |
145 pUser2Device->TransformRect(rcTemp); | 145 pUser2Device->TransformRect(rcTemp); |
146 FX_RECT rcClip((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, | 146 FX_RECT rcClip((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, |
147 (int32_t)rcTemp.right, (int32_t)rcTemp.top); | 147 (int32_t)rcTemp.right, (int32_t)rcTemp.top); |
148 | 148 |
149 pDevice->SetClip_Rect(&rcClip); | 149 pDevice->SetClip_Rect(&rcClip); |
150 | 150 |
151 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { | 151 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { |
152 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 152 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
153 CPDF_Rect rcChild = pChild->ChildToParent(pChild->GetWindowRect()); | 153 CPDF_Rect rcChild = pChild->ChildToParent(pChild->GetWindowRect()); |
154 if (!(rcChild.top < rcClient.bottom || rcChild.bottom > rcClient.top)) { | 154 if (!(rcChild.top < rcClient.bottom || rcChild.bottom > rcClient.top)) { |
155 CPDF_Matrix mt = pChild->GetChildMatrix(); | 155 CFX_Matrix mt = pChild->GetChildMatrix(); |
156 if (mt.IsIdentity()) { | 156 if (mt.IsIdentity()) { |
157 pChild->DrawAppearance(pDevice, pUser2Device); | 157 pChild->DrawAppearance(pDevice, pUser2Device); |
158 } else { | 158 } else { |
159 mt.Concat(*pUser2Device); | 159 mt.Concat(*pUser2Device); |
160 pChild->DrawAppearance(pDevice, &mt); | 160 pChild->DrawAppearance(pDevice, &mt); |
161 } | 161 } |
162 } | 162 } |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 199 } |
200 | 200 |
201 CPDF_Rect CPWL_ListCtrl::OutToIn(const CPDF_Rect& rect) const { | 201 CPDF_Rect CPWL_ListCtrl::OutToIn(const CPDF_Rect& rect) const { |
202 CPDF_Rect rcClient = GetClientRect(); | 202 CPDF_Rect rcClient = GetClientRect(); |
203 | 203 |
204 return CPDF_Rect(rect.left - rcClient.left + m_ptScroll.x, | 204 return CPDF_Rect(rect.left - rcClient.left + m_ptScroll.x, |
205 rect.bottom - rcClient.top + m_ptScroll.y, | 205 rect.bottom - rcClient.top + m_ptScroll.y, |
206 rect.right - rcClient.left + m_ptScroll.x, | 206 rect.right - rcClient.left + m_ptScroll.x, |
207 rect.top - rcClient.top + m_ptScroll.y); | 207 rect.top - rcClient.top + m_ptScroll.y); |
208 } | 208 } |
OLD | NEW |