| OLD | NEW |
| (Empty) |
| 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 XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | |
| 8 #define XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | |
| 9 | |
| 10 #include <map> | |
| 11 #include <memory> | |
| 12 | |
| 13 #include "core/fxcrt/fx_system.h" | |
| 14 #include "xfa/fwl/core/fwl_error.h" | |
| 15 #include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" | |
| 16 #include "xfa/fxgraphics/cfx_graphics.h" | |
| 17 | |
| 18 #define FWL_WGTMGR_DisableForm 0x00000002 | |
| 19 | |
| 20 class CFWL_Message; | |
| 21 class CXFA_FFApp; | |
| 22 class CXFA_FWLAdapterWidgetMgr; | |
| 23 class CFX_Graphics; | |
| 24 class CFX_Matrix; | |
| 25 class CFWL_Widget; | |
| 26 | |
| 27 class CFWL_WidgetMgr : public CFWL_WidgetMgrDelegate { | |
| 28 public: | |
| 29 explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); | |
| 30 ~CFWL_WidgetMgr(); | |
| 31 | |
| 32 // CFWL_WidgetMgrDelegate | |
| 33 void OnSetCapability(uint32_t dwCapability) override; | |
| 34 void OnProcessMessageToForm(CFWL_Message* pMessage) override; | |
| 35 void OnDrawWidget(CFWL_Widget* pWidget, | |
| 36 CFX_Graphics* pGraphics, | |
| 37 const CFX_Matrix* pMatrix) override; | |
| 38 | |
| 39 CFWL_Widget* GetParentWidget(CFWL_Widget* pWidget) const; | |
| 40 CFWL_Widget* GetOwnerWidget(CFWL_Widget* pWidget) const; | |
| 41 CFWL_Widget* GetNextSiblingWidget(CFWL_Widget* pWidget) const; | |
| 42 CFWL_Widget* GetFirstChildWidget(CFWL_Widget* pWidget) const; | |
| 43 CFWL_Widget* GetSystemFormWidget(CFWL_Widget* pWidget) const; | |
| 44 | |
| 45 void RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF* pRect); | |
| 46 | |
| 47 void InsertWidget(CFWL_Widget* pParent, CFWL_Widget* pChild); | |
| 48 void RemoveWidget(CFWL_Widget* pWidget); | |
| 49 void SetOwner(CFWL_Widget* pOwner, CFWL_Widget* pOwned); | |
| 50 void SetParent(CFWL_Widget* pParent, CFWL_Widget* pChild); | |
| 51 | |
| 52 void SetWidgetRect_Native(CFWL_Widget* pWidget, const CFX_RectF& rect); | |
| 53 | |
| 54 CFWL_Widget* GetWidgetAtPoint(CFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy); | |
| 55 | |
| 56 void NotifySizeChanged(CFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy); | |
| 57 | |
| 58 CFWL_Widget* NextTab(CFWL_Widget* parent, CFWL_Widget* focus, bool& bFind); | |
| 59 | |
| 60 void GetSameGroupRadioButton(CFWL_Widget* pRadioButton, | |
| 61 CFX_ArrayTemplate<CFWL_Widget*>& group) const; | |
| 62 CFWL_Widget* GetDefaultButton(CFWL_Widget* pParent) const; | |
| 63 void AddRedrawCounts(CFWL_Widget* pWidget); | |
| 64 | |
| 65 bool IsFormDisabled() const { | |
| 66 return !!(m_dwCapability & FWL_WGTMGR_DisableForm); | |
| 67 } | |
| 68 | |
| 69 void GetAdapterPopupPos(CFWL_Widget* pWidget, | |
| 70 FX_FLOAT fMinHeight, | |
| 71 FX_FLOAT fMaxHeight, | |
| 72 const CFX_RectF& rtAnchor, | |
| 73 CFX_RectF& rtPopup) const; | |
| 74 | |
| 75 private: | |
| 76 class Item { | |
| 77 public: | |
| 78 Item(); | |
| 79 explicit Item(CFWL_Widget* widget); | |
| 80 ~Item(); | |
| 81 | |
| 82 Item* pParent; | |
| 83 Item* pOwner; | |
| 84 Item* pChild; | |
| 85 Item* pPrevious; | |
| 86 Item* pNext; | |
| 87 CFWL_Widget* const pWidget; | |
| 88 std::unique_ptr<CFX_Graphics> pOffscreen; | |
| 89 int32_t iRedrawCounter; | |
| 90 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
| 91 bool bOutsideChanged; | |
| 92 #endif | |
| 93 }; | |
| 94 | |
| 95 CFWL_Widget* GetFirstSiblingWidget(CFWL_Widget* pWidget) const; | |
| 96 CFWL_Widget* GetPriorSiblingWidget(CFWL_Widget* pWidget) const; | |
| 97 CFWL_Widget* GetLastChildWidget(CFWL_Widget* pWidget) const; | |
| 98 Item* GetWidgetMgrItem(CFWL_Widget* pWidget) const; | |
| 99 | |
| 100 void AppendWidget(CFWL_Widget* pWidget); | |
| 101 | |
| 102 int32_t CountRadioButtonGroup(CFWL_Widget* pFirst) const; | |
| 103 CFWL_Widget* GetRadioButtonGroupHeader(CFWL_Widget* pRadioButton) const; | |
| 104 | |
| 105 void ResetRedrawCounts(CFWL_Widget* pWidget); | |
| 106 | |
| 107 void DrawChild(CFWL_Widget* pParent, | |
| 108 const CFX_RectF& rtClip, | |
| 109 CFX_Graphics* pGraphics, | |
| 110 const CFX_Matrix* pMatrix); | |
| 111 CFX_Graphics* DrawWidgetBefore(CFWL_Widget* pWidget, | |
| 112 CFX_Graphics* pGraphics, | |
| 113 const CFX_Matrix* pMatrix); | |
| 114 void DrawWidgetAfter(CFWL_Widget* pWidget, | |
| 115 CFX_Graphics* pGraphics, | |
| 116 CFX_RectF& rtClip, | |
| 117 const CFX_Matrix* pMatrix); | |
| 118 bool IsNeedRepaint(CFWL_Widget* pWidget, | |
| 119 CFX_Matrix* pMatrix, | |
| 120 const CFX_RectF& rtDirty); | |
| 121 bool UseOffscreenDirect(CFWL_Widget* pWidget) const; | |
| 122 | |
| 123 bool IsAbleNative(CFWL_Widget* pWidget) const; | |
| 124 | |
| 125 uint32_t m_dwCapability; | |
| 126 std::map<CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; | |
| 127 CXFA_FWLAdapterWidgetMgr* const m_pAdapter; | |
| 128 #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) | |
| 129 CFX_RectF m_rtScreen; | |
| 130 #endif | |
| 131 }; | |
| 132 | |
| 133 #endif // XFA_FWL_CORE_CFWL_WIDGETMGR_H_ | |
| OLD | NEW |