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/pdfwindow/PWL_IconList.h" | 7 #include "fpdfsdk/pdfwindow/PWL_IconList.h" |
8 | 8 |
9 #include "fpdfsdk/pdfwindow/PWL_Label.h" | 9 #include "fpdfsdk/pdfwindow/PWL_Label.h" |
10 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" | 10 #include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 sInfo.fContentMax = rcScroll.top; | 158 sInfo.fContentMax = rcScroll.top; |
159 sInfo.fPlateWidth = GetClientRect().Height(); | 159 sInfo.fPlateWidth = GetClientRect().Height(); |
160 sInfo.fSmallStep = 13.0f; | 160 sInfo.fSmallStep = 13.0f; |
161 sInfo.fBigStep = sInfo.fPlateWidth; | 161 sInfo.fBigStep = sInfo.fPlateWidth; |
162 | 162 |
163 pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); | 163 pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CFX_FloatPoint& point, | 167 FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CFX_FloatPoint& point, |
168 FX_DWORD nFlag) { | 168 uint32_t nFlag) { |
169 SetFocus(); | 169 SetFocus(); |
170 | 170 |
171 SetCapture(); | 171 SetCapture(); |
172 m_bMouseDown = TRUE; | 172 m_bMouseDown = TRUE; |
173 | 173 |
174 int32_t nItemIndex = FindItemIndex(point); | 174 int32_t nItemIndex = FindItemIndex(point); |
175 SetSelect(nItemIndex); | 175 SetSelect(nItemIndex); |
176 ScrollToItem(nItemIndex); | 176 ScrollToItem(nItemIndex); |
177 | 177 |
178 return TRUE; | 178 return TRUE; |
179 } | 179 } |
180 | 180 |
181 FX_BOOL CPWL_IconList_Content::OnLButtonUp(const CFX_FloatPoint& point, | 181 FX_BOOL CPWL_IconList_Content::OnLButtonUp(const CFX_FloatPoint& point, |
182 FX_DWORD nFlag) { | 182 uint32_t nFlag) { |
183 m_bMouseDown = FALSE; | 183 m_bMouseDown = FALSE; |
184 ReleaseCapture(); | 184 ReleaseCapture(); |
185 | 185 |
186 return TRUE; | 186 return TRUE; |
187 } | 187 } |
188 | 188 |
189 FX_BOOL CPWL_IconList_Content::OnMouseMove(const CFX_FloatPoint& point, | 189 FX_BOOL CPWL_IconList_Content::OnMouseMove(const CFX_FloatPoint& point, |
190 FX_DWORD nFlag) { | 190 uint32_t nFlag) { |
191 if (m_bMouseDown) { | 191 if (m_bMouseDown) { |
192 int32_t nItemIndex = FindItemIndex(point); | 192 int32_t nItemIndex = FindItemIndex(point); |
193 SetSelect(nItemIndex); | 193 SetSelect(nItemIndex); |
194 ScrollToItem(nItemIndex); | 194 ScrollToItem(nItemIndex); |
195 } | 195 } |
196 | 196 |
197 return TRUE; | 197 return TRUE; |
198 } | 198 } |
199 | 199 |
200 FX_BOOL CPWL_IconList_Content::OnKeyDown(uint16_t nChar, FX_DWORD nFlag) { | 200 FX_BOOL CPWL_IconList_Content::OnKeyDown(uint16_t nChar, uint32_t nFlag) { |
201 switch (nChar) { | 201 switch (nChar) { |
202 case FWL_VKEY_Up: | 202 case FWL_VKEY_Up: |
203 if (m_nSelectIndex > 0) { | 203 if (m_nSelectIndex > 0) { |
204 int32_t nItemIndex = m_nSelectIndex - 1; | 204 int32_t nItemIndex = m_nSelectIndex - 1; |
205 SetSelect(nItemIndex); | 205 SetSelect(nItemIndex); |
206 ScrollToItem(nItemIndex); | 206 ScrollToItem(nItemIndex); |
207 } | 207 } |
208 return TRUE; | 208 return TRUE; |
209 case FWL_VKEY_Down: | 209 case FWL_VKEY_Down: |
210 if (m_nSelectIndex < m_nListCount - 1) { | 210 if (m_nSelectIndex < m_nListCount - 1) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 void CPWL_IconList::OnCreated() { | 369 void CPWL_IconList::OnCreated() { |
370 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { | 370 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { |
371 pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); | 371 pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); |
372 pScrollBar->SetTransparency(255); | 372 pScrollBar->SetTransparency(255); |
373 pScrollBar->SetNotifyForever(TRUE); | 373 pScrollBar->SetNotifyForever(TRUE); |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, | 377 void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, |
378 FX_DWORD msg, | 378 uint32_t msg, |
379 intptr_t wParam, | 379 intptr_t wParam, |
380 intptr_t lParam) { | 380 intptr_t lParam) { |
381 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); | 381 CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); |
382 | 382 |
383 if (wParam == SBT_VSCROLL) { | 383 if (wParam == SBT_VSCROLL) { |
384 switch (msg) { | 384 switch (msg) { |
385 case PNM_SETSCROLLINFO: | 385 case PNM_SETSCROLLINFO: |
386 if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { | 386 if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { |
387 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { | 387 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { |
388 if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { | 388 if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const { | 457 CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const { |
458 return m_pListContent->GetListString(nItemIndex); | 458 return m_pListContent->GetListString(nItemIndex); |
459 } | 459 } |
460 | 460 |
461 void CPWL_IconList::SetIconFillColor(const CPWL_Color& color) { | 461 void CPWL_IconList::SetIconFillColor(const CPWL_Color& color) { |
462 m_pListContent->SetIconFillColor(color); | 462 m_pListContent->SetIconFillColor(color); |
463 } | 463 } |
464 | 464 |
465 FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, | 465 FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, |
466 const CFX_FloatPoint& point, | 466 const CFX_FloatPoint& point, |
467 FX_DWORD nFlag) { | 467 uint32_t nFlag) { |
468 CFX_FloatPoint ptScroll = m_pListContent->GetScrollPos(); | 468 CFX_FloatPoint ptScroll = m_pListContent->GetScrollPos(); |
469 CFX_FloatRect rcScroll = m_pListContent->GetScrollArea(); | 469 CFX_FloatRect rcScroll = m_pListContent->GetScrollArea(); |
470 CFX_FloatRect rcContents = m_pListContent->GetClientRect(); | 470 CFX_FloatRect rcContents = m_pListContent->GetClientRect(); |
471 | 471 |
472 if (rcScroll.top - rcScroll.bottom > rcContents.Height()) { | 472 if (rcScroll.top - rcScroll.bottom > rcContents.Height()) { |
473 CFX_FloatPoint ptNew = ptScroll; | 473 CFX_FloatPoint ptNew = ptScroll; |
474 | 474 |
475 if (zDelta > 0) | 475 if (zDelta > 0) |
476 ptNew.y += 30; | 476 ptNew.y += 30; |
477 else | 477 else |
(...skipping 14 matching lines...) Expand all Loading... |
492 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) | 492 if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) |
493 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, | 493 pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, |
494 (intptr_t)&ptNew.y); | 494 (intptr_t)&ptNew.y); |
495 | 495 |
496 return TRUE; | 496 return TRUE; |
497 } | 497 } |
498 } | 498 } |
499 | 499 |
500 return FALSE; | 500 return FALSE; |
501 } | 501 } |
OLD | NEW |