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 _FWL_WIDGETMGR_H 8 #define _FWL_WIDGETMGR_H 9 class IFWL_Widget; 10 class IFWL_WidgetMgr; 11 class IFWL_WidgetMgrDelegate; 12 enum FWL_WGTRELATION { 13 FWL_WGTRELATION_Parent = 0, 14 FWL_WGTRELATION_Owner, 15 FWL_WGTRELATION_FirstSibling, 16 FWL_WGTRELATION_PriorSibling, 17 FWL_WGTRELATION_NextSibling, 18 FWL_WGTRELATION_LastSibling, 19 FWL_WGTRELATION_FirstChild, 20 FWL_WGTRELATION_LastChild, 21 FWL_WGTRELATION_SystemForm 22 }; 23 class IFWL_WidgetMgr { 24 public: ~IFWL_WidgetMgr()25 virtual ~IFWL_WidgetMgr() {} 26 virtual int32_t CountWidgets(IFWL_Widget* pParent = NULL) = 0; 27 virtual IFWL_Widget* GetWidget(int32_t nIndex, 28 IFWL_Widget* pParent = NULL) = 0; 29 virtual IFWL_Widget* GetWidget(IFWL_Widget* pWidget, 30 FWL_WGTRELATION eRelation) = 0; 31 virtual int32_t GetWidgetIndex(IFWL_Widget* pWidget) = 0; 32 virtual FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) = 0; 33 virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget, 34 const CFX_RectF* pRect = NULL) = 0; 35 virtual FX_DWORD GetCapability() = 0; 36 }; 37 IFWL_WidgetMgr* FWL_GetWidgetMgr(); 38 FX_BOOL FWL_WidgetIsChild(IFWL_Widget* parent, IFWL_Widget* find); 39 #define FWL_WGTMGR_DisableThread 0x00000001 40 #define FWL_WGTMGR_DisableForm 0x00000002 41 class IFWL_WidgetMgrDelegate { 42 public: ~IFWL_WidgetMgrDelegate()43 virtual ~IFWL_WidgetMgrDelegate() {} 44 virtual FWL_ERR OnSetCapability( 45 FX_DWORD dwCapability = FWL_WGTMGR_DisableThread) = 0; 46 virtual int32_t OnProcessMessageToForm(CFWL_Message* pMessage) = 0; 47 virtual FWL_ERR OnDrawWidget(IFWL_Widget* pWidget, 48 CFX_Graphics* pGraphics, 49 const CFX_Matrix* pMatrix = NULL) = 0; 50 }; 51 FWL_ERR FWL_WidgetMgrSnapshot(IFWL_Widget* pWidget, 52 const CFX_WideString* saveFile, 53 const CFX_Matrix* pMatrix = NULL); 54 #endif 55