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 <memory> |
| 11 |
10 #include "xfa/fwl/core/cfwl_event.h" | 12 #include "xfa/fwl/core/cfwl_event.h" |
11 #include "xfa/fwl/lightwidget/cfwl_widgetproperties.h" | 13 #include "xfa/fwl/lightwidget/cfwl_widgetproperties.h" |
12 #include "xfa/fwl/core/ifwl_widget.h" | 14 #include "xfa/fwl/core/ifwl_widget.h" |
13 | 15 |
14 class CFWL_Event; | 16 class CFWL_Event; |
15 class CFWL_Message; | 17 class CFWL_Message; |
16 class CFWL_Widget; | 18 class CFWL_Widget; |
17 class CFWL_WidgetDelegate; | 19 class CFWL_WidgetDelegate; |
18 class CFWL_WidgetMgr; | 20 class CFWL_WidgetMgr; |
19 | 21 |
20 class CFWL_Widget { | 22 class CFWL_Widget { |
21 public: | 23 public: |
22 virtual ~CFWL_Widget(); | 24 virtual ~CFWL_Widget(); |
23 | 25 |
24 IFWL_Widget* GetWidget(); | 26 virtual IFWL_Widget* GetWidget(); |
| 27 virtual const IFWL_Widget* GetWidget() const; |
| 28 |
25 FWL_Error GetClassName(CFX_WideString& wsClass) const; | 29 FWL_Error GetClassName(CFX_WideString& wsClass) const; |
26 FWL_Type GetClassID() const; | 30 FWL_Type GetClassID() const; |
27 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; | 31 virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; |
28 | 32 |
29 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); | 33 FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); |
30 FWL_Error GetGlobalRect(CFX_RectF& rect); | 34 FWL_Error GetGlobalRect(CFX_RectF& rect); |
31 FWL_Error SetWidgetRect(const CFX_RectF& rect); | 35 FWL_Error SetWidgetRect(const CFX_RectF& rect); |
32 FWL_Error GetClientRect(CFX_RectF& rtClient); | 36 FWL_Error GetClientRect(CFX_RectF& rtClient); |
33 CFWL_Widget* GetParent(); | 37 CFWL_Widget* GetParent(); |
34 FWL_Error SetParent(CFWL_Widget* pParent); | 38 FWL_Error SetParent(CFWL_Widget* pParent); |
(...skipping 28 matching lines...) Expand all Loading... |
63 FWL_Error SetFocus(FX_BOOL bFocus); | 67 FWL_Error SetFocus(FX_BOOL bFocus); |
64 FWL_Error SetGrab(FX_BOOL bSet); | 68 FWL_Error SetGrab(FX_BOOL bSet); |
65 CFWL_Widget(); | 69 CFWL_Widget(); |
66 | 70 |
67 void RegisterEventTarget(CFWL_Widget* pEventSource = nullptr, | 71 void RegisterEventTarget(CFWL_Widget* pEventSource = nullptr, |
68 uint32_t dwFilter = FWL_EVENT_ALL_MASK); | 72 uint32_t dwFilter = FWL_EVENT_ALL_MASK); |
69 void DispatchEvent(CFWL_Event* pEvent); | 73 void DispatchEvent(CFWL_Event* pEvent); |
70 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, | 74 CFX_SizeF CalcTextSize(const CFX_WideString& wsText, |
71 FX_BOOL bMultiLine = FALSE, | 75 FX_BOOL bMultiLine = FALSE, |
72 int32_t iLineWidth = -1); | 76 int32_t iLineWidth = -1); |
73 IFWL_Widget* m_pIface; | |
74 IFWL_WidgetDelegate* m_pDelegate; | |
75 CFWL_WidgetMgr* m_pWidgetMgr; | |
76 CFWL_WidgetProperties* m_pProperties; | |
77 | 77 |
78 protected: | 78 protected: |
79 FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); | 79 FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); |
| 80 |
| 81 std::unique_ptr<IFWL_Widget> m_pIface; |
| 82 IFWL_WidgetDelegate* m_pDelegate; |
| 83 CFWL_WidgetMgr* const m_pWidgetMgr; |
| 84 std::unique_ptr<CFWL_WidgetProperties> m_pProperties; |
80 }; | 85 }; |
81 | 86 |
82 #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ | 87 #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ |
OLD | NEW |