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_LIGHTWIDGET_CFWL_WIDGET_H_ | 7 #ifndef XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
8 #define XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ | 8 #define XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
9 | 9 |
10 #include "xfa/fwl/core/cfwl_event.h" | 10 #include "xfa/fwl/core/cfwl_event.h" |
11 #include "xfa/fwl/lightwidget/cfwl_widgetproperties.h" | 11 #include "xfa/fwl/lightwidget/cfwl_widgetproperties.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | 12 #include "xfa/fwl/core/ifwl_widget.h" |
13 | 13 |
14 class CFWL_Event; | 14 class CFWL_Event; |
15 class CFWL_Message; | 15 class CFWL_Message; |
16 class CFWL_Widget; | 16 class CFWL_Widget; |
17 class CFWL_WidgetDelegate; | 17 class CFWL_WidgetDelegate; |
18 class CFWL_WidgetMgr; | 18 class CFWL_WidgetMgr; |
19 | 19 |
20 class CFWL_Widget { | 20 class CFWL_Widget { |
21 public: | 21 public: |
22 virtual ~CFWL_Widget(); | 22 virtual ~CFWL_Widget(); |
23 IFWL_Widget* GetWidget(); | 23 IFWL_Widget* GetWidget(); |
24 FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 24 FWL_Error GetClassName(CFX_WideString& wsClass) const; |
25 uint32_t GetClassID() const; | 25 uint32_t GetClassID() const; |
26 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 26 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
27 | 27 |
28 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 28 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
29 FWL_ERR GetGlobalRect(CFX_RectF& rect); | 29 FWL_Error GetGlobalRect(CFX_RectF& rect); |
30 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | 30 FWL_Error SetWidgetRect(const CFX_RectF& rect); |
31 FWL_ERR GetClientRect(CFX_RectF& rtClient); | 31 FWL_Error GetClientRect(CFX_RectF& rtClient); |
32 CFWL_Widget* GetParent(); | 32 CFWL_Widget* GetParent(); |
33 FWL_ERR SetParent(CFWL_Widget* pParent); | 33 FWL_Error SetParent(CFWL_Widget* pParent); |
34 CFWL_Widget* GetOwner(); | 34 CFWL_Widget* GetOwner(); |
35 FWL_ERR SetOwner(CFWL_Widget* pOwner); | 35 FWL_Error SetOwner(CFWL_Widget* pOwner); |
36 uint32_t GetStyles(); | 36 uint32_t GetStyles(); |
37 FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); | 37 FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); |
38 uint32_t GetStylesEx(); | 38 uint32_t GetStylesEx(); |
39 FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | 39 FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, |
| 40 uint32_t dwStylesExRemoved); |
40 uint32_t GetStates(); | 41 uint32_t GetStates(); |
41 FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | 42 FWL_Error SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); |
42 FWL_ERR SetPrivateData(void* module_id, | 43 FWL_Error SetPrivateData(void* module_id, |
43 void* pData, | 44 void* pData, |
44 PD_CALLBACK_FREEDATA callback); | 45 PD_CALLBACK_FREEDATA callback); |
45 void* GetPrivateData(void* module_id); | 46 void* GetPrivateData(void* module_id); |
46 FWL_ERR Update(); | 47 FWL_Error Update(); |
47 FWL_ERR LockUpdate(); | 48 FWL_Error LockUpdate(); |
48 FWL_ERR UnlockUpdate(); | 49 FWL_Error UnlockUpdate(); |
49 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); | 50 FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); |
50 FWL_ERR TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); | 51 FWL_Error TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); |
51 FWL_ERR TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); | 52 FWL_Error TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); |
52 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | 53 FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); |
53 FWL_ERR SetMatrix(const CFX_Matrix& matrix); | 54 FWL_Error SetMatrix(const CFX_Matrix& matrix); |
54 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); | 55 FWL_Error DrawWidget(CFX_Graphics* pGraphics, |
| 56 const CFX_Matrix* pMatrix = NULL); |
55 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | 57 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); |
56 FWL_ERR Repaint(const CFX_RectF* pRect = NULL); | 58 FWL_Error Repaint(const CFX_RectF* pRect = NULL); |
57 FWL_ERR SetFocus(FX_BOOL bFocus); | 59 FWL_Error SetFocus(FX_BOOL bFocus); |
58 FWL_ERR SetGrab(FX_BOOL bSet); | 60 FWL_Error SetGrab(FX_BOOL bSet); |
59 CFWL_Widget(); | 61 CFWL_Widget(); |
60 | 62 |
61 void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, | 63 void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, |
62 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | 64 uint32_t dwFilter = FWL_EVENT_ALL_MASK); |
63 void DispatchEvent(CFWL_Event* pEvent); | 65 void DispatchEvent(CFWL_Event* pEvent); |
64 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | 66 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, |
65 FX_BOOL bMultiLine = FALSE, | 67 FX_BOOL bMultiLine = FALSE, |
66 int32_t iLineWidth = -1); | 68 int32_t iLineWidth = -1); |
67 IFWL_Widget* m_pIface; | 69 IFWL_Widget* m_pIface; |
68 IFWL_WidgetDelegate* m_pDelegate; | 70 IFWL_WidgetDelegate* m_pDelegate; |
69 CFWL_WidgetMgr* m_pWidgetMgr; | 71 CFWL_WidgetMgr* m_pWidgetMgr; |
70 CFWL_WidgetProperties* m_pProperties; | 72 CFWL_WidgetProperties* m_pProperties; |
71 | 73 |
72 protected: | 74 protected: |
73 FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); | 75 FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); |
74 }; | 76 }; |
75 | 77 |
76 #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ | 78 #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
OLD | NEW |