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

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

Issue 2525083002: Rename IFWL classes which do not have CFWL equivalents (Closed)
Patch Set: Created 4 years 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 <memory>
10 #include <utility>
11
12 #include "xfa/fde/cfde_txtedtengine.h"
13 #include "xfa/fwl/core/cfwl_msgmouse.h"
14 #include "xfa/fwl/core/ifwl_combobox.h"
15
16 IFWL_ComboEdit::IFWL_ComboEdit(
17 const CFWL_App* app,
18 std::unique_ptr<CFWL_WidgetProperties> properties,
19 IFWL_Widget* pOuter)
20 : IFWL_Edit(app, std::move(properties), pOuter) {
21 m_pOuter = static_cast<IFWL_ComboBox*>(pOuter);
22 }
23
24 void IFWL_ComboEdit::ClearSelected() {
25 ClearSelections();
26 Repaint(&GetRTClient());
27 }
28
29 void IFWL_ComboEdit::SetSelected() {
30 FlagFocus(true);
31 GetTxtEdtEngine()->MoveCaretPos(MC_End);
32 AddSelRange(0);
33 }
34
35 void IFWL_ComboEdit::FlagFocus(bool bSet) {
36 if (bSet) {
37 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
38 return;
39 }
40
41 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
42 ShowCaret(false);
43 }
44
45 void IFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) {
46 if (!pMessage)
47 return;
48
49 bool backDefault = true;
50 switch (pMessage->GetClassID()) {
51 case CFWL_MessageType::SetFocus: {
52 m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
53 backDefault = false;
54 break;
55 }
56 case CFWL_MessageType::KillFocus: {
57 m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
58 backDefault = false;
59 break;
60 }
61 case CFWL_MessageType::Mouse: {
62 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
63 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
64 ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
65 SetSelected();
66 m_pOuter->SetFocus(true);
67 }
68 break;
69 }
70 default:
71 break;
72 }
73 if (backDefault)
74 IFWL_Edit::OnProcessMessage(pMessage);
75 }
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