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

Side by Side Diff: xfa/fwl/core/ifwl_comboedit.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_comboedit.h ('k') | xfa/fwl/core/ifwl_combolist.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 2016 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_comboedit.h"
8
9 #include "xfa/fde/cfde_txtedtengine.h"
10 #include "xfa/fwl/core/ifwl_combobox.h"
11
12 // static
13 IFWL_ComboEdit* IFWL_ComboEdit::Create(
14 const CFWL_WidgetImpProperties& properties,
15 IFWL_Widget* pOuter) {
16 return new IFWL_ComboEdit(properties, pOuter);
17 }
18
19 IFWL_ComboEdit::IFWL_ComboEdit(const CFWL_WidgetImpProperties& properties,
20 IFWL_Widget* pOuter)
21 : IFWL_Edit(properties, pOuter) {
22 m_pOuter = static_cast<IFWL_ComboBox*>(pOuter);
23 }
24
25 void IFWL_ComboEdit::ClearSelected() {
26 ClearSelections();
27 Repaint(&m_rtClient);
28 }
29
30 void IFWL_ComboEdit::SetSelected() {
31 FlagFocus(TRUE);
32 EndCaret();
33 AddSelRange(0);
34 }
35
36 void IFWL_ComboEdit::EndCaret() {
37 m_pEdtEngine->MoveCaretPos(MC_End);
38 }
39
40 void IFWL_ComboEdit::FlagFocus(FX_BOOL bSet) {
41 if (bSet) {
42 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
43 } else {
44 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
45 ShowCaret(FALSE);
46 }
47 }
48
49 void IFWL_ComboEdit::SetComboBoxFocus(FX_BOOL bSet) {
50 m_pOuter->SetFocus(bSet);
51 }
52
53 CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(IFWL_ComboEdit* pOwner)
54 : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
55
56 void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
57 if (!pMessage)
58 return;
59
60 FX_BOOL backDefault = TRUE;
61 switch (pMessage->GetClassID()) {
62 case CFWL_MessageType::SetFocus: {
63 m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
64 backDefault = FALSE;
65 break;
66 }
67 case CFWL_MessageType::KillFocus: {
68 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
69 backDefault = FALSE;
70 break;
71 }
72 case CFWL_MessageType::Mouse: {
73 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
74 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
75 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
76 m_pOwner->SetSelected();
77 m_pOwner->SetComboBoxFocus(TRUE);
78 }
79 break;
80 }
81 default:
82 break;
83 }
84 if (backDefault)
85 CFWL_EditImpDelegate::OnProcessMessage(pMessage);
86 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_comboedit.h ('k') | xfa/fwl/core/ifwl_combolist.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698