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