| Index: xfa/fwl/lightwidget/cfwl_widget.cpp
|
| diff --git a/xfa/fwl/lightwidget/widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
|
| similarity index 89%
|
| rename from xfa/fwl/lightwidget/widget.cpp
|
| rename to xfa/fwl/lightwidget/cfwl_widget.cpp
|
| index 294604a01b9bbc4fd25157f24b78f682d4e31fcf..1f4512e3813313ef9c72da511a3fea48aa70182d 100644
|
| --- a/xfa/fwl/lightwidget/widget.cpp
|
| +++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
|
| @@ -4,7 +4,7 @@
|
|
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| -#include "xfa/include/fwl/lightwidget/widget.h"
|
| +#include "xfa/fwl/lightwidget/cfwl_widget.h"
|
|
|
| #include "xfa/fde/tto/fde_textout.h"
|
| #include "xfa/fwl/core/cfwl_themetext.h"
|
| @@ -16,65 +16,60 @@
|
| #include "xfa/fwl/core/ifwl_notethread.h"
|
| #include "xfa/fwl/core/ifwl_themeprovider.h"
|
|
|
| -CFWL_WidgetImpProperties CFWL_WidgetProperties::MakeWidgetImpProperties(
|
| - IFWL_DataProvider* pDataProvider) const {
|
| - CFWL_WidgetImpProperties result;
|
| - result.m_ctmOnParent = m_ctmOnParent;
|
| - result.m_rtWidget = m_rtWidget;
|
| - result.m_dwStyles = m_dwStyles;
|
| - result.m_dwStyleExes = m_dwStyleExes;
|
| - result.m_dwStates = m_dwStates;
|
| - if (m_pParent)
|
| - result.m_pParent = m_pParent->GetWidget();
|
| - if (m_pOwner)
|
| - result.m_pOwner = m_pOwner->GetWidget();
|
| - result.m_pDataProvider = pDataProvider;
|
| - return result;
|
| -}
|
| IFWL_Widget* CFWL_Widget::GetWidget() {
|
| return m_pIface;
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetClassName(wsClass);
|
| }
|
| +
|
| uint32_t CFWL_Widget::GetClassID() const {
|
| if (!m_pIface)
|
| return 0;
|
| return m_pIface->GetClassID();
|
| }
|
| +
|
| FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
|
| if (!m_pIface)
|
| return FALSE;
|
| return m_pIface->IsInstance(wsClass);
|
| }
|
| +
|
| static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
|
| +
|
| FWL_ERR CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetPrivateData(gs_pFWLWidget, this, NULL);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetWidgetRect(rect, bAutoSize);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetGlobalRect(rect);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetWidgetRect(rect);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::GetClientRect(CFX_RectF& rect) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetClientRect(rect);
|
| }
|
| +
|
| CFWL_Widget* CFWL_Widget::GetParent() {
|
| if (!m_pIface)
|
| return NULL;
|
| @@ -84,26 +79,31 @@ CFWL_Widget* CFWL_Widget::GetParent() {
|
| }
|
| return NULL;
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetParent(CFWL_Widget* pParent) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetParent(pParent ? pParent->GetWidget() : NULL);
|
| }
|
| +
|
| CFWL_Widget* CFWL_Widget::GetOwner() {
|
| if (!m_pIface)
|
| return NULL;
|
| return NULL;
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetOwner(CFWL_Widget* pOwner) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return FWL_ERR_Succeeded;
|
| }
|
| +
|
| uint32_t CFWL_Widget::GetStyles() {
|
| if (!m_pIface)
|
| return 0;
|
| return m_pIface->GetStyles();
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded,
|
| uint32_t dwStylesRemoved) {
|
| if (!m_pIface)
|
| @@ -115,20 +115,24 @@ uint32_t CFWL_Widget::GetStylesEx() {
|
| return 0;
|
| return m_pIface->GetStylesEx();
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded,
|
| uint32_t dwStylesExRemoved) {
|
| return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
|
| }
|
| +
|
| uint32_t CFWL_Widget::GetStates() {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetStates();
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetStates(dwStates, bSet);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
|
| void* pData,
|
| PD_CALLBACK_FREEDATA callback) {
|
| @@ -136,31 +140,37 @@ FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetPrivateData(module_id, pData, callback);
|
| }
|
| +
|
| void* CFWL_Widget::GetPrivateData(void* module_id) {
|
| if (!m_pIface)
|
| return NULL;
|
| return m_pIface->GetPrivateData(module_id);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::Update() {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->Update();
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::LockUpdate() {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->LockUpdate();
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::UnlockUpdate() {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->UnlockUpdate();
|
| }
|
| +
|
| uint32_t CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
|
| if (!m_pIface)
|
| return 0;
|
| return m_pIface->HitTest(fx, fy);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
|
| FX_FLOAT& fx,
|
| FX_FLOAT& fy) {
|
| @@ -168,39 +178,46 @@ FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, fx, fy);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, rt);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->GetMatrix(matrix, bGlobal);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->SetMatrix(matrix);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
|
| const CFX_Matrix* pMatrix) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| return m_pIface->DrawWidget(pGraphics, pMatrix);
|
| }
|
| +
|
| IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
|
| if (!m_pIface)
|
| return NULL;
|
| m_pDelegate = m_pIface->SetDelegate(pDelegate);
|
| return m_pDelegate;
|
| }
|
| +
|
| CFWL_Widget::CFWL_Widget()
|
| : m_pIface(NULL), m_pDelegate(NULL), m_pProperties(NULL) {
|
| m_pProperties = new CFWL_WidgetProperties;
|
| m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
|
| FXSYS_assert(m_pWidgetMgr != NULL);
|
| }
|
| +
|
| CFWL_Widget::~CFWL_Widget() {
|
| delete m_pProperties;
|
| if (m_pIface) {
|
| @@ -208,6 +225,7 @@ CFWL_Widget::~CFWL_Widget() {
|
| delete m_pIface;
|
| }
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| @@ -220,6 +238,7 @@ FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
|
| }
|
| return m_pWidgetMgr->RepaintWidget(m_pIface, &rect);
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| @@ -238,6 +257,7 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
|
| }
|
| return FWL_ERR_Succeeded;
|
| }
|
| +
|
| FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
|
| if (!m_pIface)
|
| return FWL_ERR_Indefinite;
|
| @@ -250,6 +270,7 @@ FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
|
| pDriver->SetGrab(m_pIface, bSet);
|
| return FWL_ERR_Succeeded;
|
| }
|
| +
|
| void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
|
| uint32_t dwFilter) {
|
| if (!m_pIface)
|
| @@ -264,6 +285,7 @@ void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
|
| !pEventSource ? NULL : pEventSource->GetWidget();
|
| pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter);
|
| }
|
| +
|
| void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
|
| if (!m_pIface)
|
| return;
|
| @@ -278,9 +300,11 @@ void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
|
| return;
|
| pNoteDriver->SendNote(pEvent);
|
| }
|
| +
|
| #define FWL_WGT_CalcHeight 2048
|
| #define FWL_WGT_CalcWidth 2048
|
| #define FWL_WGT_CalcMultiLineDefWidth 120.0f
|
| +
|
| CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
|
| FX_BOOL bMultiLine,
|
| int32_t iLineWidth) {
|
| @@ -305,15 +329,3 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText,
|
| pTheme->CalcTextRect(&calPart, rect);
|
| return CFX_SizeF(rect.width, rect.height);
|
| }
|
| -CFWL_WidgetDelegate::CFWL_WidgetDelegate() {}
|
| -CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {}
|
| -int32_t CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) {
|
| - return 1;
|
| -}
|
| -FWL_ERR CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
| -FWL_ERR CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| - return FWL_ERR_Succeeded;
|
| -}
|
|
|