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

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: Rebase to master 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
« no previous file with comments | « xfa/fwl/basewidget/fwl_scrollbarimp.cpp ('k') | xfa/fwl/basewidget/ifwl_barcode.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/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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 OnFocusChanged(pMessage, TRUE); 215 OnFocusChanged(pMessage, TRUE);
212 break; 216 break;
213 } 217 }
214 case CFWL_MessageType::KillFocus: { 218 case CFWL_MessageType::KillFocus: {
215 OnFocusChanged(pMessage, FALSE); 219 OnFocusChanged(pMessage, FALSE);
216 break; 220 break;
217 } 221 }
218 case CFWL_MessageType::Mouse: { 222 case CFWL_MessageType::Mouse: {
219 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); 223 CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
220 switch (pMsg->m_dwCmd) { 224 switch (pMsg->m_dwCmd) {
221 case FWL_MSGMOUSECMD_LButtonDown: { 225 case FWL_MouseCommand::LeftButtonDown: {
222 OnLButtonDown(pMsg); 226 OnLButtonDown(pMsg);
223 break; 227 break;
224 } 228 }
225 case FWL_MSGMOUSECMD_LButtonUp: { 229 case FWL_MouseCommand::LeftButtonUp: {
226 OnLButtonUp(pMsg); 230 OnLButtonUp(pMsg);
227 break; 231 break;
228 } 232 }
229 case FWL_MSGMOUSECMD_MouseMove: { 233 case FWL_MouseCommand::Move: {
230 OnMouseMove(pMsg); 234 OnMouseMove(pMsg);
231 break; 235 break;
232 } 236 }
233 case FWL_MSGMOUSECMD_MouseLeave: { 237 case FWL_MouseCommand::Leave: {
234 OnMouseLeave(pMsg); 238 OnMouseLeave(pMsg);
235 break; 239 break;
236 } 240 }
237 default: 241 default:
238 break; 242 break;
239 } 243 }
240 break; 244 break;
241 } 245 }
242 case CFWL_MessageType::Key: { 246 case CFWL_MessageType::Key: {
243 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage); 247 CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
244 if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) 248 if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown)
245 OnKeyDown(pKey); 249 OnKeyDown(pKey);
246 break; 250 break;
247 } 251 }
248 default: { 252 default: {
249 iRet = 0; 253 iRet = 0;
250 break; 254 break;
251 } 255 }
252 } 256 }
253 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); 257 CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
254 return iRet; 258 return iRet;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (bDnPress) { 294 if (bDnPress) {
291 m_pOwner->m_iButtonIndex = 1; 295 m_pOwner->m_iButtonIndex = 1;
292 m_pOwner->m_dwDnState = CFWL_PartState_Pressed; 296 m_pOwner->m_dwDnState = CFWL_PartState_Pressed;
293 } 297 }
294 CFWL_EvtSpbClick wmPosChanged; 298 CFWL_EvtSpbClick wmPosChanged;
295 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; 299 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
296 wmPosChanged.m_bUp = bUpPress; 300 wmPosChanged.m_bUp = bUpPress;
297 m_pOwner->DispatchEvent(&wmPosChanged); 301 m_pOwner->DispatchEvent(&wmPosChanged);
298 m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton 302 m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton
299 : &m_pOwner->m_rtDnButton); 303 : &m_pOwner->m_rtDnButton);
300 m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, FWL_SPIN_Elapse); 304 m_pOwner->m_hTimer = FWL_StartTimer(m_pOwner, kElapseTime);
301 } 305 }
302 void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { 306 void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
303 if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) { 307 if (m_pOwner->m_pProperties->m_dwStates & CFWL_PartState_Disabled) {
304 return; 308 return;
305 } 309 }
306 m_pOwner->m_bLButtonDwn = FALSE; 310 m_pOwner->m_bLButtonDwn = FALSE;
307 m_pOwner->SetGrab(FALSE); 311 m_pOwner->SetGrab(FALSE);
308 m_pOwner->SetFocus(FALSE); 312 m_pOwner->SetFocus(FALSE);
309 if (m_pOwner->m_hTimer) { 313 if (m_pOwner->m_hTimer) {
310 FWL_StopTimer(m_pOwner->m_hTimer); 314 FWL_StopTimer(m_pOwner->m_hTimer);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (!bUpEnable && !bDownEnable) { 428 if (!bUpEnable && !bDownEnable) {
425 return; 429 return;
426 } 430 }
427 CFWL_EvtSpbClick wmPosChanged; 431 CFWL_EvtSpbClick wmPosChanged;
428 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface; 432 wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
429 wmPosChanged.m_bUp = bUpEnable; 433 wmPosChanged.m_bUp = bUpEnable;
430 m_pOwner->DispatchEvent(&wmPosChanged); 434 m_pOwner->DispatchEvent(&wmPosChanged);
431 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton 435 m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton
432 : &m_pOwner->m_rtDnButton); 436 : &m_pOwner->m_rtDnButton);
433 } 437 }
OLDNEW
« no previous file with comments | « xfa/fwl/basewidget/fwl_scrollbarimp.cpp ('k') | xfa/fwl/basewidget/ifwl_barcode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698