| 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 "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 if (m_pTimerInfo) { | 28 if (m_pTimerInfo) { |
| 29 m_pTimerInfo->StopTimer(); | 29 m_pTimerInfo->StopTimer(); |
| 30 m_pTimerInfo = nullptr; | 30 m_pTimerInfo = nullptr; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 FWL_Type IFWL_Caret::GetClassID() const { | 34 FWL_Type IFWL_Caret::GetClassID() const { |
| 35 return FWL_Type::Caret; | 35 return FWL_Type::Caret; |
| 36 } | 36 } |
| 37 | 37 |
| 38 FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, | 38 void IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics, |
| 39 const CFX_Matrix* pMatrix) { | 39 const CFX_Matrix* pMatrix) { |
| 40 if (!pGraphics) | 40 if (!pGraphics) |
| 41 return FWL_Error::Indefinite; | 41 return; |
| 42 if (!m_pProperties->m_pThemeProvider) | 42 if (!m_pProperties->m_pThemeProvider) |
| 43 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 43 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 44 if (!m_pProperties->m_pThemeProvider) | 44 if (!m_pProperties->m_pThemeProvider) |
| 45 return FWL_Error::Indefinite; | 45 return; |
| 46 | 46 |
| 47 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); | 47 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); |
| 48 return FWL_Error::Succeeded; | |
| 49 } | 48 } |
| 50 | 49 |
| 51 void IFWL_Caret::ShowCaret(bool bFlag) { | 50 void IFWL_Caret::ShowCaret(bool bFlag) { |
| 52 if (m_pTimerInfo) { | 51 if (m_pTimerInfo) { |
| 53 m_pTimerInfo->StopTimer(); | 52 m_pTimerInfo->StopTimer(); |
| 54 m_pTimerInfo = nullptr; | 53 m_pTimerInfo = nullptr; |
| 55 } | 54 } |
| 56 if (bFlag) | 55 if (bFlag) |
| 57 m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true); | 56 m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true); |
| 58 | 57 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 109 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
| 111 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); | 110 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); |
| 112 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); | 111 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); |
| 113 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); | 112 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); |
| 114 | 113 |
| 115 CFX_RectF rt; | 114 CFX_RectF rt; |
| 116 pCaret->GetWidgetRect(rt); | 115 pCaret->GetWidgetRect(rt); |
| 117 rt.Set(0, 0, rt.width + 1, rt.height); | 116 rt.Set(0, 0, rt.width + 1, rt.height); |
| 118 pCaret->Repaint(&rt); | 117 pCaret->Repaint(&rt); |
| 119 } | 118 } |
| OLD | NEW |