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