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 "xfa/fwl/basewidget/fwl_scrollbarimp.h" | 7 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" | 9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { | 618 FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { |
619 FX_BOOL bRet = TRUE; | 619 FX_BOOL bRet = TRUE; |
620 CFWL_EvtScroll ev; | 620 CFWL_EvtScroll ev; |
621 ev.m_iScrollCode = dwCode; | 621 ev.m_iScrollCode = dwCode; |
622 ev.m_pSrcTarget = m_pInterface; | 622 ev.m_pSrcTarget = m_pInterface; |
623 ev.m_fPos = fPos; | 623 ev.m_fPos = fPos; |
624 ev.m_pRet = &bRet; | 624 ev.m_pRet = &bRet; |
625 DispatchEvent(&ev); | 625 DispatchEvent(&ev); |
626 return bRet; | 626 return bRet; |
627 } | 627 } |
| 628 |
628 CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) | 629 CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) |
629 : m_pOwner(pOwner) {} | 630 : m_pOwner(pOwner) {} |
| 631 |
630 int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 632 int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
631 if (!pMessage) | 633 if (!pMessage) |
632 return 0; | 634 return 0; |
| 635 |
633 int32_t iRet = 1; | 636 int32_t iRet = 1; |
634 uint32_t dwMsgCode = pMessage->GetClassID(); | 637 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
635 if (dwMsgCode == FWL_MSGHASH_Mouse) { | 638 if (dwMsgCode == CFWL_MessageType::Mouse) { |
636 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 639 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
637 uint32_t dwCmd = pMsg->m_dwCmd; | 640 uint32_t dwCmd = pMsg->m_dwCmd; |
638 switch (dwCmd) { | 641 switch (dwCmd) { |
639 case FWL_MSGMOUSECMD_LButtonDown: { | 642 case FWL_MSGMOUSECMD_LButtonDown: { |
640 OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); | 643 OnLButtonDown(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); |
641 break; | 644 break; |
642 } | 645 } |
643 case FWL_MSGMOUSECMD_LButtonUp: { | 646 case FWL_MSGMOUSECMD_LButtonUp: { |
644 OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); | 647 OnLButtonUp(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); |
645 break; | 648 break; |
646 } | 649 } |
647 case FWL_MSGMOUSECMD_MouseMove: { | 650 case FWL_MSGMOUSECMD_MouseMove: { |
648 OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); | 651 OnMouseMove(pMsg->m_dwFlags, pMsg->m_fx, pMsg->m_fy); |
649 break; | 652 break; |
650 } | 653 } |
651 case FWL_MSGMOUSECMD_MouseLeave: { | 654 case FWL_MSGMOUSECMD_MouseLeave: { |
652 OnMouseLeave(); | 655 OnMouseLeave(); |
653 break; | 656 break; |
654 } | 657 } |
655 default: { iRet = 0; } | 658 default: { |
| 659 iRet = 0; |
| 660 break; |
| 661 } |
656 } | 662 } |
657 } else if (dwMsgCode == FWL_MSGHASH_MouseWheel) { | 663 } else if (dwMsgCode == CFWL_MessageType::MouseWheel) { |
658 CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage); | 664 CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage); |
659 OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, | 665 OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX, |
660 pMsg->m_fDeltaY); | 666 pMsg->m_fDeltaY); |
661 } else { | 667 } else { |
662 iRet = 0; | 668 iRet = 0; |
663 } | 669 } |
664 return iRet; | 670 return iRet; |
665 } | 671 } |
| 672 |
666 FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 673 FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
667 const CFX_Matrix* pMatrix) { | 674 const CFX_Matrix* pMatrix) { |
668 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 675 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
669 } | 676 } |
670 void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, | 677 void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, |
671 FX_FLOAT fx, | 678 FX_FLOAT fx, |
672 FX_FLOAT fy) { | 679 FX_FLOAT fy) { |
673 if (!m_pOwner->IsEnabled()) { | 680 if (!m_pOwner->IsEnabled()) { |
674 return; | 681 return; |
675 } | 682 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 } | 806 } |
800 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, | 807 void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem, |
801 const CFX_RectF& rtItem, | 808 const CFX_RectF& rtItem, |
802 int32_t& iState) { | 809 int32_t& iState) { |
803 if (iState == CFWL_PartState_Hovered) { | 810 if (iState == CFWL_PartState_Hovered) { |
804 return; | 811 return; |
805 } | 812 } |
806 iState = CFWL_PartState_Hovered; | 813 iState = CFWL_PartState_Hovered; |
807 m_pOwner->Repaint(&rtItem); | 814 m_pOwner->Repaint(&rtItem); |
808 } | 815 } |
OLD | NEW |