| Index: xfa/fwl/core/ifwl_widget.cpp
|
| diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/ifwl_widget.cpp
|
| similarity index 66%
|
| rename from xfa/fwl/core/fwl_widgetimp.cpp
|
| rename to xfa/fwl/core/ifwl_widget.cpp
|
| index 890f0da8aff7b3067f421942eec4432981895b9a..68755bf24abbe2584d8994d79a3b8d34d0e2c4ea 100644
|
| --- a/xfa/fwl/core/fwl_widgetimp.cpp
|
| +++ b/xfa/fwl/core/ifwl_widget.cpp
|
| @@ -4,12 +4,11 @@
|
|
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| -#include "xfa/fwl/core/fwl_widgetimp.h"
|
| +#include "xfa/fwl/core/ifwl_widget.h"
|
|
|
| #include <algorithm>
|
|
|
| #include "xfa/fde/tto/fde_textout.h"
|
| -#include "xfa/fwl/basewidget/ifwl_combobox.h"
|
| #include "xfa/fwl/core/cfwl_message.h"
|
| #include "xfa/fwl/core/cfwl_themebackground.h"
|
| #include "xfa/fwl/core/cfwl_themepart.h"
|
| @@ -17,6 +16,7 @@
|
| #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"
|
| #include "xfa/fwl/core/ifwl_themeprovider.h"
|
| #include "xfa/fwl/core/ifwl_widget.h"
|
| @@ -24,149 +24,7 @@
|
|
|
| #define FWL_STYLEEXT_MNU_Vert (1L << 0)
|
|
|
| -IFWL_Widget::IFWL_Widget() {}
|
| -
|
| -IFWL_Widget::~IFWL_Widget() {}
|
| -
|
| -FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
|
| - return m_pImpl->GetClassName(wsClass);
|
| -}
|
| -
|
| -FWL_Type IFWL_Widget::GetClassID() const {
|
| - return m_pImpl->GetClassID();
|
| -}
|
| -
|
| -FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
|
| - return m_pImpl->IsInstance(wsClass);
|
| -}
|
| -
|
| FWL_Error IFWL_Widget::Initialize() {
|
| - return m_pImpl->Initialize();
|
| -}
|
| -
|
| -FWL_Error IFWL_Widget::Finalize() {
|
| - return m_pImpl->Finalize();
|
| -}
|
| -
|
| -FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| - return GetImpl()->GetWidgetRect(rect, bAutoSize);
|
| -}
|
| -FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
|
| - return GetImpl()->GetGlobalRect(rect);
|
| -}
|
| -FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
|
| - return GetImpl()->SetWidgetRect(rect);
|
| -}
|
| -FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) {
|
| - return GetImpl()->GetClientRect(rect);
|
| -}
|
| -IFWL_Widget* IFWL_Widget::GetParent() {
|
| - return GetImpl()->GetParent();
|
| -}
|
| -FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) {
|
| - return GetImpl()->SetParent(pParent);
|
| -}
|
| -IFWL_Widget* IFWL_Widget::GetOwner() {
|
| - return GetImpl()->GetOwner();
|
| -}
|
| -FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) {
|
| - return GetImpl()->SetOwner(pOwner);
|
| -}
|
| -IFWL_Widget* IFWL_Widget::GetOuter() {
|
| - return GetImpl()->GetOuter();
|
| -}
|
| -uint32_t IFWL_Widget::GetStyles() {
|
| - return GetImpl()->GetStyles();
|
| -}
|
| -FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
|
| - uint32_t dwStylesRemoved) {
|
| - return GetImpl()->ModifyStyles(dwStylesAdded, dwStylesRemoved);
|
| -}
|
| -uint32_t IFWL_Widget::GetStylesEx() {
|
| - return GetImpl()->GetStylesEx();
|
| -}
|
| -FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
|
| - uint32_t dwStylesExRemoved) {
|
| - return GetImpl()->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
|
| -}
|
| -uint32_t IFWL_Widget::GetStates() {
|
| - return GetImpl()->GetStates();
|
| -}
|
| -void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| - GetImpl()->SetStates(dwStates, bSet);
|
| -}
|
| -
|
| -uint32_t IFWL_Widget::GetEventKey() const {
|
| - return GetImpl()->GetEventKey();
|
| -}
|
| -
|
| -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);
|
| -}
|
| -
|
| -void* IFWL_Widget::GetAssociateWidget() const {
|
| - return GetImpl()->GetAssociateWidget();
|
| -}
|
| -
|
| -void IFWL_Widget::SetAssociateWidget(void* pAssociate) {
|
| - GetImpl()->SetAssociateWidget(pAssociate);
|
| -}
|
| -
|
| -FWL_Error IFWL_Widget::Update() {
|
| - return GetImpl()->Update();
|
| -}
|
| -FWL_Error IFWL_Widget::LockUpdate() {
|
| - return GetImpl()->LockUpdate();
|
| -}
|
| -FWL_Error IFWL_Widget::UnlockUpdate() {
|
| - return GetImpl()->UnlockUpdate();
|
| -}
|
| -FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
|
| - return GetImpl()->HitTest(fx, fy);
|
| -}
|
| -FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget,
|
| - FX_FLOAT& fx,
|
| - FX_FLOAT& fy) {
|
| - return GetImpl()->TransformTo(pWidget, fx, fy);
|
| -}
|
| -FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) {
|
| - return GetImpl()->TransformTo(pWidget, rt);
|
| -}
|
| -FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
|
| - return GetImpl()->GetMatrix(matrix, bGlobal);
|
| -}
|
| -FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
|
| - return GetImpl()->SetMatrix(matrix);
|
| -}
|
| -FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| - return GetImpl()->DrawWidget(pGraphics, pMatrix);
|
| -}
|
| -IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() {
|
| - return GetImpl()->GetThemeProvider();
|
| -}
|
| -FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
|
| - return GetImpl()->SetThemeProvider(pThemeProvider);
|
| -}
|
| -IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
|
| - return GetImpl()->SetDelegate(pDelegate);
|
| -}
|
| -IFWL_App* IFWL_Widget::GetOwnerApp() const {
|
| - return GetImpl()->GetOwnerApp();
|
| -}
|
| -CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) {
|
| - return GetImpl()->GetOffsetFromParent(pParent);
|
| -}
|
| -
|
| -FWL_Error CFWL_WidgetImp::Initialize() {
|
| IFWL_App* pApp = FWL_GetApp();
|
| if (!pApp)
|
| return FWL_Error::Indefinite;
|
| @@ -178,31 +36,31 @@ FWL_Error CFWL_WidgetImp::Initialize() {
|
| SetOwnerApp(FWL_GetApp());
|
|
|
| IFWL_Widget* pParent = m_pProperties->m_pParent;
|
| - m_pWidgetMgr->InsertWidget(pParent, m_pInterface);
|
| + m_pWidgetMgr->InsertWidget(pParent, this);
|
| if (!IsChild()) {
|
| IFWL_Widget* pOwner = m_pProperties->m_pOwner;
|
| if (pOwner)
|
| - m_pWidgetMgr->SetOwner(pOwner, m_pInterface);
|
| + m_pWidgetMgr->SetOwner(pOwner, this);
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Error CFWL_WidgetImp::Finalize() {
|
| +FWL_Error IFWL_Widget::Finalize() {
|
| NotifyDriver();
|
| - m_pWidgetMgr->RemoveWidget(m_pInterface);
|
| + m_pWidgetMgr->RemoveWidget(this);
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const {
|
| +FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
|
| wsClass.clear();
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const {
|
| +FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
|
| return FALSE;
|
| }
|
|
|
| -FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| +FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| if (bAutoSize) {
|
| if (HasEdge()) {
|
| FX_FLOAT fEdge = GetEdgeWidth();
|
| @@ -218,27 +76,27 @@ FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| return FWL_Error::Succeeded;
|
| }
|
|
|
| -FWL_Error CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) {
|
| - IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(m_pInterface);
|
| +FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
|
| + IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this);
|
| if (!pForm)
|
| return FWL_Error::Indefinite;
|
|
|
| rect.Set(0, 0, m_pProperties->m_rtWidget.width,
|
| m_pProperties->m_rtWidget.height);
|
| - if (pForm == m_pInterface)
|
| + if (pForm == this)
|
| return FWL_Error::Succeeded;
|
|
|
| return TransformTo(pForm, rect);
|
| }
|
|
|
| -FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) {
|
| +FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
|
| CFX_RectF rtOld = m_pProperties->m_rtWidget;
|
| m_pProperties->m_rtWidget = rect;
|
| if (IsChild()) {
|
| if (FXSYS_fabs(rtOld.width - rect.width) > 0.5f ||
|
| FXSYS_fabs(rtOld.height - rect.height) > 0.5f) {
|
| CFWL_EvtSizeChanged ev;
|
| - ev.m_pSrcTarget = m_pInterface;
|
| + ev.m_pSrcTarget = this;
|
| ev.m_rtOld = rtOld;
|
| ev.m_rtNew = rect;
|
| IFWL_WidgetDelegate* pDelegate = SetDelegate(nullptr);
|
| @@ -248,10 +106,11 @@ FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) {
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| - m_pWidgetMgr->SetWidgetRect_Native(m_pInterface, rect);
|
| + m_pWidgetMgr->SetWidgetRect_Native(this, rect);
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) {
|
| +
|
| +FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) {
|
| GetEdgeRect(rect);
|
| if (HasEdge()) {
|
| FX_FLOAT fEdge = GetEdgeWidth();
|
| @@ -259,46 +118,57 @@ FWL_Error CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) {
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| -IFWL_Widget* CFWL_WidgetImp::GetParent() {
|
| - return m_pWidgetMgr->GetParentWidget(m_pInterface);
|
| +
|
| +IFWL_Widget* IFWL_Widget::GetParent() {
|
| + return m_pWidgetMgr->GetParentWidget(this);
|
| }
|
| -FWL_Error CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) {
|
| +
|
| +FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) {
|
| m_pProperties->m_pParent = pParent;
|
| - m_pWidgetMgr->SetParent(pParent, m_pInterface);
|
| + m_pWidgetMgr->SetParent(pParent, this);
|
| return FWL_Error::Succeeded;
|
| }
|
| -IFWL_Widget* CFWL_WidgetImp::GetOwner() {
|
| - return m_pWidgetMgr->GetOwnerWidget(m_pInterface);
|
| +
|
| +IFWL_Widget* IFWL_Widget::GetOwner() {
|
| + return m_pWidgetMgr->GetOwnerWidget(this);
|
| }
|
| -FWL_Error CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) {
|
| +
|
| +FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) {
|
| m_pProperties->m_pOwner = pOwner;
|
| - m_pWidgetMgr->SetOwner(pOwner, m_pInterface);
|
| + m_pWidgetMgr->SetOwner(pOwner, this);
|
| return FWL_Error::Succeeded;
|
| }
|
| -IFWL_Widget* CFWL_WidgetImp::GetOuter() {
|
| +
|
| +IFWL_Widget* IFWL_Widget::GetOuter() {
|
| return m_pOuter;
|
| }
|
| -uint32_t CFWL_WidgetImp::GetStyles() {
|
| +
|
| +uint32_t IFWL_Widget::GetStyles() {
|
| return m_pProperties->m_dwStyles;
|
| }
|
| -FWL_Error CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded,
|
| - uint32_t dwStylesRemoved) {
|
| +
|
| +FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
|
| + uint32_t dwStylesRemoved) {
|
| m_pProperties->m_dwStyles =
|
| (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded;
|
| return FWL_Error::Succeeded;
|
| }
|
| -uint32_t CFWL_WidgetImp::GetStylesEx() {
|
| +
|
| +uint32_t IFWL_Widget::GetStylesEx() {
|
| return m_pProperties->m_dwStyleExes;
|
| }
|
| -FWL_Error CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded,
|
| - uint32_t dwStylesExRemoved) {
|
| +
|
| +FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
|
| + uint32_t dwStylesExRemoved) {
|
| m_pProperties->m_dwStyleExes =
|
| (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded;
|
| return FWL_Error::Succeeded;
|
| }
|
| -uint32_t CFWL_WidgetImp::GetStates() {
|
| +
|
| +uint32_t IFWL_Widget::GetStates() {
|
| return m_pProperties->m_dwStates;
|
| }
|
| +
|
| static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr,
|
| IFWL_Widget* widget,
|
| CFWL_NoteDriver* noteDriver) {
|
| @@ -310,7 +180,7 @@ static void NotifyHideChildWidget(CFWL_WidgetMgr* widgetMgr,
|
| }
|
| }
|
|
|
| -void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| +void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| bSet ? (m_pProperties->m_dwStates |= dwStates)
|
| : (m_pProperties->m_dwStates &= ~dwStates);
|
| if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet)
|
| @@ -319,8 +189,8 @@ void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| CFWL_NoteDriver* noteDriver =
|
| static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver());
|
| CFWL_WidgetMgr* widgetMgr = CFWL_WidgetMgr::GetInstance();
|
| - noteDriver->NotifyTargetHide(m_pInterface);
|
| - IFWL_Widget* child = widgetMgr->GetFirstChildWidget(m_pInterface);
|
| + noteDriver->NotifyTargetHide(this);
|
| + IFWL_Widget* child = widgetMgr->GetFirstChildWidget(this);
|
| while (child) {
|
| noteDriver->NotifyTargetHide(child);
|
| NotifyHideChildWidget(widgetMgr, child, noteDriver);
|
| @@ -328,20 +198,24 @@ void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| }
|
| return;
|
| }
|
| -FWL_Error CFWL_WidgetImp::Update() {
|
| +
|
| +FWL_Error IFWL_Widget::Update() {
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::LockUpdate() {
|
| +
|
| +FWL_Error IFWL_Widget::LockUpdate() {
|
| m_iLock++;
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::UnlockUpdate() {
|
| +
|
| +FWL_Error IFWL_Widget::UnlockUpdate() {
|
| if (IsLocked()) {
|
| m_iLock--;
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
|
| +
|
| +FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
|
| CFX_RectF rtClient;
|
| GetClientRect(rtClient);
|
| if (rtClient.Contains(fx, fy))
|
| @@ -360,15 +234,16 @@ FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
|
| }
|
| return FWL_WidgetHit::Unknown;
|
| }
|
| -FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
|
| - FX_FLOAT& fx,
|
| - FX_FLOAT& fy) {
|
| +
|
| +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget,
|
| + FX_FLOAT& fx,
|
| + FX_FLOAT& fy) {
|
| if (m_pWidgetMgr->IsFormDisabled()) {
|
| CFX_SizeF szOffset;
|
| if (IsParent(pWidget)) {
|
| szOffset = GetOffsetFromParent(pWidget);
|
| } else {
|
| - szOffset = pWidget->GetOffsetFromParent(m_pInterface);
|
| + szOffset = pWidget->GetOffsetFromParent(this);
|
| szOffset.x = -szOffset.x;
|
| szOffset.y = -szOffset.y;
|
| }
|
| @@ -386,7 +261,7 @@ FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
|
| GetMatrix(m, TRUE);
|
| m.TransformPoint(fx, fy);
|
| }
|
| - IFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(m_pInterface);
|
| + IFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this);
|
| if (!form1)
|
| return FWL_Error::Indefinite;
|
| if (!pWidget) {
|
| @@ -419,10 +294,12 @@ FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) {
|
| +
|
| +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) {
|
| return TransformTo(pWidget, rt.left, rt.top);
|
| }
|
| -FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
|
| +
|
| +FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
|
| if (!m_pProperties)
|
| return FWL_Error::Indefinite;
|
| if (bGlobal) {
|
| @@ -450,7 +327,8 @@ FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
|
| }
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) {
|
| +
|
| +FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
|
| if (!m_pProperties)
|
| return FWL_Error::Indefinite;
|
| IFWL_Widget* parent = GetParent();
|
| @@ -460,19 +338,21 @@ FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) {
|
| m_pProperties->m_ctmOnParent = matrix;
|
| return FWL_Error::Succeeded;
|
| }
|
| -FWL_Error CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| +
|
| +FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
|
| + const CFX_Matrix* pMatrix) {
|
| return FWL_Error::Indefinite;
|
| }
|
| -IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() {
|
| +
|
| +IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() {
|
| return m_pProperties->m_pThemeProvider;
|
| }
|
| -FWL_Error CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
|
| +FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
|
| m_pProperties->m_pThemeProvider = pThemeProvider;
|
| return FWL_Error::Succeeded;
|
| }
|
| -IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate(
|
| - IFWL_WidgetDelegate* pDelegate) {
|
| +
|
| +IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
|
| if (!m_pCurDelegate) {
|
| m_pCurDelegate = m_pDelegate;
|
| }
|
| @@ -483,52 +363,47 @@ IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate(
|
| m_pCurDelegate = pDelegate;
|
| return pOldDelegate;
|
| }
|
| -IFWL_App* CFWL_WidgetImp::GetOwnerApp() const {
|
| +
|
| +IFWL_App* IFWL_Widget::GetOwnerApp() const {
|
| return m_pOwnerApp;
|
| }
|
| -FWL_Error CFWL_WidgetImp::SetOwnerApp(IFWL_App* pOwnerApp) {
|
| +
|
| +FWL_Error IFWL_Widget::SetOwnerApp(IFWL_App* pOwnerApp) {
|
| m_pOwnerApp = pOwnerApp;
|
| return FWL_Error::Succeeded;
|
| }
|
| -IFWL_Widget* CFWL_WidgetImp::GetInterface() const {
|
| - return m_pInterface;
|
| -}
|
| -void CFWL_WidgetImp::SetInterface(IFWL_Widget* pInterface) {
|
| - m_pInterface = pInterface;
|
| -}
|
|
|
| -uint32_t CFWL_WidgetImp::GetEventKey() const {
|
| +uint32_t IFWL_Widget::GetEventKey() const {
|
| return m_nEventKey;
|
| }
|
|
|
| -void CFWL_WidgetImp::SetEventKey(uint32_t key) {
|
| +void IFWL_Widget::SetEventKey(uint32_t key) {
|
| m_nEventKey = key;
|
| }
|
|
|
| -void* CFWL_WidgetImp::GetLayoutItem() const {
|
| +void* IFWL_Widget::GetLayoutItem() const {
|
| return m_pLayoutItem;
|
| }
|
|
|
| -void CFWL_WidgetImp::SetLayoutItem(void* pItem) {
|
| +void IFWL_Widget::SetLayoutItem(void* pItem) {
|
| m_pLayoutItem = pItem;
|
| }
|
|
|
| -void* CFWL_WidgetImp::GetAssociateWidget() const {
|
| +CFWL_Widget* IFWL_Widget::GetAssociateWidget() const {
|
| return m_pAssociate;
|
| }
|
|
|
| -void CFWL_WidgetImp::SetAssociateWidget(void* pAssociate) {
|
| +void IFWL_Widget::SetAssociateWidget(CFWL_Widget* pAssociate) {
|
| m_pAssociate = pAssociate;
|
| }
|
|
|
| -CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
|
| - IFWL_Widget* pOuter)
|
| +IFWL_Widget::IFWL_Widget(const CFWL_WidgetImpProperties& properties,
|
| + IFWL_Widget* pOuter)
|
| : m_pWidgetMgr(CFWL_WidgetMgr::GetInstance()),
|
| m_pProperties(new CFWL_WidgetImpProperties(properties)),
|
| m_pDelegate(nullptr),
|
| m_pCurDelegate(nullptr),
|
| m_pOuter(pOuter),
|
| - m_pInterface(nullptr),
|
| m_pLayoutItem(nullptr),
|
| m_pAssociate(nullptr),
|
| m_iLock(0),
|
| @@ -536,40 +411,50 @@ CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
|
| ASSERT(m_pWidgetMgr);
|
| }
|
|
|
| -CFWL_WidgetImp::~CFWL_WidgetImp() {}
|
| +IFWL_Widget::~IFWL_Widget() {}
|
|
|
| -FX_BOOL CFWL_WidgetImp::IsEnabled() const {
|
| +FX_BOOL IFWL_Widget::IsEnabled() const {
|
| return (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) == 0;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsVisible() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsVisible() const {
|
| return (m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) == 0;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsActive() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsActive() const {
|
| return (m_pProperties->m_dwStates & FWL_WGTSTATE_Deactivated) == 0;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsOverLapper() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsOverLapper() const {
|
| return (m_pProperties->m_dwStyles & FWL_WGTSTYLE_WindowTypeMask) ==
|
| FWL_WGTSTYLE_OverLapper;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsPopup() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsPopup() const {
|
| return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Popup);
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsChild() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsChild() const {
|
| return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Child);
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsLocked() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsLocked() const {
|
| return m_iLock > 0;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsOffscreen() const {
|
| +
|
| +FX_BOOL IFWL_Widget::IsOffscreen() const {
|
| return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Offscreen);
|
| }
|
| -FX_BOOL CFWL_WidgetImp::HasBorder() const {
|
| +
|
| +FX_BOOL IFWL_Widget::HasBorder() const {
|
| return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border);
|
| }
|
| -FX_BOOL CFWL_WidgetImp::HasEdge() const {
|
| +
|
| +FX_BOOL IFWL_Widget::HasEdge() const {
|
| return !!(m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask);
|
| }
|
| -void CFWL_WidgetImp::GetEdgeRect(CFX_RectF& rtEdge) {
|
| +
|
| +void IFWL_Widget::GetEdgeRect(CFX_RectF& rtEdge) {
|
| rtEdge = m_pProperties->m_rtWidget;
|
| rtEdge.left = rtEdge.top = 0;
|
| if (HasBorder()) {
|
| @@ -578,14 +463,16 @@ void CFWL_WidgetImp::GetEdgeRect(CFX_RectF& rtEdge) {
|
| rtEdge.Deflate(fCX, fCY);
|
| }
|
| }
|
| -FX_FLOAT CFWL_WidgetImp::GetBorderSize(FX_BOOL bCX) {
|
| +
|
| +FX_FLOAT IFWL_Widget::GetBorderSize(FX_BOOL bCX) {
|
| FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity(
|
| bCX ? CFWL_WidgetCapacity::CXBorder : CFWL_WidgetCapacity::CYBorder));
|
| if (!pfBorder)
|
| return 0;
|
| return *pfBorder;
|
| }
|
| -FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() {
|
| +
|
| +FX_FLOAT IFWL_Widget::GetEdgeWidth() {
|
| CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None;
|
| switch (m_pProperties->m_dwStyles & FWL_WGTSTYLE_EdgeMask) {
|
| case FWL_WGTSTYLE_EdgeFlat: {
|
| @@ -607,23 +494,26 @@ FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() {
|
| }
|
| return 0;
|
| }
|
| -void CFWL_WidgetImp::GetRelativeRect(CFX_RectF& rect) {
|
| +
|
| +void IFWL_Widget::GetRelativeRect(CFX_RectF& rect) {
|
| rect = m_pProperties->m_rtWidget;
|
| rect.left = rect.top = 0;
|
| }
|
| -void* CFWL_WidgetImp::GetThemeCapacity(CFWL_WidgetCapacity dwCapacity) {
|
| +
|
| +void* IFWL_Widget::GetThemeCapacity(CFWL_WidgetCapacity dwCapacity) {
|
| IFWL_ThemeProvider* pTheme = GetAvailableTheme();
|
| if (!pTheme)
|
| return nullptr;
|
| CFWL_ThemePart part;
|
| - part.m_pWidget = m_pInterface;
|
| + part.m_pWidget = this;
|
| return pTheme->GetCapacity(&part, dwCapacity);
|
| }
|
| -IFWL_ThemeProvider* CFWL_WidgetImp::GetAvailableTheme() {
|
| +
|
| +IFWL_ThemeProvider* IFWL_Widget::GetAvailableTheme() {
|
| if (m_pProperties->m_pThemeProvider) {
|
| return m_pProperties->m_pThemeProvider;
|
| }
|
| - IFWL_Widget* pUp = m_pInterface;
|
| + IFWL_Widget* pUp = this;
|
| do {
|
| pUp = (pUp->GetStyles() & FWL_WGTSTYLE_Popup)
|
| ? m_pWidgetMgr->GetOwnerWidget(pUp)
|
| @@ -636,27 +526,30 @@ IFWL_ThemeProvider* CFWL_WidgetImp::GetAvailableTheme() {
|
| } while (pUp);
|
| return nullptr;
|
| }
|
| -CFWL_WidgetImp* CFWL_WidgetImp::GetRootOuter() {
|
| +
|
| +IFWL_Widget* IFWL_Widget::GetRootOuter() {
|
| IFWL_Widget* pRet = m_pOuter;
|
| if (!pRet)
|
| return nullptr;
|
| while (IFWL_Widget* pOuter = pRet->GetOuter()) {
|
| pRet = pOuter;
|
| }
|
| - return static_cast<CFWL_WidgetImp*>(pRet->GetImpl());
|
| + return pRet;
|
| }
|
| +
|
| #define FWL_WGT_CalcHeight 2048
|
| #define FWL_WGT_CalcWidth 2048
|
| #define FWL_WGT_CalcMultiLineDefWidth 120.0f
|
| -CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
|
| - IFWL_ThemeProvider* pTheme,
|
| - FX_BOOL bMultiLine,
|
| - int32_t iLineWidth) {
|
| +
|
| +CFX_SizeF IFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
|
| + IFWL_ThemeProvider* pTheme,
|
| + FX_BOOL bMultiLine,
|
| + int32_t iLineWidth) {
|
| if (!pTheme)
|
| return CFX_SizeF();
|
|
|
| CFWL_ThemeText calPart;
|
| - calPart.m_pWidget = m_pInterface;
|
| + calPart.m_pWidget = this;
|
| calPart.m_wsText = wsText;
|
| calPart.m_dwTTOStyles =
|
| bMultiLine ? FDE_TTOSTYLE_LineWrap : FDE_TTOSTYLE_SingleLine;
|
| @@ -670,19 +563,21 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText,
|
| pTheme->CalcTextRect(&calPart, rect);
|
| return CFX_SizeF(rect.width, rect.height);
|
| }
|
| -void CFWL_WidgetImp::CalcTextRect(const CFX_WideString& wsText,
|
| - IFWL_ThemeProvider* pTheme,
|
| - uint32_t dwTTOStyles,
|
| - int32_t iTTOAlign,
|
| - CFX_RectF& rect) {
|
| +
|
| +void IFWL_Widget::CalcTextRect(const CFX_WideString& wsText,
|
| + IFWL_ThemeProvider* pTheme,
|
| + uint32_t dwTTOStyles,
|
| + int32_t iTTOAlign,
|
| + CFX_RectF& rect) {
|
| CFWL_ThemeText calPart;
|
| - calPart.m_pWidget = m_pInterface;
|
| + calPart.m_pWidget = this;
|
| calPart.m_wsText = wsText;
|
| calPart.m_dwTTOStyles = dwTTOStyles;
|
| calPart.m_iTTOAlign = iTTOAlign;
|
| pTheme->CalcTextRect(&calPart, rect);
|
| }
|
| -void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) {
|
| +
|
| +void IFWL_Widget::SetFocus(FX_BOOL bFocus) {
|
| if (m_pWidgetMgr->IsFormDisabled())
|
| return;
|
|
|
| @@ -696,44 +591,45 @@ void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) {
|
| return;
|
|
|
| IFWL_Widget* curFocus = pDriver->GetFocus();
|
| - if (bFocus && curFocus != m_pInterface) {
|
| - pDriver->SetFocus(m_pInterface);
|
| - } else if (!bFocus && curFocus == m_pInterface) {
|
| + if (bFocus && curFocus != this) {
|
| + pDriver->SetFocus(this);
|
| + } else if (!bFocus && curFocus == this) {
|
| pDriver->SetFocus(nullptr);
|
| }
|
| }
|
| -void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) {
|
| +
|
| +void IFWL_Widget::SetGrab(FX_BOOL bSet) {
|
| IFWL_App* pApp = GetOwnerApp();
|
| if (!pApp)
|
| return;
|
| CFWL_NoteDriver* pDriver =
|
| static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
|
| - pDriver->SetGrab(m_pInterface, bSet);
|
| + pDriver->SetGrab(this, bSet);
|
| }
|
|
|
| -FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight,
|
| - FX_FLOAT fMaxHeight,
|
| - const CFX_RectF& rtAnchor,
|
| - CFX_RectF& rtPopup) {
|
| +FX_BOOL IFWL_Widget::GetPopupPos(FX_FLOAT fMinHeight,
|
| + FX_FLOAT fMaxHeight,
|
| + const CFX_RectF& rtAnchor,
|
| + CFX_RectF& rtPopup) {
|
| if (GetClassID() == FWL_Type::ComboBox) {
|
| if (m_pWidgetMgr->IsFormDisabled()) {
|
| - return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight,
|
| - fMaxHeight, rtAnchor, rtPopup);
|
| + return m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight,
|
| + rtAnchor, rtPopup);
|
| }
|
| return GetPopupPosComboBox(fMinHeight, fMaxHeight, rtAnchor, rtPopup);
|
| }
|
| if (GetClassID() == FWL_Type::DateTimePicker &&
|
| m_pWidgetMgr->IsFormDisabled()) {
|
| - return m_pWidgetMgr->GetAdapterPopupPos(m_pInterface, fMinHeight,
|
| - fMaxHeight, rtAnchor, rtPopup);
|
| + return m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight,
|
| + rtAnchor, rtPopup);
|
| }
|
| return GetPopupPosGeneral(fMinHeight, fMaxHeight, rtAnchor, rtPopup);
|
| }
|
|
|
| -FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight,
|
| - FX_FLOAT fMaxHeight,
|
| - const CFX_RectF& rtAnchor,
|
| - CFX_RectF& rtPopup) {
|
| +FX_BOOL IFWL_Widget::GetPopupPosMenu(FX_FLOAT fMinHeight,
|
| + FX_FLOAT fMaxHeight,
|
| + const CFX_RectF& rtAnchor,
|
| + CFX_RectF& rtPopup) {
|
| FX_FLOAT fx = 0;
|
| FX_FLOAT fy = 0;
|
| FX_FLOAT fScreenWidth = 0;
|
| @@ -764,10 +660,11 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosMenu(FX_FLOAT fMinHeight,
|
| rtPopup.Offset(fx, fy);
|
| return TRUE;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::GetPopupPosComboBox(FX_FLOAT fMinHeight,
|
| - FX_FLOAT fMaxHeight,
|
| - const CFX_RectF& rtAnchor,
|
| - CFX_RectF& rtPopup) {
|
| +
|
| +FX_BOOL IFWL_Widget::GetPopupPosComboBox(FX_FLOAT fMinHeight,
|
| + FX_FLOAT fMaxHeight,
|
| + const CFX_RectF& rtAnchor,
|
| + CFX_RectF& rtPopup) {
|
| FX_FLOAT fx = 0;
|
| FX_FLOAT fy = 0;
|
| FX_FLOAT fScreenWidth = 0;
|
| @@ -790,10 +687,11 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosComboBox(FX_FLOAT fMinHeight,
|
| rtPopup.Offset(fx, fy);
|
| return TRUE;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::GetPopupPosGeneral(FX_FLOAT fMinHeight,
|
| - FX_FLOAT fMaxHeight,
|
| - const CFX_RectF& rtAnchor,
|
| - CFX_RectF& rtPopup) {
|
| +
|
| +FX_BOOL IFWL_Widget::GetPopupPosGeneral(FX_FLOAT fMinHeight,
|
| + FX_FLOAT fMaxHeight,
|
| + const CFX_RectF& rtAnchor,
|
| + CFX_RectF& rtPopup) {
|
| FX_FLOAT fx = 0;
|
| FX_FLOAT fy = 0;
|
| FX_FLOAT fScreenWidth = 0;
|
| @@ -810,11 +708,13 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosGeneral(FX_FLOAT fMinHeight,
|
| rtPopup.Offset(fx, fy);
|
| return TRUE;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) {
|
| +
|
| +FX_BOOL IFWL_Widget::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) {
|
| return FALSE;
|
| }
|
| -void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource,
|
| - uint32_t dwFilter) {
|
| +
|
| +void IFWL_Widget::RegisterEventTarget(IFWL_Widget* pEventSource,
|
| + uint32_t dwFilter) {
|
| IFWL_App* pApp = GetOwnerApp();
|
| if (!pApp)
|
| return;
|
| @@ -823,9 +723,10 @@ void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource,
|
| if (!pNoteDriver)
|
| return;
|
|
|
| - pNoteDriver->RegisterEventTarget(m_pInterface, pEventSource, dwFilter);
|
| + pNoteDriver->RegisterEventTarget(this, pEventSource, dwFilter);
|
| }
|
| -void CFWL_WidgetImp::UnregisterEventTarget() {
|
| +
|
| +void IFWL_Widget::UnregisterEventTarget() {
|
| IFWL_App* pApp = GetOwnerApp();
|
| if (!pApp)
|
| return;
|
| @@ -834,20 +735,22 @@ void CFWL_WidgetImp::UnregisterEventTarget() {
|
| if (!pNoteDriver)
|
| return;
|
|
|
| - pNoteDriver->UnregisterEventTarget(m_pInterface);
|
| + pNoteDriver->UnregisterEventTarget(this);
|
| }
|
| -void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) {
|
| +
|
| +void IFWL_Widget::DispatchKeyEvent(CFWL_MsgKey* pNote) {
|
| if (!pNote)
|
| return;
|
| CFWL_EvtKey* pEvent = new CFWL_EvtKey;
|
| - pEvent->m_pSrcTarget = m_pInterface;
|
| + pEvent->m_pSrcTarget = this;
|
| pEvent->m_dwCmd = pNote->m_dwCmd;
|
| pEvent->m_dwKeyCode = pNote->m_dwKeyCode;
|
| pEvent->m_dwFlags = pNote->m_dwFlags;
|
| DispatchEvent(pEvent);
|
| pEvent->Release();
|
| }
|
| -void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) {
|
| +
|
| +void IFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
|
| if (m_pOuter) {
|
| IFWL_WidgetDelegate* pDelegate = m_pOuter->SetDelegate(nullptr);
|
| pDelegate->OnProcessEvent(pEvent);
|
| @@ -861,24 +764,26 @@ void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) {
|
| return;
|
| pNoteDriver->SendEvent(pEvent);
|
| }
|
| -void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) {
|
| +
|
| +void IFWL_Widget::Repaint(const CFX_RectF* pRect) {
|
| if (pRect) {
|
| - m_pWidgetMgr->RepaintWidget(m_pInterface, pRect);
|
| + m_pWidgetMgr->RepaintWidget(this, pRect);
|
| return;
|
| }
|
| CFX_RectF rect;
|
| rect = m_pProperties->m_rtWidget;
|
| rect.left = rect.top = 0;
|
| - m_pWidgetMgr->RepaintWidget(m_pInterface, &rect);
|
| + m_pWidgetMgr->RepaintWidget(this, &rect);
|
| }
|
| -void CFWL_WidgetImp::DrawBackground(CFX_Graphics* pGraphics,
|
| - CFWL_Part iPartBk,
|
| - IFWL_ThemeProvider* pTheme,
|
| - const CFX_Matrix* pMatrix) {
|
| +
|
| +void IFWL_Widget::DrawBackground(CFX_Graphics* pGraphics,
|
| + CFWL_Part iPartBk,
|
| + IFWL_ThemeProvider* pTheme,
|
| + const CFX_Matrix* pMatrix) {
|
| CFX_RectF rtRelative;
|
| GetRelativeRect(rtRelative);
|
| CFWL_ThemeBackground param;
|
| - param.m_pWidget = m_pInterface;
|
| + param.m_pWidget = this;
|
| param.m_iPart = iPartBk;
|
| param.m_pGraphics = pGraphics;
|
| if (pMatrix) {
|
| @@ -887,14 +792,15 @@ void CFWL_WidgetImp::DrawBackground(CFX_Graphics* pGraphics,
|
| param.m_rtPart = rtRelative;
|
| pTheme->DrawBackground(¶m);
|
| }
|
| -void CFWL_WidgetImp::DrawBorder(CFX_Graphics* pGraphics,
|
| - CFWL_Part iPartBorder,
|
| - IFWL_ThemeProvider* pTheme,
|
| - const CFX_Matrix* pMatrix) {
|
| +
|
| +void IFWL_Widget::DrawBorder(CFX_Graphics* pGraphics,
|
| + CFWL_Part iPartBorder,
|
| + IFWL_ThemeProvider* pTheme,
|
| + const CFX_Matrix* pMatrix) {
|
| CFX_RectF rtRelative;
|
| GetRelativeRect(rtRelative);
|
| CFWL_ThemeBackground param;
|
| - param.m_pWidget = m_pInterface;
|
| + param.m_pWidget = this;
|
| param.m_iPart = iPartBorder;
|
| param.m_pGraphics = pGraphics;
|
| if (pMatrix) {
|
| @@ -903,14 +809,15 @@ void CFWL_WidgetImp::DrawBorder(CFX_Graphics* pGraphics,
|
| param.m_rtPart = rtRelative;
|
| pTheme->DrawBackground(¶m);
|
| }
|
| -void CFWL_WidgetImp::DrawEdge(CFX_Graphics* pGraphics,
|
| - CFWL_Part iPartEdge,
|
| - IFWL_ThemeProvider* pTheme,
|
| - const CFX_Matrix* pMatrix) {
|
| +
|
| +void IFWL_Widget::DrawEdge(CFX_Graphics* pGraphics,
|
| + CFWL_Part iPartEdge,
|
| + IFWL_ThemeProvider* pTheme,
|
| + const CFX_Matrix* pMatrix) {
|
| CFX_RectF rtEdge;
|
| GetEdgeRect(rtEdge);
|
| CFWL_ThemeBackground param;
|
| - param.m_pWidget = m_pInterface;
|
| + param.m_pWidget = this;
|
| param.m_iPart = iPartEdge;
|
| param.m_pGraphics = pGraphics;
|
| if (pMatrix) {
|
| @@ -919,7 +826,8 @@ void CFWL_WidgetImp::DrawEdge(CFX_Graphics* pGraphics,
|
| param.m_rtPart = rtEdge;
|
| pTheme->DrawBackground(¶m);
|
| }
|
| -void CFWL_WidgetImp::NotifyDriver() {
|
| +
|
| +void IFWL_Widget::NotifyDriver() {
|
| IFWL_App* pApp = GetOwnerApp();
|
| if (!pApp)
|
| return;
|
| @@ -929,10 +837,11 @@ void CFWL_WidgetImp::NotifyDriver() {
|
| if (!pDriver)
|
| return;
|
|
|
| - pDriver->NotifyTargetDestroy(m_pInterface);
|
| + pDriver->NotifyTargetDestroy(this);
|
| }
|
| -CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
|
| - if (pParent == GetInterface())
|
| +
|
| +CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) {
|
| + if (pParent == this)
|
| return CFX_SizeF();
|
|
|
| CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
|
| @@ -951,7 +860,8 @@ CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
|
| }
|
| return szRet;
|
| }
|
| -FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) {
|
| +
|
| +FX_BOOL IFWL_Widget::IsParent(IFWL_Widget* pParent) {
|
| IFWL_Widget* pUpWidget = GetParent();
|
| while (pUpWidget) {
|
| if (pUpWidget == pParent)
|
| @@ -967,15 +877,14 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| if (!pMessage->m_pDstTarget)
|
| return;
|
|
|
| - CFWL_WidgetImp* pWidget =
|
| - static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl());
|
| + IFWL_Widget* pWidget = pMessage->m_pDstTarget;
|
| CFWL_MessageType dwMsgCode = pMessage->GetClassID();
|
| switch (dwMsgCode) {
|
| case CFWL_MessageType::Mouse: {
|
| CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage);
|
| CFWL_EvtMouse evt;
|
| - evt.m_pSrcTarget = pWidget->m_pInterface;
|
| - evt.m_pDstTarget = pWidget->m_pInterface;
|
| + evt.m_pSrcTarget = pWidget;
|
| + evt.m_pDstTarget = pWidget;
|
| evt.m_dwCmd = pMsgMouse->m_dwCmd;
|
| evt.m_dwFlags = pMsgMouse->m_dwFlags;
|
| evt.m_fx = pMsgMouse->m_fx;
|
| @@ -987,8 +896,8 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| CFWL_MsgMouseWheel* pMsgMouseWheel =
|
| static_cast<CFWL_MsgMouseWheel*>(pMessage);
|
| CFWL_EvtMouseWheel evt;
|
| - evt.m_pSrcTarget = pWidget->m_pInterface;
|
| - evt.m_pDstTarget = pWidget->m_pInterface;
|
| + evt.m_pSrcTarget = pWidget;
|
| + evt.m_pDstTarget = pWidget;
|
| evt.m_dwFlags = pMsgMouseWheel->m_dwFlags;
|
| evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX;
|
| evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY;
|
| @@ -1000,8 +909,8 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| case CFWL_MessageType::Key: {
|
| CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
|
| CFWL_EvtKey evt;
|
| - evt.m_pSrcTarget = pWidget->m_pInterface;
|
| - evt.m_pDstTarget = pWidget->m_pInterface;
|
| + evt.m_pSrcTarget = pWidget;
|
| + evt.m_pDstTarget = pWidget;
|
| evt.m_dwKeyCode = pMsgKey->m_dwKeyCode;
|
| evt.m_dwFlags = pMsgKey->m_dwFlags;
|
| evt.m_dwCmd = pMsgKey->m_dwCmd;
|
| @@ -1013,7 +922,7 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| CFWL_EvtSetFocus evt;
|
| evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget;
|
| evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget;
|
| - evt.m_pSetFocus = pWidget->m_pInterface;
|
| + evt.m_pSetFocus = pWidget;
|
| pWidget->DispatchEvent(&evt);
|
| break;
|
| }
|
| @@ -1023,7 +932,7 @@ void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| CFWL_EvtKillFocus evt;
|
| evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget;
|
| evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget;
|
| - evt.m_pKillFocus = pWidget->m_pInterface;
|
| + evt.m_pKillFocus = pWidget;
|
| pWidget->DispatchEvent(&evt);
|
| break;
|
| }
|
|
|