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

Side by Side Diff: xfa/fwl/basewidget/fwl_spinbuttonimp.cpp

Issue 1938163002: More define cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months 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/basewidget/fwl_spinbuttonimp.h" 7 #include "xfa/fwl/basewidget/fwl_spinbuttonimp.h"
8 8
9 #include "xfa/fwl/basewidget/ifwl_spinbutton.h" 9 #include "xfa/fwl/basewidget/ifwl_spinbutton.h"
10 #include "xfa/fwl/core/cfwl_message.h" 10 #include "xfa/fwl/core/cfwl_message.h"
11 #include "xfa/fwl/core/cfwl_themebackground.h" 11 #include "xfa/fwl/core/cfwl_themebackground.h"
12 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" 12 #include "xfa/fwl/core/cfwl_widgetimpproperties.h"
13 #include "xfa/fwl/core/fwl_noteimp.h" 13 #include "xfa/fwl/core/fwl_noteimp.h"
14 #include "xfa/fwl/core/fwl_widgetimp.h" 14 #include "xfa/fwl/core/fwl_widgetimp.h"
15 #include "xfa/fwl/core/ifwl_themeprovider.h" 15 #include "xfa/fwl/core/ifwl_themeprovider.h"
16 #include "xfa/fwl/core/ifwl_themeprovider.h" 16 #include "xfa/fwl/core/ifwl_themeprovider.h"
17 #include "xfa/fwl/core/ifwl_timer.h" 17 #include "xfa/fwl/core/ifwl_timer.h"
18 18
19 #define FWL_SPN_MinWidth 18 19 namespace {
20 #define FWL_SPN_MinHeight 32 20
21 #define FWL_SPIN_Elapse 200 21 const int kMinWidth = 18;
22 const int kMinHeight = 32;
23 const int kElapseTime = 200;
24
25 } // namespace
22 26
23 // static 27 // static
24 IFWL_SpinButton* IFWL_SpinButton::Create( 28 IFWL_SpinButton* IFWL_SpinButton::Create(
25 const CFWL_WidgetImpProperties& properties, 29 const CFWL_WidgetImpProperties& properties,
26 IFWL_Widget* pOuter) { 30 IFWL_Widget* pOuter) {
27 IFWL_SpinButton* pSpinButton = new IFWL_SpinButton; 31 IFWL_SpinButton* pSpinButton = new IFWL_SpinButton;
28 CFWL_SpinButtonImp* pSpinButtonImpl = 32 CFWL_SpinButtonImp* pSpinButtonImpl =
29 new CFWL_SpinButtonImp(properties, nullptr); 33 new CFWL_SpinButtonImp(properties, nullptr);
30 pSpinButton->SetImpl(pSpinButtonImpl); 34 pSpinButton->SetImpl(pSpinButtonImpl);
31 pSpinButtonImpl->SetInterface(pSpinButton); 35 pSpinButtonImpl->SetInterface(pSpinButton);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 m_pDelegate = new CFWL_SpinButtonImpDelegate(this); 72 m_pDelegate = new CFWL_SpinButtonImpDelegate(this);
69 return FWL_ERR_Succeeded; 73 return FWL_ERR_Succeeded;
70 } 74 }
71 FWL_ERR CFWL_SpinButtonImp::Finalize() { 75 FWL_ERR CFWL_SpinButtonImp::Finalize() {
72 delete m_pDelegate; 76 delete m_pDelegate;
73 m_pDelegate = nullptr; 77 m_pDelegate = nullptr;
74 return CFWL_WidgetImp::Finalize(); 78 return CFWL_WidgetImp::Finalize();
75 } 79 }
76 FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { 80 FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
77 if (bAutoSize) { 81 if (bAutoSize) {
78 rect.Set(0, 0, FWL_SPN_MinWidth, FWL_SPN_MinHeight); 82 rect.Set(0, 0, kMinWidth, kMinHeight);
79 CFWL_WidgetImp::GetWidgetRect(rect, TRUE); 83 CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
80 } else { 84 } else {
81 rect = m_pProperties->m_rtWidget; 85 rect = m_pProperties->m_rtWidget;
82 } 86 }
83 return FWL_ERR_Succeeded; 87 return FWL_ERR_Succeeded;
84 } 88 }
85 FWL_ERR CFWL_SpinButtonImp::Update() { 89 FWL_ERR CFWL_SpinButtonImp::Update() {
86 if (IsLocked()) { 90 if (IsLocked()) {
87 return FWL_ERR_Indefinite; 91 return FWL_ERR_Indefinite;
88 } 92 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 OnFocusChanged(pMessage, TRUE); 220 OnFocusChanged(pMessage, TRUE);
217 break; 221 break;
218 } 222 }
219 case CFWL_MessageType::KillFocus: { 223 case CFWL_MessageType::KillFocus: {
220 OnFocusChanged(pMessage, FALSE); 224 OnFocusChanged(pMessage, FALSE);
221 break; 225 break;
222 } 226 }
223 case CFWL_MessageType::Mouse: { 227 case CFWL_MessageType::Mouse: {
224 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 228 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
225 switch (pMsg->m_dwCmd) { 229 switch (pMsg->m_dwCmd) {
226 case FWL_MSGMOUSECMD_LButtonDown: { 230 case FWL_MouseCommand::LeftButtonDown: {
227 OnLButtonDown(pMsg); 231 OnLButtonDown(pMsg);
228 break; 232 break;
229 } 233 }
230 case FWL_MSGMOUSECMD_LButtonUp: { 234 case FWL_MouseCommand::LeftButtonUp: {
231 OnLButtonUp(pMsg); 235 OnLButtonUp(pMsg);
232 break; 236 break;
233 } 237 }
234 case FWL_MSGMOUSECMD_MouseMove: { 238 case FWL_MouseCommand::Move: {
235 OnMouseMove(pMsg); 239 OnMouseMove(pMsg);
236 break; 240 break;
237 } 241 }
238 case FWL_MSGMOUSECMD_MouseLeave: { 242 case FWL_MouseCommand::Leave: {
239 OnMouseLeave(pMsg); 243 OnMouseLeave(pMsg);
240 break; 244 break;
241 } 245 }
242 default: 246 default:
243 break; 247 break;
244 } 248 }
245 break; 249 break;
246 } 250 }
247 case CFWL_MessageType::Key: { 251 case CFWL_MessageType::Key: {
248 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); 252 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
249 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) 253 if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown)
250 OnKeyDown(pKey); 254 OnKeyDown(pKey);
251 break; 255 break;
252 } 256 }
253 default: { 257 default: {
254 iRet = 0; 258 iRet = 0;
255 break; 259 break;
256 } 260 }
257 } 261 }
258 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 262 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
259 return iRet; 263 return iRet;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (bDnPress) { 299 if (bDnPress) {
296 m_pOwner->m_iButtonIndex = 1; 300 m_pOwner->m_iButtonIndex = 1;
297 m_pOwner->m_dwDnState = CFWL_PartState_Pressed; 301 m_pOwner->m_dwDnState = CFWL_PartState_Pressed;
298 } 302 }
299 CFWL_EvtSpbClick wmPosChanged; 303 CFWL_EvtSpbClick wmPosChanged;
300 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; 304 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
301 wmPosChanged.m_bUp = bUpPress; 305 wmPosChanged.m_bUp = bUpPress;
302 m_pOwner->DispatchEvent(&wmPosChanged); 306 m_pOwner->DispatchEvent(&wmPosChanged);
303 m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton 307 m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton
304 : &m_pOwner->m_rtDnButton); 308 : &m_pOwner->m_rtDnButton);
305 m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, FWL_SPIN_Elapse); 309 m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, kElapseTime);
306 } 310 }
307 void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { 311 void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
308 if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) { 312 if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) {
309 return; 313 return;
310 } 314 }
311 m_pOwner->m_bLButtonDwn = FALSE; 315 m_pOwner->m_bLButtonDwn = FALSE;
312 m_pOwner->SetGrab(FALSE); 316 m_pOwner->SetGrab(FALSE);
313 m_pOwner->SetFocus(FALSE); 317 m_pOwner->SetFocus(FALSE);
314 if (m_pOwner->m_hTimer) { 318 if (m_pOwner->m_hTimer) {
315 FWL_StopTimer(m_pOwner->m_hTimer); 319 FWL_StopTimer(m_pOwner->m_hTimer);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 if (!bUpEnable && !bDownEnable) { 433 if (!bUpEnable && !bDownEnable) {
430 return; 434 return;
431 } 435 }
432 CFWL_EvtSpbClick wmPosChanged; 436 CFWL_EvtSpbClick wmPosChanged;
433 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; 437 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
434 wmPosChanged.m_bUp = bUpEnable; 438 wmPosChanged.m_bUp = bUpEnable;
435 m_pOwner->DispatchEvent(&wmPosChanged); 439 m_pOwner->DispatchEvent(&wmPosChanged);
436 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton 440 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton
437 : &m_pOwner->m_rtDnButton); 441 : &m_pOwner->m_rtDnButton);
438 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698