diff options
author | tsepez <tsepez@chromium.org> | 2016-05-26 17:35:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-26 17:35:54 -0700 |
commit | 54ab2343c338f55735c37ed6751040791e1df1e2 (patch) | |
tree | 59851961d740cb6c913dbdd42d54a8d64bfbf5de /xfa/fwl/core/fwl_widgetimp.cpp | |
parent | 3bd3841291b46bd7ae31cfb8dc8035e5b4ed4e40 (diff) | |
download | pdfium-54ab2343c338f55735c37ed6751040791e1df1e2.tar.xz |
Add opaque "layout item" to widgets for caller's use.
This avoids another use of CFX_PrivateData. Note that in the old
code, we'd be calling through a m_pImpl onto the same underlying
object as we passed as the "key" argument when setting the value,
which explains why the get calls, happening one object lower, pass
the same argument as which they are being inovked against.
Review-Url: https://codereview.chromium.org/2010923002
Diffstat (limited to 'xfa/fwl/core/fwl_widgetimp.cpp')
-rw-r--r-- | xfa/fwl/core/fwl_widgetimp.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index c6070b28e7..38e3a1ff28 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -103,6 +103,14 @@ void IFWL_Widget::SetEventKey(uint32_t key) { GetImpl()->SetEventKey(key); } +void* IFWL_Widget::GetLayoutItem() const { + return GetImpl()->GetLayoutItem(); +} + +void IFWL_Widget::SetLayoutItem(void* pItem) { + GetImpl()->SetLayoutItem(pItem); +} + FWL_Error IFWL_Widget::SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback) { @@ -517,30 +525,35 @@ void CFWL_WidgetImp::SetEventKey(uint32_t key) { m_nEventKey = key; } +void* CFWL_WidgetImp::GetLayoutItem() const { + return m_pLayoutItem; +} + +void CFWL_WidgetImp::SetLayoutItem(void* pItem) { + m_pLayoutItem = pItem; +} + CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : m_pProperties(new CFWL_WidgetImpProperties), - m_pPrivateData(NULL), - m_pDelegate(NULL), - m_pCurDelegate(NULL), + m_pPrivateData(nullptr), + m_pDelegate(nullptr), + m_pCurDelegate(nullptr), m_pOuter(pOuter), - m_pInterface(NULL), + m_pInterface(nullptr), + m_pLayoutItem(nullptr), m_iLock(0), m_nEventKey(0) { *m_pProperties = properties; m_pWidgetMgr = CFWL_WidgetMgr::GetInstance(); - ASSERT(m_pWidgetMgr != NULL); + ASSERT(m_pWidgetMgr); } + CFWL_WidgetImp::~CFWL_WidgetImp() { - if (m_pPrivateData) { - delete m_pPrivateData; - m_pPrivateData = NULL; - } - if (m_pProperties) { - delete m_pProperties; - m_pProperties = NULL; - } + delete m_pPrivateData; + delete m_pProperties; } + FX_BOOL CFWL_WidgetImp::IsEnabled() const { return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0; } |