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

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

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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_comboboxproxy.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/core/ifwl_comboboxproxy.h" 7 #include "xfa/fwl/core/ifwl_comboboxproxy.h"
8 8
9 #include "xfa/fwl/core/fwl_noteimp.h" 9 #include "xfa/fwl/core/fwl_noteimp.h"
10 #include "xfa/fwl/core/ifwl_app.h" 10 #include "xfa/fwl/core/ifwl_app.h"
11 #include "xfa/fwl/core/ifwl_combobox.h" 11 #include "xfa/fwl/core/ifwl_combobox.h"
12 12
13 IFWL_ComboBoxProxy::IFWL_ComboBoxProxy( 13 IFWL_ComboBoxProxy::IFWL_ComboBoxProxy(
14 IFWL_ComboBox* pComboBox, 14 IFWL_ComboBox* pComboBox,
15 const IFWL_App* app, 15 const IFWL_App* app,
16 const CFWL_WidgetImpProperties& properties, 16 const CFWL_WidgetImpProperties& properties,
17 IFWL_Widget* pOuter) 17 IFWL_Widget* pOuter)
18 : IFWL_FormProxy(app, properties, pOuter), 18 : IFWL_FormProxy(app, properties, pOuter),
19 m_bLButtonDown(FALSE), 19 m_bLButtonDown(false),
20 m_bLButtonUpSelf(FALSE), 20 m_bLButtonUpSelf(false),
21 m_pComboBox(pComboBox) {} 21 m_pComboBox(pComboBox) {}
22 22
23 IFWL_ComboBoxProxy::~IFWL_ComboBoxProxy() {} 23 IFWL_ComboBoxProxy::~IFWL_ComboBoxProxy() {}
24 24
25 void IFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) { 25 void IFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) {
26 if (!pMessage) 26 if (!pMessage)
27 return; 27 return;
28 28
29 switch (pMessage->GetClassID()) { 29 switch (pMessage->GetClassID()) {
30 case CFWL_MessageType::Mouse: { 30 case CFWL_MessageType::Mouse: {
31 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 31 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
32 switch (pMsg->m_dwCmd) { 32 switch (pMsg->m_dwCmd) {
33 case FWL_MouseCommand::LeftButtonDown: 33 case FWL_MouseCommand::LeftButtonDown:
34 OnLButtonDown(pMsg); 34 OnLButtonDown(pMsg);
35 break; 35 break;
36 case FWL_MouseCommand::LeftButtonUp: 36 case FWL_MouseCommand::LeftButtonUp:
37 OnLButtonUp(pMsg); 37 OnLButtonUp(pMsg);
38 break; 38 break;
39 case FWL_MouseCommand::Move: 39 case FWL_MouseCommand::Move:
40 break; 40 break;
41 default: 41 default:
42 break; 42 break;
43 } 43 }
44 break; 44 break;
45 } 45 }
46 case CFWL_MessageType::Deactivate: 46 case CFWL_MessageType::Deactivate:
47 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); 47 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage));
48 break; 48 break;
49 case CFWL_MessageType::KillFocus: 49 case CFWL_MessageType::KillFocus:
50 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), FALSE); 50 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), false);
51 break; 51 break;
52 case CFWL_MessageType::SetFocus: 52 case CFWL_MessageType::SetFocus:
53 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), TRUE); 53 OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage), true);
54 break; 54 break;
55 default: 55 default:
56 break; 56 break;
57 } 57 }
58 IFWL_Widget::OnProcessMessage(pMessage); 58 IFWL_Widget::OnProcessMessage(pMessage);
59 } 59 }
60 60
61 void IFWL_ComboBoxProxy::OnDrawWidget(CFX_Graphics* pGraphics, 61 void IFWL_ComboBoxProxy::OnDrawWidget(CFX_Graphics* pGraphics,
62 const CFX_Matrix* pMatrix) { 62 const CFX_Matrix* pMatrix) {
63 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); 63 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix);
64 } 64 }
65 65
66 void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) { 66 void IFWL_ComboBoxProxy::OnLButtonDown(CFWL_MsgMouse* pMsg) {
67 const IFWL_App* pApp = GetOwnerApp(); 67 const IFWL_App* pApp = GetOwnerApp();
68 if (!pApp) 68 if (!pApp)
69 return; 69 return;
70 70
71 CFWL_NoteDriver* pDriver = 71 CFWL_NoteDriver* pDriver =
72 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); 72 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
73 CFX_RectF rtWidget; 73 CFX_RectF rtWidget;
74 GetWidgetRect(rtWidget); 74 GetWidgetRect(rtWidget);
75 rtWidget.left = rtWidget.top = 0; 75 rtWidget.left = rtWidget.top = 0;
76 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { 76 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) {
77 m_bLButtonDown = TRUE; 77 m_bLButtonDown = true;
78 pDriver->SetGrab(this, TRUE); 78 pDriver->SetGrab(this, true);
79 } else { 79 } else {
80 m_bLButtonDown = FALSE; 80 m_bLButtonDown = false;
81 pDriver->SetGrab(this, FALSE); 81 pDriver->SetGrab(this, false);
82 m_pComboBox->ShowDropList(FALSE); 82 m_pComboBox->ShowDropList(false);
83 } 83 }
84 } 84 }
85 85
86 void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) { 86 void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) {
87 m_bLButtonDown = FALSE; 87 m_bLButtonDown = false;
88 const IFWL_App* pApp = GetOwnerApp(); 88 const IFWL_App* pApp = GetOwnerApp();
89 if (!pApp) 89 if (!pApp)
90 return; 90 return;
91 91
92 CFWL_NoteDriver* pDriver = 92 CFWL_NoteDriver* pDriver =
93 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); 93 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
94 pDriver->SetGrab(this, FALSE); 94 pDriver->SetGrab(this, false);
95 if (m_bLButtonUpSelf) { 95 if (m_bLButtonUpSelf) {
96 CFX_RectF rect; 96 CFX_RectF rect;
97 GetWidgetRect(rect); 97 GetWidgetRect(rect);
98 rect.left = rect.top = 0; 98 rect.left = rect.top = 0;
99 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && 99 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
100 m_pComboBox->IsDropListShowed()) { 100 m_pComboBox->IsDropListShowed()) {
101 m_pComboBox->ShowDropList(FALSE); 101 m_pComboBox->ShowDropList(false);
102 } 102 }
103 } else { 103 } else {
104 m_bLButtonUpSelf = TRUE; 104 m_bLButtonUpSelf = true;
105 } 105 }
106 } 106 }
107 107
108 void IFWL_ComboBoxProxy::OnDeactive(CFWL_MsgDeactivate* pMsg) { 108 void IFWL_ComboBoxProxy::OnDeactive(CFWL_MsgDeactivate* pMsg) {
109 m_pComboBox->ShowDropList(FALSE); 109 m_pComboBox->ShowDropList(false);
110 } 110 }
111 111
112 void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_MsgKillFocus* pMsg, FX_BOOL bSet) { 112 void IFWL_ComboBoxProxy::OnFocusChanged(CFWL_MsgKillFocus* pMsg, bool bSet) {
113 if (bSet) 113 if (bSet)
114 return; 114 return;
115 115
116 if (!pMsg->m_pSetFocus) 116 if (!pMsg->m_pSetFocus)
117 m_pComboBox->ShowDropList(FALSE); 117 m_pComboBox->ShowDropList(false);
118 } 118 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_comboboxproxy.h ('k') | xfa/fwl/core/ifwl_comboedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698