summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_widget.h
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-28 10:51:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-28 10:51:13 -0700
commit7322343b9322b93d97077575f95a00dcca3f0451 (patch)
tree36337e0a2aff2147a9067477f982496129f0f7a1 /xfa/fwl/core/ifwl_widget.h
parente6ebf7af7ea94d48091be300cec84b499d3b8ae0 (diff)
downloadpdfium-7322343b9322b93d97077575f95a00dcca3f0451.tar.xz
More FWL interface cleanup.
This CL merges the IFWL_Target class into IFWL_Widget and IFWL_Thread into IFWL_App. The IFWL_WidgetMgrDelegate, IFWL_NoteDriver and IFWL_NotThread are removed in favour of their concrete classes. Review-Url: https://codereview.chromium.org/1921853006
Diffstat (limited to 'xfa/fwl/core/ifwl_widget.h')
-rw-r--r--xfa/fwl/core/ifwl_widget.h42
1 files changed, 38 insertions, 4 deletions
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 3540a3c87c..ea57c4e3fa 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -7,21 +7,38 @@
#ifndef XFA_FWL_CORE_IFWL_WIDGET_H_
#define XFA_FWL_CORE_IFWL_WIDGET_H_
+#include <memory>
+
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/ifwl_target.h"
+#include "xfa/fwl/core/fwl_widgetimp.h"
+
+// FWL contains three parallel inheritance hierarchies, which reference each
+// other via pointers as follows:
+//
+// m_pIface m_pImpl
+// CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp
+// | | |
+// A A A
+// | | |
+// CFWL_... IFWL_... CFWL_...Imp
+//
+class CFWL_WidgetImp;
class CFX_Graphics;
+class IFWL_App;
class IFWL_DataProvider;
class IFWL_Form;
-class IFWL_Thread;
class IFWL_ThemeProvider;
class IFWL_WidgetDelegate;
-class IFWL_Widget : public IFWL_Target {
+class IFWL_Widget {
public:
+ IFWL_Widget() : m_pImpl(nullptr) {}
+ virtual ~IFWL_Widget();
+
FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
FWL_ERR GetGlobalRect(CFX_RectF& rect);
FWL_ERR SetWidgetRect(const CFX_RectF& rect);
@@ -54,8 +71,25 @@ class IFWL_Widget : public IFWL_Target {
FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider);
IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
- IFWL_Thread* GetOwnerThread() const;
+ IFWL_App* GetOwnerApp() const;
CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
+
+ // These call into equivalent polymorphic methods of m_pImpl. There
+ // should be no need to override these in subclasses.
+ FWL_ERR GetClassName(CFX_WideString& wsClass) const;
+ uint32_t GetClassID() const;
+ FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
+ FWL_ERR Initialize();
+ FWL_ERR Finalize();
+
+ CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); }
+
+ protected:
+ // Takes ownership of |pImpl|.
+ void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); }
+
+ private:
+ std::unique_ptr<CFWL_WidgetImp> m_pImpl;
};
#endif // XFA_FWL_CORE_IFWL_WIDGET_H_