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_combolist.h" | 7 #include "xfa/fwl/core/cfwl_combolist.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 CFWL_Message::Type type = pMessage->GetType(); | 80 CFWL_Message::Type type = pMessage->GetType(); |
81 bool backDefault = true; | 81 bool backDefault = true; |
82 if (type == CFWL_Message::Type::SetFocus || | 82 if (type == CFWL_Message::Type::SetFocus || |
83 type == CFWL_Message::Type::KillFocus) { | 83 type == CFWL_Message::Type::KillFocus) { |
84 OnDropListFocusChanged(pMessage, type == CFWL_Message::Type::SetFocus); | 84 OnDropListFocusChanged(pMessage, type == CFWL_Message::Type::SetFocus); |
85 } else if (type == CFWL_Message::Type::Mouse) { | 85 } else if (type == CFWL_Message::Type::Mouse) { |
86 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 86 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
87 CFWL_ScrollBar* vertSB = GetVertScrollBar(); | 87 CFWL_ScrollBar* vertSB = GetVertScrollBar(); |
88 if (IsShowScrollBar(true) && vertSB) { | 88 if (IsShowScrollBar(true) && vertSB) { |
89 CFX_RectF rect; | 89 CFX_RectF rect = vertSB->GetWidgetRect(); |
90 vertSB->GetWidgetRect(rect, false); | |
91 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 90 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
92 pMsg->m_fx -= rect.left; | 91 pMsg->m_fx -= rect.left; |
93 pMsg->m_fy -= rect.top; | 92 pMsg->m_fy -= rect.top; |
94 vertSB->GetDelegate()->OnProcessMessage(pMsg); | 93 vertSB->GetDelegate()->OnProcessMessage(pMsg); |
95 return; | 94 return; |
96 } | 95 } |
97 } | 96 } |
98 switch (pMsg->m_dwCmd) { | 97 switch (pMsg->m_dwCmd) { |
99 case FWL_MouseCommand::Move: { | 98 case FWL_MouseCommand::Move: { |
100 backDefault = false; | 99 backDefault = false; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 132 } |
134 } | 133 } |
135 | 134 |
136 void CFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { | 135 void CFWL_ComboList::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { |
137 if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy)) { | 136 if (GetRTClient().Contains(pMsg->m_fx, pMsg->m_fy)) { |
138 if (m_bNotifyOwner) | 137 if (m_bNotifyOwner) |
139 m_bNotifyOwner = false; | 138 m_bNotifyOwner = false; |
140 | 139 |
141 CFWL_ScrollBar* vertSB = GetVertScrollBar(); | 140 CFWL_ScrollBar* vertSB = GetVertScrollBar(); |
142 if (IsShowScrollBar(true) && vertSB) { | 141 if (IsShowScrollBar(true) && vertSB) { |
143 CFX_RectF rect; | 142 CFX_RectF rect = vertSB->GetWidgetRect(); |
144 vertSB->GetWidgetRect(rect, false); | |
145 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) | 143 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) |
146 return; | 144 return; |
147 } | 145 } |
148 | 146 |
149 CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | 147 CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
150 if (!hItem) | 148 if (!hItem) |
151 return; | 149 return; |
152 | 150 |
153 ChangeSelected(GetItemIndex(this, hItem)); | 151 ChangeSelected(GetItemIndex(this, hItem)); |
154 } else if (m_bNotifyOwner) { | 152 } else if (m_bNotifyOwner) { |
(...skipping 14 matching lines...) Expand all Loading... |
169 void CFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { | 167 void CFWL_ComboList::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) { |
170 CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter); | 168 CFWL_ComboBox* pOuter = static_cast<CFWL_ComboBox*>(m_pOuter); |
171 if (m_bNotifyOwner) { | 169 if (m_bNotifyOwner) { |
172 ClientToOuter(pMsg->m_fx, pMsg->m_fy); | 170 ClientToOuter(pMsg->m_fx, pMsg->m_fy); |
173 pOuter->GetDelegate()->OnProcessMessage(pMsg); | 171 pOuter->GetDelegate()->OnProcessMessage(pMsg); |
174 return; | 172 return; |
175 } | 173 } |
176 | 174 |
177 CFWL_ScrollBar* vertSB = GetVertScrollBar(); | 175 CFWL_ScrollBar* vertSB = GetVertScrollBar(); |
178 if (IsShowScrollBar(true) && vertSB) { | 176 if (IsShowScrollBar(true) && vertSB) { |
179 CFX_RectF rect; | 177 CFX_RectF rect = vertSB->GetWidgetRect(); |
180 vertSB->GetWidgetRect(rect, false); | |
181 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) | 178 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) |
182 return; | 179 return; |
183 } | 180 } |
184 pOuter->ShowDropList(false); | 181 pOuter->ShowDropList(false); |
185 | 182 |
186 CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); | 183 CFWL_ListItem* hItem = GetItemAtPoint(pMsg->m_fx, pMsg->m_fy); |
187 if (hItem) | 184 if (hItem) |
188 pOuter->ProcessSelChanged(true); | 185 pOuter->ProcessSelChanged(true); |
189 } | 186 } |
190 | 187 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 CFX_RectF rtInvalidate; | 236 CFX_RectF rtInvalidate; |
240 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, | 237 rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, |
241 m_pProperties->m_rtWidget.height); | 238 m_pProperties->m_rtWidget.height); |
242 Repaint(&rtInvalidate); | 239 Repaint(&rtInvalidate); |
243 break; | 240 break; |
244 } | 241 } |
245 default: | 242 default: |
246 break; | 243 break; |
247 } | 244 } |
248 } | 245 } |
OLD | NEW |