Chromium Code Reviews| 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/core/ifwl_form.h" | 7 #include "xfa/fwl/core/ifwl_form.h" |
| 8 | 8 |
| 9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fde/tto/fde_textout.h" | 10 #include "xfa/fde/tto/fde_textout.h" |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 if (!pWidgetMgr) | 659 if (!pWidgetMgr) |
| 660 return; | 660 return; |
| 661 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; | 661 IFWL_DataProvider* pData = m_pProperties->m_pDataProvider; |
| 662 if (!pData) | 662 if (!pData) |
| 663 return; | 663 return; |
| 664 CFX_WideString text; | 664 CFX_WideString text; |
| 665 pData->GetCaption(this, text); | 665 pData->GetCaption(this, text); |
| 666 } | 666 } |
| 667 | 667 |
| 668 #ifdef FWL_UseMacSystemBorder | 668 #ifdef FWL_UseMacSystemBorder |
| 669 void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { | 669 void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) {} |
|
npm
2016/11/15 21:38:30
Can this method now be virtual or something like t
dsinclair
2016/11/15 21:44:06
It is virtual. We want the implementation here tha
| |
| 670 if (!pMessage) | |
| 671 return; | |
| 672 | |
| 673 switch (pMessage->GetClassID()) { | |
| 674 case CFWL_MessageType::Activate: { | |
| 675 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | |
| 676 Repaint(&m_rtRelative); | |
| 677 break; | |
| 678 } | |
| 679 case CFWL_MessageType::Deactivate: { | |
| 680 m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | |
| 681 Repaint(&m_rtRelative); | |
| 682 break; | |
| 683 } | |
| 684 default: | |
| 685 break; | |
| 686 } | |
| 687 } | |
| 688 #else | 670 #else |
| 689 void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { | 671 void IFWL_Form::OnProcessMessage(CFWL_Message* pMessage) { |
| 690 if (!pMessage) | 672 if (!pMessage) |
| 691 return; | 673 return; |
| 692 | 674 |
| 693 switch (pMessage->GetClassID()) { | 675 switch (pMessage->GetClassID()) { |
| 694 case CFWL_MessageType::Activate: { | |
| 695 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; | |
| 696 const IFWL_App* pApp = GetOwnerApp(); | |
| 697 CFWL_NoteDriver* pDriver = | |
| 698 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | |
| 699 IFWL_Widget* pSubFocus = GetSubFocus(); | |
| 700 if (pSubFocus && pSubFocus != pDriver->GetFocus()) | |
| 701 pDriver->SetFocus(pSubFocus); | |
| 702 | |
| 703 Repaint(&m_rtRelative); | |
| 704 break; | |
| 705 } | |
| 706 case CFWL_MessageType::Deactivate: { | |
| 707 m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated; | |
| 708 const IFWL_App* pApp = GetOwnerApp(); | |
| 709 CFWL_NoteDriver* pDriver = | |
| 710 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | |
| 711 IFWL_Widget* pSubFocus = GetSubFocus(); | |
| 712 if (pSubFocus) { | |
| 713 if (pSubFocus == pDriver->GetFocus()) { | |
| 714 pDriver->SetFocus(nullptr); | |
| 715 } else if (pSubFocus->GetStates() & FWL_WGTSTATE_Focused) { | |
| 716 if (IFWL_WidgetDelegate* pDelegate = pSubFocus->GetDelegate()) { | |
| 717 CFWL_MsgKillFocus ms; | |
| 718 pDelegate->OnProcessMessage(&ms); | |
| 719 } | |
| 720 } | |
| 721 } | |
| 722 Repaint(&m_rtRelative); | |
| 723 break; | |
| 724 } | |
| 725 case CFWL_MessageType::Mouse: { | 676 case CFWL_MessageType::Mouse: { |
| 726 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 677 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 727 switch (pMsg->m_dwCmd) { | 678 switch (pMsg->m_dwCmd) { |
| 728 case FWL_MouseCommand::LeftButtonDown: | 679 case FWL_MouseCommand::LeftButtonDown: |
| 729 OnLButtonDown(pMsg); | 680 OnLButtonDown(pMsg); |
| 730 break; | 681 break; |
| 731 case FWL_MouseCommand::LeftButtonUp: | 682 case FWL_MouseCommand::LeftButtonUp: |
| 732 OnLButtonUp(pMsg); | 683 OnLButtonUp(pMsg); |
| 733 break; | 684 break; |
| 734 case FWL_MouseCommand::Move: | 685 case FWL_MouseCommand::Move: |
| 735 OnMouseMove(pMsg); | 686 OnMouseMove(pMsg); |
| 736 break; | 687 break; |
| 737 case FWL_MouseCommand::Leave: | 688 case FWL_MouseCommand::Leave: |
| 738 OnMouseLeave(pMsg); | 689 OnMouseLeave(pMsg); |
| 739 break; | 690 break; |
| 740 case FWL_MouseCommand::LeftButtonDblClk: | 691 case FWL_MouseCommand::LeftButtonDblClk: |
| 741 OnLButtonDblClk(pMsg); | 692 OnLButtonDblClk(pMsg); |
| 742 break; | 693 break; |
| 743 default: | 694 default: |
| 744 break; | 695 break; |
| 745 } | 696 } |
| 746 break; | 697 break; |
| 747 } | 698 } |
| 748 case CFWL_MessageType::Size: { | |
| 749 CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr(); | |
| 750 if (!pWidgetMgr) | |
| 751 return; | |
| 752 | |
| 753 pWidgetMgr->AddRedrawCounts(this); | |
| 754 if (!m_bSetMaximize) | |
| 755 break; | |
| 756 | |
| 757 m_bSetMaximize = false; | |
| 758 CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage); | |
| 759 m_pProperties->m_rtWidget.left = 0; | |
| 760 m_pProperties->m_rtWidget.top = 0; | |
| 761 m_pProperties->m_rtWidget.width = (FX_FLOAT)pMsg->m_iWidth; | |
| 762 m_pProperties->m_rtWidget.height = (FX_FLOAT)pMsg->m_iHeight; | |
| 763 Update(); | |
| 764 break; | |
| 765 } | |
| 766 case CFWL_MessageType::WindowMove: | |
| 767 OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage)); | |
| 768 break; | |
| 769 case CFWL_MessageType::Close: | |
| 770 OnClose(static_cast<CFWL_MsgClose*>(pMessage)); | |
| 771 break; | |
| 772 default: | 699 default: |
| 773 break; | 700 break; |
| 774 } | 701 } |
| 775 } | 702 } |
| 776 #endif // FWL_UseMacSystemBorder | 703 #endif // FWL_UseMacSystemBorder |
| 777 | 704 |
| 778 void IFWL_Form::OnDrawWidget(CFX_Graphics* pGraphics, | 705 void IFWL_Form::OnDrawWidget(CFX_Graphics* pGraphics, |
| 779 const CFX_Matrix* pMatrix) { | 706 const CFX_Matrix* pMatrix) { |
| 780 DrawWidget(pGraphics, pMatrix); | 707 DrawWidget(pGraphics, pMatrix); |
| 781 } | 708 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 if (m_bMaximized) | 821 if (m_bMaximized) |
| 895 SetWidgetRect(m_rtRestore); | 822 SetWidgetRect(m_rtRestore); |
| 896 else | 823 else |
| 897 SetWorkAreaRect(); | 824 SetWorkAreaRect(); |
| 898 | 825 |
| 899 Update(); | 826 Update(); |
| 900 m_bMaximized = !m_bMaximized; | 827 m_bMaximized = !m_bMaximized; |
| 901 } | 828 } |
| 902 } | 829 } |
| 903 | 830 |
| 904 void IFWL_Form::OnWindowMove(CFWL_MsgWindowMove* pMsg) { | |
| 905 m_pProperties->m_rtWidget.left = pMsg->m_fx; | |
| 906 m_pProperties->m_rtWidget.top = pMsg->m_fy; | |
| 907 } | |
| 908 | |
| 909 void IFWL_Form::OnClose(CFWL_MsgClose* pMsg) { | |
| 910 CFWL_EvtClose eClose; | |
| 911 eClose.m_pSrcTarget = this; | |
| 912 DispatchEvent(&eClose); | |
| 913 } | |
| 914 | |
| 915 CFWL_SysBtn::CFWL_SysBtn() { | 831 CFWL_SysBtn::CFWL_SysBtn() { |
| 916 m_rtBtn.Set(0, 0, 0, 0); | 832 m_rtBtn.Set(0, 0, 0, 0); |
| 917 m_dwState = 0; | 833 m_dwState = 0; |
| 918 } | 834 } |
| 919 | 835 |
| 920 bool CFWL_SysBtn::IsDisabled() const { | 836 bool CFWL_SysBtn::IsDisabled() const { |
| 921 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); | 837 return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); |
| 922 } | 838 } |
| 923 | 839 |
| 924 void CFWL_SysBtn::SetNormal() { | 840 void CFWL_SysBtn::SetNormal() { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 942 | 858 |
| 943 uint32_t CFWL_SysBtn::GetPartState() const { | 859 uint32_t CFWL_SysBtn::GetPartState() const { |
| 944 if (IsDisabled()) | 860 if (IsDisabled()) |
| 945 return CFWL_PartState_Disabled; | 861 return CFWL_PartState_Disabled; |
| 946 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | 862 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) |
| 947 return CFWL_PartState_Pressed; | 863 return CFWL_PartState_Pressed; |
| 948 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | 864 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) |
| 949 return CFWL_PartState_Hovered; | 865 return CFWL_PartState_Hovered; |
| 950 return CFWL_PartState_Normal; | 866 return CFWL_PartState_Normal; |
| 951 } | 867 } |
| OLD | NEW |