Chromium Code Reviews| 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_pushbuttonimp.h" | 7 #include "xfa/fwl/basewidget/fwl_pushbuttonimp.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" | 10 #include "xfa/fwl/basewidget/ifwl_pushbutton.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 m_iTTOAlign = FDE_TTOALIGNMENT_BottomRight; | 391 m_iTTOAlign = FDE_TTOALIGNMENT_BottomRight; |
| 392 break; | 392 break; |
| 393 } | 393 } |
| 394 default: {} | 394 default: {} |
| 395 } | 395 } |
| 396 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; | 396 m_dwTTOStyles = FDE_TTOSTYLE_SingleLine; |
| 397 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) { | 397 if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) { |
| 398 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; | 398 m_dwTTOStyles |= FDE_TTOSTYLE_RTL; |
| 399 } | 399 } |
| 400 } | 400 } |
| 401 | |
| 401 CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( | 402 CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( |
| 402 CFWL_PushButtonImp* pOwner) | 403 CFWL_PushButtonImp* pOwner) |
| 403 : m_pOwner(pOwner) {} | 404 : m_pOwner(pOwner) {} |
| 405 | |
| 404 int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { | 406 int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { |
| 405 if (!pMessage) | 407 if (!pMessage) |
| 406 return 0; | 408 return 0; |
| 407 if (!m_pOwner->IsEnabled()) { | 409 if (!m_pOwner->IsEnabled()) |
| 408 return 1; | 410 return 1; |
| 409 } | 411 |
| 410 int32_t iRet = 1; | 412 int32_t iRet = 1; |
| 411 uint32_t dwMsgCode = pMessage->GetClassID(); | 413 CFWL_MessageType dwMsgCode = pMessage->GetClassID(); |
| 412 switch (dwMsgCode) { | 414 switch (dwMsgCode) { |
| 413 case FWL_MSGHASH_SetFocus: | 415 case CFWL_MessageType::SetFocus: |
| 414 case FWL_MSGHASH_KillFocus: { | 416 case CFWL_MessageType::KillFocus: { |
| 415 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | 417 OnFocusChanged(pMessage, dwMsgCode == CFWL_MessageType::SetFocus); |
|
Tom Sepez
2016/04/21 19:22:33
missed a third.
dsinclair
2016/04/21 19:35:49
Done.
| |
| 416 break; | 418 break; |
| 417 } | 419 } |
| 418 case FWL_MSGHASH_Mouse: { | 420 case CFWL_MessageType::Mouse: { |
| 419 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 421 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
| 420 uint32_t dwCmd = pMsg->m_dwCmd; | 422 uint32_t dwCmd = pMsg->m_dwCmd; |
| 421 switch (dwCmd) { | 423 switch (dwCmd) { |
| 422 case FWL_MSGMOUSECMD_LButtonDown: { | 424 case FWL_MSGMOUSECMD_LButtonDown: { |
| 423 OnLButtonDown(pMsg); | 425 OnLButtonDown(pMsg); |
| 424 break; | 426 break; |
| 425 } | 427 } |
| 426 case FWL_MSGMOUSECMD_LButtonUp: { | 428 case FWL_MSGMOUSECMD_LButtonUp: { |
| 427 OnLButtonUp(pMsg); | 429 OnLButtonUp(pMsg); |
| 428 break; | 430 break; |
| 429 } | 431 } |
| 430 case FWL_MSGMOUSECMD_MouseMove: { | 432 case FWL_MSGMOUSECMD_MouseMove: { |
| 431 OnMouseMove(pMsg); | 433 OnMouseMove(pMsg); |
| 432 break; | 434 break; |
| 433 } | 435 } |
| 434 case FWL_MSGMOUSECMD_MouseLeave: { | 436 case FWL_MSGMOUSECMD_MouseLeave: { |
| 435 OnMouseLeave(pMsg); | 437 OnMouseLeave(pMsg); |
| 436 break; | 438 break; |
| 437 } | 439 } |
| 438 default: {} | 440 default: |
| 441 break; | |
| 439 } | 442 } |
| 440 break; | 443 break; |
| 441 } | 444 } |
| 442 case FWL_MSGHASH_Key: { | 445 case CFWL_MessageType::Key: { |
| 443 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 446 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
| 444 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 447 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
| 445 OnKeyDown(pKey); | 448 OnKeyDown(pKey); |
| 446 } | |
| 447 break; | 449 break; |
| 448 } | 450 } |
| 449 default: { | 451 default: { |
| 450 iRet = 0; | 452 iRet = 0; |
| 451 break; | 453 break; |
| 452 } | 454 } |
| 453 } | 455 } |
| 454 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 456 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
| 455 return iRet; | 457 return iRet; |
| 456 } | 458 } |
| 459 | |
| 457 FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 460 FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
| 458 return FWL_ERR_Succeeded; | 461 return FWL_ERR_Succeeded; |
| 459 } | 462 } |
| 460 FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 463 FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 461 const CFX_Matrix* pMatrix) { | 464 const CFX_Matrix* pMatrix) { |
| 462 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 465 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 463 } | 466 } |
| 464 void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 467 void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
| 465 FX_BOOL bSet) { | 468 FX_BOOL bSet) { |
| 466 if (bSet) { | 469 if (bSet) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 CFWL_EvtClick wmClick; | 548 CFWL_EvtClick wmClick; |
| 546 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; | 549 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; |
| 547 m_pOwner->DispatchEvent(&wmClick); | 550 m_pOwner->DispatchEvent(&wmClick); |
| 548 return; | 551 return; |
| 549 } | 552 } |
| 550 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { | 553 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { |
| 551 return; | 554 return; |
| 552 } | 555 } |
| 553 m_pOwner->DispatchKeyEvent(pMsg); | 556 m_pOwner->DispatchKeyEvent(pMsg); |
| 554 } | 557 } |
| OLD | NEW |