| 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/core/fwl_noteimp.h" | 7 #include "xfa/fwl/core/fwl_noteimp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
| 10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 auto it = m_eventTargets.begin(); | 630 auto it = m_eventTargets.begin(); |
| 631 while (it != m_eventTargets.end()) { | 631 while (it != m_eventTargets.end()) { |
| 632 auto old = it++; | 632 auto old = it++; |
| 633 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 633 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
| 634 delete old->second; | 634 delete old->second; |
| 635 m_eventTargets.erase(old); | 635 m_eventTargets.erase(old); |
| 636 } | 636 } |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 | 639 |
| 640 class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { | |
| 641 public: | |
| 642 CFWL_CoreToolTipDP(int32_t iInitDelayTime, int32_t iAutoDelayTime); | |
| 643 | |
| 644 // IFWL_ToolTipDP | |
| 645 FWL_Error GetCaption(IFWL_Widget* pWidget, | |
| 646 CFX_WideString& wsCaption) override; | |
| 647 int32_t GetInitialDelay(IFWL_Widget* pWidget) override; | |
| 648 int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override; | |
| 649 CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override; | |
| 650 CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override; | |
| 651 | |
| 652 CFX_RectF GetAnchor(); | |
| 653 | |
| 654 CFX_WideString m_wsCaption; | |
| 655 int32_t m_nInitDelayTime; | |
| 656 int32_t m_nAutoPopDelayTime; | |
| 657 CFX_RectF m_fAnchor; | |
| 658 }; | |
| 659 | |
| 660 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP(int32_t iInitDelayTime, | |
| 661 int32_t iAutoDelayTime) | |
| 662 : m_nInitDelayTime(iInitDelayTime), m_nAutoPopDelayTime(iAutoDelayTime) { | |
| 663 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | |
| 664 } | |
| 665 | |
| 666 FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, | |
| 667 CFX_WideString& wsCaption) { | |
| 668 wsCaption = m_wsCaption; | |
| 669 return FWL_Error::Succeeded; | |
| 670 } | |
| 671 | |
| 672 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | |
| 673 return m_nInitDelayTime; | |
| 674 } | |
| 675 | |
| 676 int32_t CFWL_CoreToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { | |
| 677 return m_nAutoPopDelayTime; | |
| 678 } | |
| 679 | |
| 680 CFX_DIBitmap* CFWL_CoreToolTipDP::GetToolTipIcon(IFWL_Widget* pWidget) { | |
| 681 return nullptr; | |
| 682 } | |
| 683 | |
| 684 CFX_SizeF CFWL_CoreToolTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) { | |
| 685 return CFX_SizeF(); | |
| 686 } | |
| 687 | |
| 688 CFX_RectF CFWL_CoreToolTipDP::GetAnchor() { | |
| 689 return m_fAnchor; | |
| 690 } | |
| 691 | |
| 692 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, | 640 CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, |
| 693 IFWL_Widget* pListener) | 641 IFWL_Widget* pListener) |
| 694 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {} | 642 : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {} |
| 695 CFWL_EventTarget::~CFWL_EventTarget() { | 643 CFWL_EventTarget::~CFWL_EventTarget() { |
| 696 m_eventSources.RemoveAll(); | 644 m_eventSources.RemoveAll(); |
| 697 } | 645 } |
| 698 | 646 |
| 699 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, | 647 int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, |
| 700 uint32_t dwFilter) { | 648 uint32_t dwFilter) { |
| 701 if (pSource) { | 649 if (pSource) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 case CFWL_EventType::Idle: | 700 case CFWL_EventType::Idle: |
| 753 return !!(dwFilter & FWL_EVENT_IDLE_MASK); | 701 return !!(dwFilter & FWL_EVENT_IDLE_MASK); |
| 754 default: | 702 default: |
| 755 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); | 703 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); |
| 756 } | 704 } |
| 757 } | 705 } |
| 758 | 706 |
| 759 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; | 707 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; |
| 760 | 708 |
| 761 CFWL_ToolTipContainer::CFWL_ToolTipContainer() | 709 CFWL_ToolTipContainer::CFWL_ToolTipContainer() |
| 762 : m_pToolTipDp(new CFWL_CoreToolTipDP(0, 2000)) {} | 710 : m_nInitDelayTime(0), m_nAutoPopDelayTime(2000) { |
| 711 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); |
| 712 } |
| 763 | 713 |
| 764 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {} | 714 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {} |
| 765 | 715 |
| 716 FWL_Error CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget, |
| 717 CFX_WideString& wsCaption) { |
| 718 wsCaption = m_wsCaption; |
| 719 return FWL_Error::Succeeded; |
| 720 } |
| 721 |
| 722 int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) { |
| 723 return m_nInitDelayTime; |
| 724 } |
| 725 |
| 726 int32_t CFWL_ToolTipContainer::GetAutoPopDelay(IFWL_Widget* pWidget) { |
| 727 return m_nAutoPopDelayTime; |
| 728 } |
| 729 |
| 730 CFX_DIBitmap* CFWL_ToolTipContainer::GetToolTipIcon(IFWL_Widget* pWidget) { |
| 731 return nullptr; |
| 732 } |
| 733 |
| 734 CFX_SizeF CFWL_ToolTipContainer::GetToolTipIconSize(IFWL_Widget* pWidget) { |
| 735 return CFX_SizeF(); |
| 736 } |
| 737 |
| 738 CFX_RectF CFWL_ToolTipContainer::GetAnchor() { |
| 739 return m_fAnchor; |
| 740 } |
| 741 |
| 766 // static | 742 // static |
| 767 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { | 743 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { |
| 768 if (!s_pInstance) | 744 if (!s_pInstance) |
| 769 s_pInstance = new CFWL_ToolTipContainer; | 745 s_pInstance = new CFWL_ToolTipContainer; |
| 770 return s_pInstance; | 746 return s_pInstance; |
| 771 } | 747 } |
| 772 | 748 |
| 773 // static | 749 // static |
| 774 void CFWL_ToolTipContainer::DeleteInstance() { | 750 void CFWL_ToolTipContainer::DeleteInstance() { |
| 775 delete s_pInstance; | 751 delete s_pInstance; |
| 776 s_pInstance = nullptr; | 752 s_pInstance = nullptr; |
| 777 } | 753 } |
| OLD | NEW |