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

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

Issue 2467993003: Merge delegates into IFWL_* classes. (Closed)
Patch Set: Add const version 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
« no previous file with comments | « xfa/fwl/core/ifwl_scrollbar.cpp ('k') | xfa/fwl/core/ifwl_spinbutton.cpp » ('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 #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_SpinButtonImpDelegate;
19 class CFWL_WidgetImpProperties; 18 class CFWL_WidgetImpProperties;
20 19
21 FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;) 20 FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;)
22 21
23 class IFWL_SpinButton : public IFWL_Widget { 22 class IFWL_SpinButton : public IFWL_Widget {
24 public: 23 public:
25 explicit IFWL_SpinButton(const IFWL_App* app, 24 explicit IFWL_SpinButton(const IFWL_App* app,
26 const CFWL_WidgetImpProperties& properties); 25 const CFWL_WidgetImpProperties& properties);
27 ~IFWL_SpinButton() override; 26 ~IFWL_SpinButton() override;
28 27
29 // IFWL_Widget 28 // IFWL_Widget
30 FWL_Type GetClassID() const override; 29 FWL_Type GetClassID() const override;
31 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; 30 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
32 FWL_Error Update() override; 31 FWL_Error Update() override;
33 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; 32 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
34 FWL_Error DrawWidget(CFX_Graphics* pGraphics, 33 FWL_Error DrawWidget(CFX_Graphics* pGraphics,
35 const CFX_Matrix* pMatrix = nullptr) override; 34 const CFX_Matrix* pMatrix = nullptr) override;
35 void OnProcessMessage(CFWL_Message* pMessage) override;
36 void OnProcessEvent(CFWL_Event* pEvent) override;
37 void OnDrawWidget(CFX_Graphics* pGraphics,
38 const CFX_Matrix* pMatrix) override;
36 39
37 FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); 40 FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE);
38 FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); 41 FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE);
39 42
40 protected: 43 protected:
41 friend class CFWL_SpinButtonImpDelegate;
42
43 class Timer : public IFWL_Timer { 44 class Timer : public IFWL_Timer {
44 public: 45 public:
45 explicit Timer(IFWL_SpinButton* pToolTip); 46 explicit Timer(IFWL_SpinButton* pToolTip);
46 ~Timer() override {} 47 ~Timer() override {}
47 48
48 void Run(IFWL_TimerInfo* pTimerInfo) override; 49 void Run(IFWL_TimerInfo* pTimerInfo) override;
49 }; 50 };
50 friend class IFWL_SpinButton::Timer; 51 friend class IFWL_SpinButton::Timer;
51 52
52 void DrawUpButton(CFX_Graphics* pGraphics, 53 void DrawUpButton(CFX_Graphics* pGraphics,
53 IFWL_ThemeProvider* pTheme, 54 IFWL_ThemeProvider* pTheme,
54 const CFX_Matrix* pMatrix); 55 const CFX_Matrix* pMatrix);
55 void DrawDownButton(CFX_Graphics* pGraphics, 56 void DrawDownButton(CFX_Graphics* pGraphics,
56 IFWL_ThemeProvider* pTheme, 57 IFWL_ThemeProvider* pTheme,
57 const CFX_Matrix* pMatrix); 58 const CFX_Matrix* pMatrix);
58 59
59 CFX_RectF m_rtClient; 60 CFX_RectF m_rtClient;
60 CFX_RectF m_rtUpButton; 61 CFX_RectF m_rtUpButton;
61 CFX_RectF m_rtDnButton; 62 CFX_RectF m_rtDnButton;
62 uint32_t m_dwUpState; 63 uint32_t m_dwUpState;
63 uint32_t m_dwDnState; 64 uint32_t m_dwDnState;
64 int32_t m_iButtonIndex; 65 int32_t m_iButtonIndex;
65 FX_BOOL m_bLButtonDwn; 66 FX_BOOL m_bLButtonDwn;
66 IFWL_TimerInfo* m_pTimerInfo; 67 IFWL_TimerInfo* m_pTimerInfo;
67 IFWL_SpinButton::Timer m_Timer; 68 IFWL_SpinButton::Timer m_Timer;
68 };
69 69
70 class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { 70 private:
71 public: 71 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet);
72 CFWL_SpinButtonImpDelegate(IFWL_SpinButton* pOwner);
73 void OnProcessMessage(CFWL_Message* pMessage) override;
74 void OnProcessEvent(CFWL_Event* pEvent) override;
75 void OnDrawWidget(CFX_Graphics* pGraphics,
76 const CFX_Matrix* pMatrix = nullptr) override;
77
78 protected:
79 void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
80 void OnLButtonDown(CFWL_MsgMouse* pMsg); 72 void OnLButtonDown(CFWL_MsgMouse* pMsg);
81 void OnLButtonUp(CFWL_MsgMouse* pMsg); 73 void OnLButtonUp(CFWL_MsgMouse* pMsg);
82 void OnMouseMove(CFWL_MsgMouse* pMsg); 74 void OnMouseMove(CFWL_MsgMouse* pMsg);
83 void OnMouseLeave(CFWL_MsgMouse* pMsg); 75 void OnMouseLeave(CFWL_MsgMouse* pMsg);
84 void OnKeyDown(CFWL_MsgKey* pMsg); 76 void OnKeyDown(CFWL_MsgKey* pMsg);
85 IFWL_SpinButton* m_pOwner;
86 }; 77 };
87 78
88 #endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_ 79 #endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_
OLDNEW
« no previous file with comments | « xfa/fwl/core/ifwl_scrollbar.cpp ('k') | xfa/fwl/core/ifwl_spinbutton.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698