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