OLD | NEW |
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_FWL_FORMIMP_H_ | 7 #ifndef XFA_FWL_CORE_FWL_FORMIMP_H_ |
8 #define XFA_FWL_CORE_FWL_FORMIMP_H_ | 8 #define XFA_FWL_CORE_FWL_FORMIMP_H_ |
9 | 9 |
10 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/fwl_widgetimp.h" |
11 #include "xfa/fwl/core/ifwl_form.h" | 11 #include "xfa/fwl/core/ifwl_form.h" |
12 | 12 |
13 class CFWL_MsgMouse; | 13 class CFWL_MsgMouse; |
14 class CFWL_MsgClose; | 14 class CFWL_MsgClose; |
15 class CFWL_MsgWindowMove; | 15 class CFWL_MsgWindowMove; |
16 class CFWL_NoteLoop; | 16 class CFWL_NoteLoop; |
17 class CFWL_WidgetImpProperties; | 17 class CFWL_WidgetImpProperties; |
18 class IFWL_Widget; | 18 class IFWL_Widget; |
19 class IFWL_ThemeProvider; | 19 class IFWL_ThemeProvider; |
20 class CFWL_SysBtn; | 20 class CFWL_SysBtn; |
21 class CFWL_FormImp; | 21 class CFWL_FormImp; |
22 class CFWL_FormImpDelegate; | 22 class CFWL_FormImpDelegate; |
23 | 23 |
24 #define FWL_SYSBUTTONSTATE_Hover 0x0001 | 24 #define FWL_SYSBUTTONSTATE_Hover 0x0001 |
25 #define FWL_SYSBUTTONSTATE_Pressed 0x0002 | 25 #define FWL_SYSBUTTONSTATE_Pressed 0x0002 |
26 #define FWL_SYSBUTTONSTATE_Disabled 0x0010 | 26 #define FWL_SYSBUTTONSTATE_Disabled 0x0010 |
27 | 27 |
28 class CFWL_SysBtn { | 28 class CFWL_SysBtn { |
29 public: | 29 public: |
30 CFWL_SysBtn() { | 30 CFWL_SysBtn(); |
31 m_rtBtn.Set(0, 0, 0, 0); | |
32 m_dwState = 0; | |
33 } | |
34 | 31 |
35 bool IsDisabled() { return !!(m_dwState & FWL_SYSBUTTONSTATE_Disabled); } | 32 bool IsDisabled() const; |
| 33 uint32_t GetPartState() const; |
36 | 34 |
37 void SetNormal() { m_dwState &= 0xFFF0; } | 35 void SetNormal(); |
38 void SetPressed() { | 36 void SetPressed(); |
39 SetNormal(); | 37 void SetHover(); |
40 m_dwState |= FWL_SYSBUTTONSTATE_Pressed; | 38 void SetDisabled(FX_BOOL bDisabled); |
41 } | |
42 void SetHover() { | |
43 SetNormal(); | |
44 m_dwState |= FWL_SYSBUTTONSTATE_Hover; | |
45 } | |
46 void SetDisabled(FX_BOOL bDisabled) { | |
47 bDisabled ? m_dwState |= FWL_SYSBUTTONSTATE_Disabled | |
48 : m_dwState &= ~FWL_SYSBUTTONSTATE_Disabled; | |
49 } | |
50 uint32_t GetPartState() { | |
51 if (IsDisabled()) | |
52 return CFWL_PartState_Disabled; | |
53 if (m_dwState & FWL_SYSBUTTONSTATE_Pressed) | |
54 return CFWL_PartState_Pressed; | |
55 if (m_dwState & FWL_SYSBUTTONSTATE_Hover) | |
56 return CFWL_PartState_Hovered; | |
57 return CFWL_PartState_Normal; | |
58 } | |
59 | 39 |
60 CFX_RectF m_rtBtn; | 40 CFX_RectF m_rtBtn; |
61 uint32_t m_dwState; | 41 uint32_t m_dwState; |
62 }; | 42 }; |
63 | 43 |
64 enum FORM_RESIZETYPE { | 44 enum FORM_RESIZETYPE { |
65 FORM_RESIZETYPE_None = 0, | 45 FORM_RESIZETYPE_None = 0, |
66 FORM_RESIZETYPE_Cap, | 46 FORM_RESIZETYPE_Cap, |
67 }; | 47 }; |
68 | 48 |
69 typedef struct RestoreResizeInfo { | 49 typedef struct RestoreResizeInfo { |
| 50 RestoreResizeInfo(); |
| 51 ~RestoreResizeInfo(); |
| 52 |
70 CFX_PointF m_ptStart; | 53 CFX_PointF m_ptStart; |
71 CFX_SizeF m_szStart; | 54 CFX_SizeF m_szStart; |
72 } RestoreInfo; | 55 } RestoreInfo; |
73 | 56 |
74 class CFWL_FormImp : public CFWL_WidgetImp { | 57 class CFWL_FormImp : public CFWL_WidgetImp { |
75 public: | 58 public: |
76 CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 59 CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
77 ~CFWL_FormImp() override; | 60 ~CFWL_FormImp() override; |
78 | 61 |
79 // CFWL_WidgetImp | 62 // CFWL_WidgetImp |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 void OnMouseMove(CFWL_MsgMouse* pMsg); | 170 void OnMouseMove(CFWL_MsgMouse* pMsg); |
188 void OnMouseHover(CFWL_MsgMouse* pMsg); | 171 void OnMouseHover(CFWL_MsgMouse* pMsg); |
189 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 172 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
190 void OnLButtonDblClk(CFWL_MsgMouse* pMsg); | 173 void OnLButtonDblClk(CFWL_MsgMouse* pMsg); |
191 void OnWindowMove(CFWL_MsgWindowMove* pMsg); | 174 void OnWindowMove(CFWL_MsgWindowMove* pMsg); |
192 void OnClose(CFWL_MsgClose* pMsg); | 175 void OnClose(CFWL_MsgClose* pMsg); |
193 CFWL_FormImp* m_pOwner; | 176 CFWL_FormImp* m_pOwner; |
194 }; | 177 }; |
195 | 178 |
196 #endif // XFA_FWL_CORE_FWL_FORMIMP_H_ | 179 #endif // XFA_FWL_CORE_FWL_FORMIMP_H_ |
OLD | NEW |