diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-21 17:05:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-21 17:05:59 -0800 |
commit | 37b6d1479b1674eb239cea8893eea31274d22ecd (patch) | |
tree | 07b5a2842c29c2b3324c6c60d369e9aea000e1b0 /xfa/fwl | |
parent | 6a1c9bd09ef8fdd2fe2f9e39b9a05f6581be9d87 (diff) | |
download | pdfium-37b6d1479b1674eb239cea8893eea31274d22ecd.tar.xz |
Split fwl/core class pt II.
Split classes in FWL to be single class per file. In the case of data providers
which added no new methods, removed and used the IFWL_Widget::DataProvider
directly.
Review-Url: https://codereview.chromium.org/2520063002
Diffstat (limited to 'xfa/fwl')
38 files changed, 357 insertions, 272 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 95b4cd29eb..2a4622f9fb 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -11,7 +11,7 @@ #include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_barcode.h" -class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { +class CFWL_Barcode : public CFWL_Edit, public IFWL_Barcode::DataProvider { public: explicit CFWL_Barcode(const IFWL_App* pApp); ~CFWL_Barcode() override; @@ -21,7 +21,7 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_BarcodeDP + // IFWL_Barcode::DataProvider BC_CHAR_ENCODING GetCharEncoding() const override; int32_t GetModuleHeight() const override; int32_t GetModuleWidth() const override; diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index d395aa058d..4d39a94726 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -10,7 +10,7 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_checkbox.h" -class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { +class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBox::DataProvider { public: explicit CFWL_CheckBox(const IFWL_App* pApp); ~CFWL_CheckBox() override; @@ -20,7 +20,7 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_CheckBoxDP + // IFWL_CheckBox::DataProvider FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override; void SetBoxSize(FX_FLOAT fHeight); diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h index 8d983c9cdd..68cc421147 100644 --- a/xfa/fwl/core/cfwl_datetimepicker.h +++ b/xfa/fwl/core/cfwl_datetimepicker.h @@ -10,7 +10,8 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fwl/core/ifwl_datetimepicker.h" -class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { +class CFWL_DateTimePicker : public CFWL_Widget, + public IFWL_DateTimePicker::DataProvider { public: explicit CFWL_DateTimePicker(const IFWL_App* pApp); ~CFWL_DateTimePicker() override; @@ -20,7 +21,7 @@ class CFWL_DateTimePicker : public CFWL_Widget, public IFWL_DateTimePickerDP { // IFWL_Widget::DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - // IFWL_DateTimePickerDP + // IFWL_DateTimePicker::DataProvider void GetToday(IFWL_Widget* pWidget, int32_t& iYear, int32_t& iMonth, diff --git a/xfa/fwl/core/cfwl_eventtarget.cpp b/xfa/fwl/core/cfwl_eventtarget.cpp new file mode 100644 index 0000000000..77fb9d8354 --- /dev/null +++ b/xfa/fwl/core/cfwl_eventtarget.cpp @@ -0,0 +1,74 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/cfwl_eventtarget.h" + +#include "xfa/fwl/core/ifwl_widget.h" +#include "xfa/fwl/core/ifwl_widgetdelegate.h" + +CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener) + : m_pListener(pListener), m_bInvalid(false) {} + +CFWL_EventTarget::~CFWL_EventTarget() { + m_eventSources.RemoveAll(); +} + +int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, + uint32_t dwFilter) { + if (pSource) { + m_eventSources.SetAt(pSource, dwFilter); + return m_eventSources.GetCount(); + } + return 1; +} + +bool CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { + IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate(); + if (!pDelegate) + return false; + if (m_eventSources.GetCount() == 0) { + pDelegate->OnProcessEvent(pEvent); + return true; + } + + FX_POSITION pos = m_eventSources.GetStartPosition(); + while (pos) { + IFWL_Widget* pSource = nullptr; + uint32_t dwFilter = 0; + m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); + if (pSource == pEvent->m_pSrcTarget) { + if (IsFilterEvent(pEvent, dwFilter)) { + pDelegate->OnProcessEvent(pEvent); + return true; + } + } + } + return false; +} + +bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, + uint32_t dwFilter) const { + if (dwFilter == FWL_EVENT_ALL_MASK) + return true; + + switch (pEvent->GetClassID()) { + case CFWL_EventType::Mouse: + return !!(dwFilter & FWL_EVENT_MOUSE_MASK); + case CFWL_EventType::MouseWheel: + return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); + case CFWL_EventType::Key: + return !!(dwFilter & FWL_EVENT_KEY_MASK); + case CFWL_EventType::SetFocus: + case CFWL_EventType::KillFocus: + return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); + case CFWL_EventType::Close: + return !!(dwFilter & FWL_EVENT_CLOSE_MASK); + case CFWL_EventType::SizeChanged: + return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); + default: + return !!(dwFilter & FWL_EVENT_CONTROL_MASK); + } +} diff --git a/xfa/fwl/core/cfwl_eventtarget.h b/xfa/fwl/core/cfwl_eventtarget.h new file mode 100644 index 0000000000..b7e43ce5ff --- /dev/null +++ b/xfa/fwl/core/cfwl_eventtarget.h @@ -0,0 +1,36 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FWL_CORE_CFWL_EVENTTARGET_H_ +#define XFA_FWL_CORE_CFWL_EVENTTARGET_H_ + +#include "core/fxcrt/fx_basic.h" +#include "xfa/fwl/core/cfwl_event.h" + +class CFWL_Event; +class IFWL_Widget; + +class CFWL_EventTarget { + public: + explicit CFWL_EventTarget(IFWL_Widget* pListener); + ~CFWL_EventTarget(); + + int32_t SetEventSource(IFWL_Widget* pSource, + uint32_t dwFilter = FWL_EVENT_ALL_MASK); + bool ProcessEvent(CFWL_Event* pEvent); + + bool IsInvalid() const { return m_bInvalid; } + void FlagInvalid() { m_bInvalid = true; } + + private: + bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const; + + CFX_MapPtrTemplate<void*, uint32_t> m_eventSources; + IFWL_Widget* m_pListener; + bool m_bInvalid; +}; + +#endif // XFA_FWL_CORE_CFWL_EVENTTARGET_H_ diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/cfwl_notedriver.cpp index 8b9a7236fe..7c53e54847 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/cfwl_notedriver.cpp @@ -4,24 +4,24 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fwl/core/fwl_noteimp.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include <utility> #include "core/fxcrt/fx_ext.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" +#include "xfa/fwl/core/cfwl_eventtarget.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgkillfocus.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_msgmousewheel.h" #include "xfa/fwl/core/cfwl_msgsetfocus.h" +#include "xfa/fwl/core/cfwl_noteloop.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_tooltip.h" -CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {} - CFWL_NoteDriver::CFWL_NoteDriver() : m_pHover(nullptr), m_pFocus(nullptr), @@ -487,67 +487,3 @@ void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) { } } } - -CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener) - : m_pListener(pListener), m_bInvalid(false) {} - -CFWL_EventTarget::~CFWL_EventTarget() { - m_eventSources.RemoveAll(); -} - -int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, - uint32_t dwFilter) { - if (pSource) { - m_eventSources.SetAt(pSource, dwFilter); - return m_eventSources.GetCount(); - } - return 1; -} - -bool CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) { - IFWL_WidgetDelegate* pDelegate = m_pListener->GetDelegate(); - if (!pDelegate) - return false; - if (m_eventSources.GetCount() == 0) { - pDelegate->OnProcessEvent(pEvent); - return true; - } - - FX_POSITION pos = m_eventSources.GetStartPosition(); - while (pos) { - IFWL_Widget* pSource = nullptr; - uint32_t dwFilter = 0; - m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter); - if (pSource == pEvent->m_pSrcTarget) { - if (IsFilterEvent(pEvent, dwFilter)) { - pDelegate->OnProcessEvent(pEvent); - return true; - } - } - } - return false; -} - -bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, - uint32_t dwFilter) const { - if (dwFilter == FWL_EVENT_ALL_MASK) - return true; - - switch (pEvent->GetClassID()) { - case CFWL_EventType::Mouse: - return !!(dwFilter & FWL_EVENT_MOUSE_MASK); - case CFWL_EventType::MouseWheel: - return !!(dwFilter & FWL_EVENT_MOUSEWHEEL_MASK); - case CFWL_EventType::Key: - return !!(dwFilter & FWL_EVENT_KEY_MASK); - case CFWL_EventType::SetFocus: - case CFWL_EventType::KillFocus: - return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); - case CFWL_EventType::Close: - return !!(dwFilter & FWL_EVENT_CLOSE_MASK); - case CFWL_EventType::SizeChanged: - return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); - default: - return !!(dwFilter & FWL_EVENT_CONTROL_MASK); - } -} diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/cfwl_notedriver.h index 5a530ed9af..a9b2c715db 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/cfwl_notedriver.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FWL_CORE_FWL_NOTEIMP_H_ -#define XFA_FWL_CORE_FWL_NOTEIMP_H_ +#ifndef XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ +#define XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ #include <deque> #include <memory> @@ -17,25 +17,11 @@ #include "xfa/fxgraphics/cfx_graphics.h" class CFWL_EventTarget; +class CFWL_NoteLoop; class CFWL_TargetImp; class IFWL_ToolTip; class IFWL_Widget; -class CFWL_NoteLoop { - public: - CFWL_NoteLoop(); - ~CFWL_NoteLoop() {} - - IFWL_Widget* GetForm() const { return m_pForm; } - bool ContinueModal() const { return m_bContinueModal; } - void EndModalLoop() { m_bContinueModal = false; } - void SetMainForm(IFWL_Widget* pForm) { m_pForm = pForm; } - - private: - IFWL_Widget* m_pForm; - bool m_bContinueModal; -}; - class CFWL_NoteDriver { public: CFWL_NoteDriver(); @@ -93,24 +79,4 @@ class CFWL_NoteDriver { std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop; }; -class CFWL_EventTarget { - public: - explicit CFWL_EventTarget(IFWL_Widget* pListener); - ~CFWL_EventTarget(); - - int32_t SetEventSource(IFWL_Widget* pSource, - uint32_t dwFilter = FWL_EVENT_ALL_MASK); - bool ProcessEvent(CFWL_Event* pEvent); - - bool IsInvalid() const { return m_bInvalid; } - void FlagInvalid() { m_bInvalid = true; } - - private: - bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const; - - CFX_MapPtrTemplate<void*, uint32_t> m_eventSources; - IFWL_Widget* m_pListener; - bool m_bInvalid; -}; - -#endif // XFA_FWL_CORE_FWL_NOTEIMP_H_ +#endif // XFA_FWL_CORE_CFWL_NOTEDRIVER_H_ diff --git a/xfa/fwl/core/cfwl_noteloop.cpp b/xfa/fwl/core/cfwl_noteloop.cpp new file mode 100644 index 0000000000..4b2b6105ed --- /dev/null +++ b/xfa/fwl/core/cfwl_noteloop.cpp @@ -0,0 +1,9 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/cfwl_noteloop.h" + +CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {} diff --git a/xfa/fwl/core/cfwl_noteloop.h b/xfa/fwl/core/cfwl_noteloop.h new file mode 100644 index 0000000000..f07bdc56a4 --- /dev/null +++ b/xfa/fwl/core/cfwl_noteloop.h @@ -0,0 +1,27 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FWL_CORE_CFWL_NOTELOOP_H_ +#define XFA_FWL_CORE_CFWL_NOTELOOP_H_ + +class IFWL_Widget; + +class CFWL_NoteLoop { + public: + CFWL_NoteLoop(); + ~CFWL_NoteLoop() {} + + IFWL_Widget* GetForm() const { return m_pForm; } + bool ContinueModal() const { return m_bContinueModal; } + void EndModalLoop() { m_bContinueModal = false; } + void SetMainForm(IFWL_Widget* pForm) { m_pForm = pForm; } + + private: + IFWL_Widget* m_pForm; + bool m_bContinueModal; +}; + +#endif // XFA_FWL_CORE_CFWL_NOTELOOP_H_ diff --git a/xfa/fwl/core/cfwl_themepart.cpp b/xfa/fwl/core/cfwl_themepart.cpp new file mode 100644 index 0000000000..6b48a1e03e --- /dev/null +++ b/xfa/fwl/core/cfwl_themepart.cpp @@ -0,0 +1,18 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/cfwl_themepart.h" + +CFWL_ThemePart::CFWL_ThemePart() + : m_pWidget(nullptr), + m_iPart(CFWL_Part::None), + m_dwStates(CFWL_PartState_Normal), + m_bMaximize(false), + m_bStaticBackground(false), + m_pData(nullptr) { + m_rtPart.Reset(); + m_matrix.SetIdentity(); +} diff --git a/xfa/fwl/core/cfwl_themepart.h b/xfa/fwl/core/cfwl_themepart.h index 1b2c706274..93565e91f5 100644 --- a/xfa/fwl/core/cfwl_themepart.h +++ b/xfa/fwl/core/cfwl_themepart.h @@ -93,15 +93,4 @@ class CFWL_ThemePart { void* m_pData; }; -inline CFWL_ThemePart::CFWL_ThemePart() - : m_pWidget(nullptr), - m_iPart(CFWL_Part::None), - m_dwStates(CFWL_PartState_Normal), - m_bMaximize(false), - m_bStaticBackground(false), - m_pData(nullptr) { - m_rtPart.Reset(); - m_matrix.SetIdentity(); -} - #endif // XFA_FWL_CORE_CFWL_THEMEPART_H_ diff --git a/xfa/fwl/core/cfwl_widget.cpp b/xfa/fwl/core/cfwl_widget.cpp index 39d86fa8ba..2e08be7817 100644 --- a/xfa/fwl/core/cfwl_widget.cpp +++ b/xfa/fwl/core/cfwl_widget.cpp @@ -7,9 +7,9 @@ #include "xfa/fwl/core/cfwl_widget.h" #include "xfa/fde/tto/fde_textout.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_themeprovider.h" diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp index 6623e8f9fb..6c11018893 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.cpp +++ b/xfa/fwl/core/cfwl_widgetmgr.cpp @@ -8,7 +8,8 @@ #include <utility> -#include "xfa/fwl/core/fwl_noteimp.h" +#include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_form.h" #include "xfa/fxfa/app/xfa_fwladapter.h" @@ -38,7 +39,7 @@ bool FWL_UseOffscreen(IFWL_Widget* pWidget) { CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) : m_dwCapability(0), m_pAdapter(pAdapterNative->GetWidgetMgr(this)) { ASSERT(m_pAdapter); - m_mapWidgetItem[nullptr].reset(new CFWL_WidgetMgrItem); + m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>(); #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) m_rtScreen.Reset(); #endif @@ -47,17 +48,17 @@ CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative) CFWL_WidgetMgr::~CFWL_WidgetMgr() {} IFWL_Widget* CFWL_WidgetMgr::GetParentWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pParent ? pItem->pParent->pWidget : nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetOwnerWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pOwner ? pItem->pOwner->pWidget : nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem) return nullptr; @@ -68,22 +69,22 @@ IFWL_Widget* CFWL_WidgetMgr::GetFirstSiblingWidget(IFWL_Widget* pWidget) const { } IFWL_Widget* CFWL_WidgetMgr::GetPriorSiblingWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pPrevious ? pItem->pPrevious->pWidget : nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetNextSiblingWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pNext ? pItem->pNext->pWidget : nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetFirstChildWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); return pItem && pItem->pChild ? pItem->pChild->pWidget : nullptr; } IFWL_Widget* CFWL_WidgetMgr::GetLastChildWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem) return nullptr; @@ -94,7 +95,7 @@ IFWL_Widget* CFWL_WidgetMgr::GetLastChildWidget(IFWL_Widget* pWidget) const { } IFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); while (pItem) { if (IsAbleNative(pItem->pWidget)) return pItem->pWidget; @@ -104,13 +105,13 @@ IFWL_Widget* CFWL_WidgetMgr::GetSystemFormWidget(IFWL_Widget* pWidget) const { } void CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem) return; if (!pItem->pParent) return; - CFWL_WidgetMgrItem* pChild = pItem->pParent->pChild; + Item* pChild = pItem->pParent->pChild; int32_t i = 0; while (pChild) { if (pChild == pItem) { @@ -203,18 +204,21 @@ void CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, void CFWL_WidgetMgr::InsertWidget(IFWL_Widget* pParent, IFWL_Widget* pChild, int32_t nIndex) { - CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); + Item* pParentItem = GetWidgetMgrItem(pParent); if (!pParentItem) { - pParentItem = new CFWL_WidgetMgrItem(pParent); - m_mapWidgetItem[pParent].reset(pParentItem); + auto item = pdfium::MakeUnique<Item>(pParent); + pParentItem = item.get(); + m_mapWidgetItem[pParent] = std::move(item); + pParentItem->pParent = GetWidgetMgrItem(nullptr); SetWidgetIndex(pParent, -1); } - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pChild); + Item* pItem = GetWidgetMgrItem(pChild); if (!pItem) { - pItem = new CFWL_WidgetMgrItem(pChild); - m_mapWidgetItem[pChild].reset(pItem); + auto item = pdfium::MakeUnique<Item>(pChild); + pItem = item.get(); + m_mapWidgetItem[pChild] = std::move(item); } if (pItem->pParent && pItem->pParent != pParentItem) { if (pItem->pPrevious) @@ -229,7 +233,7 @@ void CFWL_WidgetMgr::InsertWidget(IFWL_Widget* pParent, } void CFWL_WidgetMgr::RemoveWidget(IFWL_Widget* pWidget) { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem) return; if (pItem->pPrevious) @@ -239,9 +243,9 @@ void CFWL_WidgetMgr::RemoveWidget(IFWL_Widget* pWidget) { if (pItem->pParent && pItem->pParent->pChild == pItem) pItem->pParent->pChild = pItem->pNext; - CFWL_WidgetMgrItem* pChild = pItem->pChild; + Item* pChild = pItem->pChild; while (pChild) { - CFWL_WidgetMgrItem* pNext = pChild->pNext; + Item* pNext = pChild->pNext; RemoveWidget(pChild->pWidget); pChild = pNext; } @@ -249,24 +253,27 @@ void CFWL_WidgetMgr::RemoveWidget(IFWL_Widget* pWidget) { } void CFWL_WidgetMgr::SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned) { - CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pOwner); + Item* pParentItem = GetWidgetMgrItem(pOwner); if (!pParentItem) { - pParentItem = new CFWL_WidgetMgrItem(pOwner); - m_mapWidgetItem[pOwner].reset(pParentItem); + auto item = pdfium::MakeUnique<Item>(pOwner); + pParentItem = item.get(); + m_mapWidgetItem[pOwner] = std::move(item); + pParentItem->pParent = GetWidgetMgrItem(nullptr); SetWidgetIndex(pOwner, -1); } - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pOwned); + Item* pItem = GetWidgetMgrItem(pOwned); if (!pItem) { - pItem = new CFWL_WidgetMgrItem(pOwned); - m_mapWidgetItem[pOwned].reset(pItem); + auto item = pdfium::MakeUnique<Item>(pOwned); + pItem = item.get(); + m_mapWidgetItem[pOwned] = std::move(item); } pItem->pOwner = pParentItem; } void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) { - CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent); - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pChild); + Item* pParentItem = GetWidgetMgrItem(pParent); + Item* pItem = GetWidgetMgrItem(pChild); if (!pItem) return; if (pItem->pParent && pItem->pParent != pParentItem) { @@ -289,7 +296,7 @@ void CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, if (!FWL_UseOffscreen(pWidget)) return; - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); pItem->iRedrawCounter++; if (pItem->pOffscreen) { CFX_RenderDevice* pDevice = pItem->pOffscreen->GetRenderDevice(); @@ -427,12 +434,11 @@ void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) { GetWidgetMgrItem(pWidget)->iRedrawCounter = 0; } -CFWL_WidgetMgrItem* CFWL_WidgetMgr::GetWidgetMgrItem( +CFWL_WidgetMgr::Item* CFWL_WidgetMgr::GetWidgetMgrItem( IFWL_Widget* pWidget) const { auto it = m_mapWidgetItem.find(pWidget); - return it != m_mapWidgetItem.end() - ? static_cast<CFWL_WidgetMgrItem*>(it->second.get()) - : nullptr; + return it != m_mapWidgetItem.end() ? static_cast<Item*>(it->second.get()) + : nullptr; } bool CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) const { @@ -591,7 +597,7 @@ CFX_Graphics* CFWL_WidgetMgr::DrawWidgetBefore(IFWL_Widget* pWidget, if (!FWL_UseOffscreen(pWidget)) return pGraphics; - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!pItem->pOffscreen) { pItem->pOffscreen.reset(new CFX_Graphics); CFX_RectF rect; @@ -610,21 +616,21 @@ void CFWL_WidgetMgr::DrawWidgetAfter(IFWL_Widget* pWidget, CFX_RectF& rtClip, const CFX_Matrix* pMatrix) { if (FWL_UseOffscreen(pWidget)) { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); pGraphics->Transfer(pItem->pOffscreen.get(), rtClip.left, rtClip.top, rtClip, pMatrix); #ifdef _WIN32 pItem->pOffscreen->ClearClip(); #endif } - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); pItem->iRedrawCounter = 0; } bool CFWL_WidgetMgr::IsNeedRepaint(IFWL_Widget* pWidget, CFX_Matrix* pMatrix, const CFX_RectF& rtDirty) { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (pItem && pItem->iRedrawCounter > 0) { pItem->iRedrawCounter = 0; return true; @@ -722,7 +728,7 @@ bool CFWL_WidgetMgr::IsNeedRepaint(IFWL_Widget* pWidget, } bool CFWL_WidgetMgr::UseOffscreenDirect(IFWL_Widget* pWidget) const { - CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); + Item* pItem = GetWidgetMgrItem(pWidget); if (!FWL_UseOffscreen(pWidget) || !(pItem->pOffscreen)) return false; @@ -742,9 +748,9 @@ bool CFWL_WidgetMgr::UseOffscreenDirect(IFWL_Widget* pWidget) const { return pItem->iRedrawCounter == 0; } -CFWL_WidgetMgrItem::CFWL_WidgetMgrItem() : CFWL_WidgetMgrItem(nullptr) {} +CFWL_WidgetMgr::Item::Item() : CFWL_WidgetMgr::Item(nullptr) {} -CFWL_WidgetMgrItem::CFWL_WidgetMgrItem(IFWL_Widget* widget) +CFWL_WidgetMgr::Item::Item(IFWL_Widget* widget) : pParent(nullptr), pOwner(nullptr), pChild(nullptr), @@ -759,4 +765,4 @@ CFWL_WidgetMgrItem::CFWL_WidgetMgrItem(IFWL_Widget* widget) { } -CFWL_WidgetMgrItem::~CFWL_WidgetMgrItem() {} +CFWL_WidgetMgr::Item::~Item() {} diff --git a/xfa/fwl/core/cfwl_widgetmgr.h b/xfa/fwl/core/cfwl_widgetmgr.h index cdfa24a91d..0c6a184871 100644 --- a/xfa/fwl/core/cfwl_widgetmgr.h +++ b/xfa/fwl/core/cfwl_widgetmgr.h @@ -12,6 +12,7 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/fwl_error.h" +#include "xfa/fwl/core/ifwl_widgetmgrdelegate.h" #include "xfa/fxgraphics/cfx_graphics.h" #define FWL_WGTMGR_DisableForm 0x00000002 @@ -23,34 +24,6 @@ class CFX_Graphics; class CFX_Matrix; class IFWL_Widget; -class CFWL_WidgetMgrItem { - public: - CFWL_WidgetMgrItem(); - explicit CFWL_WidgetMgrItem(IFWL_Widget* widget); - ~CFWL_WidgetMgrItem(); - - CFWL_WidgetMgrItem* pParent; - CFWL_WidgetMgrItem* pOwner; - CFWL_WidgetMgrItem* pChild; - CFWL_WidgetMgrItem* pPrevious; - CFWL_WidgetMgrItem* pNext; - IFWL_Widget* const pWidget; - std::unique_ptr<CFX_Graphics> pOffscreen; - int32_t iRedrawCounter; -#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) - bool bOutsideChanged; -#endif -}; - -class IFWL_WidgetMgrDelegate { - public: - virtual void OnSetCapability(uint32_t dwCapability) = 0; - virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; - virtual void OnDrawWidget(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) = 0; -}; - class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { public: explicit CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative); @@ -102,10 +75,29 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { CFX_RectF& rtPopup) const; private: + class Item { + public: + Item(); + explicit Item(IFWL_Widget* widget); + ~Item(); + + Item* pParent; + Item* pOwner; + Item* pChild; + Item* pPrevious; + Item* pNext; + IFWL_Widget* const pWidget; + std::unique_ptr<CFX_Graphics> pOffscreen; + int32_t iRedrawCounter; +#if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) + bool bOutsideChanged; +#endif + }; + IFWL_Widget* GetFirstSiblingWidget(IFWL_Widget* pWidget) const; IFWL_Widget* GetPriorSiblingWidget(IFWL_Widget* pWidget) const; IFWL_Widget* GetLastChildWidget(IFWL_Widget* pWidget) const; - CFWL_WidgetMgrItem* GetWidgetMgrItem(IFWL_Widget* pWidget) const; + Item* GetWidgetMgrItem(IFWL_Widget* pWidget) const; void SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex); @@ -133,7 +125,7 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgrDelegate { bool IsAbleNative(IFWL_Widget* pWidget) const; uint32_t m_dwCapability; - std::map<IFWL_Widget*, std::unique_ptr<CFWL_WidgetMgrItem>> m_mapWidgetItem; + std::map<IFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem; CXFA_FWLAdapterWidgetMgr* const m_pAdapter; #if (_FX_OS_ == _FX_WIN32_DESKTOP_) || (_FX_OS_ == _FX_WIN64_) CFX_RectF m_rtScreen; diff --git a/xfa/fwl/core/cfwl_widgetproperties.cpp b/xfa/fwl/core/cfwl_widgetproperties.cpp new file mode 100644 index 0000000000..409b7f5211 --- /dev/null +++ b/xfa/fwl/core/cfwl_widgetproperties.cpp @@ -0,0 +1,24 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fwl/core/cfwl_widgetproperties.h" + +CFWL_WidgetProperties::CFWL_WidgetProperties() + : CFWL_WidgetProperties(nullptr) {} + +CFWL_WidgetProperties::CFWL_WidgetProperties( + IFWL_Widget::DataProvider* dataProvider) + : m_dwStyles(FWL_WGTSTYLE_Child), + m_dwStyleExes(0), + m_dwStates(0), + m_pThemeProvider(nullptr), + m_pDataProvider(dataProvider), + m_pParent(nullptr), + m_pOwner(nullptr) { + m_rtWidget.Set(0, 0, 0, 0); +} + +CFWL_WidgetProperties::~CFWL_WidgetProperties() {} diff --git a/xfa/fwl/core/cfwl_widgetproperties.h b/xfa/fwl/core/cfwl_widgetproperties.h index 83e54f1672..5b2a602c6d 100644 --- a/xfa/fwl/core/cfwl_widgetproperties.h +++ b/xfa/fwl/core/cfwl_widgetproperties.h @@ -31,21 +31,4 @@ class CFWL_WidgetProperties { IFWL_Widget* m_pOwner; }; -inline CFWL_WidgetProperties::CFWL_WidgetProperties() - : CFWL_WidgetProperties(nullptr) {} - -inline CFWL_WidgetProperties::CFWL_WidgetProperties( - IFWL_Widget::DataProvider* dataProvider) - : m_dwStyles(FWL_WGTSTYLE_Child), - m_dwStyleExes(0), - m_dwStates(0), - m_pThemeProvider(nullptr), - m_pDataProvider(dataProvider), - m_pParent(nullptr), - m_pOwner(nullptr) { - m_rtWidget.Set(0, 0, 0, 0); -} - -inline CFWL_WidgetProperties::~CFWL_WidgetProperties() {} - #endif // XFA_FWL_CORE_CFWL_WIDGETPROPERTIES_H_ diff --git a/xfa/fwl/core/ifwl_adaptertimermgr.h b/xfa/fwl/core/ifwl_adaptertimermgr.h index 156c0cf6f9..ad54f46312 100644 --- a/xfa/fwl/core/ifwl_adaptertimermgr.h +++ b/xfa/fwl/core/ifwl_adaptertimermgr.h @@ -11,7 +11,6 @@ class IFWL_AdapterTimerMgr { public: - virtual ~IFWL_AdapterTimerMgr() {} virtual void Start(IFWL_Timer* pTimer, uint32_t dwElapse, bool bImmediately, diff --git a/xfa/fwl/core/ifwl_app.cpp b/xfa/fwl/core/ifwl_app.cpp index 0a2b53a749..c4a6dc39ca 100644 --- a/xfa/fwl/core/ifwl_app.cpp +++ b/xfa/fwl/core/ifwl_app.cpp @@ -7,8 +7,8 @@ #include "xfa/fwl/core/ifwl_app.h" #include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_widget.h" #include "xfa/fxfa/app/xfa_fwladapter.h" diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp index 26d60aa4c9..71346b828b 100644 --- a/xfa/fwl/core/ifwl_barcode.cpp +++ b/xfa/fwl/core/ifwl_barcode.cpp @@ -10,9 +10,9 @@ #include "third_party/base/ptr_util.h" #include "xfa/fgas/font/cfgas_gefont.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfx_barcode.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" IFWL_Barcode::IFWL_Barcode(const IFWL_App* app, @@ -66,8 +66,8 @@ void IFWL_Barcode::GenerateBarcodeImageCache() { m_dwStatus = 0; CreateBarcodeEngine(); - IFWL_BarcodeDP* pData = - static_cast<IFWL_BarcodeDP*>(m_pProperties->m_pDataProvider); + IFWL_Barcode::DataProvider* pData = + static_cast<IFWL_Barcode::DataProvider*>(m_pProperties->m_pDataProvider); if (!pData) return; if (!m_pBarcodeEngine) diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index 417b1b77cc..5ff99e85c0 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -38,26 +38,26 @@ enum FWL_BCDAttribute { FWL_BCDATTRIBUTE_TRUNCATED = 1 << 12 }; -class IFWL_BarcodeDP : public IFWL_Widget::DataProvider { - public: - virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; - virtual int32_t GetModuleHeight() const = 0; - virtual int32_t GetModuleWidth() const = 0; - virtual int32_t GetDataLength() const = 0; - virtual bool GetCalChecksum() const = 0; - virtual bool GetPrintChecksum() const = 0; - virtual BC_TEXT_LOC GetTextLocation() const = 0; - virtual int32_t GetWideNarrowRatio() const = 0; - virtual FX_CHAR GetStartChar() const = 0; - virtual FX_CHAR GetEndChar() const = 0; - virtual int32_t GetVersion() const = 0; - virtual int32_t GetErrorCorrectionLevel() const = 0; - virtual bool GetTruncated() const = 0; - virtual uint32_t GetBarcodeAttributeMask() const = 0; -}; - class IFWL_Barcode : public IFWL_Edit { public: + class DataProvider : public IFWL_Widget::DataProvider { + public: + virtual BC_CHAR_ENCODING GetCharEncoding() const = 0; + virtual int32_t GetModuleHeight() const = 0; + virtual int32_t GetModuleWidth() const = 0; + virtual int32_t GetDataLength() const = 0; + virtual bool GetCalChecksum() const = 0; + virtual bool GetPrintChecksum() const = 0; + virtual BC_TEXT_LOC GetTextLocation() const = 0; + virtual int32_t GetWideNarrowRatio() const = 0; + virtual FX_CHAR GetStartChar() const = 0; + virtual FX_CHAR GetEndChar() const = 0; + virtual int32_t GetVersion() const = 0; + virtual int32_t GetErrorCorrectionLevel() const = 0; + virtual bool GetTruncated() const = 0; + virtual uint32_t GetBarcodeAttributeMask() const = 0; + }; + IFWL_Barcode(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties); ~IFWL_Barcode() override; diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index b7607e3597..5dcebc1cbb 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -9,9 +9,9 @@ #include <utility> #include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_timerinfo.h" diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index 0d18e2cec5..04f367f772 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -15,10 +15,10 @@ #include "xfa/fwl/core/cfwl_evtcheckstatechanged.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_themeprovider.h" @@ -70,8 +70,8 @@ void IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) { } rect.Inflate(kCaptionMargin, kCaptionMargin); - IFWL_CheckBoxDP* pData = - static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_CheckBox::DataProvider* pData = + static_cast<IFWL_CheckBox::DataProvider*>(m_pProperties->m_pDataProvider); FX_FLOAT fCheckBox = pData->GetBoxSize(this); rect.width += fCheckBox; rect.height = std::max(rect.height, fCheckBox); @@ -172,8 +172,8 @@ void IFWL_CheckBox::Layout() { FX_FLOAT fBoxTop = m_rtClient.top; FX_FLOAT fClientBottom = m_rtClient.bottom(); - IFWL_CheckBoxDP* pData = - static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider); + IFWL_CheckBox::DataProvider* pData = + static_cast<IFWL_CheckBox::DataProvider*>(m_pProperties->m_pDataProvider); FX_FLOAT fCheckBox = pData->GetBoxSize(this); switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) { case FWL_STYLEEXT_CKB_Top: diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index 30d9b637a0..0c9f3cda12 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -48,13 +48,13 @@ class CFWL_MsgMouse; class CFWL_WidgetProperties; class IFWL_Widget; -class IFWL_CheckBoxDP : public IFWL_Widget::DataProvider { - public: - virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0; -}; - class IFWL_CheckBox : public IFWL_Widget { public: + class DataProvider : public IFWL_Widget::DataProvider { + public: + virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0; + }; + IFWL_CheckBox(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties); ~IFWL_CheckBox() override; diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp index b85f4e4959..e632120417 100644 --- a/xfa/fwl/core/ifwl_combobox.cpp +++ b/xfa/fwl/core/ifwl_combobox.cpp @@ -22,11 +22,11 @@ #include "xfa/fwl/core/cfwl_msgkillfocus.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_msgsetfocus.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_formproxy.h" #include "xfa/fwl/core/ifwl_listbox.h" diff --git a/xfa/fwl/core/ifwl_comboboxproxy.cpp b/xfa/fwl/core/ifwl_comboboxproxy.cpp index f454f4c9eb..53586f4062 100644 --- a/xfa/fwl/core/ifwl_comboboxproxy.cpp +++ b/xfa/fwl/core/ifwl_comboboxproxy.cpp @@ -11,7 +11,7 @@ #include "xfa/fwl/core/cfwl_msgkillfocus.h" #include "xfa/fwl/core/cfwl_msgmouse.h" -#include "xfa/fwl/core/fwl_noteimp.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_combobox.h" diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp index dca32c3b42..b0e0114bce 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.cpp +++ b/xfa/fwl/core/ifwl_datetimepicker.cpp @@ -14,9 +14,9 @@ #include "xfa/fwl/core/cfwl_evtselectchanged.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_msgsetfocus.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_formproxy.h" #include "xfa/fwl/core/ifwl_spinbutton.h" #include "xfa/fwl/core/ifwl_themeprovider.h" @@ -118,8 +118,9 @@ void IFWL_DateTimePicker::Update() { if (!(m_pMonthCal->GetThemeProvider())) m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); if (m_pProperties->m_pDataProvider) { - IFWL_DateTimePickerDP* pData = - static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); + IFWL_DateTimePicker::DataProvider* pData = + static_cast<IFWL_DateTimePicker::DataProvider*>( + m_pProperties->m_pDataProvider); pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay); } @@ -467,8 +468,9 @@ void IFWL_DateTimePicker::DisForm_Update() { if (!m_pMonthCal->GetThemeProvider()) m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); if (m_pProperties->m_pDataProvider) { - IFWL_DateTimePickerDP* pData = - static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); + IFWL_DateTimePicker::DataProvider* pData = + static_cast<IFWL_DateTimePicker::DataProvider*>( + m_pProperties->m_pDataProvider); pData->GetToday(this, m_iCurYear, m_iCurMonth, m_iCurDay); } diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h index 9d7b83a6c8..21f5f4a28e 100644 --- a/xfa/fwl/core/ifwl_datetimepicker.h +++ b/xfa/fwl/core/ifwl_datetimepicker.h @@ -35,17 +35,17 @@ class IFWL_DateTimeEdit; class IFWL_FormProxy; -class IFWL_DateTimePickerDP : public IFWL_Widget::DataProvider { - public: - virtual void GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) = 0; -}; - class IFWL_DateTimePicker : public IFWL_Widget, public IFWL_MonthCalendar::DataProvider { public: + class DataProvider : public IFWL_Widget::DataProvider { + public: + virtual void GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) = 0; + }; + explicit IFWL_DateTimePicker( const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties); diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp index 115aca04a9..bbc16ebdeb 100644 --- a/xfa/fwl/core/ifwl_form.cpp +++ b/xfa/fwl/core/ifwl_form.cpp @@ -12,12 +12,13 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_evtclose.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_notedriver.h" +#include "xfa/fwl/core/cfwl_noteloop.h" #include "xfa/fwl/core/cfwl_sysbtn.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_formproxy.h" #include "xfa/fwl/core/ifwl_themeprovider.h" diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 3b7fe4f698..8970a5c81a 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -33,8 +33,6 @@ class IFWL_Widget; class IFWL_ThemeProvider; class CFWL_SysBtn; -class IFWL_FormDP : public IFWL_Widget::DataProvider {}; - class IFWL_Form : public IFWL_Widget { public: IFWL_Form(const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp index 0e85d986ed..253ed7fb94 100644 --- a/xfa/fwl/core/ifwl_formproxy.cpp +++ b/xfa/fwl/core/ifwl_formproxy.cpp @@ -10,7 +10,7 @@ #include <utility> #include "third_party/base/ptr_util.h" -#include "xfa/fwl/core/fwl_noteimp.h" +#include "xfa/fwl/core/cfwl_notedriver.h" IFWL_FormProxy::IFWL_FormProxy( const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_monthcalendar.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp index 3d7dbf549f..10ce33a719 100644 --- a/xfa/fwl/core/ifwl_monthcalendar.cpp +++ b/xfa/fwl/core/ifwl_monthcalendar.cpp @@ -13,9 +13,9 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_datetimepicker.h" #include "xfa/fwl/core/ifwl_formproxy.h" #include "xfa/fwl/core/ifwl_themeprovider.h" diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp index f1bec5134a..9cb3604076 100644 --- a/xfa/fwl/core/ifwl_picturebox.cpp +++ b/xfa/fwl/core/ifwl_picturebox.cpp @@ -10,8 +10,8 @@ #include <utility> #include "third_party/base/ptr_util.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_picturebox.h" -#include "xfa/fwl/core/fwl_noteimp.h" IFWL_PictureBox::IFWL_PictureBox( const IFWL_App* app, diff --git a/xfa/fwl/core/ifwl_pushbutton.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp index b1894931d5..8ee0485b11 100644 --- a/xfa/fwl/core/ifwl_pushbutton.cpp +++ b/xfa/fwl/core/ifwl_pushbutton.cpp @@ -15,9 +15,9 @@ #include "xfa/fwl/core/cfwl_evtmouse.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" IFWL_PushButton::IFWL_PushButton( diff --git a/xfa/fwl/core/ifwl_scrollbar.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp index 0de791fa2d..b4d6b5076a 100644 --- a/xfa/fwl/core/ifwl_scrollbar.cpp +++ b/xfa/fwl/core/ifwl_scrollbar.cpp @@ -13,9 +13,9 @@ #include "third_party/base/ptr_util.h" #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_msgmousewheel.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_timerinfo.h" diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp index fa063d6da5..b77c259de9 100644 --- a/xfa/fwl/core/ifwl_spinbutton.cpp +++ b/xfa/fwl/core/ifwl_spinbutton.cpp @@ -13,9 +13,9 @@ #include "xfa/fwl/core/cfwl_evtclick.h" #include "xfa/fwl/core/cfwl_msgkey.h" #include "xfa/fwl/core/cfwl_msgmouse.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_widgetproperties.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_timerinfo.h" diff --git a/xfa/fwl/core/ifwl_tooltip.cpp b/xfa/fwl/core/ifwl_tooltip.cpp index a9a07c636a..770527de02 100644 --- a/xfa/fwl/core/ifwl_tooltip.cpp +++ b/xfa/fwl/core/ifwl_tooltip.cpp @@ -11,10 +11,10 @@ #include "third_party/base/ptr_util.h" #include "xfa/fde/tto/fde_textout.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_themeprovider.h" #include "xfa/fwl/core/ifwl_timerinfo.h" #include "xfa/fwl/theme/cfwl_widgettp.h" diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp index e9ee2a8715..ca574b2356 100644 --- a/xfa/fwl/core/ifwl_widget.cpp +++ b/xfa/fwl/core/ifwl_widget.cpp @@ -21,11 +21,11 @@ #include "xfa/fwl/core/cfwl_msgmouse.h" #include "xfa/fwl/core/cfwl_msgmousewheel.h" #include "xfa/fwl/core/cfwl_msgsetfocus.h" +#include "xfa/fwl/core/cfwl_notedriver.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themepart.h" #include "xfa/fwl/core/cfwl_themetext.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/fwl_noteimp.h" #include "xfa/fwl/core/ifwl_app.h" #include "xfa/fwl/core/ifwl_combobox.h" #include "xfa/fwl/core/ifwl_form.h" diff --git a/xfa/fwl/core/ifwl_widgetmgrdelegate.h b/xfa/fwl/core/ifwl_widgetmgrdelegate.h new file mode 100644 index 0000000000..c832692314 --- /dev/null +++ b/xfa/fwl/core/ifwl_widgetmgrdelegate.h @@ -0,0 +1,24 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_ +#define XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_ + +class CFWL_Message; +class CFX_Graphics; +class CFX_Matrix; +class IFWL_Widget; + +class IFWL_WidgetMgrDelegate { + public: + virtual void OnSetCapability(uint32_t dwCapability) = 0; + virtual void OnProcessMessageToForm(CFWL_Message* pMessage) = 0; + virtual void OnDrawWidget(IFWL_Widget* pWidget, + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) = 0; +}; + +#endif // XFA_FWL_CORE_IFWL_WIDGETMGRDELEGATE_H_ |