diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-02 14:51:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 14:51:25 -0700 |
commit | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (patch) | |
tree | 365d9ee7f8eec1103fb9fce0986e23d9f548ecae /xfa/fwl/core/ifwl_datetimeedit.cpp | |
parent | 4cf551577856f89103e162edc761def44ffb96fc (diff) | |
download | pdfium-3b3ce1a242f8445848d3f23d6c35ba01d7c645f4.tar.xz |
Merge delegates into IFWL_* classes.
This Cl removes ownership of the delgates from IFWL_Widget and puts it in the
hand of the creating classes. In doing so, merge the delegates back into the
IFWL_* classes to simplify logic.
Review-Url: https://codereview.chromium.org/2467993003
Diffstat (limited to 'xfa/fwl/core/ifwl_datetimeedit.cpp')
-rw-r--r-- | xfa/fwl/core/ifwl_datetimeedit.cpp | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp index 1c0baae32d..906ba94e57 100644 --- a/xfa/fwl/core/ifwl_datetimeedit.cpp +++ b/xfa/fwl/core/ifwl_datetimeedit.cpp @@ -13,16 +13,10 @@ IFWL_DateTimeEdit::IFWL_DateTimeEdit(const IFWL_App* app, const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) - : IFWL_Edit(app, properties, pOuter) { - SetDelegate(pdfium::MakeUnique<CFWL_DateTimeEditImpDelegate>(this)); -} - -CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( - IFWL_DateTimeEdit* pOwner) - : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} + : IFWL_Edit(app, properties, pOuter) {} -void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { +void IFWL_DateTimeEdit::OnProcessMessage(CFWL_Message* pMessage) { + if (m_pWidgetMgr->IsFormDisabled()) { DisForm_OnProcessMessage(pMessage); return; } @@ -30,24 +24,23 @@ void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (dwHashCode == CFWL_MessageType::SetFocus || dwHashCode == CFWL_MessageType::KillFocus) { - IFWL_Widget* pOuter = m_pOwner->GetOuter(); - pOuter->GetCurrentDelegate()->OnProcessMessage(pMessage); + IFWL_Widget* pOuter = GetOuter(); + pOuter->GetDelegate()->OnProcessMessage(pMessage); } } -void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( - CFWL_Message* pMessage) { +void IFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) { CFWL_MessageType dwHashCode = pMessage->GetClassID(); - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + if (m_pWidgetMgr->IsFormDisabled()) { if (dwHashCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown || pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) { - if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { - m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; - } + if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) + m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; + IFWL_DateTimePicker* pDateTime = - static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter); + static_cast<IFWL_DateTimePicker*>(m_pOuter); if (pDateTime->IsMonthCalendarShowed()) { CFX_RectF rtInvalidate; pDateTime->GetWidgetRect(rtInvalidate); @@ -58,5 +51,5 @@ void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( } } } - CFWL_EditImpDelegate::OnProcessMessage(pMessage); + IFWL_Edit::OnProcessMessage(pMessage); } |