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

Side by Side Diff: xfa/fwl/core/ifwl_spinbutton.h

Issue 2489013002: Continue cleaning IFWL classes (Closed)
Patch Set: Review updates 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
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 #ifndef XFA_FWL_CORE_IFWL_SPINBUTTON_H_ 7 #ifndef XFA_FWL_CORE_IFWL_SPINBUTTON_H_
8 #define XFA_FWL_CORE_IFWL_SPINBUTTON_H_ 8 #define XFA_FWL_CORE_IFWL_SPINBUTTON_H_
9 9
10 #include "xfa/fwl/core/cfwl_event.h" 10 #include "xfa/fwl/core/cfwl_event.h"
11 #include "xfa/fwl/core/ifwl_timer.h" 11 #include "xfa/fwl/core/ifwl_timer.h"
12 #include "xfa/fwl/core/ifwl_widget.h" 12 #include "xfa/fwl/core/ifwl_widget.h"
13 #include "xfa/fxfa/cxfa_eventparam.h" 13 #include "xfa/fxfa/cxfa_eventparam.h"
14 14
15 #define FWL_STYLEEXE_SPB_Vert (1L << 0) 15 #define FWL_STYLEEXE_SPB_Vert (1L << 0)
16 16
17 class CFWL_MsgMouse; 17 class CFWL_MsgMouse;
18 class CFWL_WidgetProperties; 18 class CFWL_WidgetProperties;
19 19
20 FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, bool m_bUp;) 20 FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, bool m_bUp;)
21 21
22 class IFWL_SpinButton : public IFWL_Widget { 22 class IFWL_SpinButton : public IFWL_Widget {
23 public: 23 public:
24 explicit IFWL_SpinButton(const IFWL_App* app, 24 IFWL_SpinButton(const IFWL_App* app,
25 std::unique_ptr<CFWL_WidgetProperties> properties); 25 std::unique_ptr<CFWL_WidgetProperties> properties);
26 ~IFWL_SpinButton() override; 26 ~IFWL_SpinButton() override;
27 27
28 // IFWL_Widget 28 // IFWL_Widget
29 FWL_Type GetClassID() const override; 29 FWL_Type GetClassID() const override;
30 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override; 30 void GetWidgetRect(CFX_RectF& rect, bool bAutoSize = false) override;
31 void Update() override; 31 void Update() override;
32 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; 32 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
33 void DrawWidget(CFX_Graphics* pGraphics, 33 void DrawWidget(CFX_Graphics* pGraphics,
34 const CFX_Matrix* pMatrix = nullptr) override; 34 const CFX_Matrix* pMatrix = nullptr) override;
35 void OnProcessMessage(CFWL_Message* pMessage) override; 35 void OnProcessMessage(CFWL_Message* pMessage) override;
36 void OnProcessEvent(CFWL_Event* pEvent) override; 36 void OnProcessEvent(CFWL_Event* pEvent) override;
37 void OnDrawWidget(CFX_Graphics* pGraphics, 37 void OnDrawWidget(CFX_Graphics* pGraphics,
38 const CFX_Matrix* pMatrix) override; 38 const CFX_Matrix* pMatrix) override;
39 39
40 FWL_Error EnableButton(bool bEnable, bool bUp = true); 40 private:
41 bool IsButtonEnable(bool bUp = true);
42
43 protected:
44 class Timer : public IFWL_Timer { 41 class Timer : public IFWL_Timer {
45 public: 42 public:
46 explicit Timer(IFWL_SpinButton* pToolTip); 43 explicit Timer(IFWL_SpinButton* pToolTip);
47 ~Timer() override {} 44 ~Timer() override {}
48 45
49 void Run(IFWL_TimerInfo* pTimerInfo) override; 46 void Run(IFWL_TimerInfo* pTimerInfo) override;
50 }; 47 };
51 friend class IFWL_SpinButton::Timer; 48 friend class IFWL_SpinButton::Timer;
52 49
50 void EnableButton(bool bEnable, bool bUp = true);
51 bool IsButtonEnabled(bool bUp = true);
npm_g 2016/11/09 18:35:23 Followup nit: bool bUp
dsinclair 2016/11/10 17:56:04 Acknowledged.
53 void DrawUpButton(CFX_Graphics* pGraphics, 52 void DrawUpButton(CFX_Graphics* pGraphics,
54 IFWL_ThemeProvider* pTheme, 53 IFWL_ThemeProvider* pTheme,
55 const CFX_Matrix* pMatrix); 54 const CFX_Matrix* pMatrix);
56 void DrawDownButton(CFX_Graphics* pGraphics, 55 void DrawDownButton(CFX_Graphics* pGraphics,
57 IFWL_ThemeProvider* pTheme, 56 IFWL_ThemeProvider* pTheme,
58 const CFX_Matrix* pMatrix); 57 const CFX_Matrix* pMatrix);
58 void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
59 void OnLButtonDown(CFWL_MsgMouse* pMsg);
60 void OnLButtonUp(CFWL_MsgMouse* pMsg);
61 void OnMouseMove(CFWL_MsgMouse* pMsg);
62 void OnMouseLeave(CFWL_MsgMouse* pMsg);
63 void OnKeyDown(CFWL_MsgKey* pMsg);
59 64
60 CFX_RectF m_rtClient; 65 CFX_RectF m_rtClient;
61 CFX_RectF m_rtUpButton; 66 CFX_RectF m_rtUpButton;
62 CFX_RectF m_rtDnButton; 67 CFX_RectF m_rtDnButton;
63 uint32_t m_dwUpState; 68 uint32_t m_dwUpState;
64 uint32_t m_dwDnState; 69 uint32_t m_dwDnState;
65 int32_t m_iButtonIndex; 70 int32_t m_iButtonIndex;
66 bool m_bLButtonDwn; 71 bool m_bLButtonDwn;
67 IFWL_TimerInfo* m_pTimerInfo; 72 IFWL_TimerInfo* m_pTimerInfo;
68 IFWL_SpinButton::Timer m_Timer; 73 IFWL_SpinButton::Timer m_Timer;
69
70 private:
71 void OnFocusChanged(CFWL_Message* pMsg, bool bSet);
72 void OnLButtonDown(CFWL_MsgMouse* pMsg);
73 void OnLButtonUp(CFWL_MsgMouse* pMsg);
74 void OnMouseMove(CFWL_MsgMouse* pMsg);
75 void OnMouseLeave(CFWL_MsgMouse* pMsg);
76 void OnKeyDown(CFWL_MsgKey* pMsg);
77 }; 74 };
78 75
79 #endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_ 76 #endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698