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 <map> | 7 #include <map> |
8 | 8 |
9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 if (IFX_SystemHandler* pSH = GetSystemHandler()) { | 401 if (IFX_SystemHandler* pSH = GetSystemHandler()) { |
402 if (FX_HWND hWnd = GetAttachedHWnd()) { | 402 if (FX_HWND hWnd = GetAttachedHWnd()) { |
403 pSH->InvalidateRect(hWnd, rcWin); | 403 pSH->InvalidateRect(hWnd, rcWin); |
404 } | 404 } |
405 } | 405 } |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ | 409 #define PWL_IMPLEMENT_KEY_METHOD(key_method_name) \ |
410 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, FX_DWORD nFlag) { \ | 410 FX_BOOL CPWL_Wnd::key_method_name(uint16_t nChar, uint32_t nFlag) { \ |
411 if (IsValid() && IsVisible() && IsEnabled()) { \ | 411 if (IsValid() && IsVisible() && IsEnabled()) { \ |
412 if (IsWndCaptureKeyboard(this)) { \ | 412 if (IsWndCaptureKeyboard(this)) { \ |
413 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ | 413 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ |
414 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ | 414 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ |
415 if (IsWndCaptureKeyboard(pChild)) { \ | 415 if (IsWndCaptureKeyboard(pChild)) { \ |
416 return pChild->key_method_name(nChar, nFlag); \ | 416 return pChild->key_method_name(nChar, nFlag); \ |
417 } \ | 417 } \ |
418 } \ | 418 } \ |
419 } \ | 419 } \ |
420 } \ | 420 } \ |
421 } \ | 421 } \ |
422 return FALSE; \ | 422 return FALSE; \ |
423 } | 423 } |
424 | 424 |
425 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ | 425 #define PWL_IMPLEMENT_MOUSE_METHOD(mouse_method_name) \ |
426 FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ | 426 FX_BOOL CPWL_Wnd::mouse_method_name(const CFX_FloatPoint& point, \ |
427 FX_DWORD nFlag) { \ | 427 uint32_t nFlag) { \ |
428 if (IsValid() && IsVisible() && IsEnabled()) { \ | 428 if (IsValid() && IsVisible() && IsEnabled()) { \ |
429 if (IsWndCaptureMouse(this)) { \ | 429 if (IsWndCaptureMouse(this)) { \ |
430 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ | 430 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { \ |
431 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ | 431 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { \ |
432 if (IsWndCaptureMouse(pChild)) { \ | 432 if (IsWndCaptureMouse(pChild)) { \ |
433 return pChild->mouse_method_name(pChild->ParentToChild(point), \ | 433 return pChild->mouse_method_name(pChild->ParentToChild(point), \ |
434 nFlag); \ | 434 nFlag); \ |
435 } \ | 435 } \ |
436 } \ | 436 } \ |
437 } \ | 437 } \ |
(...skipping 23 matching lines...) Expand all Loading... |
461 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) | 461 PWL_IMPLEMENT_MOUSE_METHOD(OnLButtonUp) |
462 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) | 462 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDblClk) |
463 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) | 463 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonDown) |
464 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) | 464 PWL_IMPLEMENT_MOUSE_METHOD(OnMButtonUp) |
465 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) | 465 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonDown) |
466 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) | 466 PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) |
467 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) | 467 PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) |
468 | 468 |
469 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, | 469 FX_BOOL CPWL_Wnd::OnMouseWheel(short zDelta, |
470 const CFX_FloatPoint& point, | 470 const CFX_FloatPoint& point, |
471 FX_DWORD nFlag) { | 471 uint32_t nFlag) { |
472 if (IsValid() && IsVisible() && IsEnabled()) { | 472 if (IsValid() && IsVisible() && IsEnabled()) { |
473 SetCursor(); | 473 SetCursor(); |
474 if (IsWndCaptureKeyboard(this)) { | 474 if (IsWndCaptureKeyboard(this)) { |
475 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { | 475 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { |
476 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 476 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
477 if (IsWndCaptureKeyboard(pChild)) { | 477 if (IsWndCaptureKeyboard(pChild)) { |
478 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), | 478 return pChild->OnMouseWheel(zDelta, pChild->ParentToChild(point), |
479 nFlag); | 479 nFlag); |
480 } | 480 } |
481 } | 481 } |
(...skipping 12 matching lines...) Expand all Loading... |
494 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { | 494 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { |
495 if (pChild == pWnd) { | 495 if (pChild == pWnd) { |
496 m_aChildren.RemoveAt(i); | 496 m_aChildren.RemoveAt(i); |
497 break; | 497 break; |
498 } | 498 } |
499 } | 499 } |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
503 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, | 503 void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd, |
504 FX_DWORD msg, | 504 uint32_t msg, |
505 intptr_t wParam, | 505 intptr_t wParam, |
506 intptr_t lParam) { | 506 intptr_t lParam) { |
507 switch (msg) { | 507 switch (msg) { |
508 case PNM_ADDCHILD: | 508 case PNM_ADDCHILD: |
509 AddChild(pWnd); | 509 AddChild(pWnd); |
510 break; | 510 break; |
511 case PNM_REMOVECHILD: | 511 case PNM_REMOVECHILD: |
512 RemoveChild(pWnd); | 512 RemoveChild(pWnd); |
513 break; | 513 break; |
514 default: | 514 default: |
(...skipping 27 matching lines...) Expand all Loading... |
542 rcClient.Normalize(); | 542 rcClient.Normalize(); |
543 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); | 543 return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect(); |
544 } | 544 } |
545 | 545 |
546 CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { | 546 CFX_FloatPoint CPWL_Wnd::GetCenterPoint() const { |
547 CFX_FloatRect rcClient = GetClientRect(); | 547 CFX_FloatRect rcClient = GetClientRect(); |
548 return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, | 548 return CFX_FloatPoint((rcClient.left + rcClient.right) * 0.5f, |
549 (rcClient.top + rcClient.bottom) * 0.5f); | 549 (rcClient.top + rcClient.bottom) * 0.5f); |
550 } | 550 } |
551 | 551 |
552 FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const { | 552 FX_BOOL CPWL_Wnd::HasFlag(uint32_t dwFlags) const { |
553 return (m_sPrivateParam.dwFlags & dwFlags) != 0; | 553 return (m_sPrivateParam.dwFlags & dwFlags) != 0; |
554 } | 554 } |
555 | 555 |
556 void CPWL_Wnd::RemoveFlag(FX_DWORD dwFlags) { | 556 void CPWL_Wnd::RemoveFlag(uint32_t dwFlags) { |
557 m_sPrivateParam.dwFlags &= ~dwFlags; | 557 m_sPrivateParam.dwFlags &= ~dwFlags; |
558 } | 558 } |
559 | 559 |
560 void CPWL_Wnd::AddFlag(FX_DWORD dwFlags) { | 560 void CPWL_Wnd::AddFlag(uint32_t dwFlags) { |
561 m_sPrivateParam.dwFlags |= dwFlags; | 561 m_sPrivateParam.dwFlags |= dwFlags; |
562 } | 562 } |
563 | 563 |
564 CPWL_Color CPWL_Wnd::GetBackgroundColor() const { | 564 CPWL_Color CPWL_Wnd::GetBackgroundColor() const { |
565 return m_sPrivateParam.sBackgroundColor; | 565 return m_sPrivateParam.sBackgroundColor; |
566 } | 566 } |
567 | 567 |
568 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color& color) { | 568 void CPWL_Wnd::SetBackgroundColor(const CPWL_Color& color) { |
569 m_sPrivateParam.sBackgroundColor = color; | 569 m_sPrivateParam.sBackgroundColor = color; |
570 } | 570 } |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 } | 999 } |
1000 | 1000 |
1001 FX_BOOL CPWL_Wnd::IsEnabled() { | 1001 FX_BOOL CPWL_Wnd::IsEnabled() { |
1002 return m_bEnabled; | 1002 return m_bEnabled; |
1003 } | 1003 } |
1004 | 1004 |
1005 void CPWL_Wnd::OnEnabled() {} | 1005 void CPWL_Wnd::OnEnabled() {} |
1006 | 1006 |
1007 void CPWL_Wnd::OnDisabled() {} | 1007 void CPWL_Wnd::OnDisabled() {} |
1008 | 1008 |
1009 FX_BOOL CPWL_Wnd::IsCTRLpressed(FX_DWORD nFlag) const { | 1009 FX_BOOL CPWL_Wnd::IsCTRLpressed(uint32_t nFlag) const { |
1010 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1010 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1011 return pSystemHandler->IsCTRLKeyDown(nFlag); | 1011 return pSystemHandler->IsCTRLKeyDown(nFlag); |
1012 } | 1012 } |
1013 | 1013 |
1014 return FALSE; | 1014 return FALSE; |
1015 } | 1015 } |
1016 | 1016 |
1017 FX_BOOL CPWL_Wnd::IsSHIFTpressed(FX_DWORD nFlag) const { | 1017 FX_BOOL CPWL_Wnd::IsSHIFTpressed(uint32_t nFlag) const { |
1018 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1018 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1019 return pSystemHandler->IsSHIFTKeyDown(nFlag); | 1019 return pSystemHandler->IsSHIFTKeyDown(nFlag); |
1020 } | 1020 } |
1021 | 1021 |
1022 return FALSE; | 1022 return FALSE; |
1023 } | 1023 } |
1024 | 1024 |
1025 FX_BOOL CPWL_Wnd::IsALTpressed(FX_DWORD nFlag) const { | 1025 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { |
1026 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1026 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1027 return pSystemHandler->IsALTKeyDown(nFlag); | 1027 return pSystemHandler->IsALTKeyDown(nFlag); |
1028 } | 1028 } |
1029 | 1029 |
1030 return FALSE; | 1030 return FALSE; |
1031 } | 1031 } |
1032 | 1032 |
1033 FX_BOOL CPWL_Wnd::IsINSERTpressed(FX_DWORD nFlag) const { | 1033 FX_BOOL CPWL_Wnd::IsINSERTpressed(uint32_t nFlag) const { |
1034 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { | 1034 if (IFX_SystemHandler* pSystemHandler = GetSystemHandler()) { |
1035 return pSystemHandler->IsINSERTKeyDown(nFlag); | 1035 return pSystemHandler->IsINSERTKeyDown(nFlag); |
1036 } | 1036 } |
1037 | 1037 |
1038 return FALSE; | 1038 return FALSE; |
1039 } | 1039 } |
OLD | NEW |