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

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

Issue 2557103002: Cleanup FWL default values part II. (Closed)
Patch Set: Unused 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
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_spinbutton.h" 7 #include "xfa/fwl/core/cfwl_spinbutton.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 IFWL_ThemeProvider* pTheme = GetAvailableTheme(); 107 IFWL_ThemeProvider* pTheme = GetAvailableTheme();
108 if (HasBorder()) 108 if (HasBorder())
109 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); 109 DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix);
110 if (HasEdge()) 110 if (HasEdge())
111 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); 111 DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix);
112 112
113 DrawUpButton(pGraphics, pTheme, pMatrix); 113 DrawUpButton(pGraphics, pTheme, pMatrix);
114 DrawDownButton(pGraphics, pTheme, pMatrix); 114 DrawDownButton(pGraphics, pTheme, pMatrix);
115 } 115 }
116 116
117 void CFWL_SpinButton::EnableButton(bool bEnable, bool bUp) { 117 void CFWL_SpinButton::DisableButton() {
118 if (bUp) 118 m_dwDnState = CFWL_PartState_Disabled;
119 m_dwUpState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled;
120 else
121 m_dwDnState = bEnable ? CFWL_PartState_Normal : CFWL_PartState_Disabled;
122 } 119 }
123 120
124 bool CFWL_SpinButton::IsButtonEnabled(bool bUp) { 121 bool CFWL_SpinButton::IsButtonEnabled(bool bUp) {
125 if (bUp) 122 if (bUp)
126 return (m_dwUpState != CFWL_PartState_Disabled); 123 return (m_dwUpState != CFWL_PartState_Disabled);
127 return (m_dwDnState != CFWL_PartState_Disabled); 124 return (m_dwDnState != CFWL_PartState_Disabled);
128 } 125 }
129 126
130 void CFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics, 127 void CFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics,
131 IFWL_ThemeProvider* pTheme, 128 IFWL_ThemeProvider* pTheme,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnabled(false)) { 285 if (m_dwDnState != CFWL_PartState_Normal && IsButtonEnabled(false)) {
289 m_dwDnState = CFWL_PartState_Normal; 286 m_dwDnState = CFWL_PartState_Normal;
290 if (bRepaint) 287 if (bRepaint)
291 rtInvlidate.Union(m_rtDnButton); 288 rtInvlidate.Union(m_rtDnButton);
292 else 289 else
293 rtInvlidate = m_rtDnButton; 290 rtInvlidate = m_rtDnButton;
294 291
295 bRepaint = true; 292 bRepaint = true;
296 } 293 }
297 } 294 }
298 if (!IsButtonEnabled(false)) 295 if (!IsButtonEnabled(false))
Tom Sepez 2016/12/07 17:33:32 This just reads strangely ... sounds like a no-op?
dsinclair 2016/12/07 18:28:49 Done.
299 EnableButton(false, false); 296 DisableButton();
300 297
301 } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) { 298 } else if (m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy)) {
302 if (IsButtonEnabled(false)) { 299 if (IsButtonEnabled(false)) {
303 if (m_dwDnState != CFWL_PartState_Hovered) { 300 if (m_dwDnState != CFWL_PartState_Hovered) {
304 m_dwDnState = CFWL_PartState_Hovered; 301 m_dwDnState = CFWL_PartState_Hovered;
305 bRepaint = true; 302 bRepaint = true;
306 rtInvlidate = m_rtDnButton; 303 rtInvlidate = m_rtDnButton;
307 } 304 }
308 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnabled(true)) { 305 if (m_dwUpState != CFWL_PartState_Normal && IsButtonEnabled(true)) {
309 m_dwUpState = CFWL_PartState_Normal; 306 m_dwUpState = CFWL_PartState_Normal;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) { 369 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
373 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget); 370 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget);
374 371
375 if (!pButton->m_pTimerInfo) 372 if (!pButton->m_pTimerInfo)
376 return; 373 return;
377 374
378 CFWL_Event wmPosChanged(CFWL_EventType::Click); 375 CFWL_Event wmPosChanged(CFWL_EventType::Click);
379 wmPosChanged.m_pSrcTarget = pButton; 376 wmPosChanged.m_pSrcTarget = pButton;
380 pButton->DispatchEvent(&wmPosChanged); 377 pButton->DispatchEvent(&wmPosChanged);
381 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698