| 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/ifwl_caret.h" | 7 #include "xfa/fwl/core/ifwl_caret.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | 10 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" |
| 11 #include "xfa/fwl/core/fwl_noteimp.h" | 11 #include "xfa/fwl/core/fwl_noteimp.h" |
| 12 #include "xfa/fwl/core/ifwl_caret.h" | 12 #include "xfa/fwl/core/ifwl_caret.h" |
| 13 #include "xfa/fwl/core/ifwl_themeprovider.h" | 13 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 14 | 14 |
| 15 IFWL_Caret::IFWL_Caret(const CFWL_WidgetImpProperties& properties, | 15 IFWL_Caret::IFWL_Caret(const CFWL_WidgetImpProperties& properties, |
| 16 IFWL_Widget* pOuter) | 16 IFWL_Widget* pOuter) |
| 17 : IFWL_Widget(properties, pOuter), | 17 : IFWL_Widget(properties, pOuter), |
| 18 m_pTimer(new CFWL_CaretTimer(this)), | 18 m_pTimer(new CFWL_CaretTimer(this)), |
| 19 m_pTimerInfo(nullptr), | 19 m_pTimerInfo(nullptr), |
| 20 m_dwElapse(400), | 20 m_dwElapse(400), |
| 21 m_bSetColor(FALSE) { | 21 m_bSetColor(FALSE) { |
| 22 SetStates(FWL_STATE_CAT_HightLight); | 22 SetStates(FWL_STATE_CAT_HightLight); |
| 23 } | 23 } |
| 24 | 24 |
| 25 IFWL_Caret::~IFWL_Caret() {} | 25 IFWL_Caret::~IFWL_Caret() {} |
| 26 | 26 |
| 27 FWL_Error IFWL_Caret::GetClassName(CFX_WideString& wsClass) const { | |
| 28 wsClass = FWL_CLASS_Caret; | |
| 29 return FWL_Error::Succeeded; | |
| 30 } | |
| 31 | |
| 32 FWL_Type IFWL_Caret::GetClassID() const { | 27 FWL_Type IFWL_Caret::GetClassID() const { |
| 33 return FWL_Type::Caret; | 28 return FWL_Type::Caret; |
| 34 } | 29 } |
| 35 | 30 |
| 36 FWL_Error IFWL_Caret::Initialize() { | 31 FWL_Error IFWL_Caret::Initialize() { |
| 37 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) | 32 if (IFWL_Widget::Initialize() != FWL_Error::Succeeded) |
| 38 return FWL_Error::Indefinite; | 33 return FWL_Error::Indefinite; |
| 39 | 34 |
| 40 m_pDelegate = new CFWL_CaretImpDelegate(this); | 35 m_pDelegate = new CFWL_CaretImpDelegate(this); |
| 41 return FWL_Error::Succeeded; | 36 return FWL_Error::Succeeded; |
| 42 } | 37 } |
| 43 | 38 |
| 44 FWL_Error IFWL_Caret::Finalize() { | 39 void IFWL_Caret::Finalize() { |
| 45 if (m_pTimerInfo) { | 40 if (m_pTimerInfo) { |
| 46 m_pTimerInfo->StopTimer(); | 41 m_pTimerInfo->StopTimer(); |
| 47 m_pTimerInfo = nullptr; | 42 m_pTimerInfo = nullptr; |
| 48 } | 43 } |
| 49 delete m_pDelegate; | 44 delete m_pDelegate; |
| 50 m_pDelegate = nullptr; | 45 m_pDelegate = nullptr; |
| 51 return IFWL_Widget::Finalize(); | 46 IFWL_Widget::Finalize(); |
| 52 } | 47 } |
| 53 | 48 |
| 54 FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, | 49 FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, |
| 55 const CFX_Matrix* pMatrix) { | 50 const CFX_Matrix* pMatrix) { |
| 56 if (!pGraphics) | 51 if (!pGraphics) |
| 57 return FWL_Error::Indefinite; | 52 return FWL_Error::Indefinite; |
| 58 if (!m_pProperties->m_pThemeProvider) | 53 if (!m_pProperties->m_pThemeProvider) |
| 59 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 54 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 60 if (!m_pProperties->m_pThemeProvider) | 55 if (!m_pProperties->m_pThemeProvider) |
| 61 return FWL_Error::Indefinite; | 56 return FWL_Error::Indefinite; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 124 |
| 130 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(IFWL_Caret* pOwner) | 125 CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(IFWL_Caret* pOwner) |
| 131 : m_pOwner(pOwner) {} | 126 : m_pOwner(pOwner) {} |
| 132 | 127 |
| 133 void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {} | 128 void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {} |
| 134 | 129 |
| 135 void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, | 130 void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, |
| 136 const CFX_Matrix* pMatrix) { | 131 const CFX_Matrix* pMatrix) { |
| 137 m_pOwner->DrawWidget(pGraphics, pMatrix); | 132 m_pOwner->DrawWidget(pGraphics, pMatrix); |
| 138 } | 133 } |
| OLD | NEW |