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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 if (bFlag) | 59 if (bFlag) |
60 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); | 60 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); |
61 | 61 |
62 SetStates(FWL_WGTSTATE_Invisible, !bFlag); | 62 SetStates(FWL_WGTSTATE_Invisible, !bFlag); |
63 } | 63 } |
64 | 64 |
65 void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, | 65 void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, |
66 IFWL_ThemeProvider* pTheme, | 66 IFWL_ThemeProvider* pTheme, |
67 const CFX_Matrix* pMatrix) { | 67 const CFX_Matrix* pMatrix) { |
| 68 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) |
| 69 return; |
| 70 |
68 CFX_RectF rect; | 71 CFX_RectF rect; |
69 GetWidgetRect(rect); | 72 GetWidgetRect(rect); |
70 rect.Set(0, 0, rect.width, rect.height); | 73 rect.Set(0, 0, rect.width, rect.height); |
| 74 |
71 CFWL_ThemeBackground param; | 75 CFWL_ThemeBackground param; |
72 param.m_pWidget = this; | 76 param.m_pWidget = this; |
73 param.m_pGraphics = pGraphics; | 77 param.m_pGraphics = pGraphics; |
74 param.m_rtPart = rect; | 78 param.m_rtPart = rect; |
75 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) | |
76 return; | |
77 | |
78 param.m_iPart = CFWL_Part::Background; | 79 param.m_iPart = CFWL_Part::Background; |
79 param.m_dwStates = CFWL_PartState_HightLight; | 80 param.m_dwStates = CFWL_PartState_HightLight; |
80 if (pMatrix) | 81 if (pMatrix) |
81 param.m_matrix.Concat(*pMatrix); | 82 param.m_matrix.Concat(*pMatrix); |
82 | |
83 pTheme->DrawBackground(¶m); | 83 pTheme->DrawBackground(¶m); |
84 } | 84 } |
85 | 85 |
86 void IFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {} | 86 void IFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {} |
87 | 87 |
88 void IFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics, | 88 void IFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics, |
89 const CFX_Matrix* pMatrix) { | 89 const CFX_Matrix* pMatrix) { |
90 DrawWidget(pGraphics, pMatrix); | 90 DrawWidget(pGraphics, pMatrix); |
91 } | 91 } |
92 | 92 |
93 IFWL_Caret::Timer::Timer(IFWL_Caret* pCaret) : IFWL_Timer(pCaret) {} | 93 IFWL_Caret::Timer::Timer(IFWL_Caret* pCaret) : IFWL_Timer(pCaret) {} |
94 | 94 |
95 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { | 95 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { |
96 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); | 96 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); |
97 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); | 97 pCaret->SetStates(FWL_STATE_CAT_HightLight, |
98 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); | 98 !(pCaret->GetStates() & FWL_STATE_CAT_HightLight)); |
99 | 99 |
100 CFX_RectF rt; | 100 CFX_RectF rt; |
101 pCaret->GetWidgetRect(rt); | 101 pCaret->GetWidgetRect(rt); |
102 rt.Set(0, 0, rt.width + 1, rt.height); | 102 rt.Set(0, 0, rt.width + 1, rt.height); |
103 pCaret->Repaint(&rt); | 103 pCaret->Repaint(&rt); |
104 } | 104 } |
OLD | NEW |