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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 SetStates(FWL_WGTSTATE_Invisible); | 70 SetStates(FWL_WGTSTATE_Invisible); |
71 } | 71 } |
72 | 72 |
73 void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, | 73 void CFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, |
74 IFWL_ThemeProvider* pTheme, | 74 IFWL_ThemeProvider* pTheme, |
75 const CFX_Matrix* pMatrix) { | 75 const CFX_Matrix* pMatrix) { |
76 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) | 76 if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) |
77 return; | 77 return; |
78 | 78 |
79 CFX_RectF rect; | 79 CFX_RectF rect = GetWidgetRect(); |
80 GetWidgetRect(rect, false); | |
81 rect.Set(0, 0, rect.width, rect.height); | 80 rect.Set(0, 0, rect.width, rect.height); |
82 | 81 |
83 CFWL_ThemeBackground param; | 82 CFWL_ThemeBackground param; |
84 param.m_pWidget = this; | 83 param.m_pWidget = this; |
85 param.m_pGraphics = pGraphics; | 84 param.m_pGraphics = pGraphics; |
86 param.m_rtPart = rect; | 85 param.m_rtPart = rect; |
87 param.m_iPart = CFWL_Part::Background; | 86 param.m_iPart = CFWL_Part::Background; |
88 param.m_dwStates = CFWL_PartState_HightLight; | 87 param.m_dwStates = CFWL_PartState_HightLight; |
89 if (pMatrix) | 88 if (pMatrix) |
90 param.m_matrix.Concat(*pMatrix); | 89 param.m_matrix.Concat(*pMatrix); |
91 pTheme->DrawBackground(¶m); | 90 pTheme->DrawBackground(¶m); |
92 } | 91 } |
93 | 92 |
94 void CFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {} | 93 void CFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {} |
95 | 94 |
96 void CFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics, | 95 void CFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics, |
97 const CFX_Matrix* pMatrix) { | 96 const CFX_Matrix* pMatrix) { |
98 DrawWidget(pGraphics, pMatrix); | 97 DrawWidget(pGraphics, pMatrix); |
99 } | 98 } |
100 | 99 |
101 CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {} | 100 CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {} |
102 | 101 |
103 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { | 102 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { |
104 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); | 103 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); |
105 if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight)) | 104 if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight)) |
106 pCaret->SetStates(FWL_STATE_CAT_HightLight); | 105 pCaret->SetStates(FWL_STATE_CAT_HightLight); |
107 else | 106 else |
108 pCaret->RemoveStates(FWL_STATE_CAT_HightLight); | 107 pCaret->RemoveStates(FWL_STATE_CAT_HightLight); |
109 | 108 |
110 CFX_RectF rt; | 109 CFX_RectF rt = pCaret->GetWidgetRect(); |
111 pCaret->GetWidgetRect(rt, false); | |
112 rt.Set(0, 0, rt.width + 1, rt.height); | 110 rt.Set(0, 0, rt.width + 1, rt.height); |
113 pCaret->Repaint(&rt); | 111 pCaret->Repaint(&rt); |
114 } | 112 } |
OLD | NEW |