OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/basewidget/fwl_comboboximp.h" | 7 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fee/fde_txtedtengine.h" | 10 #include "xfa/fee/fde_txtedtengine.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 backDefault = FALSE; | 152 backDefault = FALSE; |
153 break; | 153 break; |
154 } | 154 } |
155 case CFWL_MessageType::KillFocus: { | 155 case CFWL_MessageType::KillFocus: { |
156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; | 156 m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; |
157 backDefault = FALSE; | 157 backDefault = FALSE; |
158 break; | 158 break; |
159 } | 159 } |
160 case CFWL_MessageType::Mouse: { | 160 case CFWL_MessageType::Mouse: { |
161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 161 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
162 if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) && | 162 if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) && |
163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { | 163 ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) { |
164 m_pOwner->SetSelected(); | 164 m_pOwner->SetSelected(); |
165 m_pOwner->SetComboBoxFocus(TRUE); | 165 m_pOwner->SetComboBoxFocus(TRUE); |
166 } | 166 } |
167 break; | 167 break; |
168 } | 168 } |
169 default: | 169 default: |
170 break; | 170 break; |
171 } | 171 } |
172 if (!backDefault) | 172 if (!backDefault) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 CFX_RectF rect; | 301 CFX_RectF rect; |
302 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); | 302 m_pOwner->m_pVertScrollBar->GetWidgetRect(rect); |
303 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { | 303 if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) { |
304 pMsg->m_fx -= rect.left; | 304 pMsg->m_fx -= rect.left; |
305 pMsg->m_fy -= rect.top; | 305 pMsg->m_fy -= rect.top; |
306 IFWL_WidgetDelegate* pDelegate = | 306 IFWL_WidgetDelegate* pDelegate = |
307 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); | 307 m_pOwner->m_pVertScrollBar->SetDelegate(NULL); |
308 return pDelegate->OnProcessMessage(pMsg); | 308 return pDelegate->OnProcessMessage(pMsg); |
309 } | 309 } |
310 } | 310 } |
311 uint32_t dwCmd = pMsg->m_dwCmd; | 311 switch (pMsg->m_dwCmd) { |
312 switch (dwCmd) { | 312 case FWL_MouseCommand::Move: { |
313 case FWL_MSGMOUSECMD_MouseMove: { | |
314 backDefault = FALSE; | 313 backDefault = FALSE; |
315 OnDropListMouseMove(pMsg); | 314 OnDropListMouseMove(pMsg); |
316 break; | 315 break; |
317 } | 316 } |
318 case FWL_MSGMOUSECMD_LButtonDown: { | 317 case FWL_MouseCommand::LeftButtonDown: { |
319 backDefault = FALSE; | 318 backDefault = FALSE; |
320 OnDropListLButtonDown(pMsg); | 319 OnDropListLButtonDown(pMsg); |
321 break; | 320 break; |
322 } | 321 } |
323 case FWL_MSGMOUSECMD_LButtonUp: { | 322 case FWL_MouseCommand::LeftButtonUp: { |
324 backDefault = FALSE; | 323 backDefault = FALSE; |
325 OnDropListLButtonUp(pMsg); | 324 OnDropListLButtonUp(pMsg); |
326 break; | 325 break; |
327 } | 326 } |
328 default: {} | 327 default: |
| 328 break; |
329 } | 329 } |
330 } else if (dwHashCode == CFWL_MessageType::Key) { | 330 } else if (dwHashCode == CFWL_MessageType::Key) { |
331 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); | 331 backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); |
332 } | 332 } |
333 if (!backDefault) | 333 if (!backDefault) |
334 return 1; | 334 return 1; |
335 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); | 335 return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); |
336 } | 336 } |
337 | 337 |
338 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, | 338 void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 if (hItem) { | 408 if (hItem) { |
409 pOuter->ProcessSelChanged(TRUE); | 409 pOuter->ProcessSelChanged(TRUE); |
410 } | 410 } |
411 } | 411 } |
412 return 1; | 412 return 1; |
413 } | 413 } |
414 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { | 414 int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { |
415 CFWL_ComboBoxImp* pOuter = | 415 CFWL_ComboBoxImp* pOuter = |
416 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); | 416 static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl()); |
417 FX_BOOL bPropagate = FALSE; | 417 FX_BOOL bPropagate = FALSE; |
418 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 418 if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { |
419 uint32_t dwKeyCode = pKey->m_dwKeyCode; | 419 uint32_t dwKeyCode = pKey->m_dwKeyCode; |
420 switch (dwKeyCode) { | 420 switch (dwKeyCode) { |
421 case FWL_VKEY_Return: | 421 case FWL_VKEY_Return: |
422 case FWL_VKEY_Escape: { | 422 case FWL_VKEY_Escape: { |
423 pOuter->ShowDropList(FALSE); | 423 pOuter->ShowDropList(FALSE); |
424 return 1; | 424 return 1; |
425 } | 425 } |
426 case FWL_VKEY_Up: | 426 case FWL_VKEY_Up: |
427 case FWL_VKEY_Down: { | 427 case FWL_VKEY_Down: { |
428 OnDropListKeyDown(pKey); | 428 OnDropListKeyDown(pKey); |
429 pOuter->SetDelegate(nullptr); | 429 pOuter->SetDelegate(nullptr); |
430 pOuter->ProcessSelChanged(FALSE); | 430 pOuter->ProcessSelChanged(FALSE); |
431 return 1; | 431 return 1; |
432 } | 432 } |
433 default: { bPropagate = TRUE; } | 433 default: { bPropagate = TRUE; } |
434 } | 434 } |
435 } else if (pKey->m_dwCmd == FWL_MSGKEYCMD_Char) { | 435 } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) { |
436 bPropagate = TRUE; | 436 bPropagate = TRUE; |
437 } | 437 } |
438 if (bPropagate) { | 438 if (bPropagate) { |
439 pKey->m_pDstTarget = m_pOwner->m_pOuter; | 439 pKey->m_pDstTarget = m_pOwner->m_pOuter; |
440 pOuter->m_pDelegate->OnProcessMessage(pKey); | 440 pOuter->m_pDelegate->OnProcessMessage(pKey); |
441 return 1; | 441 return 1; |
442 } | 442 } |
443 return 0; | 443 return 0; |
444 } | 444 } |
445 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { | 445 void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 OnFocusChanged(pMessage, TRUE); | 1374 OnFocusChanged(pMessage, TRUE); |
1375 break; | 1375 break; |
1376 } | 1376 } |
1377 case CFWL_MessageType::KillFocus: { | 1377 case CFWL_MessageType::KillFocus: { |
1378 OnFocusChanged(pMessage, FALSE); | 1378 OnFocusChanged(pMessage, FALSE); |
1379 break; | 1379 break; |
1380 } | 1380 } |
1381 case CFWL_MessageType::Mouse: { | 1381 case CFWL_MessageType::Mouse: { |
1382 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1382 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1383 switch (pMsg->m_dwCmd) { | 1383 switch (pMsg->m_dwCmd) { |
1384 case FWL_MSGMOUSECMD_LButtonDown: { | 1384 case FWL_MouseCommand::LeftButtonDown: { |
1385 OnLButtonDown(pMsg); | 1385 OnLButtonDown(pMsg); |
1386 break; | 1386 break; |
1387 } | 1387 } |
1388 case FWL_MSGMOUSECMD_LButtonUp: { | 1388 case FWL_MouseCommand::LeftButtonUp: { |
1389 OnLButtonUp(pMsg); | 1389 OnLButtonUp(pMsg); |
1390 break; | 1390 break; |
1391 } | 1391 } |
1392 case FWL_MSGMOUSECMD_MouseMove: { | 1392 case FWL_MouseCommand::Move: { |
1393 OnMouseMove(pMsg); | 1393 OnMouseMove(pMsg); |
1394 break; | 1394 break; |
1395 } | 1395 } |
1396 case FWL_MSGMOUSECMD_MouseLeave: { | 1396 case FWL_MouseCommand::Leave: { |
1397 OnMouseLeave(pMsg); | 1397 OnMouseLeave(pMsg); |
1398 break; | 1398 break; |
1399 } | 1399 } |
1400 default: | 1400 default: |
1401 break; | 1401 break; |
1402 } | 1402 } |
1403 break; | 1403 break; |
1404 } | 1404 } |
1405 case CFWL_MessageType::Key: { | 1405 case CFWL_MessageType::Key: { |
1406 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); | 1406 OnKey(static_cast<CFWL_MsgKey*>(pMessage)); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 } | 1608 } |
1609 case CFWL_MessageType::KillFocus: { | 1609 case CFWL_MessageType::KillFocus: { |
1610 backDefault = FALSE; | 1610 backDefault = FALSE; |
1611 DisForm_OnFocusChanged(pMessage, FALSE); | 1611 DisForm_OnFocusChanged(pMessage, FALSE); |
1612 break; | 1612 break; |
1613 } | 1613 } |
1614 case CFWL_MessageType::Mouse: { | 1614 case CFWL_MessageType::Mouse: { |
1615 backDefault = FALSE; | 1615 backDefault = FALSE; |
1616 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1616 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1617 switch (pMsg->m_dwCmd) { | 1617 switch (pMsg->m_dwCmd) { |
1618 case FWL_MSGMOUSECMD_LButtonDown: { | 1618 case FWL_MouseCommand::LeftButtonDown: { |
1619 DisForm_OnLButtonDown(pMsg); | 1619 DisForm_OnLButtonDown(pMsg); |
1620 break; | 1620 break; |
1621 } | 1621 } |
1622 case FWL_MSGMOUSECMD_LButtonUp: { | 1622 case FWL_MouseCommand::LeftButtonUp: { |
1623 OnLButtonUp(pMsg); | 1623 OnLButtonUp(pMsg); |
1624 break; | 1624 break; |
1625 } | 1625 } |
1626 default: | 1626 default: |
1627 break; | 1627 break; |
1628 } | 1628 } |
1629 break; | 1629 break; |
1630 } | 1630 } |
1631 case CFWL_MessageType::Key: { | 1631 case CFWL_MessageType::Key: { |
1632 backDefault = FALSE; | 1632 backDefault = FALSE; |
1633 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 1633 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
1634 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) | 1634 if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp) |
1635 break; | 1635 break; |
1636 if (m_pOwner->DisForm_IsDropListShowed() && | 1636 if (m_pOwner->DisForm_IsDropListShowed() && |
1637 pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 1637 pKey->m_dwCmd == FWL_KeyCommand::KeyDown) { |
1638 FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || | 1638 FX_BOOL bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up || |
1639 pKey->m_dwKeyCode == FWL_VKEY_Down || | 1639 pKey->m_dwKeyCode == FWL_VKEY_Down || |
1640 pKey->m_dwKeyCode == FWL_VKEY_Return || | 1640 pKey->m_dwKeyCode == FWL_VKEY_Return || |
1641 pKey->m_dwKeyCode == FWL_VKEY_Escape; | 1641 pKey->m_dwKeyCode == FWL_VKEY_Escape; |
1642 if (bListKey) { | 1642 if (bListKey) { |
1643 IFWL_WidgetDelegate* pDelegate = | 1643 IFWL_WidgetDelegate* pDelegate = |
1644 m_pOwner->m_pListBox->SetDelegate(NULL); | 1644 m_pOwner->m_pListBox->SetDelegate(NULL); |
1645 pDelegate->OnProcessMessage(pMessage); | 1645 pDelegate->OnProcessMessage(pMessage); |
1646 break; | 1646 break; |
1647 } | 1647 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 m_pComboBox(pComboBox) {} | 1751 m_pComboBox(pComboBox) {} |
1752 | 1752 |
1753 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 1753 int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
1754 if (!pMessage) | 1754 if (!pMessage) |
1755 return 0; | 1755 return 0; |
1756 | 1756 |
1757 switch (pMessage->GetClassID()) { | 1757 switch (pMessage->GetClassID()) { |
1758 case CFWL_MessageType::Mouse: { | 1758 case CFWL_MessageType::Mouse: { |
1759 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 1759 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
1760 switch (pMsg->m_dwCmd) { | 1760 switch (pMsg->m_dwCmd) { |
1761 case FWL_MSGMOUSECMD_LButtonDown: { | 1761 case FWL_MouseCommand::LeftButtonDown: { |
1762 OnLButtonDown(pMsg); | 1762 OnLButtonDown(pMsg); |
1763 break; | 1763 break; |
1764 } | 1764 } |
1765 case FWL_MSGMOUSECMD_LButtonUp: { | 1765 case FWL_MouseCommand::LeftButtonUp: { |
1766 OnLButtonUp(pMsg); | 1766 OnLButtonUp(pMsg); |
1767 break; | 1767 break; |
1768 } | 1768 } |
1769 case FWL_MSGMOUSECMD_MouseMove: { | 1769 case FWL_MouseCommand::Move: { |
1770 OnMouseMove(pMsg); | 1770 OnMouseMove(pMsg); |
1771 break; | 1771 break; |
1772 } | 1772 } |
1773 default: | 1773 default: |
1774 break; | 1774 break; |
1775 } | 1775 } |
1776 break; | 1776 break; |
1777 } | 1777 } |
1778 case CFWL_MessageType::Deactivate: { | 1778 case CFWL_MessageType::Deactivate: { |
1779 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); | 1779 OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage)); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 m_pComboBox->ShowDropList(FALSE); | 1843 m_pComboBox->ShowDropList(FALSE); |
1844 } | 1844 } |
1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, | 1845 void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg, |
1846 FX_BOOL bSet) { | 1846 FX_BOOL bSet) { |
1847 if (!bSet) { | 1847 if (!bSet) { |
1848 if (pMsg->m_pSetFocus == NULL) { | 1848 if (pMsg->m_pSetFocus == NULL) { |
1849 m_pComboBox->ShowDropList(FALSE); | 1849 m_pComboBox->ShowDropList(FALSE); |
1850 } | 1850 } |
1851 } | 1851 } |
1852 } | 1852 } |
OLD | NEW |