| 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/cfwl_caret.h" | 7 #include "xfa/fwl/core/cfwl_caret.h" |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (!pGraphics) | 48 if (!pGraphics) |
| 49 return; | 49 return; |
| 50 if (!m_pProperties->m_pThemeProvider) | 50 if (!m_pProperties->m_pThemeProvider) |
| 51 m_pProperties->m_pThemeProvider = GetAvailableTheme(); | 51 m_pProperties->m_pThemeProvider = GetAvailableTheme(); |
| 52 if (!m_pProperties->m_pThemeProvider) | 52 if (!m_pProperties->m_pThemeProvider) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); | 55 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CFWL_Caret::ShowCaret(bool bFlag) { | 58 void CFWL_Caret::ShowCaret() { |
| 59 if (m_pTimerInfo) |
| 60 m_pTimerInfo->StopTimer(); |
| 61 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); |
| 62 SetStates(FWL_WGTSTATE_Invisible, false); |
| 63 } |
| 64 |
| 65 void CFWL_Caret::HideCaret() { |
| 59 if (m_pTimerInfo) { | 66 if (m_pTimerInfo) { |
| 60 m_pTimerInfo->StopTimer(); | 67 m_pTimerInfo->StopTimer(); |
| 61 m_pTimerInfo = nullptr; | 68 m_pTimerInfo = nullptr; |
| 62 } | 69 } |
| 63 if (bFlag) | 70 SetStates(FWL_WGTSTATE_Invisible, true); |
| 64 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); | |
| 65 | |
| 66 SetStates(FWL_WGTSTATE_Invisible, !bFlag); | |
| 67 } | 71 } |
| 68 | 72 |
| 69 void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, | 73 void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, |
| 70 IFWL_ThemeProvider* pTheme, | 74 IFWL_ThemeProvider* pTheme, |
| 71 const CFX_Matrix* pMatrix) { | 75 const CFX_Matrix* pMatrix) { |
| 72 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) | 76 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) |
| 73 return; | 77 return; |
| 74 | 78 |
| 75 CFX_RectF rect; | 79 CFX_RectF rect; |
| 76 GetWidgetRect(rect); | 80 GetWidgetRect(rect); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 99 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { | 103 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { |
| 100 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); | 104 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); |
| 101 pCaret->SetStates(FWL_STATE_CAT_HightLight, | 105 pCaret->SetStates(FWL_STATE_CAT_HightLight, |
| 102 !(pCaret->GetStates() & FWL_STATE_CAT_HightLight)); | 106 !(pCaret->GetStates() & FWL_STATE_CAT_HightLight)); |
| 103 | 107 |
| 104 CFX_RectF rt; | 108 CFX_RectF rt; |
| 105 pCaret->GetWidgetRect(rt); | 109 pCaret->GetWidgetRect(rt); |
| 106 rt.Set(0, 0, rt.width + 1, rt.height); | 110 rt.Set(0, 0, rt.width + 1, rt.height); |
| 107 pCaret->Repaint(&rt); | 111 pCaret->Repaint(&rt); |
| 108 } | 112 } |
| OLD | NEW |