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_datetimeedit.h" | 7 #include "xfa/fwl/core/ifwl_datetimeedit.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 9 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
10 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 10 #include "xfa/fwl/core/ifwl_datetimepicker.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 35 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
36 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 36 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
37 DisForm_OnProcessMessage(pMessage); | 37 DisForm_OnProcessMessage(pMessage); |
38 return; | 38 return; |
39 } | 39 } |
40 | 40 |
41 CFWL_MessageType dwHashCode = pMessage->GetClassID(); | 41 CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
42 if (dwHashCode == CFWL_MessageType::SetFocus || | 42 if (dwHashCode == CFWL_MessageType::SetFocus || |
43 dwHashCode == CFWL_MessageType::KillFocus) { | 43 dwHashCode == CFWL_MessageType::KillFocus) { |
44 IFWL_Widget* pOuter = m_pOwner->GetOuter(); | 44 IFWL_Widget* pOuter = m_pOwner->GetOuter(); |
45 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr); | 45 pOuter->GetCurrentDelegate()->OnProcessMessage(pMessage); |
46 pDelegate->OnProcessMessage(pMessage); | |
47 } | 46 } |
48 } | 47 } |
49 | 48 |
50 void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( | 49 void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( |
51 CFWL_Message* pMessage) { | 50 CFWL_Message* pMessage) { |
52 CFWL_MessageType dwHashCode = pMessage->GetClassID(); | 51 CFWL_MessageType dwHashCode = pMessage->GetClassID(); |
53 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { | 52 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { |
54 if (dwHashCode == CFWL_MessageType::Mouse) { | 53 if (dwHashCode == CFWL_MessageType::Mouse) { |
55 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); | 54 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); |
56 if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown || | 55 if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown || |
57 pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) { | 56 pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) { |
58 if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { | 57 if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { |
59 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; | 58 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; |
60 } | 59 } |
61 IFWL_DateTimePicker* pDateTime = | 60 IFWL_DateTimePicker* pDateTime = |
62 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); | 61 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); |
63 if (pDateTime->IsMonthCalendarShowed()) { | 62 if (pDateTime->IsMonthCalendarShowed()) { |
64 CFX_RectF rtInvalidate; | 63 CFX_RectF rtInvalidate; |
65 pDateTime->GetWidgetRect(rtInvalidate); | 64 pDateTime->GetWidgetRect(rtInvalidate); |
66 pDateTime->ShowMonthCalendar(FALSE); | 65 pDateTime->ShowMonthCalendar(FALSE); |
67 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); | 66 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top); |
68 pDateTime->Repaint(&rtInvalidate); | 67 pDateTime->Repaint(&rtInvalidate); |
69 } | 68 } |
70 } | 69 } |
71 } | 70 } |
72 } | 71 } |
73 CFWL_EditImpDelegate::OnProcessMessage(pMessage); | 72 CFWL_EditImpDelegate::OnProcessMessage(pMessage); |
74 } | 73 } |
OLD | NEW |