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 OnFocusChanged(pMessage, TRUE); |
415 OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); | |
416 break; | 417 break; |
417 } | 418 } |
418 case FWL_MSGHASH_Mouse: { | 419 case CFWL_MessageType::KillFocus: { |
| 420 OnFocusChanged(pMessage, FALSE); |
| 421 break; |
| 422 } |
| 423 case CFWL_MessageType::Mouse: { |
419 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); | 424 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); |
420 uint32_t dwCmd = pMsg->m_dwCmd; | 425 switch (pMsg->m_dwCmd) { |
421 switch (dwCmd) { | |
422 case FWL_MSGMOUSECMD_LButtonDown: { | 426 case FWL_MSGMOUSECMD_LButtonDown: { |
423 OnLButtonDown(pMsg); | 427 OnLButtonDown(pMsg); |
424 break; | 428 break; |
425 } | 429 } |
426 case FWL_MSGMOUSECMD_LButtonUp: { | 430 case FWL_MSGMOUSECMD_LButtonUp: { |
427 OnLButtonUp(pMsg); | 431 OnLButtonUp(pMsg); |
428 break; | 432 break; |
429 } | 433 } |
430 case FWL_MSGMOUSECMD_MouseMove: { | 434 case FWL_MSGMOUSECMD_MouseMove: { |
431 OnMouseMove(pMsg); | 435 OnMouseMove(pMsg); |
432 break; | 436 break; |
433 } | 437 } |
434 case FWL_MSGMOUSECMD_MouseLeave: { | 438 case FWL_MSGMOUSECMD_MouseLeave: { |
435 OnMouseLeave(pMsg); | 439 OnMouseLeave(pMsg); |
436 break; | 440 break; |
437 } | 441 } |
438 default: {} | 442 default: |
| 443 break; |
439 } | 444 } |
440 break; | 445 break; |
441 } | 446 } |
442 case FWL_MSGHASH_Key: { | 447 case CFWL_MessageType::Key: { |
443 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); | 448 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); |
444 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) { | 449 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) |
445 OnKeyDown(pKey); | 450 OnKeyDown(pKey); |
446 } | |
447 break; | 451 break; |
448 } | 452 } |
449 default: { | 453 default: { |
450 iRet = 0; | 454 iRet = 0; |
451 break; | 455 break; |
452 } | 456 } |
453 } | 457 } |
454 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); | 458 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); |
455 return iRet; | 459 return iRet; |
456 } | 460 } |
| 461 |
457 FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { | 462 FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { |
458 return FWL_ERR_Succeeded; | 463 return FWL_ERR_Succeeded; |
459 } | 464 } |
460 FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 465 FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
461 const CFX_Matrix* pMatrix) { | 466 const CFX_Matrix* pMatrix) { |
462 return m_pOwner->DrawWidget(pGraphics, pMatrix); | 467 return m_pOwner->DrawWidget(pGraphics, pMatrix); |
463 } | 468 } |
464 void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, | 469 void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, |
465 FX_BOOL bSet) { | 470 FX_BOOL bSet) { |
466 if (bSet) { | 471 if (bSet) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 CFWL_EvtClick wmClick; | 550 CFWL_EvtClick wmClick; |
546 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; | 551 wmClick.m_pSrcTarget = m_pOwner->m_pInterface; |
547 m_pOwner->DispatchEvent(&wmClick); | 552 m_pOwner->DispatchEvent(&wmClick); |
548 return; | 553 return; |
549 } | 554 } |
550 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { | 555 if (pMsg->m_dwKeyCode != FWL_VKEY_Tab) { |
551 return; | 556 return; |
552 } | 557 } |
553 m_pOwner->DispatchKeyEvent(pMsg); | 558 m_pOwner->DispatchKeyEvent(pMsg); |
554 } | 559 } |
OLD | NEW |