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

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

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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/ifwl_caret.h ('k') | xfa/fwl/core/ifwl_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/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"
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" 11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h"
12 #include "xfa/fwl/core/fwl_noteimp.h" 12 #include "xfa/fwl/core/fwl_noteimp.h"
13 #include "xfa/fwl/core/ifwl_caret.h" 13 #include "xfa/fwl/core/ifwl_caret.h"
14 #include "xfa/fwl/core/ifwl_themeprovider.h" 14 #include "xfa/fwl/core/ifwl_themeprovider.h"
15 15
16 IFWL_Caret::IFWL_Caret(const IFWL_App* app, 16 IFWL_Caret::IFWL_Caret(const IFWL_App* app,
17 const CFWL_WidgetImpProperties& properties, 17 const CFWL_WidgetImpProperties& properties,
18 IFWL_Widget* pOuter) 18 IFWL_Widget* pOuter)
19 : IFWL_Widget(app, properties, pOuter), 19 : IFWL_Widget(app, properties, pOuter),
20 m_pTimer(new IFWL_Caret::Timer(this)), 20 m_pTimer(new IFWL_Caret::Timer(this)),
21 m_pTimerInfo(nullptr), 21 m_pTimerInfo(nullptr),
22 m_dwElapse(400), 22 m_dwElapse(400),
23 m_bSetColor(FALSE) { 23 m_bSetColor(false) {
24 SetStates(FWL_STATE_CAT_HightLight); 24 SetStates(FWL_STATE_CAT_HightLight);
25 } 25 }
26 26
27 IFWL_Caret::~IFWL_Caret() { 27 IFWL_Caret::~IFWL_Caret() {
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 FWL_Error 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 FWL_Error::Indefinite;
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 FWL_Error::Indefinite;
46 46
47 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); 47 DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix);
48 return FWL_Error::Succeeded; 48 return FWL_Error::Succeeded;
49 } 49 }
50 50
51 void IFWL_Caret::ShowCaret(FX_BOOL bFlag) { 51 void IFWL_Caret::ShowCaret(bool bFlag) {
52 if (m_pTimerInfo) { 52 if (m_pTimerInfo) {
53 m_pTimerInfo->StopTimer(); 53 m_pTimerInfo->StopTimer();
54 m_pTimerInfo = nullptr; 54 m_pTimerInfo = nullptr;
55 } 55 }
56 if (bFlag) 56 if (bFlag)
57 m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true); 57 m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true);
58 58
59 SetStates(FWL_WGTSTATE_Invisible, !bFlag); 59 SetStates(FWL_WGTSTATE_Invisible, !bFlag);
60 } 60 }
61 61
62 FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) { 62 FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) {
63 elapse = m_dwElapse; 63 elapse = m_dwElapse;
64 return FWL_Error::Succeeded; 64 return FWL_Error::Succeeded;
65 } 65 }
66 66
67 FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) { 67 FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) {
68 m_dwElapse = elapse; 68 m_dwElapse = elapse;
69 return FWL_Error::Succeeded; 69 return FWL_Error::Succeeded;
70 } 70 }
71 71
72 FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { 72 FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) {
73 m_bSetColor = TRUE; 73 m_bSetColor = true;
74 m_crFill = crFill; 74 m_crFill = crFill;
75 return FWL_Error::Succeeded; 75 return FWL_Error::Succeeded;
76 } 76 }
77 77
78 void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, 78 void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics,
79 IFWL_ThemeProvider* pTheme, 79 IFWL_ThemeProvider* pTheme,
80 const CFX_Matrix* pMatrix) { 80 const CFX_Matrix* pMatrix) {
81 CFX_RectF rect; 81 CFX_RectF rect;
82 GetWidgetRect(rect); 82 GetWidgetRect(rect);
83 rect.Set(0, 0, rect.width, rect.height); 83 rect.Set(0, 0, rect.width, rect.height);
(...skipping 26 matching lines...) Expand all
110 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) { 110 void IFWL_Caret::Timer::Run(IFWL_TimerInfo* pTimerInfo) {
111 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget); 111 IFWL_Caret* pCaret = static_cast<IFWL_Caret*>(m_pWidget);
112 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight); 112 bool toggle = !(pCaret->GetStates() & FWL_STATE_CAT_HightLight);
113 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle); 113 pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle);
114 114
115 CFX_RectF rt; 115 CFX_RectF rt;
116 pCaret->GetWidgetRect(rt); 116 pCaret->GetWidgetRect(rt);
117 rt.Set(0, 0, rt.width + 1, rt.height); 117 rt.Set(0, 0, rt.width + 1, rt.height);
118 pCaret->Repaint(&rt); 118 pCaret->Repaint(&rt);
119 } 119 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_caret.h ('k') | xfa/fwl/core/ifwl_checkbox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698