OLD | NEW |
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/cfwl_comboboxproxy.h" | 7 #include "xfa/fwl/core/cfwl_comboboxproxy.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); | 63 m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); |
64 } | 64 } |
65 | 65 |
66 void CFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) { | 66 void CFWL_ComboBoxProxy::OnLButtonDown(CFWL_Message* pMessage) { |
67 const CFWL_App* pApp = GetOwnerApp(); | 67 const CFWL_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 = GetWidgetRect(); |
74 GetWidgetRect(rtWidget, false); | |
75 rtWidget.left = rtWidget.top = 0; | 74 rtWidget.left = rtWidget.top = 0; |
76 | 75 |
77 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 76 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
78 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { | 77 if (rtWidget.Contains(pMsg->m_fx, pMsg->m_fy)) { |
79 m_bLButtonDown = true; | 78 m_bLButtonDown = true; |
80 pDriver->SetGrab(this, true); | 79 pDriver->SetGrab(this, true); |
81 } else { | 80 } else { |
82 m_bLButtonDown = false; | 81 m_bLButtonDown = false; |
83 pDriver->SetGrab(this, false); | 82 pDriver->SetGrab(this, false); |
84 m_pComboBox->ShowDropList(false); | 83 m_pComboBox->ShowDropList(false); |
85 } | 84 } |
86 } | 85 } |
87 | 86 |
88 void CFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) { | 87 void CFWL_ComboBoxProxy::OnLButtonUp(CFWL_Message* pMessage) { |
89 m_bLButtonDown = false; | 88 m_bLButtonDown = false; |
90 const CFWL_App* pApp = GetOwnerApp(); | 89 const CFWL_App* pApp = GetOwnerApp(); |
91 if (!pApp) | 90 if (!pApp) |
92 return; | 91 return; |
93 | 92 |
94 CFWL_NoteDriver* pDriver = | 93 CFWL_NoteDriver* pDriver = |
95 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); | 94 static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); |
96 pDriver->SetGrab(this, false); | 95 pDriver->SetGrab(this, false); |
97 if (!m_bLButtonUpSelf) { | 96 if (!m_bLButtonUpSelf) { |
98 m_bLButtonUpSelf = true; | 97 m_bLButtonUpSelf = true; |
99 return; | 98 return; |
100 } | 99 } |
101 | 100 |
102 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 101 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
103 CFX_RectF rect; | 102 CFX_RectF rect = GetWidgetRect(); |
104 GetWidgetRect(rect, false); | |
105 rect.left = rect.top = 0; | 103 rect.left = rect.top = 0; |
106 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && | 104 if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) && |
107 m_pComboBox->IsDropListVisible()) { | 105 m_pComboBox->IsDropListVisible()) { |
108 m_pComboBox->ShowDropList(false); | 106 m_pComboBox->ShowDropList(false); |
109 } | 107 } |
110 } | 108 } |
111 | 109 |
112 void CFWL_ComboBoxProxy::OnFocusChanged(CFWL_Message* pMessage, bool bSet) { | 110 void CFWL_ComboBoxProxy::OnFocusChanged(CFWL_Message* pMessage, bool bSet) { |
113 if (bSet) | 111 if (bSet) |
114 return; | 112 return; |
115 | 113 |
116 CFWL_MsgKillFocus* pMsg = static_cast<CFWL_MsgKillFocus*>(pMessage); | 114 CFWL_MsgKillFocus* pMsg = static_cast<CFWL_MsgKillFocus*>(pMessage); |
117 if (!pMsg->m_pSetFocus) | 115 if (!pMsg->m_pSetFocus) |
118 m_pComboBox->ShowDropList(false); | 116 m_pComboBox->ShowDropList(false); |
119 } | 117 } |
OLD | NEW |