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_INCLUDE_FWL_LIGHTWIDGET_WIDGET_H_ | 7 #ifndef XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
8 #define XFA_INCLUDE_FWL_LIGHTWIDGET_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/core/cfwl_widgetimpproperties.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_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 { | 20 class CFWL_Widget { |
45 public: | 21 public: |
46 virtual ~CFWL_Widget(); | 22 virtual ~CFWL_Widget(); |
47 IFWL_Widget* GetWidget(); | 23 IFWL_Widget* GetWidget(); |
48 FWL_ERR GetClassName(CFX_WideString& wsClass) const; | 24 FWL_ERR GetClassName(CFX_WideString& wsClass) const; |
49 uint32_t GetClassID() const; | 25 uint32_t GetClassID() const; |
50 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 26 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
51 | 27 |
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); | 28 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
57 FWL_ERR GetGlobalRect(CFX_RectF& rect); | 29 FWL_ERR GetGlobalRect(CFX_RectF& rect); |
58 FWL_ERR SetWidgetRect(const CFX_RectF& rect); | 30 FWL_ERR SetWidgetRect(const CFX_RectF& rect); |
59 FWL_ERR GetClientRect(CFX_RectF& rtClient); | 31 FWL_ERR GetClientRect(CFX_RectF& rtClient); |
60 CFWL_Widget* GetParent(); | 32 CFWL_Widget* GetParent(); |
61 FWL_ERR SetParent(CFWL_Widget* pParent); | 33 FWL_ERR SetParent(CFWL_Widget* pParent); |
62 CFWL_Widget* GetOwner(); | 34 CFWL_Widget* GetOwner(); |
63 FWL_ERR SetOwner(CFWL_Widget* pOwner); | 35 FWL_ERR SetOwner(CFWL_Widget* pOwner); |
64 uint32_t GetStyles(); | 36 uint32_t GetStyles(); |
65 FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); | 37 FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); |
(...skipping 23 matching lines...) Expand all Loading... |
89 void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, | 61 void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, |
90 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | 62 uint32_t dwFilter = FWL_EVENT_ALL_MASK); |
91 void DispatchEvent(CFWL_Event* pEvent); | 63 void DispatchEvent(CFWL_Event* pEvent); |
92 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | 64 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, |
93 FX_BOOL bMultiLine = FALSE, | 65 FX_BOOL bMultiLine = FALSE, |
94 int32_t iLineWidth = -1); | 66 int32_t iLineWidth = -1); |
95 IFWL_Widget* m_pIface; | 67 IFWL_Widget* m_pIface; |
96 IFWL_WidgetDelegate* m_pDelegate; | 68 IFWL_WidgetDelegate* m_pDelegate; |
97 CFWL_WidgetMgr* m_pWidgetMgr; | 69 CFWL_WidgetMgr* m_pWidgetMgr; |
98 CFWL_WidgetProperties* m_pProperties; | 70 CFWL_WidgetProperties* m_pProperties; |
99 }; | 71 |
100 class CFWL_WidgetDelegate { | 72 protected: |
101 public: | 73 FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); |
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 }; | 74 }; |
109 | 75 |
110 #endif // XFA_INCLUDE_FWL_LIGHTWIDGET_WIDGET_H_ | 76 #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
OLD | NEW |