Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: xfa/fwl/core/ifwl_datetimeedit.cpp

Issue 2432423002: Merge the CFWL_*Imp classes into the IFWL_* classes. (Closed)
Patch Set: Review feedback Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_datetimeedit.h ('k') | xfa/fwl/core/ifwl_datetimepicker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "xfa/fwl/core/ifwl_datetimeedit.h"
8
9 #include "xfa/fwl/core/cfwl_widgetmgr.h"
10 #include "xfa/fwl/core/ifwl_datetimepicker.h"
11
12 // static
13 IFWL_DateTimeEdit* IFWL_DateTimeEdit::Create(
14 const CFWL_WidgetImpProperties& properties,
15 IFWL_Widget* pOuter) {
16 return new IFWL_DateTimeEdit(properties, pOuter);
17 }
18
19 IFWL_DateTimeEdit::IFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
20 IFWL_Widget* pOuter)
21 : IFWL_Edit(properties, pOuter) {}
22
23 FWL_Error IFWL_DateTimeEdit::Initialize() {
24 m_pDelegate = new CFWL_DateTimeEditImpDelegate(this);
25 if (IFWL_Edit::Initialize() != FWL_Error::Succeeded)
26 return FWL_Error::Indefinite;
27 return FWL_Error::Succeeded;
28 }
29
30 FWL_Error IFWL_DateTimeEdit::Finalize() {
31 delete m_pDelegate;
32 m_pDelegate = nullptr;
33 return IFWL_Edit::Finalize();
34 }
35
36 CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate(
37 IFWL_DateTimeEdit* pOwner)
38 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
39
40 void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
41 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
42 DisForm_OnProcessMessage(pMessage);
43 return;
44 }
45
46 CFWL_MessageType dwHashCode = pMessage->GetClassID();
47 if (dwHashCode == CFWL_MessageType::SetFocus ||
48 dwHashCode == CFWL_MessageType::KillFocus) {
49 IFWL_Widget* pOuter = m_pOwner->GetOuter();
50 IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
51 pDelegate->OnProcessMessage(pMessage);
52 }
53 }
54
55 void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage(
56 CFWL_Message* pMessage) {
57 CFWL_MessageType dwHashCode = pMessage->GetClassID();
58 if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
59 if (dwHashCode == CFWL_MessageType::Mouse) {
60 CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
61 if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown ||
62 pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) {
63 if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
64 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
65 }
66 IFWL_DateTimePicker* pDateTime =
67 static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
68 if (pDateTime->IsMonthCalendarShowed()) {
69 CFX_RectF rtInvalidate;
70 pDateTime->GetWidgetRect(rtInvalidate);
71 pDateTime->ShowMonthCalendar(FALSE);
72 rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
73 pDateTime->Repaint(&rtInvalidate);
74 }
75 }
76 }
77 }
78 CFWL_EditImpDelegate::OnProcessMessage(pMessage);
79 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_datetimeedit.h ('k') | xfa/fwl/core/ifwl_datetimepicker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698