summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_datetimeedit.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-10-20 06:44:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-20 06:44:03 -0700
commitfb5055947efd78e0e7f8a2bfd5b754c63dbb6076 (patch)
tree10511c1cb9b341e901a7f619a2bf6c2a74bb7f89 /xfa/fwl/core/ifwl_datetimeedit.cpp
parentdadea5f87d35f8a692b659dbff54cc8780d48ef8 (diff)
downloadpdfium-fb5055947efd78e0e7f8a2bfd5b754c63dbb6076.tar.xz
Merge the CFWL_*Imp classes into the IFWL_* classes.
This Cl merges the implementation classes up into the IFWL classes as the intermediate classes were just acting as proxies. Review-Url: https://chromiumcodereview.appspot.com/2432423002
Diffstat (limited to 'xfa/fwl/core/ifwl_datetimeedit.cpp')
-rw-r--r--xfa/fwl/core/ifwl_datetimeedit.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp
new file mode 100644
index 0000000000..a0f473b21e
--- /dev/null
+++ b/xfa/fwl/core/ifwl_datetimeedit.cpp
@@ -0,0 +1,79 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/ifwl_datetimeedit.h"
+
+#include "xfa/fwl/core/cfwl_widgetmgr.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
+
+// static
+IFWL_DateTimeEdit* IFWL_DateTimeEdit::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_DateTimeEdit(properties, pOuter);
+}
+
+IFWL_DateTimeEdit::IFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Edit(properties, pOuter) {}
+
+FWL_Error IFWL_DateTimeEdit::Initialize() {
+ m_pDelegate = new CFWL_DateTimeEditImpDelegate(this);
+ if (IFWL_Edit::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_DateTimeEdit::Finalize() {
+ delete m_pDelegate;
+ m_pDelegate = nullptr;
+ return IFWL_Edit::Finalize();
+}
+
+CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate(
+ IFWL_DateTimeEdit* pOwner)
+ : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
+
+void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
+ DisForm_OnProcessMessage(pMessage);
+ return;
+ }
+
+ CFWL_MessageType dwHashCode = pMessage->GetClassID();
+ if (dwHashCode == CFWL_MessageType::SetFocus ||
+ dwHashCode == CFWL_MessageType::KillFocus) {
+ IFWL_Widget* pOuter = m_pOwner->GetOuter();
+ IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
+ pDelegate->OnProcessMessage(pMessage);
+ }
+}
+
+void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage(
+ CFWL_Message* pMessage) {
+ CFWL_MessageType dwHashCode = pMessage->GetClassID();
+ if (m_pOwner->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;
+ }
+ IFWL_DateTimePicker* pDateTime =
+ static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
+ if (pDateTime->IsMonthCalendarShowed()) {
+ CFX_RectF rtInvalidate;
+ pDateTime->GetWidgetRect(rtInvalidate);
+ pDateTime->ShowMonthCalendar(FALSE);
+ rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
+ pDateTime->Repaint(&rtInvalidate);
+ }
+ }
+ }
+ }
+ CFWL_EditImpDelegate::OnProcessMessage(pMessage);
+}