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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(FX_INT32 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)this->GetBorderWidth(); | 70 FX_FLOAT fBorderWidth = (FX_FLOAT)this->GetBorderWidth(); |
71 | 71 |
72 if (fLimitWidth > fBorderWidth* 2) | 72 if (fLimitWidth > fBorderWidth* 2) |
73 { | 73 { |
74 » » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) | 74 » » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) |
75 { | 75 { |
76 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) | 76 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) |
77 { | 77 { |
78 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); | 78 FX_FLOAT fLeft = pChild->GetItemLeftMargin(); |
79 FX_FLOAT fRight = pChild->GetItemRightMargin(); | 79 FX_FLOAT fRight = pChild->GetItemRightMargin(); |
80 | 80 |
81 fRet += pChild->GetItemHeight(fLimitWidth - fBor
derWidth* 2 - fLeft - fRight); | 81 fRet += pChild->GetItemHeight(fLimitWidth - fBor
derWidth* 2 - fLeft - fRight); |
82 fRet += m_fItemSpace; | 82 fRet += m_fItemSpace; |
83 } | 83 } |
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, FX_INT32 nStart) | 94 void CPWL_ListCtrl::ResetAll(FX_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 (FX_INT32 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) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 { | 158 { |
159 ResetFace(); | 159 ResetFace(); |
160 } | 160 } |
161 | 161 |
162 void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix*
pUser2Device) | 162 void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix*
pUser2Device) |
163 { | 163 { |
164 pDevice->SaveState(); | 164 pDevice->SaveState(); |
165 CPDF_Rect rcClient = GetClientRect(); | 165 CPDF_Rect rcClient = GetClientRect(); |
166 CPDF_Rect rcTemp = rcClient; | 166 CPDF_Rect rcTemp = rcClient; |
167 pUser2Device->TransformRect(rcTemp); | 167 pUser2Device->TransformRect(rcTemp); |
168 » FX_RECT rcClip((FX_INT32)rcTemp.left, | 168 » FX_RECT rcClip((int32_t)rcTemp.left, |
169 » » (FX_INT32)rcTemp.bottom, | 169 » » (int32_t)rcTemp.bottom, |
170 » » (FX_INT32)rcTemp.right, | 170 » » (int32_t)rcTemp.right, |
171 » » (FX_INT32)rcTemp.top); | 171 » » (int32_t)rcTemp.top); |
172 | 172 |
173 pDevice->SetClip_Rect(&rcClip); | 173 pDevice->SetClip_Rect(&rcClip); |
174 | 174 |
175 » for (FX_INT32 i=0,sz=m_aChildren.GetSize(); i<sz; i++) | 175 » for (int32_t i=0,sz=m_aChildren.GetSize(); i<sz; i++) |
176 { | 176 { |
177 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) | 177 if (CPWL_Wnd * pChild = m_aChildren.GetAt(i)) |
178 { | 178 { |
179 CPDF_Rect rcChild = pChild->ChildToParent(pChild->GetWin
dowRect()); | 179 CPDF_Rect rcChild = pChild->ChildToParent(pChild->GetWin
dowRect()); |
180 if (!(rcChild.top < rcClient.bottom || rcChild.bottom >
rcClient.top)) | 180 if (!(rcChild.top < rcClient.bottom || rcChild.bottom >
rcClient.top)) |
181 { | 181 { |
182 CPDF_Matrix mt = pChild->GetChildMatrix(); | 182 CPDF_Matrix mt = pChild->GetChildMatrix(); |
183 if (mt.IsIdentity()) | 183 if (mt.IsIdentity()) |
184 { | 184 { |
185 pChild->DrawAppearance(pDevice,pUser2Dev
ice); | 185 pChild->DrawAppearance(pDevice,pUser2Dev
ice); |
186 } | 186 } |
187 else | 187 else |
188 { | 188 { |
189 mt.Concat(*pUser2Device); | 189 mt.Concat(*pUser2Device); |
190 pChild->DrawAppearance(pDevice,&mt); | 190 pChild->DrawAppearance(pDevice,&mt); |
191 } | 191 } |
192 } | 192 } |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 pDevice->RestoreState(); | 196 pDevice->RestoreState(); |
197 } | 197 } |
198 | 198 |
199 FX_INT32 CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) | 199 int32_t CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) |
200 { | 200 { |
201 » for (FX_INT32 i=0, sz=m_aChildren.GetSize(); i<sz; i++) | 201 » for (int32_t i=0, sz=m_aChildren.GetSize(); i<sz; i++) |
202 { | 202 { |
203 if (pItem == m_aChildren.GetAt(i)) | 203 if (pItem == m_aChildren.GetAt(i)) |
204 return i; | 204 return i; |
205 } | 205 } |
206 | 206 |
207 return -1; | 207 return -1; |
208 } | 208 } |
209 | 209 |
210 CPDF_Point CPWL_ListCtrl::InToOut(const CPDF_Point& point) const | 210 CPDF_Point CPWL_ListCtrl::InToOut(const CPDF_Point& point) const |
211 { | 211 { |
(...skipping 24 matching lines...) Expand all 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 |