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/core/fwl_noteimp.h" | 7 #include "xfa/fwl/core/fwl_noteimp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 if (!pDriver) | 63 if (!pDriver) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 pDriver->SendEvent(&ev); | 66 pDriver->SendEvent(&ev); |
| 67 } | 67 } |
| 68 CFWL_NoteDriver::CFWL_NoteDriver() | 68 CFWL_NoteDriver::CFWL_NoteDriver() |
| 69 : m_pHover(nullptr), | 69 : m_pHover(nullptr), |
| 70 m_pFocus(nullptr), | 70 m_pFocus(nullptr), |
| 71 m_pGrab(nullptr), | 71 m_pGrab(nullptr), |
| 72 m_pNoteLoop(new CFWL_NoteLoop) { | 72 m_pNoteLoop(new CFWL_NoteLoop) { |
| 73 PushNoteLoop(m_pNoteLoop); | 73 PushNoteLoop(m_pNoteLoop.get()); |
| 74 } | 74 } |
| 75 CFWL_NoteDriver::~CFWL_NoteDriver() { | 75 CFWL_NoteDriver::~CFWL_NoteDriver() { |
| 76 delete m_pNoteLoop; | |
| 77 ClearInvalidEventTargets(TRUE); | 76 ClearInvalidEventTargets(TRUE); |
| 78 } | 77 } |
| 79 | 78 |
| 80 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { | 79 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { |
| 81 if (m_eventTargets.empty()) | 80 if (m_eventTargets.empty()) |
| 82 return; | 81 return; |
| 83 | 82 |
| 84 for (const auto& pair : m_eventTargets) { | 83 for (const auto& pair : m_eventTargets) { |
| 85 CFWL_EventTarget* pEventTarget = pair.second; | 84 CFWL_EventTarget* pEventTarget = pair.second; |
| 86 if (pEventTarget && !pEventTarget->IsInvalid()) | 85 if (pEventTarget && !pEventTarget->IsInvalid()) |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 auto old = it++; | 647 auto old = it++; |
| 649 if (old->second && (bRemoveAll || old->second->IsInvalid())) { | 648 if (old->second && (bRemoveAll || old->second->IsInvalid())) { |
| 650 delete old->second; | 649 delete old->second; |
| 651 m_eventTargets.erase(old); | 650 m_eventTargets.erase(old); |
| 652 } | 651 } |
| 653 } | 652 } |
| 654 } | 653 } |
| 655 | 654 |
| 656 class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { | 655 class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { |
| 657 public: | 656 public: |
| 657 CFWL_CoreToolTipDP(); | |
| 658 CFWL_CoreToolTipDP(int32_t iInitDelayTime, int32_t iAutoDelayTime); | |
| 659 | |
| 658 // IFWL_ToolTipDP | 660 // IFWL_ToolTipDP |
| 659 FWL_Error GetCaption(IFWL_Widget* pWidget, | 661 FWL_Error GetCaption(IFWL_Widget* pWidget, |
| 660 CFX_WideString& wsCaption) override; | 662 CFX_WideString& wsCaption) override; |
| 661 int32_t GetInitialDelay(IFWL_Widget* pWidget) override; | 663 int32_t GetInitialDelay(IFWL_Widget* pWidget) override; |
| 662 int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override; | 664 int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override; |
| 663 CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override; | 665 CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override; |
| 664 CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override; | 666 CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override; |
| 665 | 667 |
| 666 CFX_RectF GetAnchor(); | 668 CFX_RectF GetAnchor(); |
| 667 CFWL_CoreToolTipDP(); | |
| 668 | 669 |
| 669 CFX_WideString m_wsCaption; | 670 CFX_WideString m_wsCaption; |
| 670 int32_t m_nInitDelayTime; | 671 int32_t m_nInitDelayTime; |
| 671 int32_t m_nAutoPopDelayTime; | 672 int32_t m_nAutoPopDelayTime; |
| 672 CFX_RectF m_fAnchor; | 673 CFX_RectF m_fAnchor; |
| 673 }; | 674 }; |
| 674 | 675 |
| 675 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { | 676 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() |
|
Lei Zhang
2016/08/04 22:19:30
Is this ctor ever used? If yes, just use a Delegat
Wei Li
2016/08/04 22:54:12
It is not used in the code base. I thought maybe k
| |
| 676 m_nInitDelayTime = 500; | 677 : m_nInitDelayTime(500), m_nAutoPopDelayTime(50000) { |
| 677 m_nAutoPopDelayTime = 50000; | |
| 678 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | 678 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); |
| 679 } | 679 } |
| 680 | 680 |
| 681 CFWL_CoreToolTipDP::CFWL_CoreToolTipDP(int32_t iInitDelayTime, | |
| 682 int32_t iAutoDelayTime) | |
| 683 : m_nInitDelayTime(iInitDelayTime), m_nAutoPopDelayTime(iAutoDelayTime) { | |
| 684 m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); | |
| 685 } | |
| 686 | |
| 681 FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, | 687 FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, |
| 682 CFX_WideString& wsCaption) { | 688 CFX_WideString& wsCaption) { |
| 683 wsCaption = m_wsCaption; | 689 wsCaption = m_wsCaption; |
| 684 return FWL_Error::Succeeded; | 690 return FWL_Error::Succeeded; |
| 685 } | 691 } |
| 686 | 692 |
| 687 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { | 693 int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { |
| 688 return m_nInitDelayTime; | 694 return m_nInitDelayTime; |
| 689 } | 695 } |
| 690 | 696 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); | 772 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); |
| 767 case CFWL_EventType::Idle: | 773 case CFWL_EventType::Idle: |
| 768 return !!(dwFilter & FWL_EVENT_IDLE_MASK); | 774 return !!(dwFilter & FWL_EVENT_IDLE_MASK); |
| 769 default: | 775 default: |
| 770 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); | 776 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); |
| 771 } | 777 } |
| 772 } | 778 } |
| 773 | 779 |
| 774 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; | 780 CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr; |
| 775 | 781 |
| 776 CFWL_ToolTipContainer::CFWL_ToolTipContainer() : m_pToolTipImp(nullptr) { | 782 CFWL_ToolTipContainer::CFWL_ToolTipContainer() |
| 777 m_ToolTipDp = new CFWL_CoreToolTipDP; | 783 : m_pToolTipImp(nullptr), m_pToolTipDp(new CFWL_CoreToolTipDP(0, 2000)) {} |
| 778 m_ToolTipDp->m_nInitDelayTime = 0; | 784 |
| 779 m_ToolTipDp->m_nAutoPopDelayTime = 2000; | |
| 780 } | |
| 781 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { | 785 CFWL_ToolTipContainer::~CFWL_ToolTipContainer() { |
| 782 if (m_pToolTipImp) { | 786 if (m_pToolTipImp) { |
| 783 IFWL_ToolTip* pToolTip = | 787 IFWL_ToolTip* pToolTip = |
| 784 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); | 788 static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface()); |
| 785 pToolTip->Finalize(); | 789 pToolTip->Finalize(); |
| 786 delete pToolTip; | 790 delete pToolTip; |
| 787 } | 791 } |
| 788 delete m_ToolTipDp; | |
| 789 } | 792 } |
| 790 | 793 |
| 791 // static | 794 // static |
| 792 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { | 795 CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() { |
| 793 if (!s_pInstance) | 796 if (!s_pInstance) |
| 794 s_pInstance = new CFWL_ToolTipContainer; | 797 s_pInstance = new CFWL_ToolTipContainer; |
| 795 return s_pInstance; | 798 return s_pInstance; |
| 796 } | 799 } |
| 797 | 800 |
| 798 // static | 801 // static |
| 799 void CFWL_ToolTipContainer::DeleteInstance() { | 802 void CFWL_ToolTipContainer::DeleteInstance() { |
| 800 delete s_pInstance; | 803 delete s_pInstance; |
| 801 s_pInstance = nullptr; | 804 s_pInstance = nullptr; |
| 802 } | 805 } |
| OLD | NEW |