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_spinbutton.cpp

Issue 2530993002: Cleanup FWL Event and Message code. (Closed)
Patch Set: 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>
11 11
12 #include "third_party/base/ptr_util.h" 12 #include "third_party/base/ptr_util.h"
13 #include "xfa/fwl/core/cfwl_evtclick.h" 13 #include "xfa/fwl/core/cfwl_event.h"
14 #include "xfa/fwl/core/cfwl_msgkey.h" 14 #include "xfa/fwl/core/cfwl_msgkey.h"
15 #include "xfa/fwl/core/cfwl_msgmouse.h" 15 #include "xfa/fwl/core/cfwl_msgmouse.h"
16 #include "xfa/fwl/core/cfwl_notedriver.h" 16 #include "xfa/fwl/core/cfwl_notedriver.h"
17 #include "xfa/fwl/core/cfwl_themebackground.h" 17 #include "xfa/fwl/core/cfwl_themebackground.h"
18 #include "xfa/fwl/core/cfwl_timerinfo.h" 18 #include "xfa/fwl/core/cfwl_timerinfo.h"
19 #include "xfa/fwl/core/cfwl_widgetproperties.h" 19 #include "xfa/fwl/core/cfwl_widgetproperties.h"
20 #include "xfa/fwl/core/ifwl_themeprovider.h" 20 #include "xfa/fwl/core/ifwl_themeprovider.h"
21 21
22 namespace { 22 namespace {
23 23
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return; 230 return;
231 if (bUpPress) { 231 if (bUpPress) {
232 m_iButtonIndex = 0; 232 m_iButtonIndex = 0;
233 m_dwUpState = CFWL_PartState_Pressed; 233 m_dwUpState = CFWL_PartState_Pressed;
234 } 234 }
235 if (bDnPress) { 235 if (bDnPress) {
236 m_iButtonIndex = 1; 236 m_iButtonIndex = 1;
237 m_dwDnState = CFWL_PartState_Pressed; 237 m_dwDnState = CFWL_PartState_Pressed;
238 } 238 }
239 239
240 CFWL_EvtClick wmPosChanged; 240 CFWL_Event wmPosChanged(CFWL_EventType::Click);
241 wmPosChanged.m_pSrcTarget = this; 241 wmPosChanged.m_pSrcTarget = this;
242 DispatchEvent(&wmPosChanged); 242 DispatchEvent(&wmPosChanged);
243 243
244 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton); 244 Repaint(bUpPress ? &m_rtUpButton : &m_rtDnButton);
245 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true); 245 m_pTimerInfo = m_Timer.StartTimer(kElapseTime, true);
246 } 246 }
247 247
248 void CFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) { 248 void CFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) {
249 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled) 249 if (m_pProperties->m_dwStates & CFWL_PartState_Disabled)
250 return; 250 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 bool bDown = 352 bool bDown =
353 pMsg->m_dwKeyCode == FWL_VKEY_Down || pMsg->m_dwKeyCode == FWL_VKEY_Right; 353 pMsg->m_dwKeyCode == FWL_VKEY_Down || pMsg->m_dwKeyCode == FWL_VKEY_Right;
354 if (!bUp && !bDown) 354 if (!bUp && !bDown)
355 return; 355 return;
356 356
357 bool bUpEnable = IsButtonEnabled(true); 357 bool bUpEnable = IsButtonEnabled(true);
358 bool bDownEnable = IsButtonEnabled(false); 358 bool bDownEnable = IsButtonEnabled(false);
359 if (!bUpEnable && !bDownEnable) 359 if (!bUpEnable && !bDownEnable)
360 return; 360 return;
361 361
362 CFWL_EvtClick wmPosChanged; 362 CFWL_Event wmPosChanged(CFWL_EventType::Click);
363 wmPosChanged.m_pSrcTarget = this; 363 wmPosChanged.m_pSrcTarget = this;
364 DispatchEvent(&wmPosChanged); 364 DispatchEvent(&wmPosChanged);
365 365
366 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton); 366 Repaint(bUpEnable ? &m_rtUpButton : &m_rtDnButton);
367 } 367 }
368 368
369 CFWL_SpinButton::Timer::Timer(CFWL_SpinButton* pToolTip) 369 CFWL_SpinButton::Timer::Timer(CFWL_SpinButton* pToolTip)
370 : CFWL_Timer(pToolTip) {} 370 : CFWL_Timer(pToolTip) {}
371 371
372 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) { 372 void CFWL_SpinButton::Timer::Run(CFWL_TimerInfo* pTimerInfo) {
373 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget); 373 CFWL_SpinButton* pButton = static_cast<CFWL_SpinButton*>(m_pWidget);
374 374
375 if (!pButton->m_pTimerInfo) 375 if (!pButton->m_pTimerInfo)
376 return; 376 return;
377 377
378 CFWL_EvtClick wmPosChanged; 378 CFWL_Event wmPosChanged(CFWL_EventType::Click);
379 wmPosChanged.m_pSrcTarget = pButton; 379 wmPosChanged.m_pSrcTarget = pButton;
380 pButton->DispatchEvent(&wmPosChanged); 380 pButton->DispatchEvent(&wmPosChanged);
381 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698