OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef XFA_INCLUDE_FWL_LIGHTWIDGET_WIDGET_H_ | |
8 #define XFA_INCLUDE_FWL_LIGHTWIDGET_WIDGET_H_ | |
9 | |
10 #include "xfa/fwl/core/cfwl_event.h" | |
11 #include "xfa/fwl/core/cfwl_widgetimpproperties.h" | |
12 #include "xfa/fwl/core/ifwl_widget.h" | |
13 | |
14 class CFWL_Event; | |
15 class CFWL_Message; | |
16 class CFWL_Widget; | |
17 class CFWL_WidgetDelegate; | |
18 class CFWL_WidgetMgr; | |
19 | |
20 class CFWL_WidgetProperties { | |
21 public: | |
22 CFWL_WidgetProperties() { | |
23 m_ctmOnParent.SetIdentity(); | |
24 m_rtWidget.Set(0, 0, 0, 0); | |
25 m_dwStyles = FWL_WGTSTYLE_Child; | |
26 m_dwStyleExes = 0; | |
27 m_dwStates = 0; | |
28 m_pParent = NULL; | |
29 m_pOwner = NULL; | |
30 } | |
31 CFWL_WidgetImpProperties MakeWidgetImpProperties( | |
32 IFWL_DataProvider* pDataProvider) const; | |
33 | |
34 CFX_WideString m_wsWindowclass; | |
35 CFX_Matrix m_ctmOnParent; | |
36 CFX_RectF m_rtWidget; | |
37 uint32_t m_dwStyles; | |
38 uint32_t m_dwStyleExes; | |
39 uint32_t m_dwStates; | |
40 CFWL_Widget* m_pParent; | |
41 CFWL_Widget* m_pOwner; | |
42 }; | |
43 | |
44 class CFWL_Widget { | |
45 public: | |
46 virtual ~CFWL_Widget(); | |
47 IFWL_Widget* GetWidget(); | |
48 FWL_ERR GetClassName(CFX_WideString& wsClass) const; | |
49 uint32_t GetClassID() const; | |
50 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | |
51 | |
52 protected: | |
53 FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); | |
54 | |
55 public: | |
56 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | |
57 FWL_ERR GetGlobalRect(CFX_RectF& rect); | |
58 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | |
59 FWL_ERR GetClientRect(CFX_RectF& rtClient); | |
60 CFWL_Widget* GetParent(); | |
61 FWL_ERR SetParent(CFWL_Widget* pParent); | |
62 CFWL_Widget* GetOwner(); | |
63 FWL_ERR SetOwner(CFWL_Widget* pOwner); | |
64 uint32_t GetStyles(); | |
65 FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); | |
66 uint32_t GetStylesEx(); | |
67 FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); | |
68 uint32_t GetStates(); | |
69 FWL_ERR SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); | |
70 FWL_ERR SetPrivateData(void* module_id, | |
71 void* pData, | |
72 PD_CALLBACK_FREEDATA callback); | |
73 void* GetPrivateData(void* module_id); | |
74 FWL_ERR Update(); | |
75 FWL_ERR LockUpdate(); | |
76 FWL_ERR UnlockUpdate(); | |
77 uint32_t HitTest(FX_FLOAT fx, FX_FLOAT fy); | |
78 FWL_ERR TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); | |
79 FWL_ERR TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); | |
80 FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); | |
81 FWL_ERR SetMatrix(const CFX_Matrix& matrix); | |
82 FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); | |
83 IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); | |
84 FWL_ERR Repaint(const CFX_RectF* pRect = NULL); | |
85 FWL_ERR SetFocus(FX_BOOL bFocus); | |
86 FWL_ERR SetGrab(FX_BOOL bSet); | |
87 CFWL_Widget(); | |
88 | |
89 void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, | |
90 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | |
91 void DispatchEvent(CFWL_Event* pEvent); | |
92 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | |
93 FX_BOOL bMultiLine = FALSE, | |
94 int32_t iLineWidth = -1); | |
95 IFWL_Widget* m_pIface; | |
96 IFWL_WidgetDelegate* m_pDelegate; | |
97 CFWL_WidgetMgr* m_pWidgetMgr; | |
98 CFWL_WidgetProperties* m_pProperties; | |
99 }; | |
100 class CFWL_WidgetDelegate { | |
101 public: | |
102 CFWL_WidgetDelegate(); | |
103 virtual ~CFWL_WidgetDelegate(); | |
104 virtual int32_t OnProcessMessage(CFWL_Message* pMessage); | |
105 virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); | |
106 virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, | |
107 const CFX_Matrix* pMatrix = NULL); | |
108 }; | |
109 | |
110 #endif // XFA_INCLUDE_FWL_LIGHTWIDGET_WIDGET_H_ | |
OLD | NEW |