Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: xfa/fwl/core/cfwl_caret.cpp

Issue 2533623002: Cleanup default FWL params part I (Closed)
Patch Set: Rebase to master Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fwl/core/cfwl_caret.h ('k') | xfa/fwl/core/cfwl_checkbox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 58 void CFWL_Caret::ShowCaret() {
59 if (m_pTimerInfo) 59 if (m_pTimerInfo)
60 m_pTimerInfo->StopTimer(); 60 m_pTimerInfo->StopTimer();
61 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); 61 m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true);
62 SetStates(FWL_WGTSTATE_Invisible, false); 62 RemoveStates(FWL_WGTSTATE_Invisible);
63 } 63 }
64 64
65 void CFWL_Caret::HideCaret() { 65 void CFWL_Caret::HideCaret() {
66 if (m_pTimerInfo) { 66 if (m_pTimerInfo) {
67 m_pTimerInfo->StopTimer(); 67 m_pTimerInfo->StopTimer();
68 m_pTimerInfo = nullptr; 68 m_pTimerInfo = nullptr;
69 } 69 }
70 SetStates(FWL_WGTSTATE_Invisible, true); 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;
80 GetWidgetRect(rect); 80 GetWidgetRect(rect, false);
81 rect.Set(0, 0, rect.width, rect.height); 81 rect.Set(0, 0, rect.width, rect.height);
82 82
83 CFWL_ThemeBackground param; 83 CFWL_ThemeBackground param;
84 param.m_pWidget = this; 84 param.m_pWidget = this;
85 param.m_pGraphics = pGraphics; 85 param.m_pGraphics = pGraphics;
86 param.m_rtPart = rect; 86 param.m_rtPart = rect;
87 param.m_iPart = CFWL_Part::Background; 87 param.m_iPart = CFWL_Part::Background;
88 param.m_dwStates = CFWL_PartState_HightLight; 88 param.m_dwStates = CFWL_PartState_HightLight;
89 if (pMatrix) 89 if (pMatrix)
90 param.m_matrix.Concat(*pMatrix); 90 param.m_matrix.Concat(*pMatrix);
91 pTheme->DrawBackground(&param); 91 pTheme->DrawBackground(&param);
92 } 92 }
93 93
94 void CFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {} 94 void CFWL_Caret::OnProcessMessage(CFWL_Message* pMessage) {}
95 95
96 void CFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics, 96 void CFWL_Caret::OnDrawWidget(CFX_Graphics* pGraphics,
97 const CFX_Matrix* pMatrix) { 97 const CFX_Matrix* pMatrix) {
98 DrawWidget(pGraphics, pMatrix); 98 DrawWidget(pGraphics, pMatrix);
99 } 99 }
100 100
101 CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {} 101 CFWL_Caret::Timer::Timer(CFWL_Caret* pCaret) : CFWL_Timer(pCaret) {}
102 102
103 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) { 103 void CFWL_Caret::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
104 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget); 104 CFWL_Caret* pCaret = static_cast<CFWL_Caret*>(m_pWidget);
105 pCaret->SetStates(FWL_STATE_CAT_HightLight, 105 if (!(pCaret->GetStates() & FWL_STATE_CAT_HightLight))
106 !(pCaret->GetStates() & FWL_STATE_CAT_HightLight)); 106 pCaret->SetStates(FWL_STATE_CAT_HightLight);
107 else
108 pCaret->RemoveStates(FWL_STATE_CAT_HightLight);
107 109
108 CFX_RectF rt; 110 CFX_RectF rt;
109 pCaret->GetWidgetRect(rt); 111 pCaret->GetWidgetRect(rt, false);
110 rt.Set(0, 0, rt.width + 1, rt.height); 112 rt.Set(0, 0, rt.width + 1, rt.height);
111 pCaret->Repaint(&rt); 113 pCaret->Repaint(&rt);
112 } 114 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/cfwl_caret.h ('k') | xfa/fwl/core/cfwl_checkbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698