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_panelimp.h" | |
11 #include "xfa/fwl/core/fwl_widgetimp.h" | 10 #include "xfa/fwl/core/fwl_widgetimp.h" |
12 #include "xfa/fwl/core/ifwl_form.h" | 11 #include "xfa/fwl/core/ifwl_form.h" |
13 | 12 |
14 class CFWL_MsgMouse; | 13 class CFWL_MsgMouse; |
15 class CFWL_MsgClose; | 14 class CFWL_MsgClose; |
16 class CFWL_MsgWindowMove; | 15 class CFWL_MsgWindowMove; |
17 class CFWL_NoteLoop; | 16 class CFWL_NoteLoop; |
18 class CFWL_WidgetImpProperties; | 17 class CFWL_WidgetImpProperties; |
19 class IFWL_Widget; | 18 class IFWL_Widget; |
20 class IFWL_ThemeProvider; | 19 class IFWL_ThemeProvider; |
21 class CFWL_SysBtn; | 20 class CFWL_SysBtn; |
22 class CFWL_FormImp; | 21 class CFWL_FormImp; |
23 class CFWL_FormImpDelegate; | 22 class CFWL_FormImpDelegate; |
24 | 23 |
25 #define FWL_SYSBUTTONSTATE_Hover 0x0001 | 24 #define FWL_SYSBUTTONSTATE_Hover 0x0001 |
26 #define FWL_SYSBUTTONSTATE_Pressed 0x0002 | 25 #define FWL_SYSBUTTONSTATE_Pressed 0x0002 |
27 #define FWL_SYSBUTTONSTATE_Disabled 0x0010 | 26 #define FWL_SYSBUTTONSTATE_Disabled 0x0010 |
28 class CFWL_SysBtn { | 27 class CFWL_SysBtn { |
29 public: | 28 public: |
30 CFWL_SysBtn() { | 29 CFWL_SysBtn() { |
31 m_rtBtn.Set(0, 0, 0, 0); | 30 m_rtBtn.Set(0, 0, 0, 0); |
32 m_dwState = 0; | 31 m_dwState = 0; |
33 } | 32 } |
34 | 33 |
35 FX_BOOL IsHover() { return m_dwState & FWL_SYSBUTTONSTATE_Hover; } | |
36 FX_BOOL IsPressed() { return m_dwState & FWL_SYSBUTTONSTATE_Pressed; } | |
37 FX_BOOL IsDisabled() { return m_dwState & FWL_SYSBUTTONSTATE_Disabled; } | 34 FX_BOOL IsDisabled() { return m_dwState & FWL_SYSBUTTONSTATE_Disabled; } |
| 35 |
38 void SetNormal() { m_dwState &= 0xFFF0; } | 36 void SetNormal() { m_dwState &= 0xFFF0; } |
39 void SetPressed() { | 37 void SetPressed() { |
40 SetNormal(); | 38 SetNormal(); |
41 m_dwState |= FWL_SYSBUTTONSTATE_Pressed; | 39 m_dwState |= FWL_SYSBUTTONSTATE_Pressed; |
42 } | 40 } |
43 void SetHover() { | 41 void SetHover() { |
44 SetNormal(); | 42 SetNormal(); |
45 m_dwState |= FWL_SYSBUTTONSTATE_Hover; | 43 m_dwState |= FWL_SYSBUTTONSTATE_Hover; |
46 } | 44 } |
47 void SetDisabled(FX_BOOL bDisabled) { | 45 void SetDisabled(FX_BOOL bDisabled) { |
(...skipping 11 matching lines...) Expand all Loading... |
59 enum FORM_RESIZETYPE { | 57 enum FORM_RESIZETYPE { |
60 FORM_RESIZETYPE_None = 0, | 58 FORM_RESIZETYPE_None = 0, |
61 FORM_RESIZETYPE_Cap, | 59 FORM_RESIZETYPE_Cap, |
62 }; | 60 }; |
63 | 61 |
64 typedef struct RestoreResizeInfo { | 62 typedef struct RestoreResizeInfo { |
65 CFX_PointF m_ptStart; | 63 CFX_PointF m_ptStart; |
66 CFX_SizeF m_szStart; | 64 CFX_SizeF m_szStart; |
67 } RestoreInfo; | 65 } RestoreInfo; |
68 | 66 |
69 class CFWL_FormImp : public CFWL_PanelImp { | 67 class CFWL_FormImp : public CFWL_WidgetImp { |
70 public: | 68 public: |
71 CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 69 CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
72 virtual ~CFWL_FormImp(); | 70 virtual ~CFWL_FormImp(); |
73 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 71 virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; |
74 virtual uint32_t GetClassID() const; | 72 virtual uint32_t GetClassID() const; |
75 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 73 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
76 virtual FWL_ERR Initialize(); | 74 virtual FWL_ERR Initialize(); |
77 virtual FWL_ERR Finalize(); | 75 virtual FWL_ERR Finalize(); |
78 | 76 |
79 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 77 virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 FX_BOOL m_bCustomizeLayout; | 156 FX_BOOL m_bCustomizeLayout; |
159 FWL_FORMSIZE m_eFormSize; | 157 FWL_FORMSIZE m_eFormSize; |
160 FX_BOOL m_bDoModalFlag; | 158 FX_BOOL m_bDoModalFlag; |
161 FX_FLOAT m_fSmallIconSz; | 159 FX_FLOAT m_fSmallIconSz; |
162 FX_FLOAT m_fBigIconSz; | 160 FX_FLOAT m_fBigIconSz; |
163 CFX_DIBitmap* m_pBigIcon; | 161 CFX_DIBitmap* m_pBigIcon; |
164 CFX_DIBitmap* m_pSmallIcon; | 162 CFX_DIBitmap* m_pSmallIcon; |
165 FX_BOOL m_bMouseIn; | 163 FX_BOOL m_bMouseIn; |
166 friend class CFWL_FormImpDelegate; | 164 friend class CFWL_FormImpDelegate; |
167 }; | 165 }; |
| 166 |
168 class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { | 167 class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { |
169 public: | 168 public: |
170 CFWL_FormImpDelegate(CFWL_FormImp* pOwner); | 169 CFWL_FormImpDelegate(CFWL_FormImp* pOwner); |
171 int32_t OnProcessMessage(CFWL_Message* pMessage) override; | 170 int32_t OnProcessMessage(CFWL_Message* pMessage) override; |
172 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; | 171 FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; |
173 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | 172 FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, |
174 const CFX_Matrix* pMatrix = NULL) override; | 173 const CFX_Matrix* pMatrix = NULL) override; |
175 | 174 |
176 protected: | 175 protected: |
177 void OnLButtonDown(CFWL_MsgMouse* pMsg); | 176 void OnLButtonDown(CFWL_MsgMouse* pMsg); |
178 void OnLButtonUp(CFWL_MsgMouse* pMsg); | 177 void OnLButtonUp(CFWL_MsgMouse* pMsg); |
179 void OnMouseMove(CFWL_MsgMouse* pMsg); | 178 void OnMouseMove(CFWL_MsgMouse* pMsg); |
180 void OnMouseHover(CFWL_MsgMouse* pMsg); | 179 void OnMouseHover(CFWL_MsgMouse* pMsg); |
181 void OnMouseLeave(CFWL_MsgMouse* pMsg); | 180 void OnMouseLeave(CFWL_MsgMouse* pMsg); |
182 void OnLButtonDblClk(CFWL_MsgMouse* pMsg); | 181 void OnLButtonDblClk(CFWL_MsgMouse* pMsg); |
183 void OnWindowMove(CFWL_MsgWindowMove* pMsg); | 182 void OnWindowMove(CFWL_MsgWindowMove* pMsg); |
184 void OnClose(CFWL_MsgClose* pMsg); | 183 void OnClose(CFWL_MsgClose* pMsg); |
185 CFWL_FormImp* m_pOwner; | 184 CFWL_FormImp* m_pOwner; |
186 }; | 185 }; |
187 | 186 |
188 #endif // XFA_FWL_CORE_FWL_FORMIMP_H_ | 187 #endif // XFA_FWL_CORE_FWL_FORMIMP_H_ |
OLD | NEW |