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_ScrollBar.h" | 9 #include "../../include/pdfwindow/PWL_ScrollBar.h" |
10 #include "../../include/pdfwindow/PWL_Utils.h" | 10 #include "../../include/pdfwindow/PWL_Utils.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 | 275 |
276 void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p
User2Device) | 276 void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* p
User2Device) |
277 { | 277 { |
278 if (!IsVisible()) return; | 278 if (!IsVisible()) return; |
279 | 279 |
280 CPDF_Rect rectWnd = GetWindowRect(); | 280 CPDF_Rect rectWnd = GetWindowRect(); |
281 if (rectWnd.IsEmpty()) return; | 281 if (rectWnd.IsEmpty()) return; |
282 | 282 |
283 CPDF_Point ptCenter = this->GetCenterPoint(); | 283 CPDF_Point ptCenter = this->GetCenterPoint(); |
284 » FX_INT32 nTransparancy = this->GetTransparency(); | 284 » int32_t nTransparancy = this->GetTransparency(); |
285 | 285 |
286 switch (this->m_eScrollBarType) | 286 switch (this->m_eScrollBarType) |
287 { | 287 { |
288 case SBT_HSCROLL: | 288 case SBT_HSCROLL: |
289 CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); | 289 CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device); |
290 switch (this->m_eSBButtonType) | 290 switch (this->m_eSBButtonType) |
291 { | 291 { |
292 case PSBT_MIN: | 292 case PSBT_MIN: |
293 { | 293 { |
294 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN
* 0.5f,ptCenter.y); | 294 CPDF_Point pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN
* 0.5f,ptCenter.y); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 default: | 563 default: |
564 break; | 564 break; |
565 } | 565 } |
566 } | 566 } |
567 | 567 |
568 FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) | 568 FX_BOOL CPWL_SBButton::OnLButtonDown(const CPDF_Point & point, FX_DWORD nFlag) |
569 { | 569 { |
570 CPWL_Wnd::OnLButtonDown(point,nFlag); | 570 CPWL_Wnd::OnLButtonDown(point,nFlag); |
571 | 571 |
572 if (CPWL_Wnd * pParent = GetParentWindow()) | 572 if (CPWL_Wnd * pParent = GetParentWindow()) |
573 » » pParent->OnNotify(this,PNM_LBUTTONDOWN,0,(FX_INTPTR)&point); | 573 » » pParent->OnNotify(this,PNM_LBUTTONDOWN,0,(intptr_t)&point); |
574 | 574 |
575 m_bMouseDown = TRUE; | 575 m_bMouseDown = TRUE; |
576 SetCapture(); | 576 SetCapture(); |
577 | 577 |
578 return TRUE; | 578 return TRUE; |
579 } | 579 } |
580 | 580 |
581 FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) | 581 FX_BOOL CPWL_SBButton::OnLButtonUp(const CPDF_Point & point, FX_DWORD nFlag) |
582 { | 582 { |
583 CPWL_Wnd::OnLButtonUp(point,nFlag); | 583 CPWL_Wnd::OnLButtonUp(point,nFlag); |
584 | 584 |
585 if (CPWL_Wnd * pParent = GetParentWindow()) | 585 if (CPWL_Wnd * pParent = GetParentWindow()) |
586 » » pParent->OnNotify(this,PNM_LBUTTONUP,0,(FX_INTPTR)&point); | 586 » » pParent->OnNotify(this,PNM_LBUTTONUP,0,(intptr_t)&point); |
587 | 587 |
588 m_bMouseDown = FALSE; | 588 m_bMouseDown = FALSE; |
589 ReleaseCapture(); | 589 ReleaseCapture(); |
590 | 590 |
591 return TRUE; | 591 return TRUE; |
592 } | 592 } |
593 | 593 |
594 FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) | 594 FX_BOOL CPWL_SBButton::OnMouseMove(const CPDF_Point & point, FX_DWORD nFlag) |
595 { | 595 { |
596 CPWL_Wnd::OnMouseMove(point,nFlag); | 596 CPWL_Wnd::OnMouseMove(point,nFlag); |
597 | 597 |
598 if (CPWL_Wnd * pParent = GetParentWindow()) | 598 if (CPWL_Wnd * pParent = GetParentWindow()) |
599 { | 599 { |
600 » » pParent->OnNotify(this,PNM_MOUSEMOVE,0,(FX_INTPTR)&point); | 600 » » pParent->OnNotify(this,PNM_MOUSEMOVE,0,(intptr_t)&point); |
601 | 601 |
602 /* | 602 /* |
603 if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonT
ype == PSBT_MAX)) | 603 if (m_bMouseDown && (m_eSBButtonType == PSBT_MIN || m_eSBButtonT
ype == PSBT_MAX)) |
604 { | 604 { |
605 » » » if (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(FX_I
NTPTR)&point)) | 605 » » » if (!pParent->OnNotify(this,PNM_LBUTTONDOWN,nFlags,(intp
tr_t)&point)) |
606 return FALSE; | 606 return FALSE; |
607 } | 607 } |
608 */ | 608 */ |
609 } | 609 } |
610 | 610 |
611 return TRUE; | 611 return TRUE; |
612 } | 612 } |
613 | 613 |
614 /* ------------------------------- CPWL_ScrollBar ------------------------------
---- */ | 614 /* ------------------------------- CPWL_ScrollBar ------------------------------
---- */ |
615 | 615 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 InvalidateRect(); | 833 InvalidateRect(); |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 EndTimer(); | 837 EndTimer(); |
838 m_bMouseDown = FALSE; | 838 m_bMouseDown = FALSE; |
839 | 839 |
840 return TRUE; | 840 return TRUE; |
841 } | 841 } |
842 | 842 |
843 void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, FX_INTPTR wParam, FX
_INTPTR lParam) | 843 void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd, FX_DWORD msg, intptr_t wParam, int
ptr_t lParam) |
844 { | 844 { |
845 CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); | 845 CPWL_Wnd::OnNotify(pWnd,msg,wParam,lParam); |
846 | 846 |
847 switch (msg) | 847 switch (msg) |
848 { | 848 { |
849 case PNM_LBUTTONDOWN: | 849 case PNM_LBUTTONDOWN: |
850 if (pWnd == m_pMinButton) | 850 if (pWnd == m_pMinButton) |
851 { | 851 { |
852 OnMinButtonLBDown(*(CPDF_Point*)lParam); | 852 OnMinButtonLBDown(*(CPDF_Point*)lParam); |
853 } | 853 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 FX_FLOAT fPos; | 1207 FX_FLOAT fPos; |
1208 switch (this->m_sbType) | 1208 switch (this->m_sbType) |
1209 { | 1209 { |
1210 case SBT_HSCROLL: | 1210 case SBT_HSCROLL: |
1211 fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos; | 1211 fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos; |
1212 break; | 1212 break; |
1213 case SBT_VSCROLL: | 1213 case SBT_VSCROLL: |
1214 fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; | 1214 fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos; |
1215 break; | 1215 break; |
1216 } | 1216 } |
1217 » » pParent->OnNotify(this,PNM_SCROLLWINDOW,(FX_INTPTR)m_sbType,(FX_
INTPTR)&fPos); | 1217 » » pParent->OnNotify(this,PNM_SCROLLWINDOW,(intptr_t)m_sbType,(intp
tr_t)&fPos); |
1218 } | 1218 } |
1219 } | 1219 } |
1220 | 1220 |
1221 CPDF_Rect CPWL_ScrollBar::GetScrollArea() const | 1221 CPDF_Rect CPWL_ScrollBar::GetScrollArea() const |
1222 { | 1222 { |
1223 CPDF_Rect rcClient = GetClientRect(); | 1223 CPDF_Rect rcClient = GetClientRect(); |
1224 CPDF_Rect rcArea; | 1224 CPDF_Rect rcArea; |
1225 | 1225 |
1226 if (!m_pMinButton || !m_pMaxButton)return rcClient; | 1226 if (!m_pMinButton || !m_pMaxButton)return rcClient; |
1227 | 1227 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 void CPWL_ScrollBar::OnKillFocus() | 1344 void CPWL_ScrollBar::OnKillFocus() |
1345 { | 1345 { |
1346 if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) | 1346 if (GetTransparency() != PWL_SCROLLBAR_TRANSPARANCY) |
1347 { | 1347 { |
1348 SetTransparency(PWL_SCROLLBAR_TRANSPARANCY); | 1348 SetTransparency(PWL_SCROLLBAR_TRANSPARANCY); |
1349 InvalidateRect(); | 1349 InvalidateRect(); |
1350 } | 1350 } |
1351 } | 1351 } |
1352 */ | 1352 */ |
1353 | 1353 |
OLD | NEW |