summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-10-20 06:44:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-20 06:44:03 -0700
commitfb5055947efd78e0e7f8a2bfd5b754c63dbb6076 (patch)
tree10511c1cb9b341e901a7f619a2bf6c2a74bb7f89 /xfa
parentdadea5f87d35f8a692b659dbff54cc8780d48ef8 (diff)
downloadpdfium-fb5055947efd78e0e7f8a2bfd5b754c63dbb6076.tar.xz
Merge the CFWL_*Imp classes into the IFWL_* classes.
This Cl merges the implementation classes up into the IFWL classes as the intermediate classes were just acting as proxies. Review-Url: https://chromiumcodereview.appspot.com/2432423002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_txtedtdorecord_deleterange.cpp2
-rw-r--r--xfa/fde/cfde_txtedtdorecord_insert.cpp2
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp2
-rw-r--r--xfa/fde/ifde_txtedtengine.h4
-rw-r--r--xfa/fwl/basewidget/fwl_barcodeimp.h60
-rw-r--r--xfa/fwl/basewidget/fwl_checkboximp.h73
-rw-r--r--xfa/fwl/basewidget/fwl_formproxyimp.cpp59
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.h126
-rw-r--r--xfa/fwl/basewidget/fwl_pictureboximp.h59
-rw-r--r--xfa/fwl/basewidget/ifwl_caret.h30
-rw-r--r--xfa/fwl/basewidget/ifwl_combobox.h117
-rw-r--r--xfa/fwl/basewidget/ifwl_datetimepicker.h94
-rw-r--r--xfa/fwl/basewidget/ifwl_edit.h148
-rw-r--r--xfa/fwl/basewidget/ifwl_listbox.h114
-rw-r--r--xfa/fwl/basewidget/ifwl_monthcalendar.h60
-rw-r--r--xfa/fwl/basewidget/ifwl_pushbutton.h48
-rw-r--r--xfa/fwl/basewidget/ifwl_scrollbar.h58
-rw-r--r--xfa/fwl/basewidget/ifwl_spinbutton.h30
-rw-r--r--xfa/fwl/basewidget/ifwl_tooltip.h47
-rw-r--r--xfa/fwl/core/cfwl_message.h1
-rw-r--r--xfa/fwl/core/cfwl_widgetmgr.cpp1
-rw-r--r--xfa/fwl/core/cfx_barcode.cpp (renamed from xfa/fwl/basewidget/cfx_barcode.cpp)2
-rw-r--r--xfa/fwl/core/cfx_barcode.h (renamed from xfa/fwl/basewidget/cfx_barcode.h)6
-rw-r--r--xfa/fwl/core/fwl_formimp.h181
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp64
-rw-r--r--xfa/fwl/core/fwl_noteimp.h20
-rw-r--r--xfa/fwl/core/fwl_widgetimp.h181
-rw-r--r--xfa/fwl/core/ifwl_barcode.cpp (renamed from xfa/fwl/basewidget/fwl_barcodeimp.cpp)69
-rw-r--r--xfa/fwl/core/ifwl_barcode.h (renamed from xfa/fwl/basewidget/ifwl_barcode.h)45
-rw-r--r--xfa/fwl/core/ifwl_caret.cpp (renamed from xfa/fwl/basewidget/fwl_caretimp.cpp)75
-rw-r--r--xfa/fwl/core/ifwl_caret.h (renamed from xfa/fwl/basewidget/fwl_caretimp.h)30
-rw-r--r--xfa/fwl/core/ifwl_checkbox.cpp (renamed from xfa/fwl/basewidget/fwl_checkboximp.cpp)102
-rw-r--r--xfa/fwl/core/ifwl_checkbox.h (renamed from xfa/fwl/basewidget/ifwl_checkbox.h)60
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp (renamed from xfa/fwl/basewidget/fwl_comboboximp.cpp)855
-rw-r--r--xfa/fwl/core/ifwl_combobox.h (renamed from xfa/fwl/basewidget/fwl_comboboximp.h)179
-rw-r--r--xfa/fwl/core/ifwl_comboedit.cpp86
-rw-r--r--xfa/fwl/core/ifwl_comboedit.h44
-rw-r--r--xfa/fwl/core/ifwl_combolist.cpp298
-rw-r--r--xfa/fwl/core/ifwl_combolist.h54
-rw-r--r--xfa/fwl/core/ifwl_datetimecalendar.cpp222
-rw-r--r--xfa/fwl/core/ifwl_datetimecalendar.h47
-rw-r--r--xfa/fwl/core/ifwl_datetimeedit.cpp79
-rw-r--r--xfa/fwl/core/ifwl_datetimeedit.h44
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp (renamed from xfa/fwl/basewidget/fwl_datetimepickerimp.cpp)644
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h (renamed from xfa/fwl/basewidget/fwl_datetimepickerimp.h)182
-rw-r--r--xfa/fwl/core/ifwl_edit.cpp (renamed from xfa/fwl/basewidget/fwl_editimp.cpp)419
-rw-r--r--xfa/fwl/core/ifwl_edit.h (renamed from xfa/fwl/basewidget/fwl_editimp.h)106
-rw-r--r--xfa/fwl/core/ifwl_form.cpp (renamed from xfa/fwl/core/fwl_formimp.cpp)223
-rw-r--r--xfa/fwl/core/ifwl_form.h161
-rw-r--r--xfa/fwl/core/ifwl_formproxy.cpp67
-rw-r--r--xfa/fwl/core/ifwl_formproxy.h (renamed from xfa/fwl/basewidget/fwl_formproxyimp.h)26
-rw-r--r--xfa/fwl/core/ifwl_listbox.cpp (renamed from xfa/fwl/basewidget/fwl_listboximp.cpp)357
-rw-r--r--xfa/fwl/core/ifwl_listbox.h210
-rw-r--r--xfa/fwl/core/ifwl_monthcalendar.cpp (renamed from xfa/fwl/basewidget/fwl_monthcalendarimp.cpp)339
-rw-r--r--xfa/fwl/core/ifwl_monthcalendar.h (renamed from xfa/fwl/basewidget/fwl_monthcalendarimp.h)56
-rw-r--r--xfa/fwl/core/ifwl_picturebox.cpp (renamed from xfa/fwl/basewidget/fwl_pictureboximp.cpp)65
-rw-r--r--xfa/fwl/core/ifwl_picturebox.h (renamed from xfa/fwl/basewidget/ifwl_picturebox.h)48
-rw-r--r--xfa/fwl/core/ifwl_pushbutton.cpp (renamed from xfa/fwl/basewidget/fwl_pushbuttonimp.cpp)101
-rw-r--r--xfa/fwl/core/ifwl_pushbutton.h (renamed from xfa/fwl/basewidget/fwl_pushbuttonimp.h)51
-rw-r--r--xfa/fwl/core/ifwl_scrollbar.cpp (renamed from xfa/fwl/basewidget/fwl_scrollbarimp.cpp)204
-rw-r--r--xfa/fwl/core/ifwl_scrollbar.h (renamed from xfa/fwl/basewidget/fwl_scrollbarimp.h)52
-rw-r--r--xfa/fwl/core/ifwl_spinbutton.cpp (renamed from xfa/fwl/basewidget/fwl_spinbuttonimp.cpp)100
-rw-r--r--xfa/fwl/core/ifwl_spinbutton.h (renamed from xfa/fwl/basewidget/fwl_spinbuttonimp.h)31
-rw-r--r--xfa/fwl/core/ifwl_timer.cpp (renamed from xfa/fwl/core/fwl_timerimp.cpp)0
-rw-r--r--xfa/fwl/core/ifwl_tooltip.cpp (renamed from xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp)110
-rw-r--r--xfa/fwl/core/ifwl_tooltip.h (renamed from xfa/fwl/basewidget/fwl_tooltipctrlimp.h)48
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp (renamed from xfa/fwl/core/fwl_widgetimp.cpp)533
-rw-r--r--xfa/fwl/core/ifwl_widget.h218
-rw-r--r--xfa/fwl/lightwidget/cfwl_barcode.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_checkbox.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_combobox.cpp7
-rw-r--r--xfa/fwl/lightwidget/cfwl_combobox.h6
-rw-r--r--xfa/fwl/lightwidget/cfwl_datetimepicker.cpp2
-rw-r--r--xfa/fwl/lightwidget/cfwl_datetimepicker.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_edit.cpp2
-rw-r--r--xfa/fwl/lightwidget/cfwl_edit.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_listbox.cpp4
-rw-r--r--xfa/fwl/lightwidget/cfwl_listbox.h6
-rw-r--r--xfa/fwl/lightwidget/cfwl_picturebox.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_pushbutton.h2
-rw-r--r--xfa/fwl/lightwidget/cfwl_widget.cpp1
-rw-r--r--xfa/fwl/theme/cfwl_barcodetp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_carettp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_edittp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_pictureboxtp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp2
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp2
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp2
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp2
-rw-r--r--xfa/fxfa/app/xfa_fwltheme.cpp22
96 files changed, 3720 insertions, 4599 deletions
diff --git a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp b/xfa/fde/cfde_txtedtdorecord_deleterange.cpp
index b537ba4082..33384b43ee 100644
--- a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp
+++ b/xfa/fde/cfde_txtedtdorecord_deleterange.cpp
@@ -7,7 +7,7 @@
#include "xfa/fde/cfde_txtedtdorecord_deleterange.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
+#include "xfa/fwl/core/ifwl_edit.h"
CFDE_TxtEdtDoRecord_DeleteRange::CFDE_TxtEdtDoRecord_DeleteRange(
CFDE_TxtEdtEngine* pEngine,
diff --git a/xfa/fde/cfde_txtedtdorecord_insert.cpp b/xfa/fde/cfde_txtedtdorecord_insert.cpp
index 1505d14f95..55cfb95ba4 100644
--- a/xfa/fde/cfde_txtedtdorecord_insert.cpp
+++ b/xfa/fde/cfde_txtedtdorecord_insert.cpp
@@ -7,7 +7,7 @@
#include "xfa/fde/cfde_txtedtdorecord_insert.h"
#include "xfa/fde/cfde_txtedtengine.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
+#include "xfa/fwl/core/ifwl_edit.h"
CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert(
CFDE_TxtEdtEngine* pEngine,
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index 3852fe7f0f..32df561d7e 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -15,7 +15,7 @@
#include "xfa/fde/ifx_chariter.h"
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
+#include "xfa/fwl/core/ifwl_edit.h"
namespace {
diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h
index cb9ec559e3..ff36deaa66 100644
--- a/xfa/fde/ifde_txtedtengine.h
+++ b/xfa/fde/ifde_txtedtengine.h
@@ -11,8 +11,8 @@
#include "xfa/fgas/font/fgas_font.h"
class CFDE_TxtEdtEngine;
-class CFWL_EditImp;
class IFDE_TxtEdtPage;
+class IFWL_Edit;
#define FDE_TEXTEDITMODE_MultiLines (1L << 0)
#define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1)
@@ -102,7 +102,7 @@ struct FDE_TXTEDTPARAMS {
int32_t nLineEnd;
int32_t nHorzScale;
FX_FLOAT fCharSpace;
- CFWL_EditImp* pEventSink;
+ IFWL_Edit* pEventSink;
};
enum FDE_TXTEDT_TEXTCHANGE_TYPE {
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.h b/xfa/fwl/basewidget/fwl_barcodeimp.h
deleted file mode 100644
index 56898bc69e..0000000000
--- a/xfa/fwl/basewidget/fwl_barcodeimp.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_FWL_BARCODEIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_BARCODEIMP_H_
-
-#include <memory>
-
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/ifwl_barcode.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
-
-class CFWL_WidgetImpProperties;
-class CFWL_BarcodeImpDelegate;
-class CFX_Barcode;
-class IFWL_Widget;
-
-#define XFA_BCS_NeedUpdate 0x0001
-#define XFA_BCS_EncodeSuccess 0x0002
-
-class CFWL_BarcodeImp : public CFWL_EditImp {
- public:
- CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_BarcodeImp() override;
-
- // CFWL_WidgetImp
- FWL_Error GetClassName(CFX_WideString& wsClass) const override;
- FWL_Type GetClassID() const override;
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
- FWL_Error Update() override;
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
- FWL_Error SetText(const CFX_WideString& wsText) override;
-
- void SetType(BC_TYPE type);
- FX_BOOL IsProtectedType();
-
- protected:
- friend class CFWL_BarcodeImpDelegate;
-
- void GenerateBarcodeImageCache();
- void CreateBarcodeEngine();
-
- std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
- uint32_t m_dwStatus;
- BC_TYPE m_type;
-};
-
-class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate {
- public:
- explicit CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner);
- void OnProcessEvent(CFWL_Event* pEvent) override;
-};
-
-#endif // XFA_FWL_BASEWIDGET_FWL_BARCODEIMP_H_
diff --git a/xfa/fwl/basewidget/fwl_checkboximp.h b/xfa/fwl/basewidget/fwl_checkboximp.h
deleted file mode 100644
index 5d36ff00f0..0000000000
--- a/xfa/fwl/basewidget/fwl_checkboximp.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_FWL_CHECKBOXIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_
-
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-class CFWL_CheckBoxImpDelegate;
-class CFWL_MsgMouse;
-class CFWL_WidgetImpProperties;
-class IFWL_Widget;
-
-class CFWL_CheckBoxImp : public CFWL_WidgetImp {
- public:
- CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_CheckBoxImp() override;
-
- // CFWL_WidgetImp
- FWL_Error GetClassName(CFX_WideString& wsClass) const override;
- FWL_Type GetClassID() const override;
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
- FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
- FWL_Error Update() override;
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
- int32_t GetCheckState();
- FWL_Error SetCheckState(int32_t iCheck);
-
- protected:
- friend class CFWL_CheckBoxImpDelegate;
-
- void Layout();
- uint32_t GetPartStates();
- void UpdateTextOutStyles();
- void NextStates();
-
- CFX_RectF m_rtClient;
- CFX_RectF m_rtBox;
- CFX_RectF m_rtCaption;
- CFX_RectF m_rtFocus;
- uint32_t m_dwTTOStyles;
- int32_t m_iTTOAlign;
- FX_BOOL m_bBtnDown;
-};
-
-class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate {
- public:
- CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner);
-
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- protected:
- void OnActivate(CFWL_Message* pMsg);
- void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseMove(CFWL_MsgMouse* pMsg);
- void OnMouseLeave(CFWL_MsgMouse* pMsg);
- void OnKeyDown(CFWL_MsgKey* pMsg);
-
- CFWL_CheckBoxImp* m_pOwner;
-};
-
-#endif // XFA_FWL_BASEWIDGET_FWL_CHECKBOXIMP_H_
diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp
deleted file mode 100644
index 0317ae38b2..0000000000
--- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 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/basewidget/fwl_formproxyimp.h"
-
-#include "xfa/fwl/core/fwl_formimp.h"
-#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
-
-CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_FormImp(properties, pOuter) {}
-
-CFWL_FormProxyImp::~CFWL_FormProxyImp() {}
-
-FWL_Error CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const {
- wsClass = FWL_CLASS_FormProxy;
- return FWL_Error::Succeeded;
-}
-
-FWL_Type CFWL_FormProxyImp::GetClassID() const {
- return FWL_Type::FormProxy;
-}
-
-FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const {
- if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) {
- return TRUE;
- }
- return CFWL_FormImp::IsInstance(wsClass);
-}
-FWL_Error CFWL_FormProxyImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
- return FWL_Error::Indefinite;
- m_pDelegate = new CFWL_FormProxyImpDelegate(this);
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_FormProxyImp::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
-}
-FWL_Error CFWL_FormProxyImp::Update() {
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
- return FWL_Error::Succeeded;
-}
-
-CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner)
- : m_pOwner(pOwner) {}
-
-void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
-}
diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h
deleted file mode 100644
index 6a2fcb138e..0000000000
--- a/xfa/fwl/basewidget/fwl_listboximp.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_FWL_LISTBOXIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_
-
-#include <memory>
-
-#include "xfa/fwl/basewidget/ifwl_combobox.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
-#include "xfa/fwl/basewidget/ifwl_listbox.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
-
-class CFWL_ListBoxImpDelegate;
-class CFWL_MsgKillFocus;
-class CFWL_MsgMouse;
-class CFWL_MsgMouseWheel;
-
-class CFWL_ListBoxImp : public CFWL_WidgetImp {
- public:
- CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_ListBoxImp() override;
-
- // CFWL_WidgetImp
- FWL_Error GetClassName(CFX_WideString& wsClass) const override;
- FWL_Type GetClassID() const override;
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
- FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
- FWL_Error Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
- FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
-
- int32_t CountSelItems();
- IFWL_ListItem* GetSelItem(int32_t nIndexSel);
- int32_t GetSelIndex(int32_t nIndex);
- FWL_Error SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect = TRUE);
- FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText);
- FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
- FWL_Error* Sort(IFWL_ListBoxCompare* pCom);
-
- protected:
- friend class CFWL_ListBoxImpDelegate;
-
- IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode);
- void SetSelection(IFWL_ListItem* hStart,
- IFWL_ListItem* hEnd,
- FX_BOOL bSelected);
- void SetSelectionDirect(IFWL_ListItem* hItem, FX_BOOL bSelect);
- FX_BOOL IsItemSelected(IFWL_ListItem* hItem);
- void ClearSelection();
- void SelectAll();
- IFWL_ListItem* GetFocusedItem();
- void SetFocusItem(IFWL_ListItem* hItem);
- IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
- FX_BOOL GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck);
- FX_BOOL SetItemChecked(IFWL_ListItem* hItem, FX_BOOL bChecked);
- FX_BOOL GetItemChecked(IFWL_ListItem* hItem);
- FX_BOOL ScrollToVisible(IFWL_ListItem* hItem);
- void DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawItems(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawItem(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- IFWL_ListItem* hItem,
- int32_t Index,
- const CFX_RectF& rtItem,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
- CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE);
- void GetItemSize(CFX_SizeF& size,
- IFWL_ListItem* hItem,
- FX_FLOAT fWidth,
- FX_FLOAT fHeight,
- FX_BOOL bAutoSize = FALSE);
- FX_FLOAT GetMaxTextWidth();
- FX_FLOAT GetScrollWidth();
- FX_FLOAT GetItemHeigt();
- void InitScrollBar(FX_BOOL bVert = TRUE);
- FX_BOOL IsShowScrollBar(FX_BOOL bVert);
- void ProcessSelChanged();
-
- CFX_RectF m_rtClient;
- CFX_RectF m_rtStatic;
- CFX_RectF m_rtConent;
- std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
- std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
- uint32_t m_dwTTOStyles;
- int32_t m_iTTOAligns;
- IFWL_ListItem* m_hAnchor;
- FX_FLOAT m_fItemHeight;
- FX_FLOAT m_fScorllBarWidth;
- FX_BOOL m_bLButtonDown;
- IFWL_ThemeProvider* m_pScrollBarTP;
-};
-class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate {
- public:
- CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- protected:
- void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
- void OnKeyDown(CFWL_MsgKey* pMsg);
- void OnVK(IFWL_ListItem* hItem, FX_BOOL bShift, FX_BOOL bCtrl);
- FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos);
- void DispatchSelChangedEv();
- CFWL_ListBoxImp* m_pOwner;
-};
-
-#endif // XFA_FWL_BASEWIDGET_FWL_LISTBOXIMP_H_
diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.h b/xfa/fwl/basewidget/fwl_pictureboximp.h
deleted file mode 100644
index eb466c108e..0000000000
--- a/xfa/fwl/basewidget/fwl_pictureboximp.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_FWL_PICTUREBOXIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_PICTUREBOXIMP_H_
-
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-class CFWL_WidgetImpProperties;
-class IFWL_Widget;
-class CFWL_PictureBoxImpDelegate;
-
-class CFWL_PictureBoxImp : public CFWL_WidgetImp {
- public:
- CFWL_PictureBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_PictureBoxImp() override;
-
- // CFWL_WidgetImp
- FWL_Error GetClassName(CFX_WideString& wsClass) const override;
- FWL_Type GetClassID() const override;
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
- FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
- FWL_Error Update() override;
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- protected:
- friend class CFWL_PictureBoxImpDelegate;
-
- void DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
-
- FX_BOOL VStyle(FX_BOOL dwStyle);
- CFX_RectF m_rtClient;
- CFX_RectF m_rtImage;
- CFX_Matrix m_matrix;
- FX_BOOL m_bTop;
- FX_BOOL m_bVCenter;
- FX_BOOL m_bButton;
-};
-
-class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate {
- public:
- CFWL_PictureBoxImpDelegate(CFWL_PictureBoxImp* pOwner);
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- protected:
- CFWL_PictureBoxImp* m_pOwner;
-};
-
-#endif // XFA_FWL_BASEWIDGET_FWL_PICTUREBOXIMP_H_
diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h
deleted file mode 100644
index 53166c2aa6..0000000000
--- a/xfa/fwl/basewidget/ifwl_caret.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_CARET_H_
-#define XFA_FWL_BASEWIDGET_IFWL_CARET_H_
-
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_Caret L"FWL_CARET"
-#define FWL_STATE_CAT_HightLight 1
-
-class IFWL_Caret : public IFWL_Widget {
- public:
- static IFWL_Caret* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- void ShowCaret(FX_BOOL bFlag = TRUE);
- FWL_Error GetFrequency(uint32_t& elapse);
- FWL_Error SetFrequency(uint32_t elapse);
- FWL_Error SetColor(CFX_Color crFill);
-
- protected:
- IFWL_Caret();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_CARET_H_
diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h
deleted file mode 100644
index 1dd0ca0ad3..0000000000
--- a/xfa/fwl/basewidget/ifwl_combobox.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_COMBOBOX_H_
-#define XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_
-
-#include "xfa/fwl/basewidget/ifwl_listbox.h"
-#include "xfa/fxgraphics/cfx_graphics.h"
-
-class CFWL_WidgetImpProperties;
-class IFDE_TxtEdtDoRecord;
-class IFWL_ComboBox;
-
-#define FWL_CLASS_ComboBox L"FWL_COMBOBOX"
-#define FWL_STYLEEXT_CMB_DropList (0L << 0)
-#define FWL_STYLEEXT_CMB_DropDown (1L << 0)
-#define FWL_STYLEEXT_CMB_Sort (1L << 1)
-#define FWL_STYLEEXT_CMB_ListDrag (1L << 2)
-#define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3)
-#define FWL_STYLEEXT_CMB_EditHNear (0L << 4)
-#define FWL_STYLEEXT_CMB_EditHCenter (1L << 4)
-#define FWL_STYLEEXT_CMB_EditHFar (2L << 4)
-#define FWL_STYLEEXT_CMB_EditVNear (0L << 6)
-#define FWL_STYLEEXT_CMB_EditVCenter (1L << 6)
-#define FWL_STYLEEXT_CMB_EditVFar (2L << 6)
-#define FWL_STYLEEXT_CMB_EditJustified (1L << 8)
-#define FWL_STYLEEXT_CMB_EditDistributed (2L << 8)
-#define FWL_STYLEEXT_CMB_EditHAlignMask (3L << 4)
-#define FWL_STYLEEXT_CMB_EditVAlignMask (3L << 6)
-#define FWL_STYLEEXT_CMB_EditHAlignModeMask (3L << 8)
-#define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10)
-#define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10)
-#define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10)
-#define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10)
-#define FWL_STYLEEXT_CMB_ListItemText (0L << 12)
-#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
-#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
-
-FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown)
-
-FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown)
-
-FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp)
-
-FWL_EVENT_DEF(CFWL_EvtCmbEditChanged,
- CFWL_EventType::EditChanged,
- int32_t nChangeType;
- CFX_WideString wsInsert;
- CFX_WideString wsDelete;)
-
-FWL_EVENT_DEF(CFWL_EvtCmbSelChanged,
- CFWL_EventType::SelectChanged,
- CFX_Int32Array iArraySels;
- FX_BOOL bLButtonUp;)
-
-FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged,
- CFWL_EventType::HoverChanged,
- int32_t m_iCurHover;)
-
-FWL_EVENT_DEF(CFWL_EvtCmbDrawItem,
- CFWL_EventType::DrawItem,
- CFX_Graphics* m_pGraphics;
- CFX_Matrix m_matrix;
- int32_t m_index;
- CFX_RectF m_rtItem;)
-
-class IFWL_ComboBoxDP : public IFWL_ListBoxDP {
- public:
- virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0;
-};
-
-class IFWL_ComboBox : public IFWL_Widget {
- public:
- static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties);
-
- int32_t GetCurSel();
- FWL_Error SetCurSel(int32_t iSel);
- FWL_Error SetEditText(const CFX_WideString& wsText);
- int32_t GetEditTextLength() const;
- FWL_Error GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1);
- int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart);
- int32_t GetEditLimit();
- FWL_Error SetEditLimit(int32_t nLimit);
- FWL_Error EditDoClipboard(int32_t iCmd);
- FX_BOOL EditRedo(const IFDE_TxtEdtDoRecord* pRecord);
- FX_BOOL EditUndo(const IFDE_TxtEdtDoRecord* pRecord);
- IFWL_ListBox* GetListBoxt();
- FX_BOOL AfterFocusShowDropList();
- FWL_Error OpenDropDownList(FX_BOOL bActivate);
- FX_BOOL EditCanUndo();
- FX_BOOL EditCanRedo();
- FX_BOOL EditUndo();
- FX_BOOL EditRedo();
- FX_BOOL EditCanCopy();
- FX_BOOL EditCanCut();
- FX_BOOL EditCanSelectAll();
- FX_BOOL EditCopy(CFX_WideString& wsCopy);
- FX_BOOL EditCut(CFX_WideString& wsCut);
- FX_BOOL EditPaste(const CFX_WideString& wsPaste);
- FX_BOOL EditSelectAll();
- FX_BOOL EditDelete();
- FX_BOOL EditDeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
- FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved);
-
- protected:
- IFWL_ComboBox();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_COMBOBOX_H_
diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h
deleted file mode 100644
index 404ba48f14..0000000000
--- a/xfa/fwl/basewidget/ifwl_datetimepicker.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_DATETIMEPICKER_H_
-#define XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_
-
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER"
-#define FWL_STYLEEXT_DTP_AllowEdit (1L << 0)
-#define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1)
-#define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1)
-#define FWL_STYLEEXT_DTP_TimeFormat (2L << 1)
-#define FWL_STYLEEXT_DTP_Spin (1L << 3)
-#define FWL_STYLEEXT_DTP_EditHNear (0L << 4)
-#define FWL_STYLEEXT_DTP_EditHCenter (1L << 4)
-#define FWL_STYLEEXT_DTP_EditHFar (2L << 4)
-#define FWL_STYLEEXT_DTP_EditVNear (0L << 6)
-#define FWL_STYLEEXT_DTP_EditVCenter (1L << 6)
-#define FWL_STYLEEXT_DTP_EditVFar (2L << 6)
-#define FWL_STYLEEXT_DTP_EditJustified (1L << 8)
-#define FWL_STYLEEXT_DTP_EditDistributed (2L << 8)
-#define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4)
-#define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6)
-#define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8)
-
-FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown)
-
-FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp)
-
-FWL_EVENT_DEF(CFWL_Event_DtpEditChanged,
- CFWL_EventType::EditChanged,
- CFX_WideString m_wsText;)
-
-FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged,
- CFWL_EventType::HoverChanged,
- int32_t hoverday;)
-
-FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged,
- CFWL_EventType::SelectChanged,
- int32_t iYear;
- int32_t iMonth;
- int32_t iDay;)
-
-class IFWL_DateTimePickerDP : public IFWL_DataProvider {
- public:
- virtual FWL_Error GetToday(IFWL_Widget* pWidget,
- int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) = 0;
-};
-
-class IFWL_DateTimePicker : public IFWL_Widget {
- public:
- static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay);
- FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay);
- FWL_Error SetEditText(const CFX_WideString& wsText);
- FWL_Error GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- int32_t CountSelRanges();
- int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
- FX_BOOL CanUndo();
- FX_BOOL CanRedo();
- FX_BOOL Undo();
- FX_BOOL Redo();
- FX_BOOL CanCopy();
- FX_BOOL CanCut();
- FX_BOOL CanSelectAll();
- FX_BOOL Copy(CFX_WideString& wsCopy);
- FX_BOOL Cut(CFX_WideString& wsCut);
- FX_BOOL Paste(const CFX_WideString& wsPaste);
- FX_BOOL SelectAll();
- FX_BOOL Delete();
- FX_BOOL DeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
- FWL_Error SetEditLimit(int32_t nLimit);
- FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved);
-
- protected:
- IFWL_DateTimePicker();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_DATETIMEPICKER_H_
diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h
deleted file mode 100644
index ac2ca3110f..0000000000
--- a/xfa/fwl/basewidget/ifwl_edit.h
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_EDIT_H_
-#define XFA_FWL_BASEWIDGET_IFWL_EDIT_H_
-
-#include <vector>
-
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/lightwidget/cfwl_widget.h"
-
-#define FWL_CLASS_Edit L"FWL_EDIT"
-#define FWL_STYLEEXT_EDT_ReadOnly (1L << 0)
-#define FWL_STYLEEXT_EDT_MultiLine (1L << 1)
-#define FWL_STYLEEXT_EDT_WantReturn (1L << 2)
-#define FWL_STYLEEXT_EDT_NoHideSel (1L << 3)
-#define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4)
-#define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5)
-#define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6)
-#define FWL_STYLEEXT_EDT_Validate (1L << 7)
-#define FWL_STYLEEXT_EDT_Password (1L << 8)
-#define FWL_STYLEEXT_EDT_Number (1L << 9)
-#define FWL_STYLEEXT_EDT_HSelfAdaption (1L << 10)
-#define FWL_STYLEEXT_EDT_VSelfAdaption (1L << 11)
-#define FWL_STYLEEXT_EDT_VerticalLayout (1L << 12)
-#define FWL_STYLEEXT_EDT_VerticalChars (1L << 13)
-#define FWL_STYLEEXT_EDT_ReverseLine (1L << 14)
-#define FWL_STYLEEXT_EDT_ArabicShapes (1L << 15)
-#define FWL_STYLEEXT_EDT_ExpandTab (1L << 16)
-#define FWL_STYLEEXT_EDT_CombText (1L << 17)
-#define FWL_STYLEEXT_EDT_HNear (0L << 18)
-#define FWL_STYLEEXT_EDT_HCenter (1L << 18)
-#define FWL_STYLEEXT_EDT_HFar (2L << 18)
-#define FWL_STYLEEXT_EDT_VNear (0L << 20)
-#define FWL_STYLEEXT_EDT_VCenter (1L << 20)
-#define FWL_STYLEEXT_EDT_VFar (2L << 20)
-#define FWL_STYLEEXT_EDT_Justified (1L << 22)
-#define FWL_STYLEEXT_EDT_Distributed (2L << 22)
-#define FWL_STYLEEXT_EDT_HAlignMask (3L << 18)
-#define FWL_STYLEEXT_EDT_VAlignMask (3L << 20)
-#define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22)
-#define FWL_STYLEEXT_EDT_InnerCaret (1L << 24)
-#define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25)
-#define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
-#define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
-
-enum FWL_EDT_TEXTCHANGED {
- FWL_EDT_TEXTCHANGED_Insert = 0,
- FWL_EDT_TEXTCHANGED_Delete,
- FWL_EDT_TEXTCHANGED_Replace,
-};
-
-FWL_EVENT_DEF(CFWL_EvtEdtTextChanged,
- CFWL_EventType::TextChanged,
- int32_t nChangeType;
- CFX_WideString wsInsert;
- CFX_WideString wsDelete;
- CFX_WideString wsPrevText;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull)
-
-FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption,
- CFWL_EventType::PreSelfAdaption,
- FX_BOOL bHSelfAdaption;
- FX_BOOL bVSelfAdaption;
- CFX_RectF rtAfterChange;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtValidate,
- CFWL_EventType::Validate,
- IFWL_Widget* pDstWidget;
- CFX_WideString wsInsert;
- FX_BOOL bValidate;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtCheckWord,
- CFWL_EventType::CheckWord,
- CFX_ByteString bsWord;
- FX_BOOL bCheckWord;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords,
- CFWL_EventType::GetSuggestedWords,
- FX_BOOL bSuggestWords;
- CFX_ByteString bsWord;
- std::vector<CFX_ByteString> bsArraySuggestWords;)
-
-class CFWL_WidgetImpProperties;
-class IFDE_TxtEdtDoRecord;
-
-class IFWL_EditDP : public IFWL_DataProvider {};
-
-class IFWL_Edit : public IFWL_Widget {
- public:
- static IFWL_Edit* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- static IFWL_Edit* CreateComboEdit(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- FWL_Error SetText(const CFX_WideString& wsText);
- int32_t GetTextLength() const;
- FWL_Error GetText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- FWL_Error ClearText();
- int32_t GetCaretPos() const;
- int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE);
- FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1);
- int32_t CountSelRanges();
- int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
- FWL_Error ClearSelections();
- int32_t GetLimit();
- FWL_Error SetLimit(int32_t nLimit);
- FWL_Error SetAliasChar(FX_WCHAR wAlias);
- FWL_Error Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen);
- FWL_Error DeleteSelections();
- FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1);
- FWL_Error Replace(int32_t nStart,
- int32_t nLen,
- const CFX_WideStringC& wsReplace);
- FWL_Error DoClipboard(int32_t iCmd);
- FX_BOOL Copy(CFX_WideString& wsCopy);
- FX_BOOL Cut(CFX_WideString& wsCut);
- FX_BOOL Paste(const CFX_WideString& wsPaste);
- FX_BOOL Delete();
- FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord);
- FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord);
- FX_BOOL Undo();
- FX_BOOL Redo();
- FX_BOOL CanUndo();
- FX_BOOL CanRedo();
- FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant);
- FWL_Error SetOuter(IFWL_Widget* pOuter);
- FWL_Error SetNumberRange(int32_t iMin, int32_t iMax);
- FWL_Error SetBackColor(uint32_t dwColor);
- FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize);
- void SetScrollOffset(FX_FLOAT fScrollOffset);
- FX_BOOL GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest);
- FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace);
-
- protected:
- IFWL_Edit();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_EDIT_H_
diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h
deleted file mode 100644
index fde6a88978..0000000000
--- a/xfa/fwl/basewidget/ifwl_listbox.h
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_LISTBOX_H_
-#define XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_
-
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_ListBox L"FWL_LISTBOX"
-#define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
-#define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2)
-#define FWL_STYLEEXT_LTB_MultiColumn (1L << 3)
-#define FWL_STYLEEXT_LTB_LeftAlign (0L << 4)
-#define FWL_STYLEEXT_LTB_CenterAlign (1L << 4)
-#define FWL_STYLEEXT_LTB_RightAlign (2L << 4)
-#define FWL_STYLEEXT_LTB_MultiLine (1L << 6)
-#define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7)
-#define FWL_STYLEEXT_LTB_Icon (1L << 8)
-#define FWL_STYLEEXT_LTB_Check (1L << 9)
-#define FWL_STYLEEXT_LTB_AlignMask (3L << 4)
-#define FWL_STYLEEXT_LTB_ShowScrollBarFocus (1L << 10)
-#define FWL_ITEMSTATE_LTB_Selected (1L << 0)
-#define FWL_ITEMSTATE_LTB_Focused (1L << 1)
-#define FWL_ITEMSTATE_LTB_Checked (1L << 2)
-
-class CFX_DIBitmap;
-
-FWL_EVENT_DEF(CFWL_EvtLtbSelChanged,
- CFWL_EventType::SelectChanged,
- CFX_Int32Array iarraySels;)
-
-FWL_EVENT_DEF(CFWL_EvtLtbDrawItem,
- CFWL_EventType::DrawItem,
- CFX_Graphics* m_pGraphics;
- CFX_Matrix m_matrix;
- int32_t m_index;
- CFX_RectF m_rect;)
-
-class IFWL_ListItem {};
-
-class IFWL_ListBoxDP : public IFWL_DataProvider {
- public:
- virtual int32_t CountItems(IFWL_Widget* pWidget) = 0;
- virtual IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) = 0;
- virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0;
- virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- int32_t nIndex) = 0;
- virtual uint32_t GetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) = 0;
- virtual FWL_Error GetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_WideString& wsText) = 0;
- virtual FWL_Error GetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtItem) = 0;
- virtual void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0;
- virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwStyle) = 0;
- virtual FWL_Error SetItemText(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const FX_WCHAR* pszText) = 0;
- virtual FWL_Error SetItemRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtItem) = 0;
- virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0;
- virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) = 0;
- virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) = 0;
- virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- const CFX_RectF& rtCheck) = 0;
- virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem) = 0;
- virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
- IFWL_ListItem* pItem,
- uint32_t dwCheckState) = 0;
-};
-
-class IFWL_ListBoxCompare {
- public:
- virtual ~IFWL_ListBoxCompare() {}
- virtual int32_t Compare(IFWL_ListItem* hLeft, IFWL_ListItem* hRight) = 0;
-};
-
-class IFWL_ListBox : public IFWL_Widget {
- public:
- static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- static IFWL_ListBox* CreateComboList(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- int32_t CountSelItems();
- IFWL_ListItem* GetSelItem(int32_t nIndexSel);
- int32_t GetSelIndex(int32_t nIndex);
- FWL_Error SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect = TRUE);
- FWL_Error GetItemText(IFWL_ListItem* pItem, CFX_WideString& wsText);
- FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
-
- protected:
- IFWL_ListBox();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_LISTBOX_H_
diff --git a/xfa/fwl/basewidget/ifwl_monthcalendar.h b/xfa/fwl/basewidget/ifwl_monthcalendar.h
deleted file mode 100644
index 1ddebe977d..0000000000
--- a/xfa/fwl/basewidget/ifwl_monthcalendar.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_MONTHCALENDAR_H_
-#define XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_
-
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR"
-#define FWL_STYLEEXT_MCD_MultiSelect (1L << 0)
-#define FWL_STYLEEXT_MCD_NoToday (1L << 1)
-#define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2)
-#define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3)
-#define FWL_ITEMSTATE_MCD_Nomal (0L << 0)
-#define FWL_ITEMSTATE_MCD_Flag (1L << 0)
-#define FWL_ITEMSTATE_MCD_Selected (1L << 1)
-#define FWL_ITEMSTATE_MCD_Focused (1L << 2)
-
-FWL_EVENT_DEF(CFWL_Event_McdDateSelected,
- CFWL_EventType::DataSelected,
- int32_t m_iStartDay;
- int32_t m_iEndDay;)
-
-FWL_EVENT_DEF(CFWL_EventMcdDateChanged,
- CFWL_EventType::DateChanged,
- int32_t m_iOldYear;
- int32_t m_iOldMonth;
- int32_t m_iStartDay;
- int32_t m_iEndDay;)
-
-class IFWL_MonthCalendarDP : public IFWL_DataProvider {
- public:
- virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0;
- virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0;
- virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0;
-};
-
-class IFWL_MonthCalendar : public IFWL_Widget {
- public:
- static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- int32_t CountSelect();
- FX_BOOL GetSelect(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay,
- int32_t nIndex = 0);
- FX_BOOL SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay);
-
- protected:
- IFWL_MonthCalendar();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_MONTHCALENDAR_H_
diff --git a/xfa/fwl/basewidget/ifwl_pushbutton.h b/xfa/fwl/basewidget/ifwl_pushbutton.h
deleted file mode 100644
index bbac4811ac..0000000000
--- a/xfa/fwl/basewidget/ifwl_pushbutton.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_PUSHBUTTON_H_
-#define XFA_FWL_BASEWIDGET_IFWL_PUSHBUTTON_H_
-
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_PushButton L"FWL_PUSHBUTTON"
-#define FWL_STYLEEXT_PSB_Left (0L << 0)
-#define FWL_STYLEEXT_PSB_Center (1L << 0)
-#define FWL_STYLEEXT_PSB_Right (2L << 0)
-#define FWL_STYLEEXT_PSB_Top (0L << 2)
-#define FWL_STYLEEXT_PSB_VCenter (1L << 2)
-#define FWL_STYLEEXT_PSB_Bottom (2L << 2)
-#define FWL_STYLEEXT_PSB_TextOnly (0L << 4)
-#define FWL_STYLEEXT_PSB_IconOnly (1L << 4)
-#define FWL_STYLEEXT_PSB_TextIcon (2L << 4)
-#define FWL_STYLEEXT_PSB_HLayoutMask (3L << 0)
-#define FWL_STYLEEXT_PSB_VLayoutMask (3L << 2)
-#define FWL_STYLEEXT_PSB_ModeMask (3L << 4)
-#define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX)
-#define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1))
-#define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2))
-
-class CFX_DIBitmap;
-
-class IFWL_PushButtonDP : public IFWL_DataProvider {
- public:
- virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0;
-};
-
-class IFWL_PushButton : public IFWL_Widget {
- public:
- static IFWL_PushButton* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- protected:
- IFWL_PushButton();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_PUSHBUTTON_H_
diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h
deleted file mode 100644
index 33477acce6..0000000000
--- a/xfa/fwl/basewidget/ifwl_scrollbar.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_SCROLLBAR_H_
-#define XFA_FWL_BASEWIDGET_IFWL_SCROLLBAR_H_
-
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
-#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_dataprovider.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-
-#define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR"
-#define FWL_STYLEEXT_SCB_Horz (0L << 0)
-#define FWL_STYLEEXT_SCB_Vert (1L << 0)
-
-enum FWL_SCBCODE {
- FWL_SCBCODE_None = 1,
- FWL_SCBCODE_Min,
- FWL_SCBCODE_Max,
- FWL_SCBCODE_PageBackward,
- FWL_SCBCODE_PageForward,
- FWL_SCBCODE_StepBackward,
- FWL_SCBCODE_StepForward,
- FWL_SCBCODE_Pos,
- FWL_SCBCODE_TrackPos,
- FWL_SCBCODE_EndScroll,
-};
-
-class IFWL_ScrollBarDP : public IFWL_DataProvider {};
-
-class IFWL_ScrollBar : public IFWL_Widget {
- public:
- static IFWL_ScrollBar* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- FX_BOOL IsVertical();
- FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax);
- FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax);
- FX_FLOAT GetPageSize();
- FWL_Error SetPageSize(FX_FLOAT fPageSize);
- FX_FLOAT GetStepSize();
- FWL_Error SetStepSize(FX_FLOAT fStepSize);
- FX_FLOAT GetPos();
- FWL_Error SetPos(FX_FLOAT fPos);
- FX_FLOAT GetTrackPos();
- FWL_Error SetTrackPos(FX_FLOAT fTrackPos);
- FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f);
-
- protected:
- IFWL_ScrollBar();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_SCROLLBAR_H_
diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h
deleted file mode 100644
index 93e2712094..0000000000
--- a/xfa/fwl/basewidget/ifwl_spinbutton.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_SPINBUTTON_H_
-#define XFA_FWL_BASEWIDGET_IFWL_SPINBUTTON_H_
-
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fxfa/cxfa_eventparam.h"
-
-#define FWL_CLASS_SpinButton L"FWL_SPINBUTTON"
-#define FWL_STYLEEXE_SPB_Vert (1L << 0)
-
-FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;)
-
-class IFWL_SpinButton : public IFWL_Widget {
- public:
- static IFWL_SpinButton* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE);
- FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE);
-
- protected:
- IFWL_SpinButton();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_SPINBUTTON_H_
diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h
deleted file mode 100644
index db048d3ff6..0000000000
--- a/xfa/fwl/basewidget/ifwl_tooltip.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 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_BASEWIDGET_IFWL_TOOLTIP_H_
-#define XFA_FWL_BASEWIDGET_IFWL_TOOLTIP_H_
-
-#include "xfa/fwl/core/ifwl_form.h"
-
-class CFWL_WidgetImpProperties;
-class IFWL_ToolTip;
-
-#define FWL_CLASS_ToolTip L"FWL_TOOLTIP"
-#define FWL_STYLEEXT_TTP_Rectangle (0L << 3)
-#define FWL_STYLEEXT_TTP_RoundCorner (1L << 3)
-#define FWL_STYLEEXT_TTP_Balloon (1L << 4)
-#define FWL_STYLEEXT_TTP_Multiline (1L << 5)
-#define FWL_STYLEEXT_TTP_NoAnchor (1L << 6)
-
-class IFWL_ToolTipDP : public IFWL_DataProvider {
- public:
- // IFWL_DataProvider
- FWL_Error GetCaption(IFWL_Widget* pWidget,
- CFX_WideString& wsCaption) override = 0;
-
- virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0;
- virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0;
- virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0;
- virtual CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) = 0;
-};
-
-class IFWL_ToolTip : public IFWL_Form {
- public:
- static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- void SetAnchor(const CFX_RectF& rtAnchor);
- void Show();
- void Hide();
-
- protected:
- IFWL_ToolTip();
-};
-
-#endif // XFA_FWL_BASEWIDGET_IFWL_TOOLTIP_H_
diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h
index 6089fdcf4f..2bffff0007 100644
--- a/xfa/fwl/core/cfwl_message.h
+++ b/xfa/fwl/core/cfwl_message.h
@@ -7,6 +7,7 @@
#ifndef XFA_FWL_CORE_CFWL_MESSAGE_H_
#define XFA_FWL_CORE_CFWL_MESSAGE_H_
+#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fwl/core/fwl_error.h"
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index 30571c9aed..e7f8b3819c 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -8,7 +8,6 @@
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_form.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
diff --git a/xfa/fwl/basewidget/cfx_barcode.cpp b/xfa/fwl/core/cfx_barcode.cpp
index cb554f5c5b..549f908229 100644
--- a/xfa/fwl/basewidget/cfx_barcode.cpp
+++ b/xfa/fwl/core/cfx_barcode.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/cfx_barcode.h"
+#include "xfa/fwl/core/cfx_barcode.h"
#include "xfa/fxbarcode/cbc_codabar.h"
#include "xfa/fxbarcode/cbc_code128.h"
diff --git a/xfa/fwl/basewidget/cfx_barcode.h b/xfa/fwl/core/cfx_barcode.h
index fee0885654..389ff52042 100644
--- a/xfa/fwl/basewidget/cfx_barcode.h
+++ b/xfa/fwl/core/cfx_barcode.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_CFX_BARCODE_H_
-#define XFA_FWL_BASEWIDGET_CFX_BARCODE_H_
+#ifndef XFA_FWL_CORE_CFX_BARCODE_H_
+#define XFA_FWL_CORE_CFX_BARCODE_H_
#include <memory>
@@ -57,4 +57,4 @@ class CFX_Barcode {
std::unique_ptr<CBC_CodeBase> m_pBCEngine;
};
-#endif // XFA_FWL_BASEWIDGET_CFX_BARCODE_H_
+#endif // XFA_FWL_CORE_CFX_BARCODE_H_
diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h
deleted file mode 100644
index c88b5e683b..0000000000
--- a/xfa/fwl/core/fwl_formimp.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2014 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_FWL_FORMIMP_H_
-#define XFA_FWL_CORE_FWL_FORMIMP_H_
-
-#include <memory>
-
-#include "xfa/fwl/core/fwl_widgetimp.h"
-#include "xfa/fwl/core/ifwl_form.h"
-
-class CFWL_MsgMouse;
-class CFWL_MsgClose;
-class CFWL_MsgWindowMove;
-class CFWL_NoteLoop;
-class CFWL_WidgetImpProperties;
-class IFWL_Widget;
-class IFWL_ThemeProvider;
-class CFWL_SysBtn;
-class CFWL_FormImp;
-class CFWL_FormImpDelegate;
-
-#define FWL_SYSBUTTONSTATE_Hover 0x0001
-#define FWL_SYSBUTTONSTATE_Pressed 0x0002
-#define FWL_SYSBUTTONSTATE_Disabled 0x0010
-
-class CFWL_SysBtn {
- public:
- CFWL_SysBtn();
-
- bool IsDisabled() const;
- uint32_t GetPartState() const;
-
- void SetNormal();
- void SetPressed();
- void SetHover();
- void SetDisabled(FX_BOOL bDisabled);
-
- CFX_RectF m_rtBtn;
- uint32_t m_dwState;
-};
-
-enum FORM_RESIZETYPE {
- FORM_RESIZETYPE_None = 0,
- FORM_RESIZETYPE_Cap,
-};
-
-typedef struct RestoreResizeInfo {
- RestoreResizeInfo();
- ~RestoreResizeInfo();
-
- CFX_PointF m_ptStart;
- CFX_SizeF m_szStart;
-} RestoreInfo;
-
-class CFWL_FormImp : public CFWL_WidgetImp {
- public:
- CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
- ~CFWL_FormImp() override;
-
- // CFWL_WidgetImp
- FWL_Error GetClassName(CFX_WideString& wsClass) const override;
- FWL_Type GetClassID() const override;
- FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override;
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
-
- FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
- FWL_Error GetClientRect(CFX_RectF& rect) override;
- FWL_Error Update() override;
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- FWL_FORMSIZE GetFormSize();
- FWL_Error SetFormSize(FWL_FORMSIZE eFormSize);
- IFWL_Widget* DoModal();
- IFWL_Widget* DoModal(uint32_t& dwCommandID);
- FWL_Error EndDoModal();
- FWL_Error SetBorderRegion(CFX_Path* pPath);
- void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
- CFWL_WidgetImp* GetSubFocus();
- void SetSubFocus(CFWL_WidgetImp* pWidget);
-
- protected:
- void ShowChildWidget(IFWL_Widget* pParent);
- void RemoveSysButtons();
- void CalcContentRect(CFX_RectF& rtContent);
- CFWL_SysBtn* GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy);
- CFWL_SysBtn* GetSysBtnByState(uint32_t dwState);
- CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex);
- int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn);
- FX_FLOAT GetCaptionHeight();
- void DrawCaptionText(CFX_Graphics* pGs,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawIconImage(CFX_Graphics* pGs,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void GetEdgeRect(CFX_RectF& rtEdge);
- void SetWorkAreaRect();
- void SetCursor(FX_FLOAT fx, FX_FLOAT fy);
- void Layout();
- void ReSetSysBtn();
- void RegisterForm();
- void UnRegisterForm();
- FX_BOOL IsDoModal();
- void SetThemeData();
- FX_BOOL HasIcon();
- void UpdateIcon();
- void UpdateCaption();
- void DoWidthLimit(FX_FLOAT& fLeft,
- FX_FLOAT& fWidth,
- FX_FLOAT fCurX,
- FX_FLOAT fSpace,
- FX_FLOAT fLimitMin,
- FX_FLOAT fLimitMax,
- FX_BOOL bLeft);
- void DoHeightLimit(FX_FLOAT& fTop,
- FX_FLOAT& fHeight,
- FX_FLOAT fCurY,
- FX_FLOAT fSpace,
- FX_FLOAT fLimitMin,
- FX_FLOAT fLimitMax,
- FX_BOOL bTop);
-
- CFX_RectF m_rtRestore;
- CFX_RectF m_rtCaptionText;
- CFX_RectF m_rtRelative;
- CFX_RectF m_rtCaption;
- CFX_RectF m_rtIcon;
- CFWL_SysBtn* m_pCloseBox;
- CFWL_SysBtn* m_pMinBox;
- CFWL_SysBtn* m_pMaxBox;
- CFWL_SysBtn* m_pCaptionBox;
- std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
- CFWL_WidgetImp* m_pSubFocus;
- RestoreInfo m_InfoStart;
- FX_FLOAT m_fCXBorder;
- FX_FLOAT m_fCYBorder;
- int32_t m_iCaptureBtn;
- int32_t m_iSysBox;
- int32_t m_eResizeType;
- FX_BOOL m_bLButtonDown;
- bool m_bMaximized;
- FX_BOOL m_bSetMaximize;
- FX_BOOL m_bCustomizeLayout;
- FWL_FORMSIZE m_eFormSize;
- FX_BOOL m_bDoModalFlag;
- FX_FLOAT m_fSmallIconSz;
- FX_FLOAT m_fBigIconSz;
- CFX_DIBitmap* m_pBigIcon;
- CFX_DIBitmap* m_pSmallIcon;
- FX_BOOL m_bMouseIn;
- friend class CFWL_FormImpDelegate;
-};
-
-class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate {
- public:
- CFWL_FormImpDelegate(CFWL_FormImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-
- protected:
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseMove(CFWL_MsgMouse* pMsg);
- void OnMouseHover(CFWL_MsgMouse* pMsg);
- void OnMouseLeave(CFWL_MsgMouse* pMsg);
- void OnLButtonDblClk(CFWL_MsgMouse* pMsg);
- void OnWindowMove(CFWL_MsgWindowMove* pMsg);
- void OnClose(CFWL_MsgClose* pMsg);
- CFWL_FormImp* m_pOwner;
-};
-
-#endif // XFA_FWL_CORE_FWL_FORMIMP_H_
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 848cb772ba..f0474bda04 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -8,15 +8,12 @@
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h"
-#include "xfa/fwl/basewidget/ifwl_tooltip.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
-#include "xfa/fwl/core/fwl_formimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_tooltip.h"
-CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm)
+CFWL_NoteLoop::CFWL_NoteLoop(IFWL_Widget* pForm)
: m_pForm(pForm), m_bContinueModal(TRUE) {}
FWL_Error CFWL_NoteLoop::Idle(int32_t count) {
@@ -36,7 +33,7 @@ FWL_Error CFWL_NoteLoop::Idle(int32_t count) {
#endif
return FWL_Error::Indefinite;
}
-CFWL_WidgetImp* CFWL_NoteLoop::GetForm() {
+IFWL_Widget* CFWL_NoteLoop::GetForm() {
return m_pForm;
}
FX_BOOL CFWL_NoteLoop::ContinueModal() {
@@ -47,7 +44,7 @@ FWL_Error CFWL_NoteLoop::EndModalLoop() {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) {
+FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) {
m_pForm = pForm;
return FWL_Error::Succeeded;
}
@@ -155,13 +152,10 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
if (pFocus) {
IFWL_Widget* pWidget =
CFWL_WidgetMgr::GetInstance()->GetSystemFormWidget(pFocus);
- CFWL_FormImp* pForm =
- pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
- if (pForm) {
- CFWL_WidgetImp* pNewFocus =
- static_cast<CFWL_WidgetImp*>(pFocus->GetImpl());
- pForm->SetSubFocus(pNewFocus);
- }
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
+ if (pForm)
+ pForm->SetSubFocus(pFocus);
+
CFWL_MsgSetFocus ms;
ms.m_pDstTarget = pFocus;
if (bNotify) {
@@ -230,20 +224,20 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) {
UnregisterEventTarget(pNoteTarget);
int32_t count = m_forms.GetSize();
for (int32_t nIndex = 0; nIndex < count; nIndex++) {
- CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[nIndex]);
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[nIndex]);
if (!pForm) {
continue;
}
- CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
+ IFWL_Widget* pSubFocus = pForm->GetSubFocus();
if (!pSubFocus)
return;
- if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) {
+ if (pSubFocus == pNoteTarget) {
pForm->SetSubFocus(nullptr);
}
}
}
-FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) {
+FWL_Error CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) {
if (!pForm)
return FWL_Error::Indefinite;
if (m_forms.Find(pForm) >= 0) {
@@ -259,7 +253,7 @@ FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) {
+FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) {
if (!pForm)
return FWL_Error::Indefinite;
int32_t nIndex = m_forms.Find(pForm);
@@ -424,12 +418,11 @@ FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
return TRUE;
}
IFWL_Widget* pWidget = pMsg->m_pDstTarget;
- CFWL_FormImp* pForm =
- pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
- if (pForm) {
- CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
+ if (pWidget) {
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(pWidget);
+ IFWL_Widget* pSubFocus = pForm->GetSubFocus();
if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
- pMsg->m_pDstTarget = pSubFocus->GetInterface();
+ pMsg->m_pDstTarget = pSubFocus;
if (m_pFocus != pMsg->m_pDstTarget) {
m_pFocus = pMsg->m_pDstTarget;
return TRUE;
@@ -447,13 +440,11 @@ FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
}
return TRUE;
}
- IFWL_Widget* pWidget = pMsg->m_pDstTarget;
- CFWL_FormImp* pForm =
- pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(pMsg->m_pDstTarget);
if (pForm) {
- CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
+ IFWL_Widget* pSubFocus = pForm->GetSubFocus();
if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
- pMsg->m_pDstTarget = pSubFocus->GetInterface();
+ pMsg->m_pDstTarget = pSubFocus;
if (m_pFocus == pMsg->m_pDstTarget) {
m_pFocus = nullptr;
return TRUE;
@@ -606,14 +597,14 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
int32_t iCount = m_noteLoopQueue.GetSize();
for (int32_t i = 0; i < iCount; i++) {
CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]);
- CFWL_WidgetImp* pForm = pNoteLoop->GetForm();
- if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget))
+ IFWL_Widget* pForm = pNoteLoop->GetForm();
+ if (pForm && (pForm == pMessage->m_pDstTarget))
return TRUE;
}
iCount = m_forms.GetSize();
for (int32_t j = 0; j < iCount; j++) {
- CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]);
- if (pForm->GetInterface() == pMessage->m_pDstTarget)
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(m_forms[j]);
+ if (pForm == pMessage->m_pDstTarget)
return TRUE;
}
return FALSE;
@@ -627,8 +618,8 @@ IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
if (iTrackLoop > 1) {
CFWL_NoteLoop* pNootLoop =
static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
- pMessageForm = pNootLoop->GetForm()->GetInterface();
- } else if (m_forms.Find(pDstTarget->GetImpl()) < 0) {
+ pMessageForm = pNootLoop->GetForm();
+ } else if (m_forms.Find(pDstTarget) < 0) {
pMessageForm = pDstTarget;
}
if (!pMessageForm && pDstTarget) {
@@ -777,8 +768,7 @@ CFWL_ToolTipContainer::CFWL_ToolTipContainer()
CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
if (m_pToolTipImp) {
- IFWL_ToolTip* pToolTip =
- static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface());
+ IFWL_ToolTip* pToolTip = static_cast<IFWL_ToolTip*>(m_pToolTipImp);
pToolTip->Finalize();
delete pToolTip;
}
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index 23b3c991ab..6e587166c0 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -29,24 +29,24 @@ class CFWL_MsgSetFocus;
class CFWL_MsgSize;
class CFWL_MsgWindowMove;
class CFWL_TargetImp;
-class CFWL_ToolTipImp;
-class CFWL_WidgetImp;
+class IFWL_ToolTip;
+class IFWL_Widget;
class CFWL_NoteLoop {
public:
- CFWL_NoteLoop(CFWL_WidgetImp* pForm = nullptr);
+ CFWL_NoteLoop(IFWL_Widget* pForm = nullptr);
~CFWL_NoteLoop() {}
FWL_Error Idle(int32_t count);
- CFWL_WidgetImp* GetForm();
+ IFWL_Widget* GetForm();
FX_BOOL ContinueModal();
FWL_Error EndModalLoop();
- FWL_Error SetMainForm(CFWL_WidgetImp* pForm);
+ FWL_Error SetMainForm(IFWL_Widget* pForm);
protected:
void GenerateCommondEvent(uint32_t dwCommand);
- CFWL_WidgetImp* m_pForm;
+ IFWL_Widget* m_pForm;
FX_BOOL m_bContinueModal;
};
@@ -73,8 +73,8 @@ class CFWL_NoteDriver {
void SetHover(IFWL_Widget* pHover);
void NotifyTargetHide(IFWL_Widget* pNoteTarget);
void NotifyTargetDestroy(IFWL_Widget* pNoteTarget);
- FWL_Error RegisterForm(CFWL_WidgetImp* pForm);
- FWL_Error UnRegisterForm(CFWL_WidgetImp* pForm);
+ FWL_Error RegisterForm(IFWL_Widget* pForm);
+ FWL_Error UnRegisterForm(IFWL_Widget* pForm);
FX_BOOL QueueMessage(CFWL_Message* pMessage);
FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop);
CFWL_NoteLoop* GetTopLoop();
@@ -99,7 +99,7 @@ class CFWL_NoteDriver {
IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
void ClearInvalidEventTargets(FX_BOOL bRemoveAll);
- CFX_ArrayTemplate<CFWL_WidgetImp*> m_forms;
+ CFX_ArrayTemplate<IFWL_Widget*> m_forms;
CFX_ArrayTemplate<CFWL_Message*> m_noteQueue;
CFX_ArrayTemplate<CFWL_NoteLoop*> m_noteLoopQueue;
std::unordered_map<uint32_t, CFWL_EventTarget*> m_eventTargets;
@@ -137,7 +137,7 @@ class CFWL_ToolTipContainer final {
CFWL_ToolTipContainer();
~CFWL_ToolTipContainer();
- CFWL_ToolTipImp* m_pToolTipImp;
+ IFWL_ToolTip* m_pToolTipImp;
std::unique_ptr<CFWL_CoreToolTipDP> m_pToolTipDp;
private:
diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h
deleted file mode 100644
index 10f7880ba3..0000000000
--- a/xfa/fwl/core/fwl_widgetimp.h
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2014 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_FWL_WIDGETIMP_H_
-#define XFA_FWL_CORE_FWL_WIDGETIMP_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_coordinates.h"
-#include "core/fxcrt/fx_system.h"
-#include "xfa/fwl/core/cfwl_event.h"
-#include "xfa/fwl/core/cfwl_themepart.h"
-#include "xfa/fwl/core/fwl_widgethit.h"
-#include "xfa/fwl/core/ifwl_widgetdelegate.h"
-#include "xfa/fwl/theme/cfwl_widgettp.h"
-
-class CFWL_AppImp;
-class CFWL_MsgKey;
-class CFWL_WidgetImpProperties;
-class CFWL_WidgetMgr;
-class IFWL_App;
-class IFWL_DataProvider;
-class IFWL_ThemeProvider;
-class IFWL_Widget;
-enum class FWL_Type;
-
-class CFWL_WidgetImp {
- public:
- virtual ~CFWL_WidgetImp();
-
- virtual FWL_Error Initialize();
- virtual FWL_Error Finalize();
- virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
- virtual FWL_Type GetClassID() const = 0;
- virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
-
- virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
- virtual FWL_Error GetGlobalRect(CFX_RectF& rect);
- virtual FWL_Error SetWidgetRect(const CFX_RectF& rect);
- virtual FWL_Error GetClientRect(CFX_RectF& rect);
- virtual IFWL_Widget* GetParent();
- virtual FWL_Error SetParent(IFWL_Widget* pParent);
- virtual IFWL_Widget* GetOwner();
- virtual FWL_Error SetOwner(IFWL_Widget* pOwner);
- virtual IFWL_Widget* GetOuter();
- virtual uint32_t GetStyles();
- virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded,
- uint32_t dwStylesRemoved);
- virtual uint32_t GetStylesEx();
- virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved);
- virtual uint32_t GetStates();
- virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
- virtual FWL_Error Update();
- virtual FWL_Error LockUpdate();
- virtual FWL_Error UnlockUpdate();
- virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
- virtual FWL_Error TransformTo(IFWL_Widget* pWidget,
- FX_FLOAT& fx,
- FX_FLOAT& fy);
- virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
- virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
- virtual FWL_Error SetMatrix(const CFX_Matrix& matrix);
- virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr);
- virtual IFWL_ThemeProvider* GetThemeProvider();
- virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
- virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
- virtual IFWL_App* GetOwnerApp() const;
-
- FWL_Error SetOwnerApp(IFWL_App* pOwnerApp);
- IFWL_Widget* GetInterface() const;
- void SetInterface(IFWL_Widget* pInterface);
- CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
- uint32_t GetEventKey() const;
- void SetEventKey(uint32_t key);
- void* GetLayoutItem() const;
- void SetLayoutItem(void* pItem);
- void* GetAssociateWidget() const;
- void SetAssociateWidget(void* pAssociate);
-
- protected:
- friend class CFWL_WidgetImpDelegate;
-
- CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- FX_BOOL IsEnabled() const;
- FX_BOOL IsVisible() const;
- FX_BOOL IsActive() const;
- FX_BOOL IsOverLapper() const;
- FX_BOOL IsPopup() const;
- FX_BOOL IsChild() const;
- FX_BOOL IsLocked() const;
- FX_BOOL IsOffscreen() const;
- FX_BOOL HasBorder() const;
- FX_BOOL HasEdge() const;
- void GetEdgeRect(CFX_RectF& rtEdge);
- FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE);
- FX_FLOAT GetEdgeWidth();
- void GetRelativeRect(CFX_RectF& rect);
- void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity);
- IFWL_ThemeProvider* GetAvailableTheme();
- CFWL_WidgetImp* GetRootOuter();
- CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
- IFWL_ThemeProvider* pTheme,
- FX_BOOL bMultiLine = FALSE,
- int32_t iLineWidth = -1);
- void CalcTextRect(const CFX_WideString& wsText,
- IFWL_ThemeProvider* pTheme,
- uint32_t dwTTOStyles,
- int32_t iTTOAlign,
- CFX_RectF& rect);
- void SetFocus(FX_BOOL bFocus);
- void SetGrab(FX_BOOL bSet);
- FX_BOOL GetPopupPos(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup);
- FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup);
- FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup);
- FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight,
- FX_FLOAT fMaxHeight,
- const CFX_RectF& rtAnchor,
- CFX_RectF& rtPopup);
- FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy);
- void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr,
- uint32_t dwFilter = FWL_EVENT_ALL_MASK);
- void UnregisterEventTarget();
- void DispatchKeyEvent(CFWL_MsgKey* pNote);
- void DispatchEvent(CFWL_Event* pEvent);
- void Repaint(const CFX_RectF* pRect = nullptr);
- void DrawBackground(CFX_Graphics* pGraphics,
- CFWL_Part iPartBk,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawBorder(CFX_Graphics* pGraphics,
- CFWL_Part iPartBorder,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void DrawEdge(CFX_Graphics* pGraphics,
- CFWL_Part iPartEdge,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix = nullptr);
- void NotifyDriver();
-
- FX_BOOL IsParent(IFWL_Widget* pParent);
-
- CFWL_WidgetMgr* const m_pWidgetMgr;
- IFWL_App* m_pOwnerApp;
- std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties;
- IFWL_WidgetDelegate* m_pDelegate;
- IFWL_WidgetDelegate* m_pCurDelegate;
- IFWL_Widget* m_pOuter;
- IFWL_Widget* m_pInterface;
- void* m_pLayoutItem;
- void* m_pAssociate;
- int32_t m_iLock;
- uint32_t m_nEventKey;
-};
-
-class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate {
- public:
- CFWL_WidgetImpDelegate();
- ~CFWL_WidgetImpDelegate() override {}
- void OnProcessMessage(CFWL_Message* pMessage) override;
- void OnProcessEvent(CFWL_Event* pEvent) override;
- void OnDrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr) override;
-};
-
-#endif // XFA_FWL_CORE_FWL_WIDGETIMP_H_
diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/core/ifwl_barcode.cpp
index 70f5c73c3a..76f64facd0 100644
--- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp
+++ b/xfa/fwl/core/ifwl_barcode.cpp
@@ -4,73 +4,58 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_barcodeimp.h"
+#include "xfa/fwl/core/ifwl_barcode.h"
#include "xfa/fgas/font/fgas_gefont.h"
-#include "xfa/fwl/basewidget/cfx_barcode.h"
-#include "xfa/fwl/basewidget/fwl_editimp.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/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
// static
IFWL_Barcode* IFWL_Barcode::Create(const CFWL_WidgetImpProperties& properties) {
- IFWL_Barcode* pBarcode = new IFWL_Barcode;
- CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, nullptr);
- pBarcode->SetImpl(pBarcodeImpl);
- pBarcodeImpl->SetInterface(pBarcode);
- return pBarcode;
-}
-IFWL_Barcode::IFWL_Barcode() {}
-void IFWL_Barcode::SetType(BC_TYPE type) {
- static_cast<CFWL_BarcodeImp*>(GetImpl())->SetType(type);
-}
-FX_BOOL IFWL_Barcode::IsProtectedType() {
- return static_cast<CFWL_BarcodeImp*>(GetImpl())->IsProtectedType();
+ return new IFWL_Barcode(properties, nullptr);
}
-CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_EditImp(properties, pOuter),
- m_dwStatus(0),
- m_type(BC_UNKNOWN) {}
+IFWL_Barcode::IFWL_Barcode(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Edit(properties, pOuter), m_dwStatus(0), m_type(BC_UNKNOWN) {}
-CFWL_BarcodeImp::~CFWL_BarcodeImp() {}
+IFWL_Barcode::~IFWL_Barcode() {}
-FWL_Error CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_Barcode::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Barcode;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_BarcodeImp::GetClassID() const {
+FWL_Type IFWL_Barcode::GetClassID() const {
return FWL_Type::Barcode;
}
-FWL_Error CFWL_BarcodeImp::Initialize() {
+FWL_Error IFWL_Barcode::Initialize() {
if (!m_pDelegate) {
m_pDelegate = new CFWL_BarcodeImpDelegate(this);
}
- if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded)
+ if (IFWL_Edit::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_BarcodeImp::Finalize() {
+FWL_Error IFWL_Barcode::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
m_pBarcodeEngine.reset();
- return CFWL_EditImp::Finalize();
+ return IFWL_Edit::Finalize();
}
-FWL_Error CFWL_BarcodeImp::Update() {
+FWL_Error IFWL_Barcode::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
- FWL_Error ret = CFWL_EditImp::Update();
+ FWL_Error ret = IFWL_Edit::Update();
GenerateBarcodeImageCache();
return ret;
}
-FWL_Error CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+FWL_Error IFWL_Barcode::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -93,9 +78,9 @@ FWL_Error CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
- return CFWL_EditImp::DrawWidget(pGraphics, pMatrix);
+ return IFWL_Edit::DrawWidget(pGraphics, pMatrix);
}
-void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
+void IFWL_Barcode::GenerateBarcodeImageCache() {
if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0)
return;
m_dwStatus = 0;
@@ -110,7 +95,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
if (GetText(wsText) != FWL_Error::Succeeded)
return;
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
CFGAS_GEFont* pFont = static_cast<CFGAS_GEFont*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Font));
@@ -176,7 +161,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
: 0;
}
-void CFWL_BarcodeImp::CreateBarcodeEngine() {
+void IFWL_Barcode::CreateBarcodeEngine() {
if (m_pBarcodeEngine || m_type == BC_UNKNOWN)
return;
@@ -185,7 +170,7 @@ void CFWL_BarcodeImp::CreateBarcodeEngine() {
m_pBarcodeEngine = std::move(pBarcode);
}
-void CFWL_BarcodeImp::SetType(BC_TYPE type) {
+void IFWL_Barcode::SetType(BC_TYPE type) {
if (m_type == type)
return;
@@ -193,12 +178,12 @@ void CFWL_BarcodeImp::SetType(BC_TYPE type) {
m_type = type;
m_dwStatus = XFA_BCS_NeedUpdate;
}
-FWL_Error CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) {
+FWL_Error IFWL_Barcode::SetText(const CFX_WideString& wsText) {
m_pBarcodeEngine.reset();
m_dwStatus = XFA_BCS_NeedUpdate;
- return CFWL_EditImp::SetText(wsText);
+ return IFWL_Edit::SetText(wsText);
}
-FX_BOOL CFWL_BarcodeImp::IsProtectedType() {
+FX_BOOL IFWL_Barcode::IsProtectedType() {
if (!m_pBarcodeEngine) {
return TRUE;
}
@@ -210,12 +195,12 @@ FX_BOOL CFWL_BarcodeImp::IsProtectedType() {
return FALSE;
}
-CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner)
+CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner)
: CFWL_EditImpDelegate(pOwner) {}
void CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
if (pEvent->GetClassID() == CFWL_EventType::TextChanged) {
- CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner);
+ IFWL_Barcode* pOwner = static_cast<IFWL_Barcode*>(m_pOwner);
pOwner->m_pBarcodeEngine.reset();
pOwner->m_dwStatus = XFA_BCS_NeedUpdate;
}
diff --git a/xfa/fwl/basewidget/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h
index aaee09b9ff..6f58ad1012 100644
--- a/xfa/fwl/basewidget/ifwl_barcode.h
+++ b/xfa/fwl/core/ifwl_barcode.h
@@ -4,14 +4,22 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_
-#define XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_
+#ifndef XFA_FWL_CORE_IFWL_BARCODE_H_
+#define XFA_FWL_CORE_IFWL_BARCODE_H_
-#include "xfa/fwl/basewidget/ifwl_edit.h"
+#include <memory>
+
+#include "xfa/fwl/core/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
#include "xfa/fxbarcode/BC_Library.h"
+class CFWL_BarcodeImpDelegate;
class CFWL_WidgetImpProperties;
+class CFX_Barcode;
+class IFWL_Widget;
+#define XFA_BCS_NeedUpdate 0x0001
+#define XFA_BCS_EncodeSuccess 0x0002
#define FWL_CLASS_Barcode L"FWL_BARCODE"
enum FWL_BCDAttribute {
@@ -52,11 +60,38 @@ class IFWL_BarcodeDP : public IFWL_EditDP {
class IFWL_Barcode : public IFWL_Edit {
public:
static IFWL_Barcode* Create(const CFWL_WidgetImpProperties& properties);
+
+ IFWL_Barcode(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_Barcode() override;
+
+ // IFWL_Widget
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override;
+ FWL_Type GetClassID() const override;
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+ FWL_Error Update() override;
+ FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+ FWL_Error SetText(const CFX_WideString& wsText) override;
+
void SetType(BC_TYPE type);
FX_BOOL IsProtectedType();
protected:
- IFWL_Barcode();
+ friend class CFWL_BarcodeImpDelegate;
+
+ void GenerateBarcodeImageCache();
+ void CreateBarcodeEngine();
+
+ std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
+ uint32_t m_dwStatus;
+ BC_TYPE m_type;
+};
+
+class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate {
+ public:
+ explicit CFWL_BarcodeImpDelegate(IFWL_Barcode* pOwner);
+ void OnProcessEvent(CFWL_Event* pEvent) override;
};
-#endif // XFA_FWL_BASEWIDGET_IFWL_BARCODE_H_
+#endif // XFA_FWL_CORE_IFWL_BARCODE_H_
diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/core/ifwl_caret.cpp
index cd51bd7430..5ece9626eb 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.cpp
+++ b/xfa/fwl/core/ifwl_caret.cpp
@@ -4,40 +4,23 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_caretimp.h"
+#include "xfa/fwl/core/ifwl_caret.h"
-#include "xfa/fwl/basewidget/ifwl_caret.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_caret.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
// static
IFWL_Caret* IFWL_Caret::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_Caret* pCaret = new IFWL_Caret;
- CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(properties, pOuter);
- pCaret->SetImpl(pCaretImpl);
- pCaretImpl->SetInterface(pCaret);
- return pCaret;
-}
-IFWL_Caret::IFWL_Caret() {}
-void IFWL_Caret::ShowCaret(FX_BOOL bFlag) {
- static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag);
-}
-FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) {
- return static_cast<CFWL_CaretImp*>(GetImpl())->GetFrequency(elapse);
-}
-FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) {
- return static_cast<CFWL_CaretImp*>(GetImpl())->SetFrequency(elapse);
-}
-FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) {
- return static_cast<CFWL_CaretImp*>(GetImpl())->SetColor(crFill);
+ return new IFWL_Caret(properties, pOuter);
}
-CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_Caret::IFWL_Caret(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_pTimer(new CFWL_CaretTimer(this)),
m_pTimerInfo(nullptr),
m_dwElapse(400),
@@ -45,36 +28,37 @@ CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
SetStates(FWL_STATE_CAT_HightLight);
}
-CFWL_CaretImp::~CFWL_CaretImp() {}
+IFWL_Caret::~IFWL_Caret() {}
-FWL_Error CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_Caret::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Caret;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_CaretImp::GetClassID() const {
+FWL_Type IFWL_Caret::GetClassID() const {
return FWL_Type::Caret;
}
-FWL_Error CFWL_CaretImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_Caret::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_CaretImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CaretImp::Finalize() {
+FWL_Error IFWL_Caret::Finalize() {
if (m_pTimerInfo) {
m_pTimerInfo->StopTimer();
m_pTimerInfo = nullptr;
}
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_Caret::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -86,7 +70,7 @@ FWL_Error CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
}
-void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
+void IFWL_Caret::ShowCaret(FX_BOOL bFlag) {
if (m_pTimerInfo) {
m_pTimerInfo->StopTimer();
m_pTimerInfo = nullptr;
@@ -96,28 +80,31 @@ void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) {
SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
-FWL_Error CFWL_CaretImp::GetFrequency(uint32_t& elapse) {
+
+FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) {
elapse = m_dwElapse;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CaretImp::SetFrequency(uint32_t elapse) {
+
+FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) {
m_dwElapse = elapse;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CaretImp::SetColor(CFX_Color crFill) {
+
+FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) {
m_bSetColor = TRUE;
m_crFill = crFill;
return FWL_Error::Succeeded;
}
-void CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFX_RectF rect;
GetWidgetRect(rect);
rect.Set(0, 0, rect.width, rect.height);
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_pGraphics = pGraphics;
param.m_rtPart = rect;
if (m_bSetColor)
@@ -133,10 +120,10 @@ void CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
-CFWL_CaretImp::CFWL_CaretTimer::CFWL_CaretTimer(CFWL_CaretImp* pCaret)
+IFWL_Caret::CFWL_CaretTimer::CFWL_CaretTimer(IFWL_Caret* pCaret)
: m_pCaret(pCaret) {}
-void CFWL_CaretImp::CFWL_CaretTimer::Run(IFWL_TimerInfo* pTimerInfo) {
+void IFWL_Caret::CFWL_CaretTimer::Run(IFWL_TimerInfo* pTimerInfo) {
bool toggle = !(m_pCaret->GetStates() & FWL_STATE_CAT_HightLight);
m_pCaret->SetStates(FWL_STATE_CAT_HightLight, toggle);
@@ -146,7 +133,7 @@ void CFWL_CaretImp::CFWL_CaretTimer::Run(IFWL_TimerInfo* pTimerInfo) {
m_pCaret->Repaint(&rt);
}
-CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner)
+CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(IFWL_Caret* pOwner)
: m_pOwner(pOwner) {}
void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {}
diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/core/ifwl_caret.h
index d8b621b43c..e261fe95c3 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.h
+++ b/xfa/fwl/core/ifwl_caret.h
@@ -4,12 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_CARET_H_
+#define XFA_FWL_CORE_IFWL_CARET_H_
#include <memory>
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_timer.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
@@ -18,13 +17,18 @@ class CFWL_WidgetImpProperties;
class IFWL_Widget;
class CFWL_CaretImpDelegate;
-class CFWL_CaretImp : public CFWL_WidgetImp {
+#define FWL_CLASS_Caret L"FWL_CARET"
+#define FWL_STATE_CAT_HightLight 1
+
+class IFWL_Caret : public IFWL_Widget {
public:
- CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_CaretImp() override;
+ static IFWL_Caret* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_Caret(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_Caret() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -43,10 +47,10 @@ class CFWL_CaretImp : public CFWL_WidgetImp {
class CFWL_CaretTimer : public IFWL_Timer {
public:
- explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret);
+ explicit CFWL_CaretTimer(IFWL_Caret* pCaret);
~CFWL_CaretTimer() override {}
void Run(IFWL_TimerInfo* hTimer) override;
- CFWL_CaretImp* const m_pCaret;
+ IFWL_Caret* const m_pCaret;
};
void DrawCaretBK(CFX_Graphics* pGraphics,
@@ -62,13 +66,13 @@ class CFWL_CaretImp : public CFWL_WidgetImp {
class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner);
+ CFWL_CaretImpDelegate(IFWL_Caret* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
protected:
- CFWL_CaretImp* m_pOwner;
+ IFWL_Caret* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_CARETIMP_H_
+#endif // XFA_FWL_CORE_IFWL_CARET_H_
diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/core/ifwl_checkbox.cpp
index 581e45319f..d822d3e820 100644
--- a/xfa/fwl/basewidget/fwl_checkboximp.cpp
+++ b/xfa/fwl/core/ifwl_checkbox.cpp
@@ -4,18 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_checkboximp.h"
+#include "xfa/fwl/core/ifwl_checkbox.h"
#include <algorithm>
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_checkbox.h"
#include "xfa/fwl/core/cfwl_message.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/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_checkbox.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
namespace {
@@ -27,23 +26,12 @@ const int kCaptionMargin = 5;
// static
IFWL_CheckBox* IFWL_CheckBox::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_CheckBox* pCheckBox = new IFWL_CheckBox;
- CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter);
- pCheckBox->SetImpl(pCheckBoxImpl);
- pCheckBoxImpl->SetInterface(pCheckBox);
- return pCheckBox;
-}
-IFWL_CheckBox::IFWL_CheckBox() {}
-int32_t IFWL_CheckBox::GetCheckState() {
- return static_cast<CFWL_CheckBoxImp*>(GetImpl())->GetCheckState();
-}
-FWL_Error IFWL_CheckBox::SetCheckState(int32_t iCheck) {
- return static_cast<CFWL_CheckBoxImp*>(GetImpl())->SetCheckState(iCheck);
+ return new IFWL_CheckBox(properties, pOuter);
}
-CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_CheckBox::IFWL_CheckBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
m_iTTOAlign(FDE_TTOALIGNMENT_Center),
m_bBtnDown(FALSE) {
@@ -53,31 +41,32 @@ CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties,
m_rtFocus.Reset();
}
-CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {}
+IFWL_CheckBox::~IFWL_CheckBox() {}
-FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_CheckBox::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_CheckBox;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_CheckBoxImp::GetClassID() const {
+FWL_Type IFWL_CheckBox::GetClassID() const {
return FWL_Type::CheckBox;
}
-FWL_Error CFWL_CheckBoxImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_CheckBox::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_CheckBoxImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CheckBoxImp::Finalize() {
+FWL_Error IFWL_CheckBox::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pThemeProvider)
@@ -87,7 +76,7 @@ FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
CFX_WideString wsCaption;
- m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
+ m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
if (wsCaption.GetLength() > 0) {
CFX_SizeF sz = CalcTextSize(
wsCaption, m_pProperties->m_pThemeProvider,
@@ -97,18 +86,19 @@ FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
rect.Inflate(kCaptionMargin, kCaptionMargin);
IFWL_CheckBoxDP* pData =
static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider);
- FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface);
+ FX_FLOAT fCheckBox = pData->GetBoxSize(this);
rect.width += fCheckBox;
if (rect.height < fCheckBox) {
rect.height = fCheckBox;
}
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CheckBoxImp::Update() {
+
+FWL_Error IFWL_CheckBox::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -119,8 +109,9 @@ FWL_Error CFWL_CheckBoxImp::Update() {
Layout();
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -136,7 +127,7 @@ FWL_Error CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics,
int32_t dwStates = GetPartStates();
{
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_dwStates = dwStates;
param.m_pGraphics = pGraphics;
@@ -156,12 +147,12 @@ FWL_Error CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Indefinite;
{
CFX_WideString wsCaption;
- m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
+ m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
int32_t iLen = wsCaption.GetLength();
if (iLen <= 0)
return FWL_Error::Indefinite;
CFWL_ThemeText textParam;
- textParam.m_pWidget = m_pInterface;
+ textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::Caption;
textParam.m_dwStates = dwStates;
textParam.m_pGraphics = pGraphics;
@@ -176,7 +167,8 @@ FWL_Error CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-int32_t CFWL_CheckBoxImp::GetCheckState() {
+
+int32_t IFWL_CheckBox::GetCheckState() {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) &&
((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral)) {
@@ -188,7 +180,8 @@ int32_t CFWL_CheckBoxImp::GetCheckState() {
}
return 0;
}
-FWL_Error CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) {
+
+FWL_Error IFWL_CheckBox::SetCheckState(int32_t iCheck) {
m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
switch (iCheck) {
case 0: {
@@ -209,7 +202,8 @@ FWL_Error CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) {
Repaint(&m_rtClient);
return FWL_Error::Succeeded;
}
-void CFWL_CheckBoxImp::Layout() {
+
+void IFWL_CheckBox::Layout() {
int32_t width = int32_t(m_pProperties->m_rtWidget.width + 0.5f);
int32_t height = int32_t(m_pProperties->m_rtWidget.height + 0.5f);
m_pProperties->m_rtWidget.width = (FX_FLOAT)width;
@@ -224,7 +218,7 @@ void CFWL_CheckBoxImp::Layout() {
return;
IFWL_CheckBoxDP* pData =
static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider);
- FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface);
+ FX_FLOAT fCheckBox = pData->GetBoxSize(this);
switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) {
case FWL_STYLEEXT_CKB_Top: {
fBoxTop = m_rtClient.top;
@@ -256,7 +250,7 @@ void CFWL_CheckBoxImp::Layout() {
rtFocus.Set(m_rtCaption.left, m_rtCaption.top, m_rtCaption.width,
m_rtCaption.height);
CFX_WideString wsCaption;
- m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
+ m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
if (wsCaption.IsEmpty()) {
m_rtFocus.Set(0, 0, 0, 0);
} else {
@@ -288,7 +282,8 @@ void CFWL_CheckBoxImp::Layout() {
m_rtFocus.Inflate(1, 1);
}
}
-uint32_t CFWL_CheckBoxImp::GetPartStates() {
+
+uint32_t IFWL_CheckBox::GetPartStates() {
int32_t dwStates = CFWL_PartState_Normal;
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Neutral) {
@@ -311,7 +306,8 @@ uint32_t CFWL_CheckBoxImp::GetPartStates() {
}
return dwStates;
}
-void CFWL_CheckBoxImp::UpdateTextOutStyles() {
+
+void IFWL_CheckBox::UpdateTextOutStyles() {
m_iTTOAlign = FDE_TTOALIGNMENT_Center;
switch (m_pProperties->m_dwStyleExes &
(FWL_STYLEEXT_CKB_HLayoutMask | FWL_STYLEEXT_CKB_VLayoutMask)) {
@@ -363,7 +359,8 @@ void CFWL_CheckBoxImp::UpdateTextOutStyles() {
m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine;
}
}
-void CFWL_CheckBoxImp::NextStates() {
+
+void IFWL_CheckBox::NextStates() {
uint32_t dwFirststate = m_pProperties->m_dwStates;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
@@ -371,12 +368,12 @@ void CFWL_CheckBoxImp::NextStates() {
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr->IsFormDisabled()) {
CFX_ArrayTemplate<IFWL_Widget*> radioarr;
- pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr);
+ pWidgetMgr->GetSameGroupRadioButton(this, radioarr);
IFWL_CheckBox* pCheckBox = nullptr;
int32_t iCount = radioarr.GetSize();
for (int32_t i = 0; i < iCount; i++) {
pCheckBox = static_cast<IFWL_CheckBox*>(radioarr[i]);
- if (pCheckBox != m_pInterface &&
+ if (pCheckBox != this &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
pCheckBox->SetCheckState(0);
CFX_RectF rt;
@@ -411,11 +408,12 @@ void CFWL_CheckBoxImp::NextStates() {
uint32_t dwLaststate = m_pProperties->m_dwStates;
if (dwFirststate != dwLaststate) {
CFWL_EvtCkbCheckStateChanged wmCheckBoxState;
- wmCheckBoxState.m_pSrcTarget = m_pInterface;
+ wmCheckBoxState.m_pSrcTarget = this;
DispatchEvent(&wmCheckBoxState);
}
}
-CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner)
+
+CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(IFWL_CheckBox* pOwner)
: m_pOwner(pOwner) {}
void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -465,9 +463,7 @@ void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKeyDown(pKey);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
@@ -482,6 +478,7 @@ void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
m_pOwner->Repaint(&(m_pOwner->m_rtClient));
}
+
void CFWL_CheckBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
if (bSet) {
@@ -491,6 +488,7 @@ void CFWL_CheckBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&(m_pOwner->m_rtClient));
}
+
void CFWL_CheckBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
return;
@@ -503,6 +501,7 @@ void CFWL_CheckBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_pProperties->m_dwStates |= FWL_STATE_CKB_Pressed;
m_pOwner->Repaint(&(m_pOwner->m_rtClient));
}
+
void CFWL_CheckBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (!m_pOwner->m_bBtnDown) {
return;
@@ -515,6 +514,7 @@ void CFWL_CheckBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_STATE_CKB_Pressed;
m_pOwner->NextStates();
}
+
void CFWL_CheckBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
return;
@@ -552,6 +552,7 @@ void CFWL_CheckBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&(m_pOwner->m_rtBox));
}
}
+
void CFWL_CheckBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_bBtnDown) {
m_pOwner->m_pProperties->m_dwStates |= FWL_STATE_CKB_Hovered;
@@ -560,6 +561,7 @@ void CFWL_CheckBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&(m_pOwner->m_rtBox));
}
+
void CFWL_CheckBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
if (pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
m_pOwner->DispatchKeyEvent(pMsg);
diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h
index ff5e3b86f7..237a15b30e 100644
--- a/xfa/fwl/basewidget/ifwl_checkbox.h
+++ b/xfa/fwl/core/ifwl_checkbox.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_IFWL_CHECKBOX_H_
-#define XFA_FWL_BASEWIDGET_IFWL_CHECKBOX_H_
+#ifndef XFA_FWL_CORE_IFWL_CHECKBOX_H_
+#define XFA_FWL_CORE_IFWL_CHECKBOX_H_
#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
@@ -44,6 +44,11 @@
#define FWL_STATE_CKB_Neutral (2 << (FWL_WGTSTATE_MAX + 2))
#define FWL_STATE_CKB_CheckMask (3L << (FWL_WGTSTATE_MAX + 2))
+class CFWL_CheckBoxImpDelegate;
+class CFWL_MsgMouse;
+class CFWL_WidgetImpProperties;
+class IFWL_Widget;
+
FWL_EVENT_DEF(CFWL_EvtCkbCheckStateChanged, CFWL_EventType::CheckStateChanged)
class IFWL_CheckBoxDP : public IFWL_DataProvider {
@@ -55,11 +60,58 @@ class IFWL_CheckBox : public IFWL_Widget {
public:
static IFWL_CheckBox* Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
+
+ IFWL_CheckBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_CheckBox() override;
+
+ // IFWL_Widget
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override;
+ FWL_Type GetClassID() const override;
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+ FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
+ FWL_Error Update() override;
+ FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
int32_t GetCheckState();
FWL_Error SetCheckState(int32_t iCheck);
protected:
- IFWL_CheckBox();
+ friend class CFWL_CheckBoxImpDelegate;
+
+ void Layout();
+ uint32_t GetPartStates();
+ void UpdateTextOutStyles();
+ void NextStates();
+
+ CFX_RectF m_rtClient;
+ CFX_RectF m_rtBox;
+ CFX_RectF m_rtCaption;
+ CFX_RectF m_rtFocus;
+ uint32_t m_dwTTOStyles;
+ int32_t m_iTTOAlign;
+ FX_BOOL m_bBtnDown;
+};
+
+class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate {
+ public:
+ CFWL_CheckBoxImpDelegate(IFWL_CheckBox* pOwner);
+
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
+ protected:
+ void OnActivate(CFWL_Message* pMsg);
+ void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseMove(CFWL_MsgMouse* pMsg);
+ void OnMouseLeave(CFWL_MsgMouse* pMsg);
+ void OnKeyDown(CFWL_MsgKey* pMsg);
+
+ IFWL_CheckBox* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_IFWL_CHECKBOX_H_
+#endif // XFA_FWL_CORE_IFWL_CHECKBOX_H_
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index e586055c3b..6a4c13f4a6 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -4,473 +4,31 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_comboboximp.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_formproxyimp.h"
-#include "xfa/fwl/basewidget/fwl_listboximp.h"
-#include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
#include "xfa/fwl/core/cfwl_message.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_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_comboedit.h"
+#include "xfa/fwl/core/ifwl_combolist.h"
+#include "xfa/fwl/core/ifwl_formproxy.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
// static
IFWL_ComboBox* IFWL_ComboBox::Create(
const CFWL_WidgetImpProperties& properties) {
- IFWL_ComboBox* pComboBox = new IFWL_ComboBox;
- CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, nullptr);
- pComboBox->SetImpl(pComboBoxImpl);
- pComboBoxImpl->SetInterface(pComboBox);
- return pComboBox;
-}
-IFWL_ComboBox::IFWL_ComboBox() {}
-int32_t IFWL_ComboBox::GetCurSel() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel();
-}
-FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetCurSel(iSel);
-}
-FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditText(wsText);
-}
-int32_t IFWL_ComboBox::GetEditTextLength() const {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditTextLength();
-}
-FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->GetEditText(wsText, nStart, nCount);
-}
-FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->SetEditSelRange(nStart, nCount);
-}
-int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->GetEditSelRange(nIndex, nStart);
-}
-int32_t IFWL_ComboBox::GetEditLimit() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditLimit();
-}
-FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditLimit(nLimit);
-}
-FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDoClipboard(iCmd);
-}
-FX_BOOL IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo(pRecord);
-}
-FX_BOOL IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo(pRecord);
-}
-IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetListBoxt();
-}
-FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->AfterFocusShowDropList();
-}
-FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->OpenDropDownList(bActivate);
-}
-FX_BOOL IFWL_ComboBox::EditCanUndo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanUndo();
-}
-FX_BOOL IFWL_ComboBox::EditCanRedo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanRedo();
-}
-FX_BOOL IFWL_ComboBox::EditUndo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditUndo();
-}
-FX_BOOL IFWL_ComboBox::EditRedo() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditRedo();
-}
-FX_BOOL IFWL_ComboBox::EditCanCopy() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanCopy();
-}
-FX_BOOL IFWL_ComboBox::EditCanCut() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanCut();
-}
-FX_BOOL IFWL_ComboBox::EditCanSelectAll() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCanSelectAll();
-}
-FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCopy(wsCopy);
-}
-FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditCut(wsCut);
-}
-FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditPaste(wsPaste);
-}
-FX_BOOL IFWL_ComboBox::EditSelectAll() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditSelectAll();
-}
-FX_BOOL IFWL_ComboBox::EditDelete() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDelete();
-}
-FX_BOOL IFWL_ComboBox::EditDeSelect() {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect();
-}
-FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect);
-}
-FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
- return static_cast<CFWL_ComboBoxImp*>(GetImpl())
- ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
-}
-
-CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_EditImp(properties, pOuter) {
- m_pOuter = static_cast<CFWL_ComboBoxImp*>(pOuter->GetImpl());
-}
-
-CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner)
- : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
-
-void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
- FX_BOOL backDefault = TRUE;
- switch (pMessage->GetClassID()) {
- case CFWL_MessageType::SetFocus: {
- m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- backDefault = FALSE;
- break;
- }
- case CFWL_MessageType::KillFocus: {
- m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- backDefault = FALSE;
- break;
- }
- case CFWL_MessageType::Mouse: {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
- ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
- m_pOwner->SetSelected();
- m_pOwner->SetComboBoxFocus(TRUE);
- }
- break;
- }
- default:
- break;
- }
- if (backDefault)
- CFWL_EditImpDelegate::OnProcessMessage(pMessage);
-}
-
-void CFWL_ComboEditImp::ClearSelected() {
- ClearSelections();
- Repaint(&m_rtClient);
-}
-void CFWL_ComboEditImp::SetSelected() {
- FlagFocus(TRUE);
- EndCaret();
- AddSelRange(0);
-}
-void CFWL_ComboEditImp::EndCaret() {
- m_pEdtEngine->MoveCaretPos(MC_End);
-}
-void CFWL_ComboEditImp::FlagFocus(FX_BOOL bSet) {
- if (bSet) {
- m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- } else {
- m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- ShowCaret(FALSE);
- }
-}
-void CFWL_ComboEditImp::SetComboBoxFocus(FX_BOOL bSet) {
- m_pOuter->SetFocus(bSet);
-}
-CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) {
- ASSERT(pOuter);
-}
-FWL_Error CFWL_ComboListImp::Initialize() {
- if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded)
- return FWL_Error::Indefinite;
- delete m_pDelegate;
- m_pDelegate = new CFWL_ComboListImpDelegate(this);
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_ComboListImp::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- return CFWL_ListBoxImp::Finalize();
-}
-int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) {
- if (wsMatch.IsEmpty()) {
- return -1;
- }
- if (!m_pProperties->m_pDataProvider)
- return -1;
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
- for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, i);
- CFX_WideString wsText;
- pData->GetItemText(m_pInterface, hItem, wsText);
- FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
- if (!pos) {
- return i;
- }
- }
- return -1;
-}
-void CFWL_ComboListImp::ChangeSelected(int32_t iSel) {
- if (!m_pProperties->m_pDataProvider)
- return;
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel);
- CFX_RectF rtInvalidate;
- rtInvalidate.Reset();
- IFWL_ListItem* hOld = GetSelItem(0);
- int32_t iOld = pData->GetItemIndex(m_pInterface, hOld);
- if (iOld == iSel) {
- return;
- } else if (iOld > -1) {
- GetItemRect(iOld, rtInvalidate);
- SetSelItem(hOld, FALSE);
- }
- if (hItem) {
- CFX_RectF rect;
- GetItemRect(iSel, rect);
- rtInvalidate.Union(rect);
- IFWL_ListItem* hSel = pData->GetItem(m_pInterface, iSel);
- SetSelItem(hSel, TRUE);
- }
- if (!rtInvalidate.IsEmpty()) {
- Repaint(&rtInvalidate);
- }
-}
-int32_t CFWL_ComboListImp::CountItems() {
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- return pData ? pData->CountItems(m_pInterface) : 0;
-}
-void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) {
- IFWL_ListBoxDP* pData =
- static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, nIndex);
- pData->GetItemRect(m_pInterface, hItem, rtItem);
-}
-void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top;
- IFWL_Widget* pOwner = GetOwner();
- if (!pOwner)
- return;
- pOwner->TransformTo(m_pOuter, fx, fy);
-}
-void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) {
- CFWL_WidgetImp::SetFocus(bSet);
-}
-
-CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner)
- : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {}
-
-void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- if (!pMessage)
- return;
-
- CFWL_MessageType dwHashCode = pMessage->GetClassID();
- FX_BOOL backDefault = TRUE;
- if (dwHashCode == CFWL_MessageType::SetFocus ||
- dwHashCode == CFWL_MessageType::KillFocus) {
- OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus);
- } else if (dwHashCode == CFWL_MessageType::Mouse) {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- pMsg->m_fx -= rect.left;
- pMsg->m_fy -= rect.top;
- IFWL_WidgetDelegate* pDelegate =
- m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMsg);
- return;
- }
- }
- switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::Move: {
- backDefault = FALSE;
- OnDropListMouseMove(pMsg);
- break;
- }
- case FWL_MouseCommand::LeftButtonDown: {
- backDefault = FALSE;
- OnDropListLButtonDown(pMsg);
- break;
- }
- case FWL_MouseCommand::LeftButtonUp: {
- backDefault = FALSE;
- OnDropListLButtonUp(pMsg);
- break;
- }
- default:
- break;
- }
- } else if (dwHashCode == CFWL_MessageType::Key) {
- backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
- }
- if (backDefault)
- CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage);
+ return new IFWL_ComboBox(properties, nullptr);
}
-void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
- FX_BOOL bSet) {
- if (!bSet) {
- CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg);
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- if (pKill->m_pSetFocus == m_pOwner->m_pOuter ||
- pKill->m_pSetFocus == pOuter->m_pEdit.get()) {
- pOuter->ShowDropList(FALSE);
- }
- }
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
- if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->m_bNotifyOwner = FALSE;
- }
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 1;
- }
- }
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
- if (hItem) {
- if (!m_pOwner->m_pProperties->m_pDataProvider)
- return 0;
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- m_pOwner->m_pProperties->m_pDataProvider);
- int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem);
- CFWL_EvtCmbHoverChanged event;
- event.m_pSrcTarget = m_pOwner->m_pOuter;
- event.m_iCurHover = iSel;
- m_pOwner->DispatchEvent(&event);
- m_pOwner->ChangeSelected(iSel);
- }
- } else if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
- }
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 0;
- }
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- pOuter->ShowDropList(FALSE);
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- if (m_pOwner->m_bNotifyOwner) {
- m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
- } else {
- if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
- CFX_RectF rect;
- m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
- if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return 1;
- }
- }
- pOuter->ShowDropList(FALSE);
- IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
- if (hItem) {
- pOuter->ProcessSelChanged(TRUE);
- }
- }
- return 1;
-}
-int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- FX_BOOL bPropagate = FALSE;
- if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
- uint32_t dwKeyCode = pKey->m_dwKeyCode;
- switch (dwKeyCode) {
- case FWL_VKEY_Return:
- case FWL_VKEY_Escape: {
- pOuter->ShowDropList(FALSE);
- return 1;
- }
- case FWL_VKEY_Up:
- case FWL_VKEY_Down: {
- OnDropListKeyDown(pKey);
- pOuter->SetDelegate(nullptr);
- pOuter->ProcessSelChanged(FALSE);
- return 1;
- }
- default: { bPropagate = TRUE; }
- }
- } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) {
- bPropagate = TRUE;
- }
- if (bPropagate) {
- pKey->m_pDstTarget = m_pOwner->m_pOuter;
- pOuter->m_pDelegate->OnProcessMessage(pKey);
- return 1;
- }
- return 0;
-}
-void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) {
- uint32_t dwKeyCode = pKey->m_dwKeyCode;
- switch (dwKeyCode) {
- case FWL_VKEY_Up:
- case FWL_VKEY_Down:
- case FWL_VKEY_Home:
- case FWL_VKEY_End: {
- CFWL_ComboBoxImp* pOuter =
- static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- m_pOwner->m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem =
- pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel);
- hItem = m_pOwner->GetItem(hItem, dwKeyCode);
- if (!hItem) {
- break;
- }
- m_pOwner->SetSelection(hItem, hItem, TRUE);
- m_pOwner->ScrollToVisible(hItem);
- CFX_RectF rtInvalidate;
- rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width,
- m_pOwner->m_pProperties->m_rtWidget.height);
- m_pOwner->Repaint(&rtInvalidate);
- break;
- }
- default: {}
- }
-}
-CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_ComboBox::IFWL_ComboBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_pForm(nullptr),
m_bLButtonDown(FALSE),
m_iCurSel(-1),
@@ -482,22 +40,22 @@ CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
m_rtHandler.Reset();
}
-CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {}
+IFWL_ComboBox::~IFWL_ComboBox() {}
-FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_ComboBox::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ComboBox;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_ComboBoxImp::GetClassID() const {
+FWL_Type IFWL_ComboBox::GetClassID() const {
return FWL_Type::ComboBox;
}
-FWL_Error CFWL_ComboBoxImp::Initialize() {
+FWL_Error IFWL_ComboBox::Initialize() {
if (m_pWidgetMgr->IsFormDisabled())
return DisForm_Initialize();
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
@@ -508,31 +66,32 @@ FWL_Error CFWL_ComboBoxImp::Initialize() {
prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
- m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
+ m_pListBox.reset(IFWL_ComboList::Create(prop, this));
m_pListBox->Initialize();
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
CFWL_WidgetImpProperties prop2;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop2, m_pInterface));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop2, this));
m_pEdit->Initialize();
- static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
+ m_pEdit->SetOuter(this);
}
if (m_pEdit)
- m_pEdit->SetParent(m_pInterface);
+ m_pEdit->SetParent(this);
SetStates(m_pProperties->m_dwStates);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::Finalize() {
+FWL_Error IFWL_ComboBox::Finalize() {
if (m_pEdit) {
m_pEdit->Finalize();
}
m_pListBox->Finalize();
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Reset();
FX_BOOL bIsDropDown = IsDropDownStyle();
@@ -550,14 +109,15 @@ FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (!pFWidth)
return FWL_Error::Indefinite;
rect.Inflate(0, 0, *pFWidth, 0);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+
+FWL_Error IFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
@@ -565,16 +125,17 @@ FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded,
bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown);
if (bAddDropDown && !m_pEdit) {
CFWL_WidgetImpProperties prop;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, nullptr));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop, nullptr));
m_pEdit->Initialize();
- static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
- m_pEdit->SetParent(m_pInterface);
+ m_pEdit->SetOuter(this);
+ m_pEdit->SetParent(this);
} else if (bRemoveDropDown && m_pEdit) {
m_pEdit->SetStates(FWL_WGTSTATE_Invisible, TRUE);
}
- return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
+ return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FWL_Error CFWL_ComboBoxImp::Update() {
+
+FWL_Error IFWL_ComboBox::Update() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Update();
}
@@ -591,20 +152,22 @@ FWL_Error CFWL_ComboBoxImp::Update() {
}
Layout();
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
m_fComboFormHandler =
*static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity(
&part, CFWL_WidgetCapacity::ComboFormHandler));
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_ComboBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_HitTest(fx, fy);
}
- return CFWL_WidgetImp::HitTest(fx, fy);
+ return IFWL_Widget::HitTest(fx, fy);
}
-FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_DrawWidget(pGraphics, pMatrix);
}
@@ -624,7 +187,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
CFX_RectF rtTextBk(m_rtClient);
rtTextBk.width -= m_rtBtn.width;
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_pGraphics = pGraphics;
if (pMatrix) {
@@ -633,8 +196,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
param.m_rtPart = rtTextBk;
if (m_iCurSel >= 0) {
IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->m_pProperties->m_pDataProvider);
+ m_pListBox->m_pProperties->m_pDataProvider);
void* p = pData->GetItemData(m_pListBox.get(),
pData->GetItem(m_pListBox.get(), m_iCurSel));
if (p) {
@@ -656,11 +218,10 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
CFWL_ThemeText theme_text;
- theme_text.m_pWidget = m_pInterface;
+ theme_text.m_pWidget = this;
theme_text.m_iPart = CFWL_Part::Caption;
theme_text.m_dwStates = m_iBtnState;
theme_text.m_pGraphics = pGraphics;
@@ -677,7 +238,7 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
}
{
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
? CFWL_PartState_Disabled
@@ -689,8 +250,8 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::SetThemeProvider(
- IFWL_ThemeProvider* pThemeProvider) {
+
+FWL_Error IFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
if (!pThemeProvider)
return FWL_Error::Indefinite;
m_pProperties->m_pThemeProvider = pThemeProvider;
@@ -700,12 +261,13 @@ FWL_Error CFWL_ComboBoxImp::SetThemeProvider(
m_pEdit->SetThemeProvider(pThemeProvider);
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBoxImp::GetCurSel() {
+
+int32_t IFWL_ComboBox::GetCurSel() {
return m_iCurSel;
}
-FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
- int32_t iCount =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems();
+
+FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
+ int32_t iCount = m_pListBox->CountItems();
FX_BOOL bClearSel = iSel < 0 || iSel >= iCount;
FX_BOOL bDropDown = IsDropDownStyle();
if (bDropDown && m_pEdit) {
@@ -715,9 +277,8 @@ FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, iSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->SetText(wsText);
}
m_pEdit->Update();
@@ -726,79 +287,87 @@ FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) {
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void IFWL_ComboBox::SetStates(uint32_t dwStates, FX_BOOL bSet) {
FX_BOOL bIsDropDown = IsDropDownStyle();
if (bIsDropDown && m_pEdit)
m_pEdit->SetStates(dwStates, bSet);
if (m_pListBox)
m_pListBox->SetStates(dwStates, bSet);
- CFWL_WidgetImp::SetStates(dwStates, bSet);
+ IFWL_Widget::SetStates(dwStates, bSet);
}
-FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) {
+FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
if (!m_pEdit)
return FWL_Error::Indefinite;
m_pEdit->SetText(wsText);
return m_pEdit->Update();
}
-int32_t CFWL_ComboBoxImp::GetEditTextLength() const {
+
+int32_t IFWL_ComboBox::GetEditTextLength() const {
if (!m_pEdit)
return -1;
return m_pEdit->GetTextLength();
}
-FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+
+FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
if (m_pEdit) {
return m_pEdit->GetText(wsText, nStart, nCount);
} else if (m_pListBox) {
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
return m_pListBox->GetItemText(hItem, wsText);
}
return FWL_Error::Indefinite;
}
-FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) {
+
+FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
if (!m_pEdit)
return FWL_Error::Indefinite;
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected();
+ m_pEdit->ClearSelected();
m_pEdit->AddSelRange(nStart, nCount);
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
+
+int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pEdit)
return -1;
return m_pEdit->GetSelRange(nIndex, nStart);
}
-int32_t CFWL_ComboBoxImp::GetEditLimit() {
+
+int32_t IFWL_ComboBox::GetEditLimit() {
if (!m_pEdit)
return -1;
return m_pEdit->GetLimit();
}
-FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) {
+
+FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
if (!m_pEdit)
return FWL_Error::Indefinite;
return m_pEdit->SetLimit(nLimit);
}
-FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) {
+
+FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
if (!m_pEdit)
return FWL_Error::Indefinite;
return m_pEdit->DoClipboard(iCmd);
}
-FX_BOOL CFWL_ComboBoxImp::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdit && m_pEdit->Redo(pRecord);
}
-FX_BOOL CFWL_ComboBoxImp::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdit && m_pEdit->Undo(pRecord);
}
-IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() {
+IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
return m_pListBox.get();
}
-FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
+
+FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() {
if (!m_bNeedShowList) {
return FALSE;
}
@@ -809,53 +378,68 @@ FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
m_bNeedShowList = FALSE;
return TRUE;
}
-FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) {
+
+FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
ShowDropList(bActivate);
return FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanUndo() {
+
+FX_BOOL IFWL_ComboBox::EditCanUndo() {
return m_pEdit->CanUndo();
}
-FX_BOOL CFWL_ComboBoxImp::EditCanRedo() {
+
+FX_BOOL IFWL_ComboBox::EditCanRedo() {
return m_pEdit->CanRedo();
}
-FX_BOOL CFWL_ComboBoxImp::EditUndo() {
+
+FX_BOOL IFWL_ComboBox::EditUndo() {
return m_pEdit->Undo();
}
-FX_BOOL CFWL_ComboBoxImp::EditRedo() {
+
+FX_BOOL IFWL_ComboBox::EditRedo() {
return m_pEdit->Redo();
}
-FX_BOOL CFWL_ComboBoxImp::EditCanCopy() {
+
+FX_BOOL IFWL_ComboBox::EditCanCopy() {
return m_pEdit->CountSelRanges() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanCut() {
+
+FX_BOOL IFWL_ComboBox::EditCanCut() {
if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) {
return FALSE;
}
return m_pEdit->CountSelRanges() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCanSelectAll() {
+
+FX_BOOL IFWL_ComboBox::EditCanSelectAll() {
return m_pEdit->GetTextLength() > 0;
}
-FX_BOOL CFWL_ComboBoxImp::EditCopy(CFX_WideString& wsCopy) {
+
+FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
return m_pEdit->Copy(wsCopy);
}
-FX_BOOL CFWL_ComboBoxImp::EditCut(CFX_WideString& wsCut) {
+
+FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
return m_pEdit->Cut(wsCut);
}
-FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) {
+
+FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
return m_pEdit->Paste(wsPaste);
}
-FX_BOOL CFWL_ComboBoxImp::EditSelectAll() {
+
+FX_BOOL IFWL_ComboBox::EditSelectAll() {
return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditDelete() {
+
+FX_BOOL IFWL_ComboBox::EditDelete() {
return m_pEdit->ClearText() == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ComboBoxImp::EditDeSelect() {
+
+FX_BOOL IFWL_ComboBox::EditDeSelect() {
return m_pEdit->ClearSelections() == FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_GetBBox(rect);
}
@@ -869,31 +453,33 @@ FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (!m_pEdit)
return FWL_Error::ParameterInvalid;
return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FX_FLOAT CFWL_ComboBoxImp::GetListHeight() {
+FX_FLOAT IFWL_ComboBox::GetListHeight() {
return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider)
- ->GetListHeight(m_pInterface);
+ ->GetListHeight(this);
}
-void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ComboBox::DrawStretchHandler(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
param.m_pGraphics = pGraphics;
param.m_iPart = CFWL_Part::StretchHandler;
param.m_dwStates = CFWL_PartState_Normal;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
if (pMatrix) {
param.m_matrix.Concat(*pMatrix);
}
param.m_rtPart = m_rtHandler;
m_pProperties->m_pThemeProvider->DrawBackground(&param);
}
-void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
+
+void IFWL_ComboBox::ShowDropList(FX_BOOL bActivate) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ShowDropList(bActivate);
}
@@ -906,8 +492,7 @@ void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
}
m_pListProxyDelegate->Reset();
if (bActivate) {
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->ChangeSelected(m_iCurSel);
+ m_pListBox->ChangeSelected(m_iCurSel);
ReSetListItemAlignment();
uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes &
(FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw);
@@ -950,58 +535,58 @@ void CFWL_ComboBoxImp::ShowDropList(FX_BOOL bActivate) {
m_pListBox->SetWidgetRect(m_rtList);
m_pListBox->Update();
CFWL_EvtCmbPreDropDown ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
DispatchEvent(&ev);
- m_fItemHeight =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->m_fItemHeight;
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->SetFocus(TRUE);
+ m_fItemHeight = m_pListBox->m_fItemHeight;
+ m_pListBox->SetFocus(TRUE);
m_pForm->DoModal();
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->SetFocus(FALSE);
+ m_pListBox->SetFocus(FALSE);
} else {
m_pForm->EndDoModal();
CFWL_EvtCmbCloseUp ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
DispatchEvent(&ev);
m_bLButtonDown = FALSE;
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->m_bNotifyOwner =
- TRUE;
+ m_pListBox->m_bNotifyOwner = TRUE;
SetFocus(TRUE);
}
}
-FX_BOOL CFWL_ComboBoxImp::IsDropListShowed() {
+
+FX_BOOL IFWL_ComboBox::IsDropListShowed() {
return m_pForm && !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
}
-FX_BOOL CFWL_ComboBoxImp::IsDropDownStyle() const {
+
+FX_BOOL IFWL_ComboBox::IsDropDownStyle() const {
return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown;
}
-void CFWL_ComboBoxImp::MatchEditText() {
+
+void IFWL_ComboBox::MatchEditText() {
CFX_WideString wsText;
m_pEdit->GetText(wsText);
- int32_t iMatch =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->MatchItem(wsText);
+ int32_t iMatch = m_pListBox->MatchItem(wsText);
if (iMatch != m_iCurSel) {
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->ChangeSelected(iMatch);
+ m_pListBox->ChangeSelected(iMatch);
if (iMatch >= 0) {
SynchrEditText(iMatch);
}
} else if (iMatch >= 0) {
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
m_iCurSel = iMatch;
}
-void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) {
+
+void IFWL_ComboBox::SynchrEditText(int32_t iListItem) {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, iListItem);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, iListItem);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->SetText(wsText);
m_pEdit->Update();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
-void CFWL_ComboBoxImp::Layout() {
+
+void IFWL_ComboBox::Layout() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Layout();
}
@@ -1023,9 +608,8 @@ void CFWL_ComboBoxImp::Layout() {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -1033,7 +617,8 @@ void CFWL_ComboBoxImp::Layout() {
m_pEdit->Update();
}
}
-void CFWL_ComboBoxImp::ReSetTheme() {
+
+void IFWL_ComboBox::ReSetTheme() {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (!pTheme) {
pTheme = GetAvailableTheme();
@@ -1044,7 +629,8 @@ void CFWL_ComboBoxImp::ReSetTheme() {
if (m_pEdit && !m_pEdit->GetThemeProvider())
m_pEdit->SetThemeProvider(pTheme);
}
-void CFWL_ComboBoxImp::ReSetEditAlignment() {
+
+void IFWL_ComboBox::ReSetEditAlignment() {
if (!m_pEdit)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -1081,7 +667,8 @@ void CFWL_ComboBoxImp::ReSetEditAlignment() {
FWL_STYLEEXT_EDT_HAlignModeMask |
FWL_STYLEEXT_EDT_VAlignMask);
}
-void CFWL_ComboBoxImp::ReSetListItemAlignment() {
+
+void IFWL_ComboBox::ReSetListItemAlignment() {
if (!m_pListBox)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -1097,26 +684,27 @@ void CFWL_ComboBoxImp::ReSetListItemAlignment() {
}
m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask);
}
-void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) {
+
+void IFWL_ComboBox::ProcessSelChanged(FX_BOOL bLButtonUp) {
IFWL_ComboBoxDP* pDatas =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- m_iCurSel = pDatas->GetItemIndex(m_pInterface, m_pListBox->GetSelItem(0));
+ m_iCurSel = pDatas->GetItemIndex(this, m_pListBox->GetSelItem(0));
FX_BOOL bDropDown = IsDropDownStyle();
if (bDropDown) {
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
if (hItem) {
CFX_WideString wsText;
- pData->GetItemText(m_pInterface, hItem, wsText);
+ pData->GetItemText(this, hItem, wsText);
if (m_pEdit) {
m_pEdit->SetText(wsText);
m_pEdit->Update();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetSelected();
+ m_pEdit->SetSelected();
}
CFWL_EvtCmbSelChanged ev;
ev.bLButtonUp = bLButtonUp;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
ev.iArraySels.Add(m_iCurSel);
DispatchEvent(&ev);
}
@@ -1125,27 +713,25 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) {
}
}
-void CFWL_ComboBoxImp::InitProxyForm() {
+void IFWL_ComboBox::InitProxyForm() {
if (m_pForm)
return;
if (!m_pListBox)
return;
CFWL_WidgetImpProperties propForm;
- propForm.m_pOwner = m_pInterface;
+ propForm.m_pOwner = this;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
- CFX_WideString className;
- m_pForm = IFWL_Form::CreateFormProxy(propForm, &className, m_pListBox.get());
+ m_pForm = IFWL_FormProxy::Create(propForm, m_pListBox.get());
m_pForm->Initialize();
- m_pProxy = static_cast<CFWL_FormProxyImp*>(m_pForm->GetImpl());
m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
- m_pProxy->SetDelegate(m_pListProxyDelegate);
+ m_pForm->SetDelegate(m_pListProxyDelegate);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_ComboBox::DisForm_Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
@@ -1154,41 +740,42 @@ FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() {
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::DisForm_InitComboList() {
+void IFWL_ComboBox::DisForm_InitComboList() {
if (m_pListBox)
return;
CFWL_WidgetImpProperties prop;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop.m_dwStates = FWL_WGTSTATE_Invisible;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface));
+ m_pListBox.reset(IFWL_ComboList::Create(prop, this));
m_pListBox->Initialize();
}
-void CFWL_ComboBoxImp::DisForm_InitComboEdit() {
+
+void IFWL_ComboBox::DisForm_InitComboEdit() {
if (m_pEdit) {
return;
}
CFWL_WidgetImpProperties prop;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(IFWL_Edit::CreateComboEdit(prop, m_pInterface));
+ m_pEdit.reset(IFWL_ComboEdit::Create(prop, this));
m_pEdit->Initialize();
- static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface);
+ m_pEdit->SetOuter(this);
}
-void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
+
+void IFWL_ComboBox::DisForm_ShowDropList(FX_BOOL bActivate) {
FX_BOOL bDropList = DisForm_IsDropListShowed();
if (bDropList == bActivate) {
return;
}
if (bActivate) {
CFWL_EvtCmbPreDropDown preEvent;
- preEvent.m_pSrcTarget = m_pInterface;
+ preEvent.m_pSrcTarget = this;
DispatchEvent(&preEvent);
- CFWL_ComboListImp* pComboList =
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl());
+ IFWL_ComboList* pComboList = m_pListBox.get();
int32_t iItems = pComboList->CountItems();
if (iItems < 1) {
return;
@@ -1216,7 +803,7 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
m_pListBox->SetStates(FWL_WGTSTATE_Invisible, !bActivate);
if (bActivate) {
CFWL_EvtCmbPostDropDown postEvent;
- postEvent.m_pSrcTarget = m_pInterface;
+ postEvent.m_pSrcTarget = this;
DispatchEvent(&postEvent);
}
CFX_RectF rect;
@@ -1224,11 +811,13 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) {
rect.Inflate(2, 2);
Repaint(&rect);
}
-FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() {
+
+FX_BOOL IFWL_ComboBox::DisForm_IsDropListShowed() {
return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+
+FWL_Error IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
if (!m_pEdit) {
DisForm_InitComboEdit();
}
@@ -1241,9 +830,10 @@ FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
} else if (bDelDropDown) {
m_pEdit->ModifyStylesEx(FWL_STYLEEXT_EDT_ReadOnly, 0);
}
- return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
+ return IFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-FWL_Error CFWL_ComboBoxImp::DisForm_Update() {
+
+FWL_Error IFWL_ComboBox::DisForm_Update() {
if (m_iLock) {
return FWL_Error::Indefinite;
}
@@ -1254,7 +844,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_Update() {
Layout();
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rect;
rect.Set(0, 0, m_pProperties->m_rtWidget.width - m_rtBtn.width,
m_pProperties->m_rtWidget.height);
@@ -1269,8 +860,9 @@ FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
}
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFX_Matrix mtOrg;
mtOrg.Set(1, 0, 0, 1, 0, 0);
@@ -1282,7 +874,7 @@ FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
pGraphics->ConcatMatrix(&mtOrg);
if (!m_rtBtn.IsEmpty(0.1f)) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
param.m_dwStates = m_iBtnState;
param.m_pGraphics = pGraphics;
@@ -1308,7 +900,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
if (m_pListBox && DisForm_IsDropListShowed()) {
CFX_RectF rtList;
@@ -1318,7 +911,8 @@ FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) {
}
return FWL_Error::Succeeded;
}
-void CFWL_ComboBoxImp::DisForm_Layout() {
+
+void IFWL_ComboBox::DisForm_Layout() {
GetClientRect(m_rtClient);
m_rtContent = m_rtClient;
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
@@ -1347,9 +941,8 @@ void CFWL_ComboBoxImp::DisForm_Layout() {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
- ->GetItemText(hItem, wsText);
+ IFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
m_pEdit->LockUpdate();
m_pEdit->SetText(wsText);
m_pEdit->UnlockUpdate();
@@ -1358,7 +951,7 @@ void CFWL_ComboBoxImp::DisForm_Layout() {
}
}
-CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner)
+CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(IFWL_ComboBox* pOwner)
: m_pOwner(pOwner) {}
void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1406,9 +999,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKey(static_cast<CFWL_MsgKey*>(pMessage));
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
@@ -1420,7 +1011,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
CFWL_EvtLtbDrawItem* pDrawItemEvent =
static_cast<CFWL_EvtLtbDrawItem*>(pEvent);
CFWL_EvtCmbDrawItem pTemp;
- pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
+ pTemp.m_pSrcTarget = m_pOwner;
pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics;
pTemp.m_index = pDrawItemEvent->m_index;
pTemp.m_rtItem = pDrawItemEvent->m_rect;
@@ -1428,7 +1019,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
} else if (dwFlag == CFWL_EventType::Scroll) {
CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
CFWL_EvtScroll pScrollEv;
- pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface;
+ pScrollEv.m_pSrcTarget = m_pOwner;
pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode;
pScrollEv.m_fPos = pScrollEvent->m_fPos;
m_pOwner->DispatchEvent(&pScrollEv);
@@ -1436,7 +1027,7 @@ void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
CFWL_EvtEdtTextChanged* pTextChangedEvent =
static_cast<CFWL_EvtEdtTextChanged*>(pEvent);
CFWL_EvtCmbEditChanged pTemp;
- pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
+ pTemp.m_pSrcTarget = m_pOwner;
pTemp.wsInsert = pTextChangedEvent->wsInsert;
pTemp.wsDelete = pTextChangedEvent->wsDelete;
pTemp.nChangeType = pTextChangedEvent->nChangeType;
@@ -1459,8 +1050,7 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
if (bDropDown && pSrcTarget != m_pOwner->m_pListBox.get()) {
if (!m_pOwner->m_pEdit)
return;
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->SetSelected();
+ m_pOwner->m_pEdit->SetSelected();
} else {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
@@ -1469,15 +1059,14 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
if (bDropDown && pDstTarget != m_pOwner->m_pListBox.get()) {
if (!m_pOwner->m_pEdit)
return;
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->FlagFocus(FALSE);
- static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
- ->ClearSelected();
+ m_pOwner->m_pEdit->FlagFocus(FALSE);
+ m_pOwner->m_pEdit->ClearSelected();
} else {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
}
}
+
void CFWL_ComboBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
return;
@@ -1497,6 +1086,7 @@ void CFWL_ComboBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
}
+
void CFWL_ComboBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDown = FALSE;
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
@@ -1506,6 +1096,7 @@ void CFWL_ComboBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
+
void CFWL_ComboBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
int32_t iOldState = m_pOwner->m_iBtnState;
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
@@ -1520,6 +1111,7 @@ void CFWL_ComboBoxImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
}
+
void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (!m_pOwner->IsDropListShowed() &&
!((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) ==
@@ -1528,23 +1120,23 @@ void CFWL_ComboBoxImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
}
+
void CFWL_ComboBoxImpDelegate::OnKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
if (dwKeyCode == FWL_VKEY_Tab) {
m_pOwner->DispatchKeyEvent(pMsg);
return;
}
- if (pMsg->m_pDstTarget == m_pOwner->m_pInterface)
+ if (pMsg->m_pDstTarget == m_pOwner)
DoSubCtrlKey(pMsg);
}
+
void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
const bool bUp = dwKeyCode == FWL_VKEY_Up;
const bool bDown = dwKeyCode == FWL_VKEY_Down;
if (bUp || bDown) {
- int32_t iCount =
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->CountItems();
+ int32_t iCount = m_pOwner->m_pListBox->CountItems();
if (iCount < 1) {
return;
}
@@ -1554,15 +1146,13 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
if (bDropDown && m_pOwner->m_pEdit) {
CFX_WideString wsText;
m_pOwner->m_pEdit->GetText(wsText);
- iCurSel = static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->MatchItem(wsText);
+ iCurSel = m_pOwner->m_pListBox->MatchItem(wsText);
if (iCurSel >= 0) {
CFX_WideString wsTemp;
IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(
m_pOwner->m_pProperties->m_pDataProvider);
- IFWL_ListItem* hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel);
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
- ->GetItemText(hItem, wsTemp);
+ IFWL_ListItem* hItem = pData->GetItem(m_pOwner, iCurSel);
+ m_pOwner->m_pListBox->GetItemText(hItem, wsTemp);
bMatchEqual = wsText == wsTemp;
}
}
@@ -1592,6 +1182,7 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
pDelegate->OnProcessMessage(pMsg);
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
CFWL_Message* pMessage) {
if (!pMessage)
@@ -1671,6 +1262,7 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
if (bSet) {
@@ -1692,13 +1284,13 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
pDelegate->OnProcessMessage(&msg);
}
}
+
void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
const bool bUp = dwKeyCode == FWL_VKEY_Up;
const bool bDown = dwKeyCode == FWL_VKEY_Down;
if (bUp || bDown) {
- CFWL_ComboListImp* pComboList =
- static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl());
+ IFWL_ComboList* pComboList = m_pOwner->m_pListBox.get();
int32_t iCount = pComboList->CountItems();
if (iCount < 1) {
return;
@@ -1738,9 +1330,8 @@ void CFWL_ComboBoxImpDelegate::DisForm_OnKey(CFWL_MsgKey* pMsg) {
}
}
-CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(
- IFWL_Form* pForm,
- CFWL_ComboBoxImp* pComboBox)
+CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate(IFWL_Form* pForm,
+ IFWL_ComboBox* pComboBox)
: m_bLButtonDown(FALSE),
m_bLButtonUpSelf(FALSE),
m_fStartPos(0),
@@ -1814,6 +1405,7 @@ void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pComboBox->ShowDropList(FALSE);
}
}
+
void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonDown = FALSE;
IFWL_App* pApp = m_pForm->GetOwnerApp();
@@ -1835,10 +1427,13 @@ void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonUpSelf = TRUE;
}
}
+
void CFWL_ComboProxyImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {}
+
void CFWL_ComboProxyImpDelegate::OnDeactive(CFWL_MsgDeactivate* pMsg) {
m_pComboBox->ShowDropList(FALSE);
}
+
void CFWL_ComboProxyImpDelegate::OnFocusChanged(CFWL_MsgKillFocus* pMsg,
FX_BOOL bSet) {
if (!bSet) {
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/core/ifwl_combobox.h
index 0ed5dbb1fa..106b7c0c08 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -4,93 +4,94 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_COMBOBOX_H_
+#define XFA_FWL_CORE_IFWL_COMBOBOX_H_
-#include <memory>
+#include "xfa/fwl/core/ifwl_form.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
+#include "xfa/fxgraphics/cfx_graphics.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_listboximp.h"
-
-class CFWL_WidgetImp;
-class CFWL_WidgetImpProperties;
-class CFWL_WidgetImpDelegate;
-class CFWL_ListBoxImp;
-class CFWL_ListBoxImpDelegate;
-class CFWL_FormProxyImp;
-class IFWL_Widget;
-class CFWL_ComboEditImp;
+class CFWL_ComboBoxImpDelegate;
class CFWL_ComboEditImpDelegate;
-class CFWL_ComboListImp;
class CFWL_ComboListImpDelegate;
-class CFWL_ComboBoxImp;
-class CFWL_ComboBoxImpDelegate;
class CFWL_ComboProxyImpDelegate;
-class CFWL_ComboEditImp : public CFWL_EditImp {
- public:
- CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- void ClearSelected();
- void SetSelected();
- void EndCaret();
- void FlagFocus(FX_BOOL bSet);
+class CFWL_ListBoxImpDelegate;
+class CFWL_WidgetImpProperties;
+class CFWL_WidgetImpDelegate;
+class IFWL_ComboBox;
+class IFWL_ComboEdit;
+class IFWL_ComboList;
+class IFWL_FormProxy;
+class IFWL_ListBox;
+class IFWL_Widget;
- protected:
- void SetComboBoxFocus(FX_BOOL bSet);
- CFWL_ComboBoxImp* m_pOuter;
- friend class CFWL_ComboEditImpDelegate;
-};
-class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate {
+#define FWL_CLASS_ComboBox L"FWL_COMBOBOX"
+#define FWL_STYLEEXT_CMB_DropList (0L << 0)
+#define FWL_STYLEEXT_CMB_DropDown (1L << 0)
+#define FWL_STYLEEXT_CMB_Sort (1L << 1)
+#define FWL_STYLEEXT_CMB_ListDrag (1L << 2)
+#define FWL_STYLEEXT_CMB_OwnerDraw (1L << 3)
+#define FWL_STYLEEXT_CMB_EditHNear (0L << 4)
+#define FWL_STYLEEXT_CMB_EditHCenter (1L << 4)
+#define FWL_STYLEEXT_CMB_EditHFar (2L << 4)
+#define FWL_STYLEEXT_CMB_EditVNear (0L << 6)
+#define FWL_STYLEEXT_CMB_EditVCenter (1L << 6)
+#define FWL_STYLEEXT_CMB_EditVFar (2L << 6)
+#define FWL_STYLEEXT_CMB_EditJustified (1L << 8)
+#define FWL_STYLEEXT_CMB_EditDistributed (2L << 8)
+#define FWL_STYLEEXT_CMB_EditHAlignMask (3L << 4)
+#define FWL_STYLEEXT_CMB_EditVAlignMask (3L << 6)
+#define FWL_STYLEEXT_CMB_EditHAlignModeMask (3L << 8)
+#define FWL_STYLEEXT_CMB_ListItemLeftAlign (0L << 10)
+#define FWL_STYLEEXT_CMB_ListItemCenterAlign (1L << 10)
+#define FWL_STYLEEXT_CMB_ListItemRightAlign (2L << 10)
+#define FWL_STYLEEXT_CMB_ListItemAlignMask (3L << 10)
+#define FWL_STYLEEXT_CMB_ListItemText (0L << 12)
+#define FWL_STYLEEXT_CMB_ListItemIconText (1L << 12)
+#define FWL_STYLEEXT_CMB_ReadOnly (1L << 13)
+
+FWL_EVENT_DEF(CFWL_EvtCmbPreDropDown, CFWL_EventType::PreDropDown)
+
+FWL_EVENT_DEF(CFWL_EvtCmbPostDropDown, CFWL_EventType::PostDropDown)
+
+FWL_EVENT_DEF(CFWL_EvtCmbCloseUp, CFWL_EventType::CloseUp)
+
+FWL_EVENT_DEF(CFWL_EvtCmbEditChanged,
+ CFWL_EventType::EditChanged,
+ int32_t nChangeType;
+ CFX_WideString wsInsert;
+ CFX_WideString wsDelete;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbSelChanged,
+ CFWL_EventType::SelectChanged,
+ CFX_Int32Array iArraySels;
+ FX_BOOL bLButtonUp;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbHoverChanged,
+ CFWL_EventType::HoverChanged,
+ int32_t m_iCurHover;)
+
+FWL_EVENT_DEF(CFWL_EvtCmbDrawItem,
+ CFWL_EventType::DrawItem,
+ CFX_Graphics* m_pGraphics;
+ CFX_Matrix m_matrix;
+ int32_t m_index;
+ CFX_RectF m_rtItem;)
+
+class IFWL_ComboBoxDP : public IFWL_ListBoxDP {
public:
- CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
-
- protected:
- CFWL_ComboEditImp* m_pOwner;
+ virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget) = 0;
};
-class CFWL_ComboListImp : public CFWL_ListBoxImp {
- public:
- CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- // CFWL_WidgetImp
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
-
- int32_t MatchItem(const CFX_WideString& wsMatch);
- void ChangeSelected(int32_t iSel);
- int32_t CountItems();
- void GetItemRect(int32_t nIndex, CFX_RectF& rtItem);
- void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
- void SetFocus(FX_BOOL bSet);
-
- FX_BOOL m_bNotifyOwner;
-
- friend class CFWL_ComboListImpDelegate;
- friend class CFWL_ComboBoxImp;
-};
-class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate {
+class IFWL_ComboBox : public IFWL_Widget {
public:
- CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
+ static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties);
- protected:
- void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
- int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg);
- int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg);
- int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg);
- int32_t OnDropListKey(CFWL_MsgKey* pKey);
- void OnDropListKeyDown(CFWL_MsgKey* pKey);
- CFWL_ComboListImp* m_pOwner;
-};
-class CFWL_ComboBoxImp : public CFWL_WidgetImp {
- public:
- CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_ComboBoxImp() override;
+ IFWL_ComboBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_ComboBox() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -140,12 +141,12 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
uint32_t dwStylesExRemoved);
protected:
- friend class CFWL_ComboListImp;
- friend class CFWL_ComboEditImp;
+ friend class CFWL_ComboBoxImpDelegate;
friend class CFWL_ComboEditImpDelegate;
friend class CFWL_ComboListImpDelegate;
- friend class CFWL_ComboBoxImpDelegate;
friend class CFWL_ComboProxyImpDelegate;
+ friend class IFWL_ComboEdit;
+ friend class IFWL_ComboList;
void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
FX_FLOAT GetListHeight();
@@ -180,9 +181,9 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
CFX_RectF m_rtList;
CFX_RectF m_rtProxy;
CFX_RectF m_rtHandler;
- std::unique_ptr<IFWL_Edit> m_pEdit;
- std::unique_ptr<IFWL_ListBox> m_pListBox;
- IFWL_Form* m_pForm;
+ std::unique_ptr<IFWL_ComboEdit> m_pEdit;
+ std::unique_ptr<IFWL_ComboList> m_pListBox;
+ IFWL_FormProxy* m_pForm;
FX_BOOL m_bLButtonDown;
FX_BOOL m_bUpFormHandler;
int32_t m_iCurSel;
@@ -190,12 +191,12 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp {
FX_FLOAT m_fComboFormHandler;
FX_FLOAT m_fItemHeight;
FX_BOOL m_bNeedShowList;
- CFWL_FormProxyImp* m_pProxy;
CFWL_ComboProxyImpDelegate* m_pListProxyDelegate;
};
+
class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner);
+ CFWL_ComboBoxImpDelegate(IFWL_ComboBox* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -209,21 +210,19 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKey(CFWL_MsgKey* pMsg);
void DoSubCtrlKey(CFWL_MsgKey* pMsg);
-
- protected:
void DisForm_OnProcessMessage(CFWL_Message* pMessage);
void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg);
void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
void DisForm_OnKey(CFWL_MsgKey* pMsg);
- protected:
- CFWL_ComboBoxImp* m_pOwner;
+ IFWL_ComboBox* m_pOwner;
friend class CFWL_ComboEditImpDelegate;
friend class CFWL_ComboListImpDelegate;
};
+
class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox);
+ CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, IFWL_ComboBox* pComboBox);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
@@ -239,7 +238,7 @@ class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate {
FX_BOOL m_bLButtonUpSelf;
FX_FLOAT m_fStartPos;
IFWL_Form* m_pForm;
- CFWL_ComboBoxImp* m_pComboBox;
+ IFWL_ComboBox* m_pComboBox;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_COMBOBOXIMP_H_
+#endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_
diff --git a/xfa/fwl/core/ifwl_comboedit.cpp b/xfa/fwl/core/ifwl_comboedit.cpp
new file mode 100644
index 0000000000..f345090fca
--- /dev/null
+++ b/xfa/fwl/core/ifwl_comboedit.cpp
@@ -0,0 +1,86 @@
+// 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/ifwl_comboedit.h"
+
+#include "xfa/fde/cfde_txtedtengine.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
+
+// static
+IFWL_ComboEdit* IFWL_ComboEdit::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_ComboEdit(properties, pOuter);
+}
+
+IFWL_ComboEdit::IFWL_ComboEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Edit(properties, pOuter) {
+ m_pOuter = static_cast<IFWL_ComboBox*>(pOuter);
+}
+
+void IFWL_ComboEdit::ClearSelected() {
+ ClearSelections();
+ Repaint(&m_rtClient);
+}
+
+void IFWL_ComboEdit::SetSelected() {
+ FlagFocus(TRUE);
+ EndCaret();
+ AddSelRange(0);
+}
+
+void IFWL_ComboEdit::EndCaret() {
+ m_pEdtEngine->MoveCaretPos(MC_End);
+}
+
+void IFWL_ComboEdit::FlagFocus(FX_BOOL bSet) {
+ if (bSet) {
+ m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
+ } else {
+ m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
+ ShowCaret(FALSE);
+ }
+}
+
+void IFWL_ComboEdit::SetComboBoxFocus(FX_BOOL bSet) {
+ m_pOuter->SetFocus(bSet);
+}
+
+CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(IFWL_ComboEdit* pOwner)
+ : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
+
+void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ if (!pMessage)
+ return;
+
+ FX_BOOL backDefault = TRUE;
+ switch (pMessage->GetClassID()) {
+ case CFWL_MessageType::SetFocus: {
+ m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
+ backDefault = FALSE;
+ break;
+ }
+ case CFWL_MessageType::KillFocus: {
+ m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
+ backDefault = FALSE;
+ break;
+ }
+ case CFWL_MessageType::Mouse: {
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
+ if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
+ ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
+ m_pOwner->SetSelected();
+ m_pOwner->SetComboBoxFocus(TRUE);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ if (backDefault)
+ CFWL_EditImpDelegate::OnProcessMessage(pMessage);
+}
diff --git a/xfa/fwl/core/ifwl_comboedit.h b/xfa/fwl/core/ifwl_comboedit.h
new file mode 100644
index 0000000000..22c3f01e41
--- /dev/null
+++ b/xfa/fwl/core/ifwl_comboedit.h
@@ -0,0 +1,44 @@
+// 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_COMBOEDIT_H_
+#define XFA_FWL_CORE_IFWL_COMBOEDIT_H_
+
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+class IFWL_ComboBox;
+
+class IFWL_ComboEdit : public IFWL_Edit {
+ public:
+ static IFWL_ComboEdit* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_ComboEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ void ClearSelected();
+ void SetSelected();
+ void EndCaret();
+ void FlagFocus(FX_BOOL bSet);
+
+ protected:
+ void SetComboBoxFocus(FX_BOOL bSet);
+ IFWL_ComboBox* m_pOuter;
+ friend class CFWL_ComboEditImpDelegate;
+};
+
+class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate {
+ public:
+ CFWL_ComboEditImpDelegate(IFWL_ComboEdit* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+
+ protected:
+ IFWL_ComboEdit* m_pOwner;
+};
+
+#endif // XFA_FWL_CORE_IFWL_COMBOEDIT_H_
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp
new file mode 100644
index 0000000000..9090622b10
--- /dev/null
+++ b/xfa/fwl/core/ifwl_combolist.cpp
@@ -0,0 +1,298 @@
+// 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/ifwl_combolist.h"
+
+#include "xfa/fwl/core/ifwl_combobox.h"
+#include "xfa/fwl/core/ifwl_comboedit.h"
+
+// static
+IFWL_ComboList* IFWL_ComboList::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_ComboList(properties, pOuter);
+}
+
+IFWL_ComboList::IFWL_ComboList(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_ListBox(properties, pOuter), m_bNotifyOwner(TRUE) {
+ ASSERT(pOuter);
+}
+
+FWL_Error IFWL_ComboList::Initialize() {
+ if (IFWL_ListBox::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
+ delete m_pDelegate;
+ m_pDelegate = new CFWL_ComboListImpDelegate(this);
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_ComboList::Finalize() {
+ delete m_pDelegate;
+ m_pDelegate = nullptr;
+ return IFWL_ListBox::Finalize();
+}
+
+int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
+ if (wsMatch.IsEmpty()) {
+ return -1;
+ }
+ if (!m_pProperties->m_pDataProvider)
+ return -1;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
+ int32_t iCount = pData->CountItems(this);
+ for (int32_t i = 0; i < iCount; i++) {
+ IFWL_ListItem* hItem = pData->GetItem(this, i);
+ CFX_WideString wsText;
+ pData->GetItemText(this, hItem, wsText);
+ FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
+ if (!pos) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+void IFWL_ComboList::ChangeSelected(int32_t iSel) {
+ if (!m_pProperties->m_pDataProvider)
+ return;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
+ IFWL_ListItem* hItem = pData->GetItem(this, iSel);
+ CFX_RectF rtInvalidate;
+ rtInvalidate.Reset();
+ IFWL_ListItem* hOld = GetSelItem(0);
+ int32_t iOld = pData->GetItemIndex(this, hOld);
+ if (iOld == iSel) {
+ return;
+ } else if (iOld > -1) {
+ GetItemRect(iOld, rtInvalidate);
+ SetSelItem(hOld, FALSE);
+ }
+ if (hItem) {
+ CFX_RectF rect;
+ GetItemRect(iSel, rect);
+ rtInvalidate.Union(rect);
+ IFWL_ListItem* hSel = pData->GetItem(this, iSel);
+ SetSelItem(hSel, TRUE);
+ }
+ if (!rtInvalidate.IsEmpty()) {
+ Repaint(&rtInvalidate);
+ }
+}
+
+int32_t IFWL_ComboList::CountItems() {
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
+ return pData ? pData->CountItems(this) : 0;
+}
+
+void IFWL_ComboList::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) {
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
+ IFWL_ListItem* hItem = pData->GetItem(this, nIndex);
+ pData->GetItemRect(this, hItem, rtItem);
+}
+
+void IFWL_ComboList::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
+ fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top;
+ IFWL_Widget* pOwner = GetOwner();
+ if (!pOwner)
+ return;
+ pOwner->TransformTo(m_pOuter, fx, fy);
+}
+
+void IFWL_ComboList::SetFocus(FX_BOOL bSet) {
+ IFWL_Widget::SetFocus(bSet);
+}
+
+CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(IFWL_ComboList* pOwner)
+ : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {}
+
+void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ if (!pMessage)
+ return;
+
+ CFWL_MessageType dwHashCode = pMessage->GetClassID();
+ FX_BOOL backDefault = TRUE;
+ if (dwHashCode == CFWL_MessageType::SetFocus ||
+ dwHashCode == CFWL_MessageType::KillFocus) {
+ OnDropListFocusChanged(pMessage, dwHashCode == CFWL_MessageType::SetFocus);
+ } else if (dwHashCode == CFWL_MessageType::Mouse) {
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
+ if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
+ CFX_RectF rect;
+ m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
+ if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ pMsg->m_fx -= rect.left;
+ pMsg->m_fy -= rect.top;
+ IFWL_WidgetDelegate* pDelegate =
+ m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
+ pDelegate->OnProcessMessage(pMsg);
+ return;
+ }
+ }
+ switch (pMsg->m_dwCmd) {
+ case FWL_MouseCommand::Move: {
+ backDefault = FALSE;
+ OnDropListMouseMove(pMsg);
+ break;
+ }
+ case FWL_MouseCommand::LeftButtonDown: {
+ backDefault = FALSE;
+ OnDropListLButtonDown(pMsg);
+ break;
+ }
+ case FWL_MouseCommand::LeftButtonUp: {
+ backDefault = FALSE;
+ OnDropListLButtonUp(pMsg);
+ break;
+ }
+ default:
+ break;
+ }
+ } else if (dwHashCode == CFWL_MessageType::Key) {
+ backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
+ }
+ if (backDefault)
+ CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage);
+}
+
+void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
+ FX_BOOL bSet) {
+ if (!bSet) {
+ CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg);
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ if (pKill->m_pSetFocus == m_pOwner->m_pOuter ||
+ pKill->m_pSetFocus == pOuter->m_pEdit.get()) {
+ pOuter->ShowDropList(FALSE);
+ }
+ }
+}
+
+int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if (m_pOwner->m_bNotifyOwner) {
+ m_pOwner->m_bNotifyOwner = FALSE;
+ }
+ if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
+ CFX_RectF rect;
+ m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
+ if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ return 1;
+ }
+ }
+ IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ if (hItem) {
+ if (!m_pOwner->m_pProperties->m_pDataProvider)
+ return 0;
+ IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
+ m_pOwner->m_pProperties->m_pDataProvider);
+ int32_t iSel = pData->GetItemIndex(m_pOwner, hItem);
+ CFWL_EvtCmbHoverChanged event;
+ event.m_pSrcTarget = m_pOwner->m_pOuter;
+ event.m_iCurHover = iSel;
+ m_pOwner->DispatchEvent(&event);
+ m_pOwner->ChangeSelected(iSel);
+ }
+ } else if (m_pOwner->m_bNotifyOwner) {
+ m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ }
+ return 1;
+}
+
+int32_t CFWL_ComboListImpDelegate::OnDropListLButtonDown(CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ return 0;
+ }
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ pOuter->ShowDropList(FALSE);
+ return 1;
+}
+
+int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ if (m_pOwner->m_bNotifyOwner) {
+ m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
+ pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ } else {
+ if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
+ CFX_RectF rect;
+ m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
+ if (rect.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ return 1;
+ }
+ }
+ pOuter->ShowDropList(FALSE);
+ IFWL_ListItem* hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
+ if (hItem) {
+ pOuter->ProcessSelChanged(TRUE);
+ }
+ }
+ return 1;
+}
+
+int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ FX_BOOL bPropagate = FALSE;
+ if (pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
+ uint32_t dwKeyCode = pKey->m_dwKeyCode;
+ switch (dwKeyCode) {
+ case FWL_VKEY_Return:
+ case FWL_VKEY_Escape: {
+ pOuter->ShowDropList(FALSE);
+ return 1;
+ }
+ case FWL_VKEY_Up:
+ case FWL_VKEY_Down: {
+ OnDropListKeyDown(pKey);
+ pOuter->SetDelegate(nullptr);
+ pOuter->ProcessSelChanged(FALSE);
+ return 1;
+ }
+ default: { bPropagate = TRUE; }
+ }
+ } else if (pKey->m_dwCmd == FWL_KeyCommand::Char) {
+ bPropagate = TRUE;
+ }
+ if (bPropagate) {
+ pKey->m_pDstTarget = m_pOwner->m_pOuter;
+ pOuter->m_pDelegate->OnProcessMessage(pKey);
+ return 1;
+ }
+ return 0;
+}
+
+void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) {
+ uint32_t dwKeyCode = pKey->m_dwKeyCode;
+ switch (dwKeyCode) {
+ case FWL_VKEY_Up:
+ case FWL_VKEY_Down:
+ case FWL_VKEY_Home:
+ case FWL_VKEY_End: {
+ IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
+ IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
+ m_pOwner->m_pProperties->m_pDataProvider);
+ IFWL_ListItem* hItem = pData->GetItem(m_pOwner, pOuter->m_iCurSel);
+ hItem = m_pOwner->GetItem(hItem, dwKeyCode);
+ if (!hItem) {
+ break;
+ }
+ m_pOwner->SetSelection(hItem, hItem, TRUE);
+ m_pOwner->ScrollToVisible(hItem);
+ CFX_RectF rtInvalidate;
+ rtInvalidate.Set(0, 0, m_pOwner->m_pProperties->m_rtWidget.width,
+ m_pOwner->m_pProperties->m_rtWidget.height);
+ m_pOwner->Repaint(&rtInvalidate);
+ break;
+ }
+ default:
+ break;
+ }
+}
diff --git a/xfa/fwl/core/ifwl_combolist.h b/xfa/fwl/core/ifwl_combolist.h
new file mode 100644
index 0000000000..74e79cd805
--- /dev/null
+++ b/xfa/fwl/core/ifwl_combolist.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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_COMBOLIST_H_
+#define XFA_FWL_CORE_IFWL_COMBOLIST_H_
+
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+class IFWL_ComboList : public IFWL_ListBox {
+ public:
+ static IFWL_ComboList* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_ComboList(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ // IFWL_Widget
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+
+ int32_t MatchItem(const CFX_WideString& wsMatch);
+ void ChangeSelected(int32_t iSel);
+ int32_t CountItems();
+ void GetItemRect(int32_t nIndex, CFX_RectF& rtItem);
+ void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
+ void SetFocus(FX_BOOL bSet);
+
+ FX_BOOL m_bNotifyOwner;
+
+ friend class CFWL_ComboListImpDelegate;
+ friend class IFWL_ComboBox;
+};
+
+class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate {
+ public:
+ CFWL_ComboListImpDelegate(IFWL_ComboList* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+
+ protected:
+ void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
+ int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg);
+ int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg);
+ int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg);
+ int32_t OnDropListKey(CFWL_MsgKey* pKey);
+ void OnDropListKeyDown(CFWL_MsgKey* pKey);
+ IFWL_ComboList* m_pOwner;
+};
+
+#endif // XFA_FWL_CORE_IFWL_COMBOLIST_H_
diff --git a/xfa/fwl/core/ifwl_datetimecalendar.cpp b/xfa/fwl/core/ifwl_datetimecalendar.cpp
new file mode 100644
index 0000000000..26d1f17da9
--- /dev/null
+++ b/xfa/fwl/core/ifwl_datetimecalendar.cpp
@@ -0,0 +1,222 @@
+// Copyright 2014 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/ifwl_datetimecalendar.h"
+
+#include "xfa/fwl/core/cfwl_widgetmgr.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
+#include "xfa/fwl/core/ifwl_formproxy.h"
+
+// static
+IFWL_DateTimeCalendar* IFWL_DateTimeCalendar::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_DateTimeCalendar(properties, pOuter);
+}
+
+IFWL_DateTimeCalendar::IFWL_DateTimeCalendar(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_MonthCalendar(properties, pOuter) {}
+
+FWL_Error IFWL_DateTimeCalendar::Initialize() {
+ if (IFWL_MonthCalendar::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
+ delete m_pDelegate;
+ m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this);
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_DateTimeCalendar::Finalize() {
+ delete m_pDelegate;
+ m_pDelegate = nullptr;
+ return IFWL_MonthCalendar::Finalize();
+}
+
+CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate(
+ IFWL_DateTimeCalendar* pOwner)
+ : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) {
+ m_bFlag = FALSE;
+}
+
+void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage(
+ CFWL_Message* pMessage) {
+ CFWL_MessageType dwCode = pMessage->GetClassID();
+ if (dwCode == CFWL_MessageType::SetFocus ||
+ dwCode == CFWL_MessageType::KillFocus) {
+ IFWL_Widget* pOuter = m_pOwner->GetOuter();
+ IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
+ pDelegate->OnProcessMessage(pMessage);
+ return;
+ }
+ if (dwCode == CFWL_MessageType::Mouse) {
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
+ if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown)
+ OnLButtonDownEx(pMsg);
+ else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp)
+ OnLButtonUpEx(pMsg);
+ return;
+ }
+ CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage);
+}
+
+void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed;
+ m_pOwner->PrevMonth();
+ m_pOwner->Repaint(&m_pOwner->m_rtClient);
+ } else if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iRBtnPartStates |= CFWL_PartState_Pressed;
+ m_pOwner->NextMonth();
+ m_pOwner->Repaint(&m_pOwner->m_rtClient);
+ } else if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ if ((m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) ==
+ 0) {
+ m_pOwner->JumpToToday();
+ m_pOwner->Repaint(&m_pOwner->m_rtClient);
+ }
+ } else {
+ IFWL_DateTimePicker* pIPicker =
+ static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
+ if (pIPicker->IsMonthCalendarShowed()) {
+ m_bFlag = 1;
+ }
+ }
+}
+
+void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
+ return DisForm_OnLButtonUpEx(pMsg);
+ }
+ if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iLBtnPartStates = 0;
+ m_pOwner->Repaint(&m_pOwner->m_rtLBtn);
+ return;
+ }
+ if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iRBtnPartStates = 0;
+ m_pOwner->Repaint(&m_pOwner->m_rtRBtn);
+ return;
+ }
+ if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ return;
+ }
+ int32_t iOldSel = 0;
+ if (m_pOwner->m_arrSelDays.GetSize() > 0) {
+ iOldSel = m_pOwner->m_arrSelDays[0];
+ }
+ int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
+ CFX_RectF rt;
+ IFWL_DateTimePicker* pIPicker =
+ static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
+ pIPicker->m_pForm->GetWidgetRect(rt);
+ rt.Set(0, 0, rt.width, rt.height);
+ if (iCurSel > 0) {
+ FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ CFX_RectF rtInvalidate(lpDatesInfo->rect);
+ if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
+ lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ rtInvalidate.Union(lpDatesInfo->rect);
+ }
+ m_pOwner->AddSelDay(iCurSel);
+ if (!m_pOwner->m_pOuter)
+ return;
+ pIPicker->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth,
+ iCurSel);
+ pIPicker->ShowMonthCalendar(FALSE);
+ } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) {
+ pIPicker->ShowMonthCalendar(FALSE);
+ }
+ m_bFlag = 0;
+}
+
+void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
+ return;
+ }
+ FX_BOOL bRepaint = FALSE;
+ CFX_RectF rtInvalidate;
+ rtInvalidate.Set(0, 0, 0, 0);
+ if (m_pOwner->m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ int32_t iHover = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
+ bRepaint = m_pOwner->m_iHovered != iHover;
+ if (bRepaint) {
+ if (m_pOwner->m_iHovered > 0) {
+ m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
+ }
+ if (iHover > 0) {
+ CFX_RectF rtDay;
+ m_pOwner->GetDayRect(iHover, rtDay);
+ if (rtInvalidate.IsEmpty()) {
+ rtInvalidate = rtDay;
+ } else {
+ rtInvalidate.Union(rtDay);
+ }
+ }
+ }
+ m_pOwner->m_iHovered = iHover;
+ CFWL_Event_DtpHoverChanged ev;
+ ev.hoverday = iHover;
+ m_pOwner->DispatchEvent(&ev);
+ } else {
+ bRepaint = m_pOwner->m_iHovered > 0;
+ if (bRepaint) {
+ m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
+ }
+ m_pOwner->m_iHovered = -1;
+ }
+ if (bRepaint && !rtInvalidate.IsEmpty()) {
+ m_pOwner->Repaint(&rtInvalidate);
+ }
+}
+
+void CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage(
+ CFWL_Message* pMessage) {
+ if (pMessage->GetClassID() == CFWL_MessageType::Mouse) {
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
+ if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) {
+ DisForm_OnLButtonUpEx(pMsg);
+ return;
+ }
+ }
+ CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage);
+}
+
+void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx(
+ CFWL_MsgMouse* pMsg) {
+ if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iLBtnPartStates = 0;
+ m_pOwner->Repaint(&(m_pOwner->m_rtLBtn));
+ return;
+ }
+ if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ m_pOwner->m_iRBtnPartStates = 0;
+ m_pOwner->Repaint(&(m_pOwner->m_rtRBtn));
+ return;
+ }
+ if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
+ return;
+ }
+ int32_t iOldSel = 0;
+ if (m_pOwner->m_arrSelDays.GetSize() > 0) {
+ iOldSel = m_pOwner->m_arrSelDays[0];
+ }
+ int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
+ if (iCurSel > 0) {
+ FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ CFX_RectF rtInvalidate(lpDatesInfo->rect);
+ if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
+ lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ rtInvalidate.Union(lpDatesInfo->rect);
+ }
+ m_pOwner->AddSelDay(iCurSel);
+ IFWL_DateTimePicker* pDateTime =
+ static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
+ pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth,
+ iCurSel);
+ pDateTime->ShowMonthCalendar(FALSE);
+ }
+}
diff --git a/xfa/fwl/core/ifwl_datetimecalendar.h b/xfa/fwl/core/ifwl_datetimecalendar.h
new file mode 100644
index 0000000000..3f29a59820
--- /dev/null
+++ b/xfa/fwl/core/ifwl_datetimecalendar.h
@@ -0,0 +1,47 @@
+// Copyright 2014 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_DATETIMECALENDAR_H_
+#define XFA_FWL_CORE_IFWL_DATETIMECALENDAR_H_
+
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
+
+class IFWL_DateTimeCalendar : public IFWL_MonthCalendar {
+ public:
+ static IFWL_DateTimeCalendar* Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ // IFWL_MonthCalendar
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+
+ protected:
+ friend class CFWL_DateTimeCalendarImpDelegate;
+};
+
+class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate {
+ public:
+ CFWL_DateTimeCalendarImpDelegate(IFWL_DateTimeCalendar* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+
+ void OnLButtonDownEx(CFWL_MsgMouse* pMsg);
+ void OnLButtonUpEx(CFWL_MsgMouse* pMsg);
+ void OnMouseMoveEx(CFWL_MsgMouse* pMsg);
+
+ protected:
+ IFWL_DateTimeCalendar* m_pOwner;
+ FX_BOOL m_bFlag;
+
+ private:
+ void DisForm_OnProcessMessage(CFWL_Message* pMessage);
+ void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg);
+};
+
+#endif // XFA_FWL_CORE_IFWL_DATETIMECALENDAR_H_
diff --git a/xfa/fwl/core/ifwl_datetimeedit.cpp b/xfa/fwl/core/ifwl_datetimeedit.cpp
new file mode 100644
index 0000000000..a0f473b21e
--- /dev/null
+++ b/xfa/fwl/core/ifwl_datetimeedit.cpp
@@ -0,0 +1,79 @@
+// Copyright 2014 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/ifwl_datetimeedit.h"
+
+#include "xfa/fwl/core/cfwl_widgetmgr.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
+
+// static
+IFWL_DateTimeEdit* IFWL_DateTimeEdit::Create(
+ const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_DateTimeEdit(properties, pOuter);
+}
+
+IFWL_DateTimeEdit::IFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Edit(properties, pOuter) {}
+
+FWL_Error IFWL_DateTimeEdit::Initialize() {
+ m_pDelegate = new CFWL_DateTimeEditImpDelegate(this);
+ if (IFWL_Edit::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_DateTimeEdit::Finalize() {
+ delete m_pDelegate;
+ m_pDelegate = nullptr;
+ return IFWL_Edit::Finalize();
+}
+
+CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate(
+ IFWL_DateTimeEdit* pOwner)
+ : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
+
+void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
+ DisForm_OnProcessMessage(pMessage);
+ return;
+ }
+
+ CFWL_MessageType dwHashCode = pMessage->GetClassID();
+ if (dwHashCode == CFWL_MessageType::SetFocus ||
+ dwHashCode == CFWL_MessageType::KillFocus) {
+ IFWL_Widget* pOuter = m_pOwner->GetOuter();
+ IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
+ pDelegate->OnProcessMessage(pMessage);
+ }
+}
+
+void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage(
+ CFWL_Message* pMessage) {
+ CFWL_MessageType dwHashCode = pMessage->GetClassID();
+ if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
+ if (dwHashCode == CFWL_MessageType::Mouse) {
+ CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
+ if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown ||
+ pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) {
+ if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
+ m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
+ }
+ IFWL_DateTimePicker* pDateTime =
+ static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
+ if (pDateTime->IsMonthCalendarShowed()) {
+ CFX_RectF rtInvalidate;
+ pDateTime->GetWidgetRect(rtInvalidate);
+ pDateTime->ShowMonthCalendar(FALSE);
+ rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
+ pDateTime->Repaint(&rtInvalidate);
+ }
+ }
+ }
+ }
+ CFWL_EditImpDelegate::OnProcessMessage(pMessage);
+}
diff --git a/xfa/fwl/core/ifwl_datetimeedit.h b/xfa/fwl/core/ifwl_datetimeedit.h
new file mode 100644
index 0000000000..98b1a364b2
--- /dev/null
+++ b/xfa/fwl/core/ifwl_datetimeedit.h
@@ -0,0 +1,44 @@
+// Copyright 2014 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_DATETIMEEDIT_H_
+#define XFA_FWL_CORE_IFWL_DATETIMEEDIT_H_
+
+#include "xfa/fwl/core/cfwl_message.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+class IFWL_DateTimeEdit : public IFWL_Edit {
+ public:
+ static IFWL_DateTimeEdit* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ // IFWL_Edit
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+
+ protected:
+ friend class CFWL_DateTimeEditImpDelegate;
+};
+
+class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate {
+ public:
+ CFWL_DateTimeEditImpDelegate(IFWL_DateTimeEdit* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+
+ protected:
+ IFWL_DateTimeEdit* m_pOwner;
+
+ private:
+ void DisForm_OnProcessMessage(CFWL_Message* pMessage);
+};
+
+#endif // XFA_FWL_CORE_IFWL_DATETIMEEDIT_H_
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index d02f8483dd..ce5f28bf08 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -4,18 +4,16 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_datetimepickerimp.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_formproxyimp.h"
-#include "xfa/fwl/basewidget/fwl_monthcalendarimp.h"
-#include "xfa/fwl/basewidget/ifwl_spinbutton.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
-#include "xfa/fwl/core/fwl_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_datetimecalendar.h"
+#include "xfa/fwl/core/ifwl_datetimeedit.h"
+#include "xfa/fwl/core/ifwl_formproxy.h"
+#include "xfa/fwl/core/ifwl_spinbutton.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
namespace {
@@ -29,399 +27,13 @@ const int kDateTimePickerHeight = 20;
IFWL_DateTimePicker* IFWL_DateTimePicker::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_DateTimePicker* pDateTimePicker = new IFWL_DateTimePicker;
- CFWL_DateTimePickerImp* pDateTimePickerImpl =
- new CFWL_DateTimePickerImp(properties, pOuter);
- pDateTimePicker->SetImpl(pDateTimePickerImpl);
- pDateTimePickerImpl->SetInterface(pDateTimePicker);
- return pDateTimePicker;
+ return new IFWL_DateTimePicker(properties, pOuter);
}
-// Static
-IFWL_DateTimeForm* IFWL_DateTimeForm::Create(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- IFWL_DateTimeForm* pDateTimeForm = new IFWL_DateTimeForm;
- CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter);
- pDateTimeForm->SetImpl(pFormProxyImpl);
- pFormProxyImpl->SetInterface(pDateTimeForm);
- return pDateTimeForm;
-}
-
-// static
-IFWL_DateTimeCalender* IFWL_DateTimeCalender::Create(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- IFWL_DateTimeCalender* pDateTimeCalendar = new IFWL_DateTimeCalender;
- CFWL_DateTimeCalendar* pDateTimeCalendarImpl =
- new CFWL_DateTimeCalendar(properties, pOuter);
- pDateTimeCalendar->SetImpl(pDateTimeCalendarImpl);
- pDateTimeCalendarImpl->SetInterface(pDateTimeCalendar);
- return pDateTimeCalendar;
-}
-
-// static
-IFWL_DateTimeEdit* IFWL_DateTimeEdit::Create(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- IFWL_DateTimeEdit* pDateTimeEdit = new IFWL_DateTimeEdit;
- CFWL_DateTimeEdit* pDateTimeEditImpl =
- new CFWL_DateTimeEdit(properties, pOuter);
- pDateTimeEdit->SetImpl(pDateTimeEditImpl);
- pDateTimeEditImpl->SetInterface(pDateTimeEdit);
- return pDateTimeEdit;
-}
-
-IFWL_DateTimePicker::IFWL_DateTimePicker() {}
-int32_t IFWL_DateTimePicker::CountSelRanges() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->GetDataTimeEdit()
- ->CountSelRanges();
-}
-int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->GetDataTimeEdit()
- ->GetSelRange(nIndex, nStart);
-}
-FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->GetCurSel(iYear, iMonth, iDay);
-}
-FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->SetCurSel(iYear, iMonth, iDay);
-}
-FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditText(wsText);
-}
-FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->GetEditText(wsText, nStart, nCount);
-}
-FX_BOOL IFWL_DateTimePicker::CanUndo() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanUndo();
-}
-FX_BOOL IFWL_DateTimePicker::CanRedo() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanRedo();
-}
-FX_BOOL IFWL_DateTimePicker::Undo() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Undo();
-}
-FX_BOOL IFWL_DateTimePicker::Redo() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Redo();
-}
-FX_BOOL IFWL_DateTimePicker::CanCopy() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanCopy();
-}
-FX_BOOL IFWL_DateTimePicker::CanCut() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanCut();
-}
-FX_BOOL IFWL_DateTimePicker::CanSelectAll() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->CanSelectAll();
-}
-FX_BOOL IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Copy(wsCopy);
-}
-FX_BOOL IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Cut(wsCut);
-}
-FX_BOOL IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Paste(wsPaste);
-}
-FX_BOOL IFWL_DateTimePicker::SelectAll() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SelectAll();
-}
-FX_BOOL IFWL_DateTimePicker::Delete() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->Delete();
-}
-FX_BOOL IFWL_DateTimePicker::DeSelect() {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->DeSelect();
-}
-FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->GetBBox(rect);
-}
-FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditLimit(nLimit);
-}
-FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
- return static_cast<CFWL_DateTimePickerImp*>(GetImpl())
- ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved);
-}
-CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_EditImp(properties, pOuter) {}
-FWL_Error CFWL_DateTimeEdit::Initialize() {
- m_pDelegate = new CFWL_DateTimeEditImpDelegate(this);
- if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded)
- return FWL_Error::Indefinite;
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_DateTimeEdit::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- return CFWL_EditImp::Finalize();
-}
-
-CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate(
- CFWL_DateTimeEdit* pOwner)
- : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {}
-
-void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
- DisForm_OnProcessMessage(pMessage);
- return;
- }
-
- CFWL_MessageType dwHashCode = pMessage->GetClassID();
- if (dwHashCode == CFWL_MessageType::SetFocus ||
- dwHashCode == CFWL_MessageType::KillFocus) {
- IFWL_Widget* pOuter = m_pOwner->GetOuter();
- IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
- }
-}
-
-void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage(
- CFWL_Message* pMessage) {
- CFWL_MessageType dwHashCode = pMessage->GetClassID();
- if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
- if (dwHashCode == CFWL_MessageType::Mouse) {
- CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
- if (pMouse->m_dwCmd == FWL_MouseCommand::LeftButtonDown ||
- pMouse->m_dwCmd == FWL_MouseCommand::RightButtonDown) {
- if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
- m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- }
- CFWL_DateTimePickerImp* pDateTime =
- static_cast<CFWL_DateTimePickerImp*>(m_pOwner->m_pOuter->GetImpl());
- if (pDateTime->IsMonthCalendarShowed()) {
- CFX_RectF rtInvalidate;
- pDateTime->GetWidgetRect(rtInvalidate);
- pDateTime->ShowMonthCalendar(FALSE);
- rtInvalidate.Offset(-rtInvalidate.left, -rtInvalidate.top);
- pDateTime->Repaint(&rtInvalidate);
- }
- }
- }
- }
- CFWL_EditImpDelegate::OnProcessMessage(pMessage);
-}
-
-CFWL_DateTimeCalendar::CFWL_DateTimeCalendar(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_MonthCalendarImp(properties, pOuter) {}
-FWL_Error CFWL_DateTimeCalendar::Initialize() {
- if (CFWL_MonthCalendarImp::Initialize() != FWL_Error::Succeeded)
- return FWL_Error::Indefinite;
- delete m_pDelegate;
- m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this);
- return FWL_Error::Succeeded;
-}
-FWL_Error CFWL_DateTimeCalendar::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- return CFWL_MonthCalendarImp::Finalize();
-}
-
-CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate(
- CFWL_DateTimeCalendar* pOwner)
- : CFWL_MonthCalendarImpDelegate(pOwner), m_pOwner(pOwner) {
- m_bFlag = FALSE;
-}
-
-void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage(
- CFWL_Message* pMessage) {
- CFWL_MessageType dwCode = pMessage->GetClassID();
- if (dwCode == CFWL_MessageType::SetFocus ||
- dwCode == CFWL_MessageType::KillFocus) {
- IFWL_Widget* pOuter = m_pOwner->GetOuter();
- IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(nullptr);
- pDelegate->OnProcessMessage(pMessage);
- return;
- }
- if (dwCode == CFWL_MessageType::Mouse) {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown)
- OnLButtonDownEx(pMsg);
- else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp)
- OnLButtonUpEx(pMsg);
- return;
- }
- CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage);
-}
-
-void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed;
- m_pOwner->PrevMonth();
- m_pOwner->Repaint(&m_pOwner->m_rtClient);
- } else if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iRBtnPartStates |= CFWL_PartState_Pressed;
- m_pOwner->NextMonth();
- m_pOwner->Repaint(&m_pOwner->m_rtClient);
- } else if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
- if ((m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) ==
- 0) {
- m_pOwner->JumpToToday();
- m_pOwner->Repaint(&m_pOwner->m_rtClient);
- }
- } else {
- IFWL_DateTimePicker* pIPicker =
- static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
- CFWL_DateTimePickerImp* pPicker =
- static_cast<CFWL_DateTimePickerImp*>(pIPicker->GetImpl());
- if (pPicker->IsMonthCalendarShowed()) {
- m_bFlag = 1;
- }
- }
-}
-void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
- return DisForm_OnLButtonUpEx(pMsg);
- }
- if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iLBtnPartStates = 0;
- m_pOwner->Repaint(&m_pOwner->m_rtLBtn);
- return;
- }
- if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iRBtnPartStates = 0;
- m_pOwner->Repaint(&m_pOwner->m_rtRBtn);
- return;
- }
- if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return;
- }
- int32_t iOldSel = 0;
- if (m_pOwner->m_arrSelDays.GetSize() > 0) {
- iOldSel = m_pOwner->m_arrSelDays[0];
- }
- int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
- CFX_RectF rt;
- IFWL_DateTimePicker* pIPicker =
- static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
- CFWL_DateTimePickerImp* pPicker =
- static_cast<CFWL_DateTimePickerImp*>(pIPicker->GetImpl());
- pPicker->m_pForm->GetWidgetRect(rt);
- rt.Set(0, 0, rt.width, rt.height);
- if (iCurSel > 0) {
- FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
- CFX_RectF rtInvalidate(lpDatesInfo->rect);
- if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
- rtInvalidate.Union(lpDatesInfo->rect);
- }
- m_pOwner->AddSelDay(iCurSel);
- if (!m_pOwner->m_pOuter)
- return;
- pPicker->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth,
- iCurSel);
- pPicker->ShowMonthCalendar(FALSE);
- } else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) {
- pPicker->ShowMonthCalendar(FALSE);
- }
- m_bFlag = 0;
-}
-void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
- return;
- }
- FX_BOOL bRepaint = FALSE;
- CFX_RectF rtInvalidate;
- rtInvalidate.Set(0, 0, 0, 0);
- if (m_pOwner->m_rtDates.Contains(pMsg->m_fx, pMsg->m_fy)) {
- int32_t iHover = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
- bRepaint = m_pOwner->m_iHovered != iHover;
- if (bRepaint) {
- if (m_pOwner->m_iHovered > 0) {
- m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
- }
- if (iHover > 0) {
- CFX_RectF rtDay;
- m_pOwner->GetDayRect(iHover, rtDay);
- if (rtInvalidate.IsEmpty()) {
- rtInvalidate = rtDay;
- } else {
- rtInvalidate.Union(rtDay);
- }
- }
- }
- m_pOwner->m_iHovered = iHover;
- CFWL_Event_DtpHoverChanged ev;
- ev.hoverday = iHover;
- m_pOwner->DispatchEvent(&ev);
- } else {
- bRepaint = m_pOwner->m_iHovered > 0;
- if (bRepaint) {
- m_pOwner->GetDayRect(m_pOwner->m_iHovered, rtInvalidate);
- }
- m_pOwner->m_iHovered = -1;
- }
- if (bRepaint && !rtInvalidate.IsEmpty()) {
- m_pOwner->Repaint(&rtInvalidate);
- }
-}
-
-void CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage(
- CFWL_Message* pMessage) {
- if (pMessage->GetClassID() == CFWL_MessageType::Mouse) {
- CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
- if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) {
- DisForm_OnLButtonUpEx(pMsg);
- return;
- }
- }
- CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage);
-}
-
-void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx(
- CFWL_MsgMouse* pMsg) {
- if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iLBtnPartStates = 0;
- m_pOwner->Repaint(&(m_pOwner->m_rtLBtn));
- return;
- }
- if (m_pOwner->m_rtRBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
- m_pOwner->m_iRBtnPartStates = 0;
- m_pOwner->Repaint(&(m_pOwner->m_rtRBtn));
- return;
- }
- if (m_pOwner->m_rtToday.Contains(pMsg->m_fx, pMsg->m_fy)) {
- return;
- }
- int32_t iOldSel = 0;
- if (m_pOwner->m_arrSelDays.GetSize() > 0) {
- iOldSel = m_pOwner->m_arrSelDays[0];
- }
- int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
- if (iCurSel > 0) {
- FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
- CFX_RectF rtInvalidate(lpDatesInfo->rect);
- if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
- rtInvalidate.Union(lpDatesInfo->rect);
- }
- m_pOwner->AddSelDay(iCurSel);
- CFWL_DateTimePickerImp* pDateTime =
- static_cast<CFWL_DateTimePickerImp*>(m_pOwner->m_pOuter->GetImpl());
- pDateTime->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth,
- iCurSel);
- pDateTime->ShowMonthCalendar(FALSE);
- }
-}
-
-CFWL_DateTimePickerImp::CFWL_DateTimePickerImp(
+IFWL_DateTimePicker::IFWL_DateTimePicker(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+ : IFWL_Widget(properties, pOuter),
m_iBtnState(1),
m_iYear(-1),
m_iMonth(-1),
@@ -430,19 +42,19 @@ CFWL_DateTimePickerImp::CFWL_DateTimePickerImp(
m_rtBtn.Set(0, 0, 0, 0);
}
-CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {}
+IFWL_DateTimePicker::~IFWL_DateTimePicker() {}
-FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_DateTimePicker::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_DateTimePicker;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_DateTimePickerImp::GetClassID() const {
+FWL_Type IFWL_DateTimePicker::GetClassID() const {
return FWL_Type::DateTimePicker;
}
-FWL_Error CFWL_DateTimePickerImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_DateTimePicker::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_DateTimePickerImpDelegate(this);
@@ -451,25 +63,25 @@ FWL_Error CFWL_DateTimePickerImp::Initialize() {
propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
propMonth.m_dwStates = FWL_WGTSTATE_Invisible;
propMonth.m_pDataProvider = &m_MonthCalendarDP;
- propMonth.m_pParent = m_pInterface;
+ propMonth.m_pParent = this;
propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface));
+ m_pMonthCal.reset(IFWL_DateTimeCalendar::Create(propMonth, this));
m_pMonthCal->Initialize();
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
m_pMonthCal->SetWidgetRect(rtMonthCal);
CFWL_WidgetImpProperties propEdit;
- propEdit.m_pParent = m_pInterface;
+ propEdit.m_pParent = this;
propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface));
+ m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, this));
m_pEdit->Initialize();
RegisterEventTarget(m_pMonthCal.get());
RegisterEventTarget(m_pEdit.get());
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::Finalize() {
+FWL_Error IFWL_DateTimePicker::Finalize() {
if (m_pEdit) {
m_pEdit->Finalize();
}
@@ -482,22 +94,24 @@ FWL_Error CFWL_DateTimePickerImp::Finalize() {
UnregisterEventTarget();
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_DateTimePicker::GetWidgetRect(CFX_RectF& rect,
+ FX_BOOL bAutoSize) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_GetWidgetRect(rect, bAutoSize);
}
if (bAutoSize) {
rect.Set(0, 0, kDateTimePickerWidth, kDateTimePickerHeight);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::Update() {
+
+FWL_Error IFWL_DateTimePicker::Update() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Update();
}
@@ -528,7 +142,7 @@ FWL_Error CFWL_DateTimePickerImp::Update() {
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
- pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear,
+ pData->GetToday(this, m_MonthCalendarDP.m_iCurYear,
m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
}
CFX_RectF rtMonthCal;
@@ -540,7 +154,16 @@ FWL_Error CFWL_DateTimePickerImp::Update() {
m_pMonthCal->Update();
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+int32_t IFWL_DateTimePicker::CountSelRanges() {
+ return GetDataTimeEdit()->CountSelRanges();
+}
+
+int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) {
+ return GetDataTimeEdit()->GetSelRange(nIndex, nStart);
+}
+
+FWL_WidgetHit IFWL_DateTimePicker::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pWidgetMgr->IsFormDisabled())
return DisForm_HitTest(fx, fy);
if (m_rtClient.Contains(fx, fy))
@@ -553,8 +176,9 @@ FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
}
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_DateTimePicker::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -574,22 +198,25 @@ FWL_Error CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) {
+
+FWL_Error IFWL_DateTimePicker::SetThemeProvider(IFWL_ThemeProvider* pTP) {
m_pProperties->m_pThemeProvider = pTP;
m_pMonthCal->SetThemeProvider(pTP);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+
+FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_iYear;
iMonth = m_iMonth;
iDay = m_iDay;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::SetCurSel(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
if (iYear <= 0 || iYear >= 3000)
return FWL_Error::Indefinite;
if (iMonth <= 0 || iMonth >= 13)
@@ -603,7 +230,7 @@ FWL_Error CFWL_DateTimePickerImp::SetCurSel(int32_t iYear,
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) {
+FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) {
if (!m_pEdit)
return FWL_Error::Indefinite;
@@ -615,59 +242,73 @@ FWL_Error CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) {
return iRet;
}
-FWL_Error CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
if (m_pEdit) {
return m_pEdit->GetText(wsText, nStart, nCount);
}
return FWL_Error::Indefinite;
}
-FX_BOOL CFWL_DateTimePickerImp::CanUndo() {
+
+FX_BOOL IFWL_DateTimePicker::CanUndo() {
return m_pEdit->CanUndo();
}
-FX_BOOL CFWL_DateTimePickerImp::CanRedo() {
+
+FX_BOOL IFWL_DateTimePicker::CanRedo() {
return m_pEdit->CanRedo();
}
-FX_BOOL CFWL_DateTimePickerImp::Undo() {
+
+FX_BOOL IFWL_DateTimePicker::Undo() {
return m_pEdit->Undo();
}
-FX_BOOL CFWL_DateTimePickerImp::Redo() {
+
+FX_BOOL IFWL_DateTimePicker::Redo() {
return m_pEdit->Redo();
}
-FX_BOOL CFWL_DateTimePickerImp::CanCopy() {
+
+FX_BOOL IFWL_DateTimePicker::CanCopy() {
int32_t nCount = m_pEdit->CountSelRanges();
return nCount > 0;
}
-FX_BOOL CFWL_DateTimePickerImp::CanCut() {
+
+FX_BOOL IFWL_DateTimePicker::CanCut() {
if (m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) {
return FALSE;
}
int32_t nCount = m_pEdit->CountSelRanges();
return nCount > 0;
}
-FX_BOOL CFWL_DateTimePickerImp::CanSelectAll() {
+
+FX_BOOL IFWL_DateTimePicker::CanSelectAll() {
return m_pEdit->GetTextLength() > 0;
}
-FX_BOOL CFWL_DateTimePickerImp::Copy(CFX_WideString& wsCopy) {
+
+FX_BOOL IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
return m_pEdit->Copy(wsCopy);
}
-FX_BOOL CFWL_DateTimePickerImp::Cut(CFX_WideString& wsCut) {
+
+FX_BOOL IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
return m_pEdit->Cut(wsCut);
}
-FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) {
+
+FX_BOOL IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
return m_pEdit->Paste(wsPaste);
}
-FX_BOOL CFWL_DateTimePickerImp::SelectAll() {
+
+FX_BOOL IFWL_DateTimePicker::SelectAll() {
return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_DateTimePickerImp::Delete() {
+
+FX_BOOL IFWL_DateTimePicker::Delete() {
return m_pEdit->ClearText() == FWL_Error::Succeeded;
}
-FX_BOOL CFWL_DateTimePickerImp::DeSelect() {
+
+FX_BOOL IFWL_DateTimePicker::DeSelect() {
return m_pEdit->ClearSelections() == FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_GetBBox(rect);
}
@@ -681,28 +322,30 @@ FWL_Error CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) {
+
+FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
return m_pEdit->SetLimit(nLimit);
}
-FWL_Error CFWL_DateTimePickerImp::ModifyEditStylesEx(
- uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved) {
+
+FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved) {
return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
-void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_DateTimePicker::DrawDropDownButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_Spin) ==
FWL_STYLEEXT_DTP_Spin) {
CFWL_WidgetImpProperties prop;
prop.m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_rtWidget = m_rtBtn;
- IFWL_SpinButton* pSpin = IFWL_SpinButton::Create(prop, m_pInterface);
+ IFWL_SpinButton* pSpin = IFWL_SpinButton::Create(prop, this);
pSpin->Initialize();
} else {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::DropDownButton;
param.m_dwStates = m_iBtnState;
param.m_pGraphics = pGraphics;
@@ -713,10 +356,11 @@ void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
}
-void CFWL_DateTimePickerImp::FormatDateString(int32_t iYear,
- int32_t iMonth,
- int32_t iDay,
- CFX_WideString& wsText) {
+
+void IFWL_DateTimePicker::FormatDateString(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay,
+ CFX_WideString& wsText) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_ShortDateFormat) ==
FWL_STYLEEXT_DTP_ShortDateFormat) {
wsText.Format(L"%d-%d-%d", iYear, iMonth, iDay);
@@ -727,7 +371,8 @@ void CFWL_DateTimePickerImp::FormatDateString(int32_t iYear,
FWL_STYLEEXT_DTP_TimeFormat) {
}
}
-void CFWL_DateTimePickerImp::ShowMonthCalendar(FX_BOOL bActivate) {
+
+void IFWL_DateTimePicker::ShowMonthCalendar(FX_BOOL bActivate) {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_ShowMonthCalendar(bActivate);
}
@@ -754,7 +399,8 @@ void CFWL_DateTimePickerImp::ShowMonthCalendar(FX_BOOL bActivate) {
m_pForm->EndDoModal();
}
}
-FX_BOOL CFWL_DateTimePickerImp::IsMonthCalendarShowed() {
+
+FX_BOOL IFWL_DateTimePicker::IsMonthCalendarShowed() {
if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_IsMonthCalendarShowed();
}
@@ -762,7 +408,8 @@ FX_BOOL CFWL_DateTimePickerImp::IsMonthCalendarShowed() {
return FALSE;
return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
}
-void CFWL_DateTimePickerImp::ReSetEditAlignment() {
+
+void IFWL_DateTimePicker::ReSetEditAlignment() {
if (!m_pEdit)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -799,9 +446,10 @@ void CFWL_DateTimePickerImp::ReSetEditAlignment() {
FWL_STYLEEXT_EDT_HAlignModeMask |
FWL_STYLEEXT_EDT_VAlignMask);
}
-void CFWL_DateTimePickerImp::ProcessSelChanged(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+void IFWL_DateTimePicker::ProcessSelChanged(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
m_iYear = iYear;
m_iMonth = iMonth;
m_iDay = iDay;
@@ -811,13 +459,14 @@ void CFWL_DateTimePickerImp::ProcessSelChanged(int32_t iYear,
m_pEdit->Update();
Repaint(&m_rtClient);
CFWL_Event_DtpSelectChanged ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
ev.iYear = m_iYear;
ev.iMonth = m_iMonth;
ev.iDay = m_iDay;
DispatchEvent(&ev);
}
-void CFWL_DateTimePickerImp::InitProxyForm() {
+
+void IFWL_DateTimePicker::InitProxyForm() {
if (m_pForm)
return;
if (!m_pMonthCal)
@@ -825,15 +474,17 @@ void CFWL_DateTimePickerImp::InitProxyForm() {
CFWL_WidgetImpProperties propForm;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
- propForm.m_pOwner = m_pInterface;
- m_pForm.reset(IFWL_DateTimeForm::Create(propForm, m_pMonthCal.get()));
+ propForm.m_pOwner = this;
+ m_pForm.reset(IFWL_FormProxy::Create(propForm, m_pMonthCal.get()));
m_pForm->Initialize();
m_pMonthCal->SetParent(m_pForm.get());
}
-IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() {
+
+IFWL_DateTimeEdit* IFWL_DateTimePicker::GetDataTimeEdit() {
return m_pEdit.get();
}
-FWL_Error CFWL_DateTimePickerImp::DisForm_Initialize() {
+
+FWL_Error IFWL_DateTimePicker::DisForm_Initialize() {
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
DisForm_InitDateTimeCalendar();
DisForm_InitDateTimeEdit();
@@ -841,7 +492,8 @@ FWL_Error CFWL_DateTimePickerImp::DisForm_Initialize() {
RegisterEventTarget(m_pEdit.get());
return FWL_Error::Succeeded;
}
-void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() {
+
+void IFWL_DateTimePicker::DisForm_InitDateTimeCalendar() {
if (m_pMonthCal) {
return;
}
@@ -849,32 +501,35 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() {
propMonth.m_dwStyles =
FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken;
propMonth.m_dwStates = FWL_WGTSTATE_Invisible;
- propMonth.m_pParent = m_pInterface;
+ propMonth.m_pParent = this;
propMonth.m_pDataProvider = &m_MonthCalendarDP;
propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pMonthCal.reset(IFWL_DateTimeCalender::Create(propMonth, m_pInterface));
+ m_pMonthCal.reset(IFWL_DateTimeCalendar::Create(propMonth, this));
m_pMonthCal->Initialize();
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
m_pMonthCal->SetWidgetRect(rtMonthCal);
}
-void CFWL_DateTimePickerImp::DisForm_InitDateTimeEdit() {
+
+void IFWL_DateTimePicker::DisForm_InitDateTimeEdit() {
if (m_pEdit) {
return;
}
CFWL_WidgetImpProperties propEdit;
- propEdit.m_pParent = m_pInterface;
+ propEdit.m_pParent = this;
propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, m_pInterface));
+ m_pEdit.reset(IFWL_DateTimeEdit::Create(propEdit, this));
m_pEdit->Initialize();
}
-FX_BOOL CFWL_DateTimePickerImp::DisForm_IsMonthCalendarShowed() {
+
+FX_BOOL IFWL_DateTimePicker::DisForm_IsMonthCalendarShowed() {
if (!m_pMonthCal)
return FALSE;
return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible);
}
-void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
+
+void IFWL_DateTimePicker::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
FX_BOOL bShowed = IsMonthCalendarShowed();
if (bShowed == bActivate) {
return;
@@ -911,8 +566,8 @@ void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
rtInvalidate.Inflate(2, 2);
Repaint(&rtInvalidate);
}
-FWL_WidgetHit CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx,
- FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_DateTimePicker::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rect;
rect.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
@@ -929,14 +584,15 @@ FWL_WidgetHit CFWL_DateTimePickerImp::DisForm_HitTest(FX_FLOAT fx,
}
return FWL_WidgetHit::Unknown;
}
-FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() {
+
+FX_BOOL IFWL_DateTimePicker::DisForm_IsNeedShowButton() {
FX_BOOL bFocus = m_pProperties->m_dwStates & FWL_WGTSTATE_Focused ||
m_pMonthCal->GetStates() & FWL_WGTSTATE_Focused ||
m_pEdit->GetStates() & FWL_WGTSTATE_Focused;
return bFocus;
}
-FWL_Error CFWL_DateTimePickerImp::DisForm_Update() {
+FWL_Error IFWL_DateTimePicker::DisForm_Update() {
if (m_iLock)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -953,7 +609,7 @@ FWL_Error CFWL_DateTimePickerImp::DisForm_Update() {
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
- pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear,
+ pData->GetToday(this, m_MonthCalendarDP.m_iCurYear,
m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
}
FX_FLOAT* pWidth = static_cast<FX_FLOAT*>(
@@ -972,15 +628,16 @@ FWL_Error CFWL_DateTimePickerImp::DisForm_Update() {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+FWL_Error IFWL_DateTimePicker::DisForm_GetWidgetRect(CFX_RectF& rect,
+ FX_BOOL bAutoSize) {
rect = m_pProperties->m_rtWidget;
if (DisForm_IsNeedShowButton()) {
rect.width += m_fBtn;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) {
+
+FWL_Error IFWL_DateTimePicker::DisForm_GetBBox(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
if (DisForm_IsNeedShowButton()) {
rect.width += m_fBtn;
@@ -994,9 +651,9 @@ FWL_Error CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_DateTimePickerImp::DisForm_DrawWidget(
- CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_DateTimePicker::DisForm_DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (m_pEdit) {
@@ -1023,7 +680,7 @@ FWL_Error CFWL_DateTimePickerImp::DisForm_DrawWidget(
}
CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate(
- CFWL_DateTimePickerImp* pOwner)
+ IFWL_DateTimePicker* pOwner)
: m_pOwner(pOwner) {}
void CFWL_DateTimePickerImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1104,6 +761,7 @@ void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_DateTimePickerImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (!pMsg)
return;
@@ -1128,6 +786,7 @@ void CFWL_DateTimePickerImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
}
}
+
void CFWL_DateTimePickerImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (!pMsg)
return;
@@ -1139,6 +798,7 @@ void CFWL_DateTimePickerImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
+
void CFWL_DateTimePickerImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
} else {
@@ -1146,12 +806,14 @@ void CFWL_DateTimePickerImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
+
void CFWL_DateTimePickerImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (!pMsg)
return;
m_pOwner->m_iBtnState = CFWL_PartState_Normal;
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
+
void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
CFX_RectF rtInvalidate(m_pOwner->m_rtBtn);
@@ -1183,29 +845,29 @@ void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg,
m_pOwner->Repaint(&rtInvalidate);
}
-CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() {
+IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::CFWL_MonthCalendarImpDP() {
m_iCurYear = 2010;
m_iCurMonth = 3;
m_iCurDay = 29;
}
-FWL_Error CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCaption(
+FWL_Error IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCaption(
IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
return FWL_Error::Succeeded;
}
-int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurDay(
+int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurDay(
IFWL_Widget* pWidget) {
return m_iCurDay;
}
-int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurMonth(
+int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurMonth(
IFWL_Widget* pWidget) {
return m_iCurMonth;
}
-int32_t CFWL_DateTimePickerImp::CFWL_MonthCalendarImpDP::GetCurYear(
+int32_t IFWL_DateTimePicker::CFWL_MonthCalendarImpDP::GetCurYear(
IFWL_Widget* pWidget) {
return m_iCurYear;
}
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/core/ifwl_datetimepicker.h
index 8306a26ba8..e14073df09 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -4,119 +4,73 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_
-
-#include <memory>
-
-#include "xfa/fwl/basewidget/fwl_editimp.h"
-#include "xfa/fwl/basewidget/fwl_monthcalendarimp.h"
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
-#include "xfa/fwl/core/ifwl_form.h"
-
-class CFWL_WidgetImp;
-class CFWL_WidgetImpProperties;
-class CFWL_WidgetImpDelegate;
-class CFWL_DateTimeEdit;
-class CFWL_DateTimeEditImpDelegate;
-class CFWL_DateTimeCalendar;
-class CFWL_DateTimeCalendarImpDelegate;
-class CFWL_DateTimePickerImp;
-class CFWL_DateTimePickerImpDelegate;
-
-class IFWL_DateTimeForm : public IFWL_Form {
+#ifndef XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
+#define XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+#define FWL_CLASS_DateTimePicker L"FWL_DATETIMEPICKER"
+#define FWL_STYLEEXT_DTP_AllowEdit (1L << 0)
+#define FWL_STYLEEXT_DTP_LongDateFormat (0L << 1)
+#define FWL_STYLEEXT_DTP_ShortDateFormat (1L << 1)
+#define FWL_STYLEEXT_DTP_TimeFormat (2L << 1)
+#define FWL_STYLEEXT_DTP_Spin (1L << 3)
+#define FWL_STYLEEXT_DTP_EditHNear (0L << 4)
+#define FWL_STYLEEXT_DTP_EditHCenter (1L << 4)
+#define FWL_STYLEEXT_DTP_EditHFar (2L << 4)
+#define FWL_STYLEEXT_DTP_EditVNear (0L << 6)
+#define FWL_STYLEEXT_DTP_EditVCenter (1L << 6)
+#define FWL_STYLEEXT_DTP_EditVFar (2L << 6)
+#define FWL_STYLEEXT_DTP_EditJustified (1L << 8)
+#define FWL_STYLEEXT_DTP_EditDistributed (2L << 8)
+#define FWL_STYLEEXT_DTP_EditHAlignMask (3L << 4)
+#define FWL_STYLEEXT_DTP_EditVAlignMask (3L << 6)
+#define FWL_STYLEEXT_DTP_EditHAlignModeMask (3L << 8)
+
+class IFWL_DateTimeCalendar;
+class IFWL_DateTimeEdit;
+class IFWL_FormProxy;
+
+FWL_EVENT_DEF(CFWL_Event_DtpDropDown, CFWL_EventType::DropDown)
+
+FWL_EVENT_DEF(CFWL_Event_DtpCloseUp, CFWL_EventType::CloseUp)
+
+FWL_EVENT_DEF(CFWL_Event_DtpEditChanged,
+ CFWL_EventType::EditChanged,
+ CFX_WideString m_wsText;)
+
+FWL_EVENT_DEF(CFWL_Event_DtpHoverChanged,
+ CFWL_EventType::HoverChanged,
+ int32_t hoverday;)
+
+FWL_EVENT_DEF(CFWL_Event_DtpSelectChanged,
+ CFWL_EventType::SelectChanged,
+ int32_t iYear;
+ int32_t iMonth;
+ int32_t iDay;)
+
+class IFWL_DateTimePickerDP : public IFWL_DataProvider {
public:
- static IFWL_DateTimeForm* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- protected:
- IFWL_DateTimeForm() {}
-};
-
-class IFWL_DateTimeCalender : public IFWL_MonthCalendar {
- public:
- static IFWL_DateTimeCalender* Create(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- protected:
- IFWL_DateTimeCalender() {}
-};
-
-class IFWL_DateTimeEdit : public IFWL_Edit {
- public:
- static IFWL_DateTimeEdit* Create(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- protected:
- IFWL_DateTimeEdit() {}
-};
-
-class CFWL_DateTimeEdit : public CFWL_EditImp {
- public:
- CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
-
- // CFWL_EditImp
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
-
- protected:
- friend class CFWL_DateTimeEditImpDelegate;
-};
-
-class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate {
- public:
- CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
-
- protected:
- CFWL_DateTimeEdit* m_pOwner;
-
- private:
- void DisForm_OnProcessMessage(CFWL_Message* pMessage);
+ virtual FWL_Error GetToday(IFWL_Widget* pWidget,
+ int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) = 0;
};
-class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp {
+class IFWL_DateTimePicker : public IFWL_Widget {
public:
- CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
+ static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
- // CFWL_MonthCalendarImp
- FWL_Error Initialize() override;
- FWL_Error Finalize() override;
-
- protected:
- friend class CFWL_DateTimeCalendarImpDelegate;
-};
-
-class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate {
- public:
- CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner);
- void OnProcessMessage(CFWL_Message* pMessage) override;
-
- void OnLButtonDownEx(CFWL_MsgMouse* pMsg);
- void OnLButtonUpEx(CFWL_MsgMouse* pMsg);
- void OnMouseMoveEx(CFWL_MsgMouse* pMsg);
-
- protected:
- CFWL_DateTimeCalendar* m_pOwner;
- FX_BOOL m_bFlag;
-
- private:
- void DisForm_OnProcessMessage(CFWL_Message* pMessage);
- void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg);
-};
-
-class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
- public:
- CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_DateTimePickerImp() override;
+ IFWL_DateTimePicker(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_DateTimePicker() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -134,6 +88,8 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
FWL_Error GetEditText(CFX_WideString& wsText,
int32_t nStart = 0,
int32_t nCount = -1) const;
+ int32_t CountSelRanges();
+ int32_t GetSelRange(int32_t nIndex, int32_t& nStart);
FX_BOOL CanUndo();
FX_BOOL CanRedo();
@@ -156,7 +112,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
protected:
friend class CFWL_DateTimeEditImpDelegate;
- friend class CFWL_DateTimeCalendar;
+ friend class IFWL_DateTimeCalendar;
friend class CFWL_DateTimeCalendarImpDelegate;
friend class CFWL_DateTimePickerImpDelegate;
@@ -199,8 +155,8 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
int32_t m_iDay;
FX_BOOL m_bLBtnDown;
std::unique_ptr<IFWL_DateTimeEdit> m_pEdit;
- std::unique_ptr<IFWL_DateTimeCalender> m_pMonthCal;
- std::unique_ptr<IFWL_DateTimeForm> m_pForm;
+ std::unique_ptr<IFWL_DateTimeCalendar> m_pMonthCal;
+ std::unique_ptr<IFWL_FormProxy> m_pForm;
FX_FLOAT m_fBtn;
CFWL_MonthCalendarImpDP m_MonthCalendarDP;
@@ -221,7 +177,7 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp {
class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner);
+ CFWL_DateTimePickerImpDelegate(IFWL_DateTimePicker* pOwner);
// CFWL_WidgetImpDelegate
void OnProcessMessage(CFWL_Message* pMessage) override;
@@ -235,10 +191,10 @@ class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
- CFWL_DateTimePickerImp* m_pOwner;
+ IFWL_DateTimePicker* m_pOwner;
private:
void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
};
-#endif // XFA_FWL_BASEWIDGET_FWL_DATETIMEPICKERIMP_H_
+#endif // XFA_FWL_CORE_IFWL_DATETIMEPICKER_H_
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/core/ifwl_edit.cpp
index 0f939f1145..83c00627c3 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/core/ifwl_edit.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_editimp.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include <algorithm>
#include <memory>
@@ -16,16 +16,12 @@
#include "xfa/fde/fde_render.h"
#include "xfa/fde/ifde_txtedtpage.h"
#include "xfa/fgas/font/fgas_gefont.h"
-#include "xfa/fwl/basewidget/fwl_caretimp.h"
-#include "xfa/fwl/basewidget/fwl_comboboximp.h"
-#include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
-#include "xfa/fwl/basewidget/ifwl_caret.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themepart.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_caret.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fxfa/xfa_ffdoc.h"
#include "xfa/fxfa/xfa_ffwidget.h"
@@ -58,147 +54,12 @@ void AddSquigglyPath(CFX_Path* pPathData,
// static
IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_Edit* pEdit = new IFWL_Edit;
- CFWL_EditImp* pEditImpl = new CFWL_EditImp(properties, pOuter);
- pEdit->SetImpl(pEditImpl);
- pEditImpl->SetInterface(pEdit);
- return pEdit;
-}
-// static
-IFWL_Edit* IFWL_Edit::CreateComboEdit(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- IFWL_Edit* pEdit = new IFWL_Edit;
- CFWL_EditImp* pComboEditImpl = new CFWL_ComboEditImp(properties, pOuter);
- pEdit->SetImpl(pComboEditImpl);
- pComboEditImpl->SetInterface(pEdit);
- return pEdit;
-}
-IFWL_Edit::IFWL_Edit() {}
-FWL_Error IFWL_Edit::SetText(const CFX_WideString& wsText) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetText(wsText);
-}
-int32_t IFWL_Edit::GetTextLength() const {
- return static_cast<CFWL_EditImp*>(GetImpl())->GetTextLength();
-}
-FWL_Error IFWL_Edit::GetText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- return static_cast<CFWL_EditImp*>(GetImpl())->GetText(wsText, nStart, nCount);
-}
-FWL_Error IFWL_Edit::ClearText() {
- return static_cast<CFWL_EditImp*>(GetImpl())->ClearText();
-}
-int32_t IFWL_Edit::GetCaretPos() const {
- return static_cast<CFWL_EditImp*>(GetImpl())->GetCaretPos();
-}
-int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetCaretPos(nIndex, bBefore);
-}
-FWL_Error IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
- return static_cast<CFWL_EditImp*>(GetImpl())->AddSelRange(nStart, nCount);
-}
-int32_t IFWL_Edit::CountSelRanges() {
- return static_cast<CFWL_EditImp*>(GetImpl())->CountSelRanges();
-}
-int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
- return static_cast<CFWL_EditImp*>(GetImpl())->GetSelRange(nIndex, nStart);
-}
-FWL_Error IFWL_Edit::ClearSelections() {
- return static_cast<CFWL_EditImp*>(GetImpl())->ClearSelections();
-}
-int32_t IFWL_Edit::GetLimit() {
- return static_cast<CFWL_EditImp*>(GetImpl())->GetLimit();
-}
-FWL_Error IFWL_Edit::SetLimit(int32_t nLimit) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetLimit(nLimit);
-}
-FWL_Error IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetAliasChar(wAlias);
-}
-FWL_Error IFWL_Edit::Insert(int32_t nStart,
- const FX_WCHAR* lpText,
- int32_t nLen) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Insert(nStart, lpText, nLen);
-}
-FWL_Error IFWL_Edit::DeleteSelections() {
- return static_cast<CFWL_EditImp*>(GetImpl())->DeleteSelections();
-}
-FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
- return static_cast<CFWL_EditImp*>(GetImpl())->DeleteRange(nStart, nCount);
-}
-FWL_Error IFWL_Edit::Replace(int32_t nStart,
- int32_t nLen,
- const CFX_WideStringC& wsReplace) {
- return static_cast<CFWL_EditImp*>(GetImpl())
- ->Replace(nStart, nLen, wsReplace);
-}
-FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) {
- return static_cast<CFWL_EditImp*>(GetImpl())->DoClipboard(iCmd);
-}
-FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Copy(wsCopy);
-}
-FX_BOOL IFWL_Edit::Cut(CFX_WideString& wsCut) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Cut(wsCut);
-}
-FX_BOOL IFWL_Edit::Paste(const CFX_WideString& wsPaste) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Paste(wsPaste);
-}
-FX_BOOL IFWL_Edit::Delete() {
- return static_cast<CFWL_EditImp*>(GetImpl())->Delete();
-}
-FX_BOOL IFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Redo(pRecord);
-}
-FX_BOOL IFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) {
- return static_cast<CFWL_EditImp*>(GetImpl())->Undo(pRecord);
-}
-FX_BOOL IFWL_Edit::Undo() {
- return static_cast<CFWL_EditImp*>(GetImpl())->Undo();
-}
-FX_BOOL IFWL_Edit::Redo() {
- return static_cast<CFWL_EditImp*>(GetImpl())->Redo();
-}
-FX_BOOL IFWL_Edit::CanUndo() {
- return static_cast<CFWL_EditImp*>(GetImpl())->CanUndo();
-}
-FX_BOOL IFWL_Edit::CanRedo() {
- return static_cast<CFWL_EditImp*>(GetImpl())->CanRedo();
-}
-FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
- return static_cast<CFWL_EditImp*>(GetImpl())
- ->SetTabWidth(fTabWidth, bEquidistant);
-}
-FWL_Error IFWL_Edit::SetOuter(IFWL_Widget* pOuter) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetOuter(pOuter);
-}
-FWL_Error IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetNumberRange(iMin, iMax);
-}
-FWL_Error IFWL_Edit::SetBackColor(uint32_t dwColor) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetBackgroundColor(dwColor);
-}
-FWL_Error IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetFont(wsFont, fSize);
-}
-void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
- return static_cast<CFWL_EditImp*>(GetImpl())->SetScrollOffset(fScrollOffset);
-}
-FX_BOOL IFWL_Edit::GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest) {
- return static_cast<CFWL_EditImp*>(GetImpl())
- ->GetSuggestWords(pointf, sSuggest);
-}
-FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) {
- return static_cast<CFWL_EditImp*>(GetImpl())
- ->ReplaceSpellCheckWord(pointf, bsReplace);
+ return new IFWL_Edit(properties, pOuter);
}
-CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_Edit::IFWL_Edit(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_fVAlignOffset(0.0f),
m_fScrollOffsetX(0.0f),
m_fScrollOffsetY(0.0f),
@@ -220,21 +81,21 @@ CFWL_EditImp::CFWL_EditImp(const CFWL_WidgetImpProperties& properties,
m_rtStatic.Reset();
}
-CFWL_EditImp::~CFWL_EditImp() {
+IFWL_Edit::~IFWL_Edit() {
ClearRecord();
}
-FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_Edit::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Edit;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_EditImp::GetClassID() const {
+FWL_Type IFWL_Edit::GetClassID() const {
return FWL_Type::Edit;
}
-FWL_Error CFWL_EditImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_Edit::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
if (!m_pDelegate)
m_pDelegate = new CFWL_EditImpDelegate(this);
@@ -246,7 +107,7 @@ FWL_Error CFWL_EditImp::Initialize() {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::Finalize() {
+FWL_Error IFWL_Edit::Finalize() {
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) {
ShowCaret(FALSE);
}
@@ -258,9 +119,9 @@ FWL_Error CFWL_EditImp::Finalize() {
}
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+FWL_Error IFWL_Edit::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (m_pEdtEngine) {
@@ -274,7 +135,7 @@ FWL_Error CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
rect.Set(0, 0, sz.x, sz.y);
}
}
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
@@ -295,18 +156,18 @@ FWL_Error CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
return FWL_Error::Succeeded;
}
-void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void IFWL_Edit::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
ShowCaret(FALSE);
}
- CFWL_WidgetImp::SetStates(dwStates, bSet);
+ IFWL_Widget::SetStates(dwStates, bSet);
}
-FWL_Error CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) {
- return CFWL_WidgetImp::SetWidgetRect(rect);
+FWL_Error IFWL_Edit::SetWidgetRect(const CFX_RectF& rect) {
+ return IFWL_Widget::SetWidgetRect(rect);
}
-FWL_Error CFWL_EditImp::Update() {
+FWL_Error IFWL_Edit::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -324,7 +185,7 @@ FWL_Error CFWL_EditImp::Update() {
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit IFWL_Edit::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowScrollBar(TRUE)) {
CFX_RectF rect;
@@ -344,11 +205,11 @@ FWL_WidgetHit CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::Unknown;
}
-void CFWL_EditImp::AddSpellCheckObj(CFX_Path& PathData,
- int32_t nStart,
- int32_t nCount,
- FX_FLOAT fOffSetX,
- FX_FLOAT fOffSetY) {
+void IFWL_Edit::AddSpellCheckObj(CFX_Path& PathData,
+ int32_t nStart,
+ int32_t nCount,
+ FX_FLOAT fOffSetX,
+ FX_FLOAT fOffSetY) {
FX_FLOAT fStartX = 0.0f;
FX_FLOAT fEndX = 0.0f;
FX_FLOAT fY = 0.0f;
@@ -369,11 +230,11 @@ void CFWL_EditImp::AddSpellCheckObj(CFX_Path& PathData,
AddSquigglyPath(&PathData, fStartX, fEndX, fY, fStep);
}
}
-int32_t CFWL_EditImp::GetWordAtPoint(CFX_PointF pointf, int32_t& nCount) {
+int32_t IFWL_Edit::GetWordAtPoint(CFX_PointF pointf, int32_t& nCount) {
return 0;
}
-FX_BOOL CFWL_EditImp::GetSuggestWords(CFX_PointF pointf,
- std::vector<CFX_ByteString>& sSuggest) {
+FX_BOOL IFWL_Edit::GetSuggestWords(CFX_PointF pointf,
+ std::vector<CFX_ByteString>& sSuggest) {
int32_t nWordCount = 0;
int32_t nWordStart = GetWordAtPoint(pointf, nWordCount);
if (nWordCount < 1) {
@@ -392,7 +253,7 @@ FX_BOOL CFWL_EditImp::GetSuggestWords(CFX_PointF pointf,
return FALSE;
}
CFWL_EvtEdtCheckWord checkWordEvent;
- checkWordEvent.m_pSrcTarget = m_pInterface;
+ checkWordEvent.m_pSrcTarget = this;
checkWordEvent.bsWord = sLatinWord;
checkWordEvent.bCheckWord = TRUE;
DispatchEvent(&checkWordEvent);
@@ -400,15 +261,15 @@ FX_BOOL CFWL_EditImp::GetSuggestWords(CFX_PointF pointf,
return FALSE;
}
CFWL_EvtEdtGetSuggestWords suggestWordsEvent;
- suggestWordsEvent.m_pSrcTarget = m_pInterface;
+ suggestWordsEvent.m_pSrcTarget = this;
suggestWordsEvent.bsWord = sLatinWord;
suggestWordsEvent.bsArraySuggestWords = sSuggest;
suggestWordsEvent.bSuggestWords = FALSE;
DispatchEvent(&checkWordEvent);
return suggestWordsEvent.bSuggestWords;
}
-FX_BOOL CFWL_EditImp::ReplaceSpellCheckWord(CFX_PointF pointf,
- const CFX_ByteStringC& bsReplace) {
+FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
+ const CFX_ByteStringC& bsReplace) {
int32_t nWordCount = 0;
int32_t nWordStart = GetWordAtPoint(pointf, nWordCount);
if (nWordCount < 1) {
@@ -432,8 +293,8 @@ FX_BOOL CFWL_EditImp::ReplaceSpellCheckWord(CFX_PointF pointf,
Replace(nWordStart, nWordCount, wsDest.AsStringC());
return TRUE;
}
-void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
pGraphics->SaveGraphState();
if (pMatrix) {
pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix));
@@ -441,7 +302,7 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics,
FX_ARGB cr = 0xFFFF0000;
CFX_Color crLine(cr);
CFWL_EvtEdtCheckWord checkWordEvent;
- checkWordEvent.m_pSrcTarget = m_pInterface;
+ checkWordEvent.m_pSrcTarget = this;
CFX_ByteString sLatinWord;
CFX_Path pathSpell;
pathSpell.Create();
@@ -490,8 +351,8 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics,
}
pGraphics->RestoreGraphState();
}
-FWL_Error CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+FWL_Error IFWL_Edit::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -518,7 +379,7 @@ FWL_Error CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
+FWL_Error IFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
if (!pThemeProvider)
return FWL_Error::Indefinite;
if (m_pHorzScrollBar) {
@@ -534,20 +395,20 @@ FWL_Error CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetText(const CFX_WideString& wsText) {
+FWL_Error IFWL_Edit::SetText(const CFX_WideString& wsText) {
m_pEdtEngine->SetText(wsText);
return FWL_Error::Succeeded;
}
-int32_t CFWL_EditImp::GetTextLength() const {
+int32_t IFWL_Edit::GetTextLength() const {
if (!m_pEdtEngine)
return -1;
return m_pEdtEngine->GetTextLength();
}
-FWL_Error CFWL_EditImp::GetText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+FWL_Error IFWL_Edit::GetText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -555,7 +416,7 @@ FWL_Error CFWL_EditImp::GetText(CFX_WideString& wsText,
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::ClearText() {
+FWL_Error IFWL_Edit::ClearText() {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -563,19 +424,19 @@ FWL_Error CFWL_EditImp::ClearText() {
return FWL_Error::Succeeded;
}
-int32_t CFWL_EditImp::GetCaretPos() const {
+int32_t IFWL_Edit::GetCaretPos() const {
if (!m_pEdtEngine)
return -1;
return m_pEdtEngine->GetCaretPos();
}
-int32_t CFWL_EditImp::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
+int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
if (!m_pEdtEngine)
return -1;
return m_pEdtEngine->SetCaretPos(nIndex, bBefore);
}
-FWL_Error CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) {
+FWL_Error IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -583,19 +444,19 @@ FWL_Error CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) {
return FWL_Error::Succeeded;
}
-int32_t CFWL_EditImp::CountSelRanges() {
+int32_t IFWL_Edit::CountSelRanges() {
if (!m_pEdtEngine)
return 0;
return m_pEdtEngine->CountSelRanges();
}
-int32_t CFWL_EditImp::GetSelRange(int32_t nIndex, int32_t& nStart) {
+int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pEdtEngine)
return -1;
return m_pEdtEngine->GetSelRange(nIndex, nStart);
}
-FWL_Error CFWL_EditImp::ClearSelections() {
+FWL_Error IFWL_Edit::ClearSelections() {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -603,11 +464,11 @@ FWL_Error CFWL_EditImp::ClearSelections() {
return FWL_Error::Succeeded;
}
-int32_t CFWL_EditImp::GetLimit() {
+int32_t IFWL_Edit::GetLimit() {
return m_nLimit;
}
-FWL_Error CFWL_EditImp::SetLimit(int32_t nLimit) {
+FWL_Error IFWL_Edit::SetLimit(int32_t nLimit) {
m_nLimit = nLimit;
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -616,7 +477,7 @@ FWL_Error CFWL_EditImp::SetLimit(int32_t nLimit) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) {
+FWL_Error IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -624,9 +485,9 @@ FWL_Error CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::Insert(int32_t nStart,
- const FX_WCHAR* lpText,
- int32_t nLen) {
+FWL_Error IFWL_Edit::Insert(int32_t nStart,
+ const FX_WCHAR* lpText,
+ int32_t nLen) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -638,7 +499,7 @@ FWL_Error CFWL_EditImp::Insert(int32_t nStart,
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::DeleteSelections() {
+FWL_Error IFWL_Edit::DeleteSelections() {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -648,7 +509,7 @@ FWL_Error CFWL_EditImp::DeleteSelections() {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) {
+FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -656,9 +517,9 @@ FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::Replace(int32_t nStart,
- int32_t nLen,
- const CFX_WideStringC& wsReplace) {
+FWL_Error IFWL_Edit::Replace(int32_t nStart,
+ int32_t nLen,
+ const CFX_WideStringC& wsReplace) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -666,7 +527,7 @@ FWL_Error CFWL_EditImp::Replace(int32_t nStart,
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::DoClipboard(int32_t iCmd) {
+FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -677,7 +538,7 @@ FWL_Error CFWL_EditImp::DoClipboard(int32_t iCmd) {
return FWL_Error::Indefinite;
}
-FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) {
+FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) {
if (!m_pEdtEngine)
return FALSE;
@@ -697,7 +558,7 @@ FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) {
return TRUE;
}
-FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) {
+FX_BOOL IFWL_Edit::Cut(CFX_WideString& wsCut) {
if (!m_pEdtEngine)
return FALSE;
@@ -718,7 +579,7 @@ FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) {
return TRUE;
}
-FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) {
+FX_BOOL IFWL_Edit::Paste(const CFX_WideString& wsPaste) {
if (!m_pEdtEngine)
return FALSE;
@@ -732,7 +593,7 @@ FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) {
return TRUE;
}
-FX_BOOL CFWL_EditImp::Delete() {
+FX_BOOL IFWL_Edit::Delete() {
if (!m_pEdtEngine)
return FALSE;
@@ -744,7 +605,7 @@ FX_BOOL CFWL_EditImp::Delete() {
return TRUE;
}
-FX_BOOL CFWL_EditImp::Redo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_Edit::Redo(const IFDE_TxtEdtDoRecord* pRecord) {
if (!m_pEdtEngine)
return FALSE;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo)
@@ -752,7 +613,7 @@ FX_BOOL CFWL_EditImp::Redo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdtEngine->Redo(pRecord);
}
-FX_BOOL CFWL_EditImp::Undo(const IFDE_TxtEdtDoRecord* pRecord) {
+FX_BOOL IFWL_Edit::Undo(const IFDE_TxtEdtDoRecord* pRecord) {
if (!m_pEdtEngine)
return FALSE;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo)
@@ -760,27 +621,27 @@ FX_BOOL CFWL_EditImp::Undo(const IFDE_TxtEdtDoRecord* pRecord) {
return m_pEdtEngine->Undo(pRecord);
}
-FX_BOOL CFWL_EditImp::Undo() {
+FX_BOOL IFWL_Edit::Undo() {
if (!CanUndo())
return FALSE;
return Undo(m_DoRecords[m_iCurRecord--].get());
}
-FX_BOOL CFWL_EditImp::Redo() {
+FX_BOOL IFWL_Edit::Redo() {
if (!CanRedo())
return FALSE;
return Redo(m_DoRecords[++m_iCurRecord].get());
}
-FX_BOOL CFWL_EditImp::CanUndo() {
+FX_BOOL IFWL_Edit::CanUndo() {
return m_iCurRecord >= 0;
}
-FX_BOOL CFWL_EditImp::CanRedo() {
+FX_BOOL IFWL_Edit::CanRedo() {
return m_iCurRecord < pdfium::CollectionSize<int32_t>(m_DoRecords) - 1;
}
-FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
+FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
if (!m_pEdtEngine)
return FWL_Error::Indefinite;
@@ -790,21 +651,21 @@ FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetOuter(IFWL_Widget* pOuter) {
+FWL_Error IFWL_Edit::SetOuter(IFWL_Widget* pOuter) {
m_pOuter = pOuter;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetNumberRange(int32_t iMin, int32_t iMax) {
+FWL_Error IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
m_iMin = iMin;
m_iMax = iMax;
m_bSetRange = TRUE;
return FWL_Error::Succeeded;
}
-void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit,
- int32_t nPage,
- FX_BOOL bVisible) {
+void IFWL_Edit::On_CaretChanged(CFDE_TxtEdtEngine* pEdit,
+ int32_t nPage,
+ FX_BOOL bVisible) {
if (m_rtEngine.IsEmpty())
return;
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)
@@ -830,8 +691,8 @@ void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit,
}
}
-void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
- FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) {
+void IFWL_Edit::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
+ FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) {
uint32_t dwStyleEx = m_pProperties->m_dwStyleExes;
if (dwStyleEx & FWL_STYLEEXT_EDT_VAlignMask)
UpdateVAlignment();
@@ -848,7 +709,7 @@ void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
FX_BOOL bNeedUpdate = FALSE;
if (bHSelfAdaption || bVSelfAdaption) {
CFWL_EvtEdtPreSelfAdaption evt;
- evt.m_pSrcTarget = m_pInterface;
+ evt.m_pSrcTarget = this;
evt.bHSelfAdaption = TRUE;
evt.bVSelfAdaption = TRUE;
FX_FLOAT fWidth;
@@ -886,7 +747,7 @@ void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
m_pProperties->m_rtWidget.height = fContentHeight1;
}
CFWL_EvtEdtTextChanged event;
- event.m_pSrcTarget = m_pInterface;
+ event.m_pSrcTarget = this;
event.nChangeType = ChangeInfo.nChangeType;
event.wsInsert = ChangeInfo.wsInsert;
event.wsDelete = ChangeInfo.wsDelete;
@@ -896,15 +757,15 @@ void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
Repaint(&rtTemp);
}
-void CFWL_EditImp::On_SelChanged(CFDE_TxtEdtEngine* pEdit) {
+void IFWL_Edit::On_SelChanged(CFDE_TxtEdtEngine* pEdit) {
CFX_RectF rtTemp;
GetClientRect(rtTemp);
Repaint(&rtTemp);
}
-FX_BOOL CFWL_EditImp::On_PageLoad(CFDE_TxtEdtEngine* pEdit,
- int32_t nPageIndex,
- int32_t nPurpose) {
+FX_BOOL IFWL_Edit::On_PageLoad(CFDE_TxtEdtEngine* pEdit,
+ int32_t nPageIndex,
+ int32_t nPurpose) {
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex);
if (!pPage)
return FALSE;
@@ -912,9 +773,9 @@ FX_BOOL CFWL_EditImp::On_PageLoad(CFDE_TxtEdtEngine* pEdit,
return TRUE;
}
-FX_BOOL CFWL_EditImp::On_PageUnload(CFDE_TxtEdtEngine* pEdit,
- int32_t nPageIndex,
- int32_t nPurpose) {
+FX_BOOL IFWL_Edit::On_PageUnload(CFDE_TxtEdtEngine* pEdit,
+ int32_t nPageIndex,
+ int32_t nPurpose) {
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(nPageIndex);
if (!pPage)
return FALSE;
@@ -922,43 +783,43 @@ FX_BOOL CFWL_EditImp::On_PageUnload(CFDE_TxtEdtEngine* pEdit,
return TRUE;
}
-void CFWL_EditImp::On_AddDoRecord(CFDE_TxtEdtEngine* pEdit,
- IFDE_TxtEdtDoRecord* pRecord) {
+void IFWL_Edit::On_AddDoRecord(CFDE_TxtEdtEngine* pEdit,
+ IFDE_TxtEdtDoRecord* pRecord) {
AddDoRecord(pRecord);
}
-FX_BOOL CFWL_EditImp::On_Validate(CFDE_TxtEdtEngine* pEdit,
- CFX_WideString& wsText) {
+FX_BOOL IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit,
+ CFX_WideString& wsText) {
IFWL_Widget* pDst = GetOuter();
if (!pDst) {
- pDst = m_pInterface;
+ pDst = this;
}
CFWL_EvtEdtValidate event;
event.pDstWidget = pDst;
- event.m_pSrcTarget = m_pInterface;
+ event.m_pSrcTarget = this;
event.wsInsert = wsText;
event.bValidate = TRUE;
DispatchEvent(&event);
return event.bValidate;
}
-FWL_Error CFWL_EditImp::SetBackgroundColor(uint32_t color) {
+FWL_Error IFWL_Edit::SetBackgroundColor(uint32_t color) {
m_backColor = color;
m_updateBackColor = TRUE;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_EditImp::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
+FWL_Error IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
m_wsFont = wsFont;
m_fFontSize = fSize;
return FWL_Error::Succeeded;
}
-void CFWL_EditImp::SetScrollOffset(FX_FLOAT fScrollOffset) {
+void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
m_fScrollOffsetY = fScrollOffset;
}
-void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_bStaticBackground = false;
param.m_dwStates = m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly
@@ -986,9 +847,9 @@ void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics,
param.m_rtPart = rtStatic;
pTheme->DrawBackground(&param);
}
-void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_Edit::DrawContent(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (!m_pEdtEngine)
return;
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
@@ -1011,7 +872,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoHideSel) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Focused);
if (bShowSel) {
- IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(m_pInterface);
+ IFWL_Widget* pForm = m_pWidgetMgr->GetSystemFormWidget(this);
if (pForm) {
bShowSel = (pForm->GetStates() & FWL_WGTSTATE_Deactivated) !=
FWL_WGTSTATE_Deactivated;
@@ -1050,7 +911,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
CFWL_ThemeBackground param;
param.m_pGraphics = pGraphics;
param.m_matrix = *pMatrix;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_pPath = &path;
pTheme->DrawBackground(&param);
@@ -1079,7 +940,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
CFWL_ThemeBackground param;
param.m_pGraphics = pGraphics;
param.m_matrix = *pMatrix;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::CombTextLine;
param.m_pPath = &path;
pTheme->DrawBackground(&param);
@@ -1087,14 +948,14 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
pGraphics->RestoreGraphState();
}
-void CFWL_EditImp::UpdateEditEngine() {
+void IFWL_Edit::UpdateEditEngine() {
UpdateEditParams();
UpdateEditLayout();
if (m_nLimit > -1) {
m_pEdtEngine->SetLimit(m_nLimit);
}
}
-void CFWL_EditImp::UpdateEditParams() {
+void IFWL_Edit::UpdateEditParams() {
FDE_TXTEDTPARAMS params;
params.nHorzScale = 100;
params.fPlateWidth = m_rtEngine.width;
@@ -1210,7 +1071,7 @@ void CFWL_EditImp::UpdateEditParams() {
m_pEdtEngine->SetEditParams(params);
}
-void CFWL_EditImp::UpdateEditLayout() {
+void IFWL_Edit::UpdateEditLayout() {
if (m_pEdtEngine->GetTextLength() <= 0)
m_pEdtEngine->SetTextByStream(nullptr);
@@ -1226,7 +1087,7 @@ void CFWL_EditImp::UpdateEditLayout() {
pPage->LoadPage(nullptr, nullptr);
}
-FX_BOOL CFWL_EditImp::UpdateOffset() {
+FX_BOOL IFWL_Edit::UpdateOffset() {
CFX_RectF rtCaret;
m_pEdtEngine->GetCaretRect(rtCaret);
FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX;
@@ -1270,8 +1131,8 @@ FX_BOOL CFWL_EditImp::UpdateOffset() {
return TRUE;
}
-FX_BOOL CFWL_EditImp::UpdateOffset(IFWL_ScrollBar* pScrollBar,
- FX_FLOAT fPosChanged) {
+FX_BOOL IFWL_Edit::UpdateOffset(IFWL_ScrollBar* pScrollBar,
+ FX_FLOAT fPosChanged) {
if (pScrollBar == m_pHorzScrollBar.get())
m_fScrollOffsetX += fPosChanged;
else
@@ -1279,7 +1140,7 @@ FX_BOOL CFWL_EditImp::UpdateOffset(IFWL_ScrollBar* pScrollBar,
return TRUE;
}
-void CFWL_EditImp::UpdateVAlignment() {
+void IFWL_Edit::UpdateVAlignment() {
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
if (!pPage)
return;
@@ -1317,7 +1178,7 @@ void CFWL_EditImp::UpdateVAlignment() {
m_fVAlignOffset = 0;
}
}
-void CFWL_EditImp::UpdateCaret() {
+void IFWL_Edit::UpdateCaret() {
CFX_RectF rtFDE;
m_pEdtEngine->GetCaretRect(rtFDE);
rtFDE.Offset(m_rtEngine.left - m_fScrollOffsetX,
@@ -1354,7 +1215,7 @@ void CFWL_EditImp::UpdateCaret() {
}
ShowCaret(bShow, &rtCaret);
}
-IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() {
+IFWL_ScrollBar* IFWL_Edit::UpdateScroll() {
FX_BOOL bShowHorz =
m_pHorzScrollBar &&
((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Invisible) == 0);
@@ -1437,7 +1298,7 @@ IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() {
}
return pRepaint;
}
-FX_BOOL CFWL_EditImp::IsShowScrollBar(FX_BOOL bVert) {
+FX_BOOL IFWL_Edit::IsShowScrollBar(FX_BOOL bVert) {
FX_BOOL bShow =
(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus)
? (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) ==
@@ -1451,7 +1312,7 @@ FX_BOOL CFWL_EditImp::IsShowScrollBar(FX_BOOL bVert) {
return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll) &&
(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine);
}
-FX_BOOL CFWL_EditImp::IsContentHeightOverflow() {
+FX_BOOL IFWL_Edit::IsContentHeightOverflow() {
if (!m_pEdtEngine)
return FALSE;
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
@@ -1459,7 +1320,7 @@ FX_BOOL CFWL_EditImp::IsContentHeightOverflow() {
return FALSE;
return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f;
}
-int32_t CFWL_EditImp::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) {
+int32_t IFWL_Edit::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) {
int32_t nCount = pdfium::CollectionSize<int32_t>(m_DoRecords);
if (m_iCurRecord == nCount - 1) {
if (nCount == m_iMaxRecord) {
@@ -1475,7 +1336,7 @@ int32_t CFWL_EditImp::AddDoRecord(IFDE_TxtEdtDoRecord* pRecord) {
m_iCurRecord = pdfium::CollectionSize<int32_t>(m_DoRecords) - 1;
return m_iCurRecord;
}
-void CFWL_EditImp::Layout() {
+void IFWL_Edit::Layout() {
GetClientRect(m_rtClient);
m_rtEngine = m_rtClient;
FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
@@ -1544,7 +1405,7 @@ void CFWL_EditImp::Layout() {
m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Invisible, TRUE);
}
}
-void CFWL_EditImp::LayoutScrollBar() {
+void IFWL_Edit::LayoutScrollBar() {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) ==
0) {
return;
@@ -1607,26 +1468,26 @@ void CFWL_EditImp::LayoutScrollBar() {
}
}
-void CFWL_EditImp::DeviceToEngine(CFX_PointF& pt) {
+void IFWL_Edit::DeviceToEngine(CFX_PointF& pt) {
pt.x += m_fScrollOffsetX - m_rtEngine.left;
pt.y += m_fScrollOffsetY - m_rtEngine.top - m_fVAlignOffset;
}
-void CFWL_EditImp::InitScrollBar(FX_BOOL bVert) {
+void IFWL_Edit::InitScrollBar(FX_BOOL bVert) {
if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) {
return;
}
CFWL_WidgetImpProperties prop;
prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz;
prop.m_dwStates = FWL_WGTSTATE_Disabled | FWL_WGTSTATE_Invisible;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
- IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface);
+ IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, this);
pScrollBar->Initialize();
(bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar);
}
-void CFWL_EditImp::InitEngine() {
+void IFWL_Edit::InitEngine() {
if (!m_pEdtEngine)
m_pEdtEngine.reset(new CFDE_TxtEdtEngine);
}
@@ -1656,7 +1517,7 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget,
return TRUE;
}
-void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) {
+void IFWL_Edit::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) {
if (m_pCaret) {
m_pCaret->ShowCaret(bVisible);
if (bVisible && !pRect->IsEmpty()) {
@@ -1664,7 +1525,7 @@ void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) {
}
Repaint(&m_rtEngine);
} else {
- IFWL_Widget* pOuter = m_pInterface;
+ IFWL_Widget* pOuter = this;
if (bVisible) {
pRect->Offset(m_pProperties->m_rtWidget.left,
m_pProperties->m_rtWidget.top);
@@ -1680,7 +1541,7 @@ void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) {
FWL_ShowCaret(pOuter, bVisible, pRect);
}
}
-FX_BOOL CFWL_EditImp::ValidateNumberChar(FX_WCHAR cNum) {
+FX_BOOL IFWL_Edit::ValidateNumberChar(FX_WCHAR cNum) {
if (!m_pEdtEngine) {
return FALSE;
}
@@ -1715,13 +1576,13 @@ FX_BOOL CFWL_EditImp::ValidateNumberChar(FX_WCHAR cNum) {
}
return FALSE;
}
-void CFWL_EditImp::InitCaret() {
+void IFWL_Edit::InitCaret() {
if (!m_pCaret) {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret)) {
CFWL_WidgetImpProperties prop;
- m_pCaret.reset(IFWL_Caret::Create(prop, m_pInterface));
+ m_pCaret.reset(IFWL_Caret::Create(prop, this));
m_pCaret->Initialize();
- m_pCaret->SetParent(m_pInterface);
+ m_pCaret->SetParent(this);
m_pCaret->SetStates(m_pProperties->m_dwStates);
}
} else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_InnerCaret) ==
@@ -1730,16 +1591,16 @@ void CFWL_EditImp::InitCaret() {
}
}
-void CFWL_EditImp::ClearRecord() {
+void IFWL_Edit::ClearRecord() {
m_iCurRecord = -1;
m_DoRecords.clear();
}
-void CFWL_EditImp::ProcessInsertError(int32_t iError) {
+void IFWL_Edit::ProcessInsertError(int32_t iError) {
switch (iError) {
case -2: {
CFWL_EvtEdtTextFull textFullEvent;
- textFullEvent.m_pSrcTarget = m_pInterface;
+ textFullEvent.m_pSrcTarget = this;
DispatchEvent(&textFullEvent);
break;
}
@@ -1747,7 +1608,7 @@ void CFWL_EditImp::ProcessInsertError(int32_t iError) {
}
}
-CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner)
+CFWL_EditImpDelegate::CFWL_EditImpDelegate(IFWL_Edit* pOwner)
: m_pOwner(pOwner) {}
void CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1805,9 +1666,7 @@ void CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnChar(pKey);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/core/ifwl_edit.h
index e17a4cfc09..2d65897b8c 100644
--- a/xfa/fwl/basewidget/fwl_editimp.h
+++ b/xfa/fwl/core/ifwl_edit.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_EDIT_H_
+#define XFA_FWL_CORE_IFWL_EDIT_H_
#include <deque>
#include <memory>
@@ -13,11 +13,88 @@
#include "xfa/fde/ifde_txtedtdorecord.h"
#include "xfa/fde/ifde_txtedtengine.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
+#include "xfa/fwl/lightwidget/cfwl_widget.h"
#include "xfa/fxgraphics/cfx_path.h"
-class CFWL_EditImp;
+#define FWL_CLASS_Edit L"FWL_EDIT"
+#define FWL_STYLEEXT_EDT_ReadOnly (1L << 0)
+#define FWL_STYLEEXT_EDT_MultiLine (1L << 1)
+#define FWL_STYLEEXT_EDT_WantReturn (1L << 2)
+#define FWL_STYLEEXT_EDT_NoHideSel (1L << 3)
+#define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4)
+#define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5)
+#define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6)
+#define FWL_STYLEEXT_EDT_Validate (1L << 7)
+#define FWL_STYLEEXT_EDT_Password (1L << 8)
+#define FWL_STYLEEXT_EDT_Number (1L << 9)
+#define FWL_STYLEEXT_EDT_HSelfAdaption (1L << 10)
+#define FWL_STYLEEXT_EDT_VSelfAdaption (1L << 11)
+#define FWL_STYLEEXT_EDT_VerticalLayout (1L << 12)
+#define FWL_STYLEEXT_EDT_VerticalChars (1L << 13)
+#define FWL_STYLEEXT_EDT_ReverseLine (1L << 14)
+#define FWL_STYLEEXT_EDT_ArabicShapes (1L << 15)
+#define FWL_STYLEEXT_EDT_ExpandTab (1L << 16)
+#define FWL_STYLEEXT_EDT_CombText (1L << 17)
+#define FWL_STYLEEXT_EDT_HNear (0L << 18)
+#define FWL_STYLEEXT_EDT_HCenter (1L << 18)
+#define FWL_STYLEEXT_EDT_HFar (2L << 18)
+#define FWL_STYLEEXT_EDT_VNear (0L << 20)
+#define FWL_STYLEEXT_EDT_VCenter (1L << 20)
+#define FWL_STYLEEXT_EDT_VFar (2L << 20)
+#define FWL_STYLEEXT_EDT_Justified (1L << 22)
+#define FWL_STYLEEXT_EDT_Distributed (2L << 22)
+#define FWL_STYLEEXT_EDT_HAlignMask (3L << 18)
+#define FWL_STYLEEXT_EDT_VAlignMask (3L << 20)
+#define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22)
+#define FWL_STYLEEXT_EDT_InnerCaret (1L << 24)
+#define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25)
+#define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
+#define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
+
+enum FWL_EDT_TEXTCHANGED {
+ FWL_EDT_TEXTCHANGED_Insert = 0,
+ FWL_EDT_TEXTCHANGED_Delete,
+ FWL_EDT_TEXTCHANGED_Replace,
+};
+
+FWL_EVENT_DEF(CFWL_EvtEdtTextChanged,
+ CFWL_EventType::TextChanged,
+ int32_t nChangeType;
+ CFX_WideString wsInsert;
+ CFX_WideString wsDelete;
+ CFX_WideString wsPrevText;)
+
+FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull)
+
+FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption,
+ CFWL_EventType::PreSelfAdaption,
+ FX_BOOL bHSelfAdaption;
+ FX_BOOL bVSelfAdaption;
+ CFX_RectF rtAfterChange;)
+
+FWL_EVENT_DEF(CFWL_EvtEdtValidate,
+ CFWL_EventType::Validate,
+ IFWL_Widget* pDstWidget;
+ CFX_WideString wsInsert;
+ FX_BOOL bValidate;)
+
+FWL_EVENT_DEF(CFWL_EvtEdtCheckWord,
+ CFWL_EventType::CheckWord,
+ CFX_ByteString bsWord;
+ FX_BOOL bCheckWord;)
+
+FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords,
+ CFWL_EventType::GetSuggestedWords,
+ FX_BOOL bSuggestWords;
+ CFX_ByteString bsWord;
+ std::vector<CFX_ByteString> bsArraySuggestWords;)
+
+class CFWL_WidgetImpProperties;
+class IFDE_TxtEdtDoRecord;
+class IFWL_Edit;
class CFWL_EditImpDelegate;
class CFWL_MsgActivate;
class CFWL_MsgDeactivate;
@@ -26,12 +103,17 @@ class CFWL_WidgetImpDelegate;
class CFWL_WidgetImpProperties;
class IFWL_Caret;
-class CFWL_EditImp : public CFWL_WidgetImp {
+class IFWL_EditDP : public IFWL_DataProvider {};
+
+class IFWL_Edit : public IFWL_Widget {
public:
- CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
- ~CFWL_EditImp() override;
+ static IFWL_Edit* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_Edit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_Edit() override;
- // CFWL_WidgetImp:
+ // IFWL_Widget:
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -177,7 +259,7 @@ class CFWL_EditImp : public CFWL_WidgetImp {
class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_EditImpDelegate(CFWL_EditImp* pOwner);
+ CFWL_EditImpDelegate(IFWL_Edit* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -196,7 +278,7 @@ class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate {
void OnChar(CFWL_MsgKey* pMsg);
FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos);
void DoCursor(CFWL_MsgMouse* pMsg);
- CFWL_EditImp* m_pOwner;
+ IFWL_Edit* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_
+#endif // XFA_FWL_CORE_IFWL_EDIT_H_
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/ifwl_form.cpp
index 0f4b89a774..ad78f98cb3 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/ifwl_form.cpp
@@ -4,18 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/core/fwl_formimp.h"
+#include "xfa/fwl/core/ifwl_form.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/fwl_formproxyimp.h"
#include "xfa/fwl/core/cfwl_message.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/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_formproxy.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
@@ -33,43 +32,13 @@ const uint8_t kCornerEnlarge = 10;
} // namespace
-// static
-IFWL_Form* IFWL_Form::CreateFormProxy(CFWL_WidgetImpProperties& properties,
- CFX_WideString* classname,
- IFWL_Widget* pOuter) {
- IFWL_Form* pForm = new IFWL_Form;
- CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter);
- pForm->SetImpl(pFormProxyImpl);
- pFormProxyImpl->SetInterface(pForm);
- return pForm;
-}
-IFWL_Form::IFWL_Form() {}
-FWL_FORMSIZE IFWL_Form::GetFormSize() {
- return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize();
-}
-FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) {
- return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize);
-}
-IFWL_Widget* IFWL_Form::DoModal() {
- return static_cast<CFWL_FormImp*>(GetImpl())->DoModal();
-}
-IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) {
- return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID);
-}
-FWL_Error IFWL_Form::EndDoModal() {
- return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal();
-}
-FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) {
- return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath);
-}
-
-RestoreResizeInfo::RestoreResizeInfo() {}
+RestoreInfo::RestoreInfo() {}
-RestoreResizeInfo::~RestoreResizeInfo() {}
+RestoreInfo::~RestoreInfo() {}
-CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_Form::IFWL_Form(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_pCloseBox(nullptr),
m_pMinBox(nullptr),
m_pMaxBox(nullptr),
@@ -96,41 +65,41 @@ CFWL_FormImp::CFWL_FormImp(const CFWL_WidgetImpProperties& properties,
m_rtIcon.Reset();
}
-CFWL_FormImp::~CFWL_FormImp() {
+IFWL_Form::~IFWL_Form() {
RemoveSysButtons();
}
-FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_Form::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Form;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_FormImp::GetClassID() const {
+FWL_Type IFWL_Form::GetClassID() const {
return FWL_Type::Form;
}
-FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const {
+FX_BOOL IFWL_Form::IsInstance(const CFX_WideStringC& wsClass) const {
if (wsClass == CFX_WideStringC(FWL_CLASS_Form))
return TRUE;
- return CFWL_WidgetImp::IsInstance(wsClass);
+ return IFWL_Widget::IsInstance(wsClass);
}
-FWL_Error CFWL_FormImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_Form::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
RegisterForm();
RegisterEventTarget();
m_pDelegate = new CFWL_FormImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_FormImp::Finalize() {
+FWL_Error IFWL_Form::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
UnregisterEventTarget();
UnRegisterForm();
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+FWL_Error IFWL_Form::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Reset();
FX_FLOAT fCapHeight = GetCaptionHeight();
@@ -144,7 +113,7 @@ FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
+FWL_Error IFWL_Form::GetClientRect(CFX_RectF& rect) {
if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) {
rect = m_pProperties->m_rtWidget;
rect.Offset(-rect.left, -rect.top);
@@ -166,7 +135,7 @@ FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (pTheme) {
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
x = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder));
y = *static_cast<FX_FLOAT*>(
@@ -180,7 +149,7 @@ FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
return FWL_Error::Succeeded;
#endif
}
-FWL_Error CFWL_FormImp::Update() {
+FWL_Error IFWL_Form::Update() {
if (m_iLock > 0) {
return FWL_Error::Succeeded;
}
@@ -198,7 +167,7 @@ FWL_Error CFWL_FormImp::Update() {
Layout();
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+FWL_WidgetHit IFWL_Form::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
GetAvailableTheme();
if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy))
return FWL_WidgetHit::CloseBox;
@@ -250,8 +219,8 @@ FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
}
return FWL_WidgetHit::Client;
}
-FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+FWL_Error IFWL_Form::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -266,7 +235,7 @@ FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
#endif
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_dwStates = iState;
param.m_pGraphics = pGraphics;
param.m_rtPart = m_rtRelative;
@@ -369,16 +338,16 @@ FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
}
-FWL_FORMSIZE CFWL_FormImp::GetFormSize() {
+FWL_FORMSIZE IFWL_Form::GetFormSize() {
return m_eFormSize;
}
-FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) {
+FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) {
m_eFormSize = eFormSize;
return FWL_Error::Succeeded;
}
-IFWL_Widget* CFWL_FormImp::DoModal() {
+IFWL_Widget* IFWL_Form::DoModal() {
IFWL_App* pApp = GetOwnerApp();
if (!pApp)
return nullptr;
@@ -400,11 +369,11 @@ IFWL_Widget* CFWL_FormImp::DoModal() {
return nullptr;
}
-IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) {
+IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) {
return DoModal();
}
-FWL_Error CFWL_FormImp::EndDoModal() {
+FWL_Error IFWL_Form::EndDoModal() {
if (!m_pNoteLoop)
return FWL_Error::Indefinite;
m_bDoModalFlag = FALSE;
@@ -428,13 +397,13 @@ FWL_Error CFWL_FormImp::EndDoModal() {
#endif
}
-FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) {
+FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) {
return FWL_Error::Succeeded;
}
-void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme) {
+void IFWL_Form::DrawBackground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_pGraphics = pGraphics;
param.m_rtPart = m_rtRelative;
@@ -442,14 +411,14 @@ void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics,
m_fCXBorder);
pTheme->DrawBackground(&param);
}
-CFWL_WidgetImp* CFWL_FormImp::GetSubFocus() {
+IFWL_Widget* IFWL_Form::GetSubFocus() {
return m_pSubFocus;
}
-void CFWL_FormImp::SetSubFocus(CFWL_WidgetImp* pWidget) {
+void IFWL_Form::SetSubFocus(IFWL_Widget* pWidget) {
m_pSubFocus = pWidget;
}
-void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
+void IFWL_Form::ShowChildWidget(IFWL_Widget* pParent) {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return;
@@ -465,7 +434,7 @@ void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
}
}
-void CFWL_FormImp::RemoveSysButtons() {
+void IFWL_Form::RemoveSysButtons() {
m_rtCaption.Reset();
delete m_pCloseBox;
m_pCloseBox = nullptr;
@@ -477,7 +446,7 @@ void CFWL_FormImp::RemoveSysButtons() {
m_pCaptionBox = nullptr;
}
-void CFWL_FormImp::CalcContentRect(CFX_RectF& rtContent) {
+void IFWL_Form::CalcContentRect(CFX_RectF& rtContent) {
#ifdef FWL_UseMacSystemBorder
rtContent = m_rtRelative;
#else
@@ -488,7 +457,7 @@ void CFWL_FormImp::CalcContentRect(CFX_RectF& rtContent) {
}
#endif
}
-CFWL_SysBtn* CFWL_FormImp::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
+CFWL_SysBtn* IFWL_Form::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
if (m_pCloseBox && m_pCloseBox->m_rtBtn.Contains(fx, fy)) {
return m_pCloseBox;
}
@@ -503,7 +472,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
return nullptr;
}
-CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) {
+CFWL_SysBtn* IFWL_Form::GetSysBtnByState(uint32_t dwState) {
if (m_pCloseBox && (m_pCloseBox->m_dwState & dwState)) {
return m_pCloseBox;
}
@@ -518,7 +487,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByState(uint32_t dwState) {
}
return nullptr;
}
-CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) {
+CFWL_SysBtn* IFWL_Form::GetSysBtnByIndex(int32_t nIndex) {
if (nIndex < 0)
return nullptr;
@@ -534,7 +503,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) {
return arrBtn[nIndex];
}
-int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) {
+int32_t IFWL_Form::GetSysBtnIndex(CFWL_SysBtn* pBtn) {
CFX_ArrayTemplate<CFWL_SysBtn*> arrBtn;
if (m_pMinBox)
arrBtn.Add(m_pMinBox);
@@ -547,7 +516,7 @@ int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) {
return arrBtn.Find(pBtn);
}
-FX_FLOAT CFWL_FormImp::GetCaptionHeight() {
+FX_FLOAT IFWL_Form::GetCaptionHeight() {
CFWL_WidgetCapacity dwCapacity = CFWL_WidgetCapacity::None;
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) {
@@ -562,17 +531,17 @@ FX_FLOAT CFWL_FormImp::GetCaptionHeight() {
}
return 0;
}
-void CFWL_FormImp::DrawCaptionText(CFX_Graphics* pGs,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_Form::DrawCaptionText(CFX_Graphics* pGs,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFX_WideString wsText;
IFWL_DataProvider* pData = m_pProperties->m_pDataProvider;
- pData->GetCaption(m_pInterface, wsText);
+ pData->GetCaption(this, wsText);
if (wsText.IsEmpty()) {
return;
}
CFWL_ThemeText textParam;
- textParam.m_pWidget = m_pInterface;
+ textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::Caption;
textParam.m_dwStates = CFWL_PartState_Normal;
textParam.m_pGraphics = pGs;
@@ -596,23 +565,23 @@ void CFWL_FormImp::DrawCaptionText(CFX_Graphics* pGs,
: FDE_TTOALIGNMENT_CenterLeft;
pTheme->DrawText(&textParam);
}
-void CFWL_FormImp::DrawIconImage(CFX_Graphics* pGs,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_Form::DrawIconImage(CFX_Graphics* pGs,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
IFWL_FormDP* pData =
static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Icon;
param.m_pGraphics = pGs;
- param.m_pImage = pData->GetIcon(m_pInterface, FALSE);
+ param.m_pImage = pData->GetIcon(this, FALSE);
param.m_rtPart = m_rtIcon;
if (pMatrix) {
param.m_matrix.Concat(*pMatrix);
}
pTheme->DrawBackground(&param);
}
-void CFWL_FormImp::GetEdgeRect(CFX_RectF& rtEdge) {
+void IFWL_Form::GetEdgeRect(CFX_RectF& rtEdge) {
rtEdge = m_rtRelative;
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Border) {
FX_FLOAT fCX = GetBorderSize();
@@ -620,7 +589,7 @@ void CFWL_FormImp::GetEdgeRect(CFX_RectF& rtEdge) {
rtEdge.Deflate(fCX, m_rtCaption.Height(), fCX, fCY);
}
}
-void CFWL_FormImp::SetWorkAreaRect() {
+void IFWL_Form::SetWorkAreaRect() {
m_rtRestore = m_pProperties->m_rtWidget;
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr)
@@ -628,21 +597,21 @@ void CFWL_FormImp::SetWorkAreaRect() {
m_bSetMaximize = TRUE;
Repaint(&m_rtRelative);
}
-void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {}
-void CFWL_FormImp::Layout() {
+void IFWL_Form::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {}
+void IFWL_Form::Layout() {
GetRelativeRect(m_rtRelative);
#ifndef FWL_UseMacSystemBorder
ReSetSysBtn();
#endif
}
-void CFWL_FormImp::ReSetSysBtn() {
+void IFWL_Form::ReSetSysBtn() {
m_fCXBorder =
*static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CXBorder));
m_fCYBorder =
*static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::CYBorder));
RemoveSysButtons();
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface);
+ m_bCustomizeLayout = pTheme->IsCustomizedLayout(this);
FX_FLOAT fCapHeight = GetCaptionHeight();
if (fCapHeight > 0) {
m_rtCaption = m_rtRelative;
@@ -695,14 +664,14 @@ void CFWL_FormImp::ReSetSysBtn() {
IFWL_FormDP* pData =
static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon &&
- pData->GetIcon(m_pInterface, FALSE)) {
+ pData->GetIcon(this, FALSE)) {
if (!m_bCustomizeLayout) {
m_rtIcon.Set(5, (m_rtCaption.height - m_fSmallIconSz) / 2, m_fSmallIconSz,
m_fSmallIconSz);
}
}
}
-void CFWL_FormImp::RegisterForm() {
+void IFWL_Form::RegisterForm() {
IFWL_App* pApp = GetOwnerApp();
if (!pApp)
return;
@@ -714,7 +683,7 @@ void CFWL_FormImp::RegisterForm() {
pDriver->RegisterForm(this);
}
-void CFWL_FormImp::UnRegisterForm() {
+void IFWL_Form::UnRegisterForm() {
IFWL_App* pApp = GetOwnerApp();
if (!pApp)
return;
@@ -726,34 +695,34 @@ void CFWL_FormImp::UnRegisterForm() {
pDriver->UnRegisterForm(this);
}
-FX_BOOL CFWL_FormImp::IsDoModal() {
+FX_BOOL IFWL_Form::IsDoModal() {
return m_bDoModalFlag;
}
-void CFWL_FormImp::SetThemeData() {
+void IFWL_Form::SetThemeData() {
m_fSmallIconSz =
*static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::SmallIcon));
m_fBigIconSz =
*static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::BigIcon));
}
-FX_BOOL CFWL_FormImp::HasIcon() {
+FX_BOOL IFWL_Form::HasIcon() {
IFWL_FormDP* pData =
static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
- return !!pData->GetIcon(m_pInterface, FALSE);
+ return !!pData->GetIcon(this, FALSE);
}
-void CFWL_FormImp::UpdateIcon() {
+void IFWL_Form::UpdateIcon() {
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr)
return;
IFWL_FormDP* pData =
static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
- CFX_DIBitmap* pBigIcon = pData->GetIcon(m_pInterface, TRUE);
- CFX_DIBitmap* pSmallIcon = pData->GetIcon(m_pInterface, FALSE);
+ CFX_DIBitmap* pBigIcon = pData->GetIcon(this, TRUE);
+ CFX_DIBitmap* pSmallIcon = pData->GetIcon(this, FALSE);
if (pBigIcon)
m_pBigIcon = pBigIcon;
if (pSmallIcon)
m_pSmallIcon = pSmallIcon;
}
-void CFWL_FormImp::UpdateCaption() {
+void IFWL_Form::UpdateCaption() {
CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
if (!pWidgetMgr)
return;
@@ -761,15 +730,15 @@ void CFWL_FormImp::UpdateCaption() {
if (!pData)
return;
CFX_WideString text;
- pData->GetCaption(m_pInterface, text);
-}
-void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
- FX_FLOAT& fWidth,
- FX_FLOAT fCurX,
- FX_FLOAT fSpace,
- FX_FLOAT fLimitMin,
- FX_FLOAT fLimitMax,
- FX_BOOL bLeft) {
+ pData->GetCaption(this, text);
+}
+void IFWL_Form::DoWidthLimit(FX_FLOAT& fLeft,
+ FX_FLOAT& fWidth,
+ FX_FLOAT fCurX,
+ FX_FLOAT fSpace,
+ FX_FLOAT fLimitMin,
+ FX_FLOAT fLimitMax,
+ FX_BOOL bLeft) {
FX_FLOAT fx = fCurX;
FX_FLOAT fy = 0;
TransformTo(nullptr, fx, fy);
@@ -788,13 +757,13 @@ void CFWL_FormImp::DoWidthLimit(FX_FLOAT& fLeft,
}
}
}
-void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop,
- FX_FLOAT& fHeight,
- FX_FLOAT fCurY,
- FX_FLOAT fSpace,
- FX_FLOAT fLimitMin,
- FX_FLOAT fLimitMax,
- FX_BOOL bTop) {
+void IFWL_Form::DoHeightLimit(FX_FLOAT& fTop,
+ FX_FLOAT& fHeight,
+ FX_FLOAT fCurY,
+ FX_FLOAT fSpace,
+ FX_FLOAT fLimitMin,
+ FX_FLOAT fLimitMax,
+ FX_BOOL bTop) {
FX_FLOAT fx = 0;
FX_FLOAT fy = fCurY;
TransformTo(nullptr, fx, fy);
@@ -813,7 +782,7 @@ void CFWL_FormImp::DoHeightLimit(FX_FLOAT& fTop,
}
}
-CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner)
+CFWL_FormImpDelegate::CFWL_FormImpDelegate(IFWL_Form* pOwner)
: m_pOwner(pOwner) {}
#ifdef FWL_UseMacSystemBorder
@@ -847,9 +816,7 @@ void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
IFWL_App* pApp = m_pOwner->GetOwnerApp();
CFWL_NoteDriver* pDriver =
static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
- CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
- IFWL_Widget* pSubFocus =
- pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
+ IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus();
if (pSubFocus && pSubFocus != pDriver->GetFocus())
pDriver->SetFocus(pSubFocus);
@@ -861,9 +828,7 @@ void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
IFWL_App* pApp = m_pOwner->GetOwnerApp();
CFWL_NoteDriver* pDriver =
static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
- CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
- IFWL_Widget* pSubFocus =
- pSubFocusImp ? pSubFocusImp->GetInterface() : nullptr;
+ IFWL_Widget* pSubFocus = m_pOwner->GetSubFocus();
if (pSubFocus) {
if (pSubFocus == pDriver->GetFocus()) {
pDriver->SetFocus(nullptr);
@@ -914,7 +879,7 @@ void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
if (!pWidgetMgr)
return;
- pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface);
+ pWidgetMgr->AddRedrawCounts(m_pOwner);
if (!m_pOwner->m_bSetMaximize)
break;
@@ -935,9 +900,7 @@ void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnClose(static_cast<CFWL_MsgClose*>(pMessage));
break;
}
- default: {
- break;
- }
+ default: { break; }
}
}
#endif // FWL_UseMacSystemBorder
@@ -1002,7 +965,7 @@ void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized;
} else if (pPressedBtn != m_pOwner->m_pMinBox) {
CFWL_EvtClose eClose;
- eClose.m_pSrcTarget = m_pOwner->m_pInterface;
+ eClose.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&eClose);
}
}
@@ -1100,7 +1063,7 @@ void CFWL_FormImpDelegate::OnWindowMove(CFWL_MsgWindowMove* pMsg) {
}
void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) {
CFWL_EvtClose eClose;
- eClose.m_pSrcTarget = m_pOwner->m_pInterface;
+ eClose.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&eClose);
}
diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h
index 860cbd679d..3aa38a00cd 100644
--- a/xfa/fwl/core/ifwl_form.h
+++ b/xfa/fwl/core/ifwl_form.h
@@ -7,6 +7,8 @@
#ifndef XFA_FWL_CORE_IFWL_FORM_H_
#define XFA_FWL_CORE_IFWL_FORM_H_
+#include <memory>
+
#include "core/fxcrt/fx_system.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
@@ -26,6 +28,10 @@
#define FWL_UseMacSystemBorder
#endif
+#define FWL_SYSBUTTONSTATE_Hover 0x0001
+#define FWL_SYSBUTTONSTATE_Pressed 0x0002
+#define FWL_SYSBUTTONSTATE_Disabled 0x0010
+
enum FWL_FORMSIZE {
FWL_FORMSIZE_Manual = 0,
FWL_FORMSIZE_Width,
@@ -33,11 +39,44 @@ enum FWL_FORMSIZE {
FWL_FORMSIZE_All,
};
-class CFX_DIBitmap;
-class CFX_WideString;
-class CFX_Path;
+class CFWL_SysBtn {
+ public:
+ CFWL_SysBtn();
+
+ bool IsDisabled() const;
+ uint32_t GetPartState() const;
+
+ void SetNormal();
+ void SetPressed();
+ void SetHover();
+ void SetDisabled(FX_BOOL bDisabled);
+
+ CFX_RectF m_rtBtn;
+ uint32_t m_dwState;
+};
+
+enum FORM_RESIZETYPE {
+ FORM_RESIZETYPE_None = 0,
+ FORM_RESIZETYPE_Cap,
+};
+
+struct RestoreInfo {
+ RestoreInfo();
+ ~RestoreInfo();
+
+ CFX_PointF m_ptStart;
+ CFX_SizeF m_szStart;
+};
+
+class CFWL_MsgMouse;
+class CFWL_MsgClose;
+class CFWL_MsgWindowMove;
+class CFWL_NoteLoop;
+class CFWL_WidgetImpProperties;
class IFWL_Widget;
-class IFWL_Form;
+class IFWL_ThemeProvider;
+class CFWL_SysBtn;
+class CFWL_FormImpDelegate;
class IFWL_FormDP : public IFWL_DataProvider {
public:
@@ -46,9 +85,22 @@ class IFWL_FormDP : public IFWL_DataProvider {
class IFWL_Form : public IFWL_Widget {
public:
- static IFWL_Form* CreateFormProxy(CFWL_WidgetImpProperties& properties,
- CFX_WideString* classname,
- IFWL_Widget* pOuter);
+ IFWL_Form(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_Form() override;
+
+ // IFWL_Widget
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override;
+ FWL_Type GetClassID() const override;
+ FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override;
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+
+ FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
+ FWL_Error GetClientRect(CFX_RectF& rect) override;
+ FWL_Error Update() override;
+ FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
FWL_FORMSIZE GetFormSize();
FWL_Error SetFormSize(FWL_FORMSIZE eFormSize);
@@ -56,9 +108,102 @@ class IFWL_Form : public IFWL_Widget {
IFWL_Widget* DoModal(uint32_t& dwCommandID);
FWL_Error EndDoModal();
FWL_Error SetBorderRegion(CFX_Path* pPath);
+ void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
+ IFWL_Widget* GetSubFocus();
+ void SetSubFocus(IFWL_Widget* pWidget);
+
+ protected:
+ friend class CFWL_FormImpDelegate;
+
+ void ShowChildWidget(IFWL_Widget* pParent);
+ void RemoveSysButtons();
+ void CalcContentRect(CFX_RectF& rtContent);
+ CFWL_SysBtn* GetSysBtnAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ CFWL_SysBtn* GetSysBtnByState(uint32_t dwState);
+ CFWL_SysBtn* GetSysBtnByIndex(int32_t nIndex);
+ int32_t GetSysBtnIndex(CFWL_SysBtn* pBtn);
+ FX_FLOAT GetCaptionHeight();
+ void DrawCaptionText(CFX_Graphics* pGs,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawIconImage(CFX_Graphics* pGs,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void GetEdgeRect(CFX_RectF& rtEdge);
+ void SetWorkAreaRect();
+ void SetCursor(FX_FLOAT fx, FX_FLOAT fy);
+ void Layout();
+ void ReSetSysBtn();
+ void RegisterForm();
+ void UnRegisterForm();
+ FX_BOOL IsDoModal();
+ void SetThemeData();
+ FX_BOOL HasIcon();
+ void UpdateIcon();
+ void UpdateCaption();
+ void DoWidthLimit(FX_FLOAT& fLeft,
+ FX_FLOAT& fWidth,
+ FX_FLOAT fCurX,
+ FX_FLOAT fSpace,
+ FX_FLOAT fLimitMin,
+ FX_FLOAT fLimitMax,
+ FX_BOOL bLeft);
+ void DoHeightLimit(FX_FLOAT& fTop,
+ FX_FLOAT& fHeight,
+ FX_FLOAT fCurY,
+ FX_FLOAT fSpace,
+ FX_FLOAT fLimitMin,
+ FX_FLOAT fLimitMax,
+ FX_BOOL bTop);
+
+ CFX_RectF m_rtRestore;
+ CFX_RectF m_rtCaptionText;
+ CFX_RectF m_rtRelative;
+ CFX_RectF m_rtCaption;
+ CFX_RectF m_rtIcon;
+ CFWL_SysBtn* m_pCloseBox;
+ CFWL_SysBtn* m_pMinBox;
+ CFWL_SysBtn* m_pMaxBox;
+ CFWL_SysBtn* m_pCaptionBox;
+ std::unique_ptr<CFWL_NoteLoop> m_pNoteLoop;
+ IFWL_Widget* m_pSubFocus;
+ RestoreInfo m_InfoStart;
+ FX_FLOAT m_fCXBorder;
+ FX_FLOAT m_fCYBorder;
+ int32_t m_iCaptureBtn;
+ int32_t m_iSysBox;
+ int32_t m_eResizeType;
+ FX_BOOL m_bLButtonDown;
+ bool m_bMaximized;
+ FX_BOOL m_bSetMaximize;
+ FX_BOOL m_bCustomizeLayout;
+ FWL_FORMSIZE m_eFormSize;
+ FX_BOOL m_bDoModalFlag;
+ FX_FLOAT m_fSmallIconSz;
+ FX_FLOAT m_fBigIconSz;
+ CFX_DIBitmap* m_pBigIcon;
+ CFX_DIBitmap* m_pSmallIcon;
+ FX_BOOL m_bMouseIn;
+};
+
+class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate {
+ public:
+ CFWL_FormImpDelegate(IFWL_Form* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
protected:
- IFWL_Form();
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseMove(CFWL_MsgMouse* pMsg);
+ void OnMouseHover(CFWL_MsgMouse* pMsg);
+ void OnMouseLeave(CFWL_MsgMouse* pMsg);
+ void OnLButtonDblClk(CFWL_MsgMouse* pMsg);
+ void OnWindowMove(CFWL_MsgWindowMove* pMsg);
+ void OnClose(CFWL_MsgClose* pMsg);
+ IFWL_Form* m_pOwner;
};
#endif // XFA_FWL_CORE_IFWL_FORM_H_
diff --git a/xfa/fwl/core/ifwl_formproxy.cpp b/xfa/fwl/core/ifwl_formproxy.cpp
new file mode 100644
index 0000000000..123db79f19
--- /dev/null
+++ b/xfa/fwl/core/ifwl_formproxy.cpp
@@ -0,0 +1,67 @@
+// Copyright 2014 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/ifwl_formproxy.h"
+
+#include "xfa/fwl/core/fwl_noteimp.h"
+
+// static
+IFWL_FormProxy* IFWL_FormProxy::Create(CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter) {
+ return new IFWL_FormProxy(properties, pOuter);
+}
+
+IFWL_FormProxy::IFWL_FormProxy(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Form(properties, pOuter) {}
+
+IFWL_FormProxy::~IFWL_FormProxy() {}
+
+FWL_Error IFWL_FormProxy::GetClassName(CFX_WideString& wsClass) const {
+ wsClass = FWL_CLASS_FormProxy;
+ return FWL_Error::Succeeded;
+}
+
+FWL_Type IFWL_FormProxy::GetClassID() const {
+ return FWL_Type::FormProxy;
+}
+
+FX_BOOL IFWL_FormProxy::IsInstance(const CFX_WideStringC& wsClass) const {
+ if (wsClass == CFX_WideStringC(FWL_CLASS_FormProxy)) {
+ return TRUE;
+ }
+ return IFWL_Form::IsInstance(wsClass);
+}
+
+FWL_Error IFWL_FormProxy::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
+ return FWL_Error::Indefinite;
+ m_pDelegate = new CFWL_FormProxyImpDelegate(this);
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_FormProxy::Finalize() {
+ delete m_pDelegate;
+ m_pDelegate = nullptr;
+ return IFWL_Widget::Finalize();
+}
+
+FWL_Error IFWL_FormProxy::Update() {
+ return FWL_Error::Succeeded;
+}
+
+FWL_Error IFWL_FormProxy::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
+ return FWL_Error::Succeeded;
+}
+
+CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(IFWL_FormProxy* pOwner)
+ : m_pOwner(pOwner) {}
+
+void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
+ IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(nullptr);
+ pDelegate->OnProcessMessage(pMessage);
+}
diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.h b/xfa/fwl/core/ifwl_formproxy.h
index 56c868e513..c188d93a05 100644
--- a/xfa/fwl/basewidget/fwl_formproxyimp.h
+++ b/xfa/fwl/core/ifwl_formproxy.h
@@ -4,22 +4,24 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_FORMPROXYIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_FORMPROXYIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_FORMPROXY_H_
+#define XFA_FWL_CORE_IFWL_FORMPROXY_H_
-#include "xfa/fwl/core/fwl_formimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_form.h"
class CFWL_WidgetImpProperties;
class CFWL_FormProxyImpDelegate;
-class CFWL_FormProxyImp : public CFWL_FormImp {
+class IFWL_FormProxy : public IFWL_Form {
public:
- CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_FormProxyImp() override;
+ static IFWL_FormProxy* Create(CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
- // CFWL_WidgetImp
+ IFWL_FormProxy(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_FormProxy() override;
+
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const override;
@@ -35,11 +37,11 @@ class CFWL_FormProxyImp : public CFWL_FormImp {
class CFWL_FormProxyImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner);
+ CFWL_FormProxyImpDelegate(IFWL_FormProxy* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
protected:
- CFWL_FormProxyImp* m_pOwner;
+ IFWL_FormProxy* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_FORMPROXYIMP_H_
+#endif // XFA_FWL_CORE_IFWL_FORMPROXY_H_
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/core/ifwl_listbox.cpp
index 33a0a8d1ee..a0a9eacd27 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/core/ifwl_listbox.cpp
@@ -4,16 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_listboximp.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/fwl_comboboximp.h"
-#include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
#include "xfa/fwl/core/cfwl_message.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_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
@@ -26,46 +23,12 @@ const int kItemTextMargin = 2;
// static
IFWL_ListBox* IFWL_ListBox::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_ListBox* pListBox = new IFWL_ListBox;
- CFWL_ListBoxImp* pListBoxImpl = new CFWL_ListBoxImp(properties, pOuter);
- pListBox->SetImpl(pListBoxImpl);
- pListBoxImpl->SetInterface(pListBox);
- return pListBox;
-}
-// static
-IFWL_ListBox* IFWL_ListBox::CreateComboList(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter) {
- IFWL_ListBox* pListBox = new IFWL_ListBox;
- CFWL_ListBoxImp* pComboListImpl = new CFWL_ComboListImp(properties, pOuter);
- pListBox->SetImpl(pComboListImpl);
- pComboListImpl->SetInterface(pListBox);
- return pListBox;
-}
-IFWL_ListBox::IFWL_ListBox() {}
-int32_t IFWL_ListBox::CountSelItems() {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->CountSelItems();
-}
-IFWL_ListItem* IFWL_ListBox::GetSelItem(int32_t nIndexSel) {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetSelItem(nIndexSel);
-}
-int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetSelIndex(nIndex);
-}
-FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->SetSelItem(pItem, bSelect);
-}
-FWL_Error IFWL_ListBox::GetItemText(IFWL_ListItem* pItem,
- CFX_WideString& wsText) {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetItemText(pItem, wsText);
-}
-FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
- return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetScrollPos(fPos, bVert);
+ return new IFWL_ListBox(properties, pOuter);
}
-CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_ListBox::IFWL_ListBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_dwTTOStyles(0),
m_iTTOAligns(0),
m_hAnchor(nullptr),
@@ -77,26 +40,26 @@ CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties,
m_rtStatic.Reset();
}
-CFWL_ListBoxImp::~CFWL_ListBoxImp() {}
+IFWL_ListBox::~IFWL_ListBox() {}
-FWL_Error CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_ListBox::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ListBox;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_ListBoxImp::GetClassID() const {
+FWL_Type IFWL_ListBox::GetClassID() const {
return FWL_Type::ListBox;
}
-FWL_Error CFWL_ListBoxImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_ListBox::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ListBoxImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::Finalize() {
+FWL_Error IFWL_ListBox::Finalize() {
if (m_pVertScrollBar) {
m_pVertScrollBar->Finalize();
}
@@ -105,9 +68,10 @@ FWL_Error CFWL_ListBoxImp::Finalize() {
}
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_ListBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pThemeProvider) {
@@ -115,13 +79,14 @@ FWL_Error CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
}
CFX_SizeF fs = CalcSize(TRUE);
rect.Set(0, 0, fs.x, fs.y);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::Update() {
+
+FWL_Error IFWL_ListBox::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -149,7 +114,8 @@ FWL_Error CFWL_ListBoxImp::Update() {
CalcSize();
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_ListBox::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (IsShowScrollBar(FALSE)) {
CFX_RectF rect;
m_pHorzScrollBar->GetWidgetRect(rect);
@@ -166,8 +132,9 @@ FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::Client;
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ListBox::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -198,45 +165,46 @@ FWL_Error CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics,
pGraphics->RestoreGraphState();
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::SetThemeProvider(
- IFWL_ThemeProvider* pThemeProvider) {
+
+FWL_Error IFWL_ListBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
if (!pThemeProvider)
return FWL_Error::Indefinite;
m_pProperties->m_pThemeProvider = pThemeProvider;
return FWL_Error::Succeeded;
}
-int32_t CFWL_ListBoxImp::CountSelItems() {
+int32_t IFWL_ListBox::CountSelItems() {
if (!m_pProperties->m_pDataProvider)
return 0;
int32_t iRet = 0;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
continue;
}
- uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwStyle = pData->GetItemStyles(this, pItem);
if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
iRet++;
}
}
return iRet;
}
-IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
+
+IFWL_ListItem* IFWL_ListBox::GetSelItem(int32_t nIndexSel) {
if (!m_pProperties->m_pDataProvider)
return nullptr;
int32_t index = 0;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
return nullptr;
}
- uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwStyle = pData->GetItemStyles(this, pItem);
if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
if (index == nIndexSel) {
return pItem;
@@ -247,19 +215,20 @@ IFWL_ListItem* CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
}
return nullptr;
}
-int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
+
+int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) {
if (!m_pProperties->m_pDataProvider)
return -1;
int32_t index = 0;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
return -1;
}
- uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwStyle = pData->GetItemStyles(this, pItem);
if (dwStyle & FWL_ITEMSTATE_LTB_Selected) {
if (index == nIndex) {
return i;
@@ -270,7 +239,8 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
}
return -1;
}
-FWL_Error CFWL_ListBoxImp::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) {
+
+FWL_Error IFWL_ListBox::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) {
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
if (!pItem) {
@@ -289,19 +259,20 @@ FWL_Error CFWL_ListBoxImp::SetSelItem(IFWL_ListItem* pItem, FX_BOOL bSelect) {
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::GetItemText(IFWL_ListItem* pItem,
- CFX_WideString& wsText) {
+
+FWL_Error IFWL_ListBox::GetItemText(IFWL_ListItem* pItem,
+ CFX_WideString& wsText) {
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
if (!pItem)
return FWL_Error::Indefinite;
- pData->GetItemText(m_pInterface, pItem, wsText);
+ pData->GetItemText(this, pItem, wsText);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
+FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
if ((bVert && IsShowScrollBar(TRUE)) || (!bVert && IsShowScrollBar(FALSE))) {
IFWL_ScrollBar* pScrollBar =
bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get();
@@ -311,8 +282,7 @@ FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
return FWL_Error::Indefinite;
}
-IFWL_ListItem* CFWL_ListBoxImp::GetItem(IFWL_ListItem* pItem,
- uint32_t dwKeyCode) {
+IFWL_ListItem* IFWL_ListBox::GetItem(IFWL_ListItem* pItem, uint32_t dwKeyCode) {
IFWL_ListItem* hRet = nullptr;
switch (dwKeyCode) {
case FWL_VKEY_Up:
@@ -326,69 +296,72 @@ IFWL_ListItem* CFWL_ListBoxImp::GetItem(IFWL_ListItem* pItem,
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iDstItem = -1;
if (bUp || bDown) {
- int32_t index = pData->GetItemIndex(m_pInterface, pItem);
+ int32_t index = pData->GetItemIndex(this, pItem);
iDstItem = dwKeyCode == FWL_VKEY_Up ? index - 1 : index + 1;
} else if (bHome) {
iDstItem = 0;
} else {
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
iDstItem = iCount - 1;
}
- hRet = pData->GetItem(m_pInterface, iDstItem);
+ hRet = pData->GetItem(this, iDstItem);
break;
}
default: {}
}
return hRet;
}
-void CFWL_ListBoxImp::SetSelection(IFWL_ListItem* hStart,
- IFWL_ListItem* hEnd,
- FX_BOOL bSelected) {
+
+void IFWL_ListBox::SetSelection(IFWL_ListItem* hStart,
+ IFWL_ListItem* hEnd,
+ FX_BOOL bSelected) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iStart = pData->GetItemIndex(m_pInterface, hStart);
- int32_t iEnd = pData->GetItemIndex(m_pInterface, hEnd);
+ int32_t iStart = pData->GetItemIndex(this, hStart);
+ int32_t iEnd = pData->GetItemIndex(this, hEnd);
if (iStart > iEnd) {
int32_t iTemp = iStart;
iStart = iEnd;
iEnd = iTemp;
}
if (bSelected) {
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
SetSelectionDirect(pItem, FALSE);
}
}
for (; iStart <= iEnd; iStart++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, iStart);
+ IFWL_ListItem* pItem = pData->GetItem(this, iStart);
SetSelectionDirect(pItem, bSelected);
}
}
-void CFWL_ListBoxImp::SetSelectionDirect(IFWL_ListItem* pItem,
- FX_BOOL bSelect) {
+
+void IFWL_ListBox::SetSelectionDirect(IFWL_ListItem* pItem, FX_BOOL bSelect) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- uint32_t dwOldStyle = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwOldStyle = pData->GetItemStyles(this, pItem);
bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected
: dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected;
- pData->SetItemStyles(m_pInterface, pItem, dwOldStyle);
+ pData->SetItemStyles(this, pItem, dwOldStyle);
}
-FX_BOOL CFWL_ListBoxImp::IsItemSelected(IFWL_ListItem* pItem) {
+
+FX_BOOL IFWL_ListBox::IsItemSelected(IFWL_ListItem* pItem) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- uint32_t dwState = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwState = pData->GetItemStyles(this, pItem);
return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0;
}
-void CFWL_ListBoxImp::ClearSelection() {
+
+void IFWL_ListBox::ClearSelection() {
FX_BOOL bMulti =
m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
- uint32_t dwState = pData->GetItemStyles(m_pInterface, pItem);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
+ uint32_t dwState = pData->GetItemStyles(this, pItem);
if (!(dwState & FWL_ITEMSTATE_LTB_Selected))
continue;
SetSelectionDirect(pItem, FALSE);
@@ -396,7 +369,8 @@ void CFWL_ListBoxImp::ClearSelection() {
return;
}
}
-void CFWL_ListBoxImp::SelectAll() {
+
+void IFWL_ListBox::SelectAll() {
FX_BOOL bMulti =
m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
if (!bMulti) {
@@ -404,45 +378,48 @@ void CFWL_ListBoxImp::SelectAll() {
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
if (iCount > 0) {
- IFWL_ListItem* pItemStart = pData->GetItem(m_pInterface, 0);
- IFWL_ListItem* pItemEnd = pData->GetItem(m_pInterface, iCount - 1);
+ IFWL_ListItem* pItemStart = pData->GetItem(this, 0);
+ IFWL_ListItem* pItemEnd = pData->GetItem(this, iCount - 1);
SetSelection(pItemStart, pItemEnd, FALSE);
}
}
-IFWL_ListItem* CFWL_ListBoxImp::GetFocusedItem() {
+
+IFWL_ListItem* IFWL_ListBox::GetFocusedItem() {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem)
return nullptr;
- if (pData->GetItemStyles(m_pInterface, pItem) & FWL_ITEMSTATE_LTB_Focused) {
+ if (pData->GetItemStyles(this, pItem) & FWL_ITEMSTATE_LTB_Focused) {
return pItem;
}
}
return nullptr;
}
-void CFWL_ListBoxImp::SetFocusItem(IFWL_ListItem* pItem) {
+
+void IFWL_ListBox::SetFocusItem(IFWL_ListItem* pItem) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
IFWL_ListItem* hFocus = GetFocusedItem();
if (pItem != hFocus) {
if (hFocus) {
- uint32_t dwStyle = pData->GetItemStyles(m_pInterface, hFocus);
+ uint32_t dwStyle = pData->GetItemStyles(this, hFocus);
dwStyle &= ~FWL_ITEMSTATE_LTB_Focused;
- pData->SetItemStyles(m_pInterface, hFocus, dwStyle);
+ pData->SetItemStyles(this, hFocus, dwStyle);
}
if (pItem) {
- uint32_t dwStyle = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwStyle = pData->GetItemStyles(this, pItem);
dwStyle |= FWL_ITEMSTATE_LTB_Focused;
- pData->SetItemStyles(m_pInterface, pItem, dwStyle);
+ pData->SetItemStyles(this, pItem, dwStyle);
}
}
}
-IFWL_ListItem* CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
+
+IFWL_ListItem* IFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
fx -= m_rtConent.left, fy -= m_rtConent.top;
FX_FLOAT fPosX = 0.0f;
if (m_pHorzScrollBar) {
@@ -454,14 +431,14 @@ IFWL_ListItem* CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t nCount = pData->CountItems(m_pInterface);
+ int32_t nCount = pData->CountItems(this);
for (int32_t i = 0; i < nCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
continue;
}
CFX_RectF rtItem;
- pData->GetItemRect(m_pInterface, pItem, rtItem);
+ pData->GetItemRect(this, pItem, rtItem);
rtItem.Offset(-fPosX, -fPosY);
if (rtItem.Contains(fx, fy)) {
return pItem;
@@ -469,8 +446,9 @@ IFWL_ListItem* CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
}
return nullptr;
}
-FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(IFWL_ListItem* pItem,
- CFX_RectF& rtCheck) {
+
+FX_BOOL IFWL_ListBox::GetItemCheckRect(IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
@@ -478,10 +456,11 @@ FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(IFWL_ListItem* pItem,
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pData->GetItemCheckRect(m_pInterface, pItem, rtCheck);
+ pData->GetItemCheckRect(this, pItem, rtCheck);
return TRUE;
}
-FX_BOOL CFWL_ListBoxImp::GetItemChecked(IFWL_ListItem* pItem) {
+
+FX_BOOL IFWL_ListBox::GetItemChecked(IFWL_ListItem* pItem) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
@@ -489,11 +468,10 @@ FX_BOOL CFWL_ListBoxImp::GetItemChecked(IFWL_ListItem* pItem) {
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- return (pData->GetItemCheckState(m_pInterface, pItem) &
- FWL_ITEMSTATE_LTB_Checked);
+ return (pData->GetItemCheckState(this, pItem) & FWL_ITEMSTATE_LTB_Checked);
}
-FX_BOOL CFWL_ListBoxImp::SetItemChecked(IFWL_ListItem* pItem,
- FX_BOOL bChecked) {
+
+FX_BOOL IFWL_ListBox::SetItemChecked(IFWL_ListItem* pItem, FX_BOOL bChecked) {
if (!m_pProperties->m_pDataProvider)
return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
@@ -501,17 +479,18 @@ FX_BOOL CFWL_ListBoxImp::SetItemChecked(IFWL_ListItem* pItem,
}
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pData->SetItemCheckState(m_pInterface, pItem,
+ pData->SetItemCheckState(this, pItem,
bChecked ? FWL_ITEMSTATE_LTB_Checked : 0);
return TRUE;
}
-FX_BOOL CFWL_ListBoxImp::ScrollToVisible(IFWL_ListItem* pItem) {
+
+FX_BOOL IFWL_ListBox::ScrollToVisible(IFWL_ListItem* pItem) {
if (!m_pVertScrollBar)
return FALSE;
CFX_RectF rtItem;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pData->GetItemRect(m_pInterface, pItem, rtItem);
+ pData->GetItemRect(this, pItem, rtItem);
FX_BOOL bScroll = FALSE;
FX_FLOAT fPosY = m_pVertScrollBar->GetPos();
rtItem.Offset(0, -fPosY + m_rtConent.top);
@@ -530,15 +509,16 @@ FX_BOOL CFWL_ListBoxImp::ScrollToVisible(IFWL_ListItem* pItem) {
Repaint(&m_rtClient);
return TRUE;
}
-void CFWL_ListBoxImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ListBox::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return;
if (!pTheme)
return;
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_dwStates = 0;
param.m_pGraphics = pGraphics;
@@ -552,9 +532,10 @@ void CFWL_ListBoxImp::DrawBkground(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&param);
}
-void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ListBox::DrawItems(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
FX_FLOAT fPosX = 0.0f;
if (m_pHorzScrollBar) {
fPosX = m_pHorzScrollBar->GetPos();
@@ -574,14 +555,14 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
continue;
}
CFX_RectF rtItem;
- pData->GetItemRect(m_pInterface, pItem, rtItem);
+ pData->GetItemRect(this, pItem, rtItem);
rtItem.Offset(m_rtConent.left - fPosX, m_rtConent.top - fPosY);
if (rtItem.bottom() < m_rtConent.top) {
continue;
@@ -594,7 +575,7 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
}
if (GetStylesEx() & FWL_STYLEEXT_LTB_OwnerDraw) {
CFWL_EvtLtbDrawItem ev;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
ev.m_pGraphics = pGraphics;
ev.m_matrix = *pMatrix;
ev.m_index = i;
@@ -605,15 +586,16 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics,
}
}
}
-void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- IFWL_ListItem* pItem,
- int32_t Index,
- const CFX_RectF& rtItem,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ListBox::DrawItem(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ IFWL_ListItem* pItem,
+ int32_t Index,
+ const CFX_RectF& rtItem,
+ const CFX_Matrix* pMatrix) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- uint32_t dwItemStyles = pData->GetItemStyles(m_pInterface, pItem);
+ uint32_t dwItemStyles = pData->GetItemStyles(this, pItem);
uint32_t dwPartStates = CFWL_PartState_Normal;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
dwPartStates = CFWL_PartState_Disabled;
@@ -626,7 +608,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
}
{
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::ListItem;
param.m_dwStates = dwPartStates;
param.m_pGraphics = pGraphics;
@@ -647,11 +629,11 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
FX_BOOL bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon;
if (bHasIcon) {
CFX_RectF rtDIB;
- CFX_DIBitmap* pDib = pData->GetItemIcon(m_pInterface, pItem);
+ CFX_DIBitmap* pDib = pData->GetItemIcon(this, pItem);
rtDIB.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
if (pDib) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Icon;
param.m_pGraphics = pGraphics;
param.m_matrix.Concat(*pMatrix);
@@ -666,9 +648,9 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
CFX_RectF rtCheck;
rtCheck.Set(rtItem.left, rtItem.top, rtItem.height, rtItem.height);
rtCheck.Deflate(2, 2, 2, 2);
- pData->SetItemCheckRect(m_pInterface, pItem, rtCheck);
+ pData->SetItemCheckRect(this, pItem, rtCheck);
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Check;
param.m_pGraphics = pGraphics;
if (GetItemChecked(pItem)) {
@@ -682,7 +664,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
CFX_WideString wsText;
- pData->GetItemText(m_pInterface, pItem, wsText);
+ pData->GetItemText(this, pItem, wsText);
if (wsText.GetLength() <= 0) {
return;
}
@@ -692,7 +674,7 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
rtText.Deflate(rtItem.height, 0, 0, 0);
}
CFWL_ThemeText textParam;
- textParam.m_pWidget = m_pInterface;
+ textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::ListItem;
textParam.m_dwStates = dwPartStates;
textParam.m_pGraphics = pGraphics;
@@ -705,7 +687,8 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics,
pTheme->DrawText(&textParam);
}
}
-CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
+
+CFX_SizeF IFWL_ListBox::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
if (!m_pProperties->m_pThemeProvider)
return fs;
@@ -723,18 +706,18 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
}
}
FX_FLOAT fWidth = 0;
- if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(m_pInterface)) {
+ if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(this)) {
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!bAutoSize) {
CFX_RectF rtItem;
rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, 0, 0);
IFWL_ListBoxDP* pBox =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pBox->SetItemRect(m_pInterface, pItem, rtItem);
+ pBox->SetItemRect(this, pItem, rtItem);
}
if (fs.x < 0) {
fs.x = 0;
@@ -759,9 +742,9 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
if (bHasIcon) {
fWidth += m_fItemHeight;
}
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* htem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* htem = pData->GetItem(this, i);
GetItemSize(fs, htem, fWidth, m_fItemHeight, bAutoSize);
}
}
@@ -864,11 +847,12 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
}
return fs;
}
-void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size,
- IFWL_ListItem* pItem,
- FX_FLOAT fWidth,
- FX_FLOAT fItemHeight,
- FX_BOOL bAutoSize) {
+
+void IFWL_ListBox::GetItemSize(CFX_SizeF& size,
+ IFWL_ListItem* pItem,
+ FX_FLOAT fWidth,
+ FX_FLOAT fItemHeight,
+ FX_BOOL bAutoSize) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn) {
} else {
if (!bAutoSize) {
@@ -876,24 +860,25 @@ void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size,
rtItem.Set(0, size.y, fWidth, fItemHeight);
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pData->SetItemRect(m_pInterface, pItem, rtItem);
+ pData->SetItemRect(this, pItem, rtItem);
}
size.x = fWidth;
size.y += fItemHeight;
}
}
-FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() {
+
+FX_FLOAT IFWL_ListBox::GetMaxTextWidth() {
FX_FLOAT fRet = 0.0f;
IFWL_ListBoxDP* pData =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- int32_t iCount = pData->CountItems(m_pInterface);
+ int32_t iCount = pData->CountItems(this);
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ListItem* pItem = pData->GetItem(m_pInterface, i);
+ IFWL_ListItem* pItem = pData->GetItem(this, i);
if (!pItem) {
continue;
}
CFX_WideString wsText;
- pData->GetItemText(m_pInterface, pItem, wsText);
+ pData->GetItemText(this, pItem, wsText);
CFX_SizeF sz = CalcTextSize(wsText, m_pProperties->m_pThemeProvider);
if (sz.x > fRet) {
fRet = sz.x;
@@ -901,35 +886,38 @@ FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() {
}
return fRet;
}
-FX_FLOAT CFWL_ListBoxImp::GetScrollWidth() {
+
+FX_FLOAT IFWL_ListBox::GetScrollWidth() {
FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
if (!pfWidth)
return 0;
return *pfWidth;
}
-FX_FLOAT CFWL_ListBoxImp::GetItemHeigt() {
+
+FX_FLOAT IFWL_ListBox::GetItemHeigt() {
FX_FLOAT* pfFont =
static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::FontSize));
if (!pfFont)
return 20;
return *pfFont + 2 * kItemTextMargin;
}
-void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) {
+
+void IFWL_ListBox::InitScrollBar(FX_BOOL bVert) {
if ((bVert && m_pVertScrollBar) || (!bVert && m_pHorzScrollBar)) {
return;
}
CFWL_WidgetImpProperties prop;
prop.m_dwStyleExes = bVert ? FWL_STYLEEXT_SCB_Vert : FWL_STYLEEXT_SCB_Horz;
prop.m_dwStates = FWL_WGTSTATE_Invisible;
- prop.m_pParent = m_pInterface;
+ prop.m_pParent = this;
prop.m_pThemeProvider = m_pScrollBarTP;
- IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface);
+ IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, this);
pScrollBar->Initialize();
(bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar);
}
-FX_BOOL CFWL_ListBoxImp::IsShowScrollBar(FX_BOOL bVert) {
+FX_BOOL IFWL_ListBox::IsShowScrollBar(FX_BOOL bVert) {
IFWL_ScrollBar* pScrollbar =
bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get();
if (!pScrollbar || (pScrollbar->GetStates() & FWL_WGTSTATE_Invisible)) {
@@ -939,9 +927,10 @@ FX_BOOL CFWL_ListBoxImp::IsShowScrollBar(FX_BOOL bVert) {
FWL_STYLEEXT_LTB_ShowScrollBarFocus) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Focused);
}
-void CFWL_ListBoxImp::ProcessSelChanged() {
+
+void IFWL_ListBox::ProcessSelChanged() {
CFWL_EvtLtbSelChanged selEvent;
- selEvent.m_pSrcTarget = m_pInterface;
+ selEvent.m_pSrcTarget = this;
CFX_Int32Array arrSels;
int32_t iCount = CountSelItems();
for (int32_t i = 0; i < iCount; i++) {
@@ -954,7 +943,7 @@ void CFWL_ListBoxImp::ProcessSelChanged() {
DispatchEvent(&selEvent);
}
-CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner)
+CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(IFWL_ListBox* pOwner)
: m_pOwner(pOwner) {}
void CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -999,9 +988,7 @@ void CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKeyDown(pMsg);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -1044,6 +1031,7 @@ void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) {
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_ListBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDown = TRUE;
if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
@@ -1093,6 +1081,7 @@ void CFWL_ListBoxImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->ProcessSelChanged();
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_ListBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_bLButtonDown) {
m_pOwner->m_bLButtonDown = FALSE;
@@ -1100,6 +1089,7 @@ void CFWL_ListBoxImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
DispatchSelChangedEv();
}
}
+
void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) {
if (!m_pOwner->IsShowScrollBar(TRUE)) {
return;
@@ -1108,6 +1098,7 @@ void CFWL_ListBoxImpDelegate::OnMouseWheel(CFWL_MsgMouseWheel* pMsg) {
m_pOwner->m_pVertScrollBar->SetDelegate(nullptr);
pDelegate->OnProcessMessage(pMsg);
}
+
void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
uint32_t dwKeyCode = pMsg->m_dwKeyCode;
switch (dwKeyCode) {
@@ -1125,9 +1116,11 @@ void CFWL_ListBoxImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
m_pOwner->ProcessSelChanged();
break;
}
- default: {}
+ default:
+ break;
}
}
+
void CFWL_ListBoxImpDelegate::OnVK(IFWL_ListItem* pItem,
FX_BOOL bShift,
FX_BOOL bCtrl) {
@@ -1159,6 +1152,7 @@ void CFWL_ListBoxImpDelegate::OnVK(IFWL_ListItem* pItem,
m_pOwner->Repaint(&rtInvalidate);
}
}
+
FX_BOOL CFWL_ListBoxImpDelegate::OnScroll(IFWL_ScrollBar* pScrollBar,
uint32_t dwCode,
FX_FLOAT fPos) {
@@ -1216,8 +1210,9 @@ FX_BOOL CFWL_ListBoxImpDelegate::OnScroll(IFWL_ScrollBar* pScrollBar,
}
return TRUE;
}
+
void CFWL_ListBoxImpDelegate::DispatchSelChangedEv() {
CFWL_EvtLtbSelChanged ev;
- ev.m_pSrcTarget = m_pOwner->m_pInterface;
+ ev.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&ev);
}
diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h
new file mode 100644
index 0000000000..79fb2e94cc
--- /dev/null
+++ b/xfa/fwl/core/ifwl_listbox.h
@@ -0,0 +1,210 @@
+// Copyright 2014 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_LISTBOX_H_
+#define XFA_FWL_CORE_IFWL_LISTBOX_H_
+
+#include <memory>
+
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
+#include "xfa/fwl/core/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
+#include "xfa/fwl/core/ifwl_widget.h"
+
+#define FWL_CLASS_ListBox L"FWL_LISTBOX"
+#define FWL_STYLEEXT_LTB_MultiSelection (1L << 0)
+#define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2)
+#define FWL_STYLEEXT_LTB_MultiColumn (1L << 3)
+#define FWL_STYLEEXT_LTB_LeftAlign (0L << 4)
+#define FWL_STYLEEXT_LTB_CenterAlign (1L << 4)
+#define FWL_STYLEEXT_LTB_RightAlign (2L << 4)
+#define FWL_STYLEEXT_LTB_MultiLine (1L << 6)
+#define FWL_STYLEEXT_LTB_OwnerDraw (1L << 7)
+#define FWL_STYLEEXT_LTB_Icon (1L << 8)
+#define FWL_STYLEEXT_LTB_Check (1L << 9)
+#define FWL_STYLEEXT_LTB_AlignMask (3L << 4)
+#define FWL_STYLEEXT_LTB_ShowScrollBarFocus (1L << 10)
+#define FWL_ITEMSTATE_LTB_Selected (1L << 0)
+#define FWL_ITEMSTATE_LTB_Focused (1L << 1)
+#define FWL_ITEMSTATE_LTB_Checked (1L << 2)
+
+class CFWL_ListBoxImpDelegate;
+class CFWL_MsgKillFocus;
+class CFWL_MsgMouse;
+class CFWL_MsgMouseWheel;
+class CFX_DIBitmap;
+
+FWL_EVENT_DEF(CFWL_EvtLtbSelChanged,
+ CFWL_EventType::SelectChanged,
+ CFX_Int32Array iarraySels;)
+
+FWL_EVENT_DEF(CFWL_EvtLtbDrawItem,
+ CFWL_EventType::DrawItem,
+ CFX_Graphics* m_pGraphics;
+ CFX_Matrix m_matrix;
+ int32_t m_index;
+ CFX_RectF m_rect;)
+
+class IFWL_ListItem {};
+
+class IFWL_ListBoxDP : public IFWL_DataProvider {
+ public:
+ virtual int32_t CountItems(const IFWL_Widget* pWidget) = 0;
+ virtual IFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
+ int32_t nIndex) = 0;
+ virtual int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0;
+ virtual FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ int32_t nIndex) = 0;
+ virtual uint32_t GetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) = 0;
+ virtual FWL_Error GetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_WideString& wsText) = 0;
+ virtual FWL_Error GetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtItem) = 0;
+ virtual void* GetItemData(IFWL_Widget* pWidget, IFWL_ListItem* pItem) = 0;
+ virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwStyle) = 0;
+ virtual FWL_Error SetItemText(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const FX_WCHAR* pszText) = 0;
+ virtual FWL_Error SetItemRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtItem) = 0;
+ virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0;
+ virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) = 0;
+ virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ CFX_RectF& rtCheck) = 0;
+ virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ const CFX_RectF& rtCheck) = 0;
+ virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem) = 0;
+ virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget,
+ IFWL_ListItem* pItem,
+ uint32_t dwCheckState) = 0;
+};
+
+class IFWL_ListBoxCompare {
+ public:
+ virtual ~IFWL_ListBoxCompare() {}
+ virtual int32_t Compare(IFWL_ListItem* hLeft, IFWL_ListItem* hRight) = 0;
+};
+
+class IFWL_ListBox : public IFWL_Widget {
+ public:
+ static IFWL_ListBox* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_ListBox(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_ListBox() override;
+
+ // IFWL_Widget
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override;
+ FWL_Type GetClassID() const override;
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+ FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
+ FWL_Error Update() override;
+ FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override;
+ FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+ FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override;
+
+ int32_t CountSelItems();
+ IFWL_ListItem* GetSelItem(int32_t nIndexSel);
+ int32_t GetSelIndex(int32_t nIndex);
+ FWL_Error SetSelItem(IFWL_ListItem* hItem, FX_BOOL bSelect = TRUE);
+ FWL_Error GetItemText(IFWL_ListItem* hItem, CFX_WideString& wsText);
+ FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE);
+ FWL_Error* Sort(IFWL_ListBoxCompare* pCom);
+
+ protected:
+ friend class CFWL_ListBoxImpDelegate;
+
+ IFWL_ListItem* GetItem(IFWL_ListItem* hItem, uint32_t dwKeyCode);
+ void SetSelection(IFWL_ListItem* hStart,
+ IFWL_ListItem* hEnd,
+ FX_BOOL bSelected);
+ void SetSelectionDirect(IFWL_ListItem* hItem, FX_BOOL bSelect);
+ FX_BOOL IsItemSelected(IFWL_ListItem* hItem);
+ void ClearSelection();
+ void SelectAll();
+ IFWL_ListItem* GetFocusedItem();
+ void SetFocusItem(IFWL_ListItem* hItem);
+ IFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
+ FX_BOOL GetItemCheckRect(IFWL_ListItem* hItem, CFX_RectF& rtCheck);
+ FX_BOOL SetItemChecked(IFWL_ListItem* hItem, FX_BOOL bChecked);
+ FX_BOOL GetItemChecked(IFWL_ListItem* hItem);
+ FX_BOOL ScrollToVisible(IFWL_ListItem* hItem);
+ void DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawItems(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawItem(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ IFWL_ListItem* hItem,
+ int32_t Index,
+ const CFX_RectF& rtItem,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawStatic(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme);
+ CFX_SizeF CalcSize(FX_BOOL bAutoSize = FALSE);
+ void GetItemSize(CFX_SizeF& size,
+ IFWL_ListItem* hItem,
+ FX_FLOAT fWidth,
+ FX_FLOAT fHeight,
+ FX_BOOL bAutoSize = FALSE);
+ FX_FLOAT GetMaxTextWidth();
+ FX_FLOAT GetScrollWidth();
+ FX_FLOAT GetItemHeigt();
+ void InitScrollBar(FX_BOOL bVert = TRUE);
+ FX_BOOL IsShowScrollBar(FX_BOOL bVert);
+ void ProcessSelChanged();
+
+ CFX_RectF m_rtClient;
+ CFX_RectF m_rtStatic;
+ CFX_RectF m_rtConent;
+ std::unique_ptr<IFWL_ScrollBar> m_pHorzScrollBar;
+ std::unique_ptr<IFWL_ScrollBar> m_pVertScrollBar;
+ uint32_t m_dwTTOStyles;
+ int32_t m_iTTOAligns;
+ IFWL_ListItem* m_hAnchor;
+ FX_FLOAT m_fItemHeight;
+ FX_FLOAT m_fScorllBarWidth;
+ FX_BOOL m_bLButtonDown;
+ IFWL_ThemeProvider* m_pScrollBarTP;
+};
+
+class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate {
+ public:
+ CFWL_ListBoxImpDelegate(IFWL_ListBox* pOwner);
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
+ protected:
+ void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseWheel(CFWL_MsgMouseWheel* pMsg);
+ void OnKeyDown(CFWL_MsgKey* pMsg);
+ void OnVK(IFWL_ListItem* hItem, FX_BOOL bShift, FX_BOOL bCtrl);
+ FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos);
+ void DispatchSelChangedEv();
+ IFWL_ListBox* m_pOwner;
+};
+
+#endif // XFA_FWL_CORE_IFWL_LISTBOX_H_
diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/core/ifwl_monthcalendar.cpp
index 7477f04bdc..741c88f606 100644
--- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp
+++ b/xfa/fwl/core/ifwl_monthcalendar.cpp
@@ -4,17 +4,16 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_monthcalendarimp.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
#include <algorithm>
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
#include "xfa/fwl/core/cfwl_message.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/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#define MONTHCAL_HSEP_HEIGHT 1
@@ -122,35 +121,13 @@ CFX_WideString* GetCapacityForMonth(IFWL_ThemeProvider* pTheme,
IFWL_MonthCalendar* IFWL_MonthCalendar::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_MonthCalendar* pMonthCalendar = new IFWL_MonthCalendar;
- CFWL_MonthCalendarImp* pMonthCalendarImpl =
- new CFWL_MonthCalendarImp(properties, pOuter);
- pMonthCalendar->SetImpl(pMonthCalendarImpl);
- pMonthCalendarImpl->SetInterface(pMonthCalendar);
- return pMonthCalendar;
-}
-IFWL_MonthCalendar::IFWL_MonthCalendar() {}
-int32_t IFWL_MonthCalendar::CountSelect() {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())->CountSelect();
-}
-FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay,
- int32_t nIndex) {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())
- ->GetSelect(iYear, iMonth, iDay, nIndex);
-}
-FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
- return static_cast<CFWL_MonthCalendarImp*>(GetImpl())
- ->SetSelect(iYear, iMonth, iDay);
+ return new IFWL_MonthCalendar(properties, pOuter);
}
-CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
+IFWL_MonthCalendar::IFWL_MonthCalendar(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+ : IFWL_Widget(properties, pOuter),
m_bInit(FALSE),
m_pDateTime(new CFX_DateTime),
m_iCurYear(2011),
@@ -176,45 +153,47 @@ CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(
m_rtWeekNumSep.Reset();
}
-CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() {
+IFWL_MonthCalendar::~IFWL_MonthCalendar() {
ClearDateItem();
m_arrSelDays.RemoveAll();
}
-FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_MonthCalendar::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_MonthCalendar;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_MonthCalendarImp::GetClassID() const {
+FWL_Type IFWL_MonthCalendar::GetClassID() const {
return FWL_Type::MonthCalendar;
}
-FWL_Error CFWL_MonthCalendarImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_MonthCalendar::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_MonthCalendarImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::Finalize() {
+FWL_Error IFWL_MonthCalendar::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_MonthCalendar::GetWidgetRect(CFX_RectF& rect,
+ FX_BOOL bAutoSize) {
if (bAutoSize) {
CFX_SizeF fs = CalcSize(TRUE);
rect.Set(0, 0, fs.x, fs.y);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::Update() {
+
+FWL_Error IFWL_MonthCalendar::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -230,8 +209,9 @@ FWL_Error CFWL_MonthCalendarImp::Update() {
LayOut();
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_MonthCalendar::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider) {
@@ -262,13 +242,15 @@ FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-int32_t CFWL_MonthCalendarImp::CountSelect() {
+
+int32_t IFWL_MonthCalendar::CountSelect() {
return m_arrSelDays.GetSize();
}
-FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay,
- int32_t nIndex) {
+
+FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay,
+ int32_t nIndex) {
if (nIndex >= m_arrSelDays.GetSize()) {
return FALSE;
}
@@ -277,17 +259,19 @@ FX_BOOL CFWL_MonthCalendarImp::GetSelect(int32_t& iYear,
iDay = m_arrSelDays[nIndex];
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetSelect(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
ChangeToMonth(iYear, iMonth);
return AddSelDay(iDay);
}
-void CFWL_MonthCalendarImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Background;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -297,11 +281,12 @@ void CFWL_MonthCalendarImp::DrawBkground(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawHeadBK(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawHeadBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Header;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -311,11 +296,12 @@ void CFWL_MonthCalendarImp::DrawHeadBK(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawLButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawLButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::LBtn;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_iLBtnPartStates;
@@ -325,11 +311,12 @@ void CFWL_MonthCalendarImp::DrawLButton(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawRButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawRButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::RBtn;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_iRBtnPartStates;
@@ -339,11 +326,12 @@ void CFWL_MonthCalendarImp::DrawRButton(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawCaption(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawCaption(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText textParam;
- textParam.m_pWidget = m_pInterface;
+ textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::Caption;
textParam.m_dwStates = CFWL_PartState_Normal;
textParam.m_pGraphics = pGraphics;
@@ -364,11 +352,12 @@ void CFWL_MonthCalendarImp::DrawCaption(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&textParam);
}
-void CFWL_MonthCalendarImp::DrawSeperator(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawSeperator(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::HSeparator;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -378,11 +367,12 @@ void CFWL_MonthCalendarImp::DrawSeperator(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesInBK(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DateInBK;
params.m_pGraphics = pGraphics;
if (pMatrix) {
@@ -412,11 +402,12 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics,
params.m_dwStates = 0;
}
}
-void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeek(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Week;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -434,11 +425,12 @@ void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeekNumber(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::WeekNum;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -466,11 +458,12 @@ void CFWL_MonthCalendarImp::DrawWeekNumber(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawWeekNumberSep(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawWeekNumberSep(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::WeekNumSep;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -480,14 +473,15 @@ void CFWL_MonthCalendarImp::DrawWeekNumberSep(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawToday(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) {
return;
}
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::Today;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -506,11 +500,12 @@ void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesIn(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DatesIn;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -531,11 +526,12 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics,
pTheme->DrawText(&params);
}
}
-void CFWL_MonthCalendarImp::DrawDatesOut(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesOut(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeText params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DatesOut;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -545,9 +541,10 @@ void CFWL_MonthCalendarImp::DrawDatesOut(CFX_Graphics* pGraphics,
}
pTheme->DrawText(&params);
}
-void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawDatesInCircle(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) {
return;
}
@@ -561,7 +558,7 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
if (!pDate)
return;
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DateInCircle;
params.m_pGraphics = pGraphics;
params.m_rtPart = pDate->rect;
@@ -571,9 +568,10 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_MonthCalendar::DrawTodayCircle(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoToday) {
return;
}
@@ -581,7 +579,7 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
return;
}
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::TodayCircle;
params.m_pGraphics = pGraphics;
params.m_dwStates = CFWL_PartState_Normal;
@@ -591,7 +589,8 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&params);
}
-CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
+
+CFX_SizeF IFWL_MonthCalendar::CalcSize(FX_BOOL bAutoSize) {
if (!m_pProperties->m_pThemeProvider)
return CFX_SizeF();
@@ -602,7 +601,7 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
CFWL_ThemePart params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
FX_FLOAT fMaxWeekW = 0.0f;
FX_FLOAT fMaxWeekH = 0.0f;
@@ -657,7 +656,7 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
return fs;
}
-void CFWL_MonthCalendarImp::CalcHeadSize() {
+void IFWL_MonthCalendar::CalcHeadSize() {
FX_FLOAT fHeadHMargin = (m_rtClient.width - m_szHead.x) / 2;
FX_FLOAT fHeadVMargin = (m_szCell.x - m_szHead.y) / 2;
m_rtHeadText.Set(m_rtClient.left + fHeadHMargin,
@@ -665,7 +664,8 @@ void CFWL_MonthCalendarImp::CalcHeadSize() {
MONTHCAL_VMARGIN + fHeadVMargin,
m_szHead.x, m_szHead.y);
}
-void CFWL_MonthCalendarImp::CalcTodaySize() {
+
+void IFWL_MonthCalendar::CalcTodaySize() {
m_rtTodayFlag.Set(
m_rtClient.left + MONTHCAL_HEADER_BTN_HMARGIN + MONTHCAL_HMARGIN,
m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN,
@@ -676,7 +676,8 @@ void CFWL_MonthCalendarImp::CalcTodaySize() {
m_rtDates.bottom() + MONTHCAL_HEADER_BTN_VMARGIN + MONTHCAL_VMARGIN,
m_szToday.x, m_szToday.y);
}
-void CFWL_MonthCalendarImp::LayOut() {
+
+void IFWL_MonthCalendar::LayOut() {
GetClientRect(m_rtClient);
{
m_rtHead.Set(
@@ -707,7 +708,8 @@ void CFWL_MonthCalendarImp::LayOut() {
}
CalDateItem();
}
-void CFWL_MonthCalendarImp::CalDateItem() {
+
+void IFWL_MonthCalendar::CalDateItem() {
FX_BOOL bNewWeek = FALSE;
int32_t iWeekOfMonth = 0;
FX_FLOAT fLeft = m_rtDates.left;
@@ -732,13 +734,14 @@ void CFWL_MonthCalendarImp::CalDateItem() {
}
}
}
-void CFWL_MonthCalendarImp::GetCapValue() {
+
+void IFWL_MonthCalendar::GetCapValue() {
if (!m_pProperties->m_pThemeProvider) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
}
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
m_fHeadWid = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::HeaderWidth));
m_fHeadHei = *static_cast<FX_FLOAT*>(
@@ -795,46 +798,52 @@ void CFWL_MonthCalendarImp::GetCapValue() {
m_fMCHei = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Height));
}
-int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+int32_t IFWL_MonthCalendar::CalWeekNumber(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
return 0;
}
-FX_BOOL CFWL_MonthCalendarImp::GetMinDate(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetMinDate(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_dtMin.iYear;
iMonth = m_dtMin.iMonth;
iDay = m_dtMin.iDay;
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetMinDate(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetMinDate(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
m_dtMin = DATE(iYear, iMonth, iDay);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::GetMaxDate(int32_t& iYear,
- int32_t& iMonth,
- int32_t& iDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetMaxDate(int32_t& iYear,
+ int32_t& iMonth,
+ int32_t& iDay) {
iYear = m_dtMax.iYear;
iMonth = m_dtMax.iMonth;
iDay = m_dtMax.iDay;
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::SetMaxDate(int32_t iYear,
- int32_t iMonth,
- int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::SetMaxDate(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay) {
m_dtMax = DATE(iYear, iMonth, iDay);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::InitDate() {
+
+FX_BOOL IFWL_MonthCalendar::InitDate() {
if (m_pProperties->m_pDataProvider) {
IFWL_MonthCalendarDP* pDateProv =
static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider);
- m_iYear = pDateProv->GetCurYear(m_pInterface);
- m_iMonth = pDateProv->GetCurMonth(m_pInterface);
- m_iDay = pDateProv->GetCurDay(m_pInterface);
+ m_iYear = pDateProv->GetCurYear(this);
+ m_iMonth = pDateProv->GetCurMonth(this);
+ m_iDay = pDateProv->GetCurDay(this);
m_iCurYear = m_iYear;
m_iCurMonth = m_iMonth;
} else {
@@ -851,14 +860,14 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() {
return TRUE;
}
-void CFWL_MonthCalendarImp::ClearDateItem() {
+void IFWL_MonthCalendar::ClearDateItem() {
for (int32_t i = 0; i < m_arrDates.GetSize(); i++)
delete m_arrDates.GetAt(i);
m_arrDates.RemoveAll();
}
-void CFWL_MonthCalendarImp::ReSetDateItem() {
+void IFWL_MonthCalendar::ReSetDateItem() {
m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1);
int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth);
int32_t iDayOfWeek = m_pDateTime->GetDayOfWeek();
@@ -882,7 +891,8 @@ void CFWL_MonthCalendarImp::ReSetDateItem() {
iDayOfWeek++;
}
}
-FX_BOOL CFWL_MonthCalendarImp::NextMonth() {
+
+FX_BOOL IFWL_MonthCalendar::NextMonth() {
int32_t iYear = m_iCurYear, iMonth = m_iCurMonth;
if (iMonth >= 12) {
iMonth = 1;
@@ -898,7 +908,8 @@ FX_BOOL CFWL_MonthCalendarImp::NextMonth() {
ChangeToMonth(m_iCurYear, m_iCurMonth);
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::PrevMonth() {
+
+FX_BOOL IFWL_MonthCalendar::PrevMonth() {
int32_t iYear = m_iCurYear, iMonth = m_iCurMonth;
if (iMonth <= 1) {
iMonth = 12;
@@ -914,7 +925,8 @@ FX_BOOL CFWL_MonthCalendarImp::PrevMonth() {
ChangeToMonth(m_iCurYear, m_iCurMonth);
return TRUE;
}
-void CFWL_MonthCalendarImp::ChangeToMonth(int32_t iYear, int32_t iMonth) {
+
+void IFWL_MonthCalendar::ChangeToMonth(int32_t iYear, int32_t iMonth) {
m_iCurYear = iYear;
m_iCurMonth = iMonth;
m_iHovered = -1;
@@ -923,7 +935,8 @@ void CFWL_MonthCalendarImp::ChangeToMonth(int32_t iYear, int32_t iMonth) {
CalDateItem();
GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead);
}
-FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
+
+FX_BOOL IFWL_MonthCalendar::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
if (iDay == -1 && !bAll) {
return FALSE;
}
@@ -953,7 +966,8 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) {
}
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) {
+
+FX_BOOL IFWL_MonthCalendar::AddSelDay(int32_t iDay) {
ASSERT(iDay > 0);
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
} else {
@@ -968,7 +982,8 @@ FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) {
}
return TRUE;
}
-FX_BOOL CFWL_MonthCalendarImp::JumpToToday() {
+
+FX_BOOL IFWL_MonthCalendar::JumpToToday() {
if (m_iYear != m_iCurYear || m_iMonth != m_iCurMonth) {
m_iCurYear = m_iYear;
m_iCurMonth = m_iMonth;
@@ -981,9 +996,10 @@ FX_BOOL CFWL_MonthCalendarImp::JumpToToday() {
}
return TRUE;
}
-void CFWL_MonthCalendarImp::GetHeadText(int32_t iYear,
- int32_t iMonth,
- CFX_WideString& wsHead) {
+
+void IFWL_MonthCalendar::GetHeadText(int32_t iYear,
+ int32_t iMonth,
+ CFX_WideString& wsHead) {
ASSERT(iMonth > 0 && iMonth < 13);
static const FX_WCHAR* const pMonth[] = {
L"January", L"February", L"March", L"April",
@@ -991,13 +1007,15 @@ void CFWL_MonthCalendarImp::GetHeadText(int32_t iYear,
L"September", L"October", L"November", L"December"};
wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear);
}
-void CFWL_MonthCalendarImp::GetTodayText(int32_t iYear,
- int32_t iMonth,
- int32_t iDay,
- CFX_WideString& wsToday) {
+
+void IFWL_MonthCalendar::GetTodayText(int32_t iYear,
+ int32_t iMonth,
+ int32_t iDay,
+ CFX_WideString& wsToday) {
wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear);
}
-int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
+
+int32_t IFWL_MonthCalendar::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
int32_t iCount = m_arrDates.GetSize();
for (int32_t i = 0; i < iCount; i++) {
FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i);
@@ -1007,7 +1025,8 @@ int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) {
}
return -1;
}
-FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
+
+FX_BOOL IFWL_MonthCalendar::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
if (iDay <= 0 || iDay > m_arrDates.GetSize()) {
return FALSE;
}
@@ -1019,7 +1038,7 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) {
}
CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate(
- CFWL_MonthCalendarImp* pOwner)
+ IFWL_MonthCalendar* pOwner)
: m_pOwner(pOwner) {}
void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -1063,9 +1082,7 @@ void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
}
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -1086,6 +1103,7 @@ void CFWL_MonthCalendarImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_pOwner->m_iLBtnPartStates = CFWL_PartState_Pressed;
@@ -1121,20 +1139,21 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
}
m_pOwner->AddSelDay(iCurSel);
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmClick);
CFWL_EventMcdDateChanged wmDateSelected;
wmDateSelected.m_iStartDay = iCurSel;
wmDateSelected.m_iEndDay = iCurSel;
wmDateSelected.m_iOldMonth = m_pOwner->m_iCurMonth;
wmDateSelected.m_iOldYear = m_pOwner->m_iCurYear;
- wmDateSelected.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmDateSelected.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmDateSelected);
m_pOwner->Repaint(&rtInvalidate);
}
}
}
}
+
void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_rtLBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_pOwner->m_iLBtnPartStates = 0;
@@ -1149,6 +1168,7 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
}
}
+
void CFWL_MonthCalendarImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_MultiSelect) {
return;
@@ -1185,6 +1205,7 @@ void CFWL_MonthCalendarImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvalidate);
}
}
+
void CFWL_MonthCalendarImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (m_pOwner->m_iHovered > 0) {
CFX_RectF rtInvalidate;
diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/core/ifwl_monthcalendar.h
index 2716f59f95..340acf0bcc 100644
--- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h
+++ b/xfa/fwl/core/ifwl_monthcalendar.h
@@ -4,15 +4,37 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
-
-#include <memory>
+#ifndef XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_
+#define XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_
#include "xfa/fgas/localization/fgas_datetime.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
+#define FWL_CLASS_MonthCalendar L"FWL_MONTHCALENDAR"
+#define FWL_STYLEEXT_MCD_MultiSelect (1L << 0)
+#define FWL_STYLEEXT_MCD_NoToday (1L << 1)
+#define FWL_STYLEEXT_MCD_NoTodayCircle (1L << 2)
+#define FWL_STYLEEXT_MCD_WeekNumbers (1L << 3)
+#define FWL_ITEMSTATE_MCD_Nomal (0L << 0)
+#define FWL_ITEMSTATE_MCD_Flag (1L << 0)
+#define FWL_ITEMSTATE_MCD_Selected (1L << 1)
+#define FWL_ITEMSTATE_MCD_Focused (1L << 2)
+
+FWL_EVENT_DEF(CFWL_Event_McdDateSelected,
+ CFWL_EventType::DataSelected,
+ int32_t m_iStartDay;
+ int32_t m_iEndDay;)
+
+FWL_EVENT_DEF(CFWL_EventMcdDateChanged,
+ CFWL_EventType::DateChanged,
+ int32_t m_iOldYear;
+ int32_t m_iOldMonth;
+ int32_t m_iStartDay;
+ int32_t m_iEndDay;)
+
class CFWL_MonthCalendarImpDelegate;
class CFWL_MsgMouse;
class CFWL_WidgetImpProperties;
@@ -22,11 +44,21 @@ struct FWL_DATEINFO;
extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
-class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
+class IFWL_MonthCalendarDP : public IFWL_DataProvider {
public:
- CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_MonthCalendarImp() override;
+ virtual int32_t GetCurDay(IFWL_Widget* pWidget) = 0;
+ virtual int32_t GetCurMonth(IFWL_Widget* pWidget) = 0;
+ virtual int32_t GetCurYear(IFWL_Widget* pWidget) = 0;
+};
+
+class IFWL_MonthCalendar : public IFWL_Widget {
+ public:
+ static IFWL_MonthCalendar* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_MonthCalendar(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_MonthCalendar() override;
// FWL_WidgetImp
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
@@ -230,7 +262,7 @@ struct FWL_DATEINFO {
class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner);
+ CFWL_MonthCalendarImpDelegate(IFWL_MonthCalendar* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
@@ -242,7 +274,7 @@ class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate {
void OnLButtonUp(CFWL_MsgMouse* pMsg);
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
- CFWL_MonthCalendarImp* m_pOwner;
+ IFWL_MonthCalendar* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_MONTHCALENDARIMP_H_
+#endif // XFA_FWL_CORE_IFWL_MONTHCALENDAR_H_
diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/core/ifwl_picturebox.cpp
index a84cc8c5e8..12d8713971 100644
--- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp
+++ b/xfa/fwl/core/ifwl_picturebox.cpp
@@ -4,29 +4,21 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_pictureboximp.h"
+#include "xfa/fwl/core/ifwl_picturebox.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/lightwidget/cfwl_picturebox.h"
// static
IFWL_PictureBox* IFWL_PictureBox::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_PictureBox* pPictureBox = new IFWL_PictureBox;
- CFWL_PictureBoxImp* pPictureBoxImpl =
- new CFWL_PictureBoxImp(properties, pOuter);
- pPictureBox->SetImpl(pPictureBoxImpl);
- pPictureBoxImpl->SetInterface(pPictureBox);
- return pPictureBox;
+ return new IFWL_PictureBox(properties, pOuter);
}
-IFWL_PictureBox::IFWL_PictureBox() {}
-CFWL_PictureBoxImp::CFWL_PictureBoxImp(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_PictureBox::IFWL_PictureBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_bTop(FALSE),
m_bVCenter(FALSE),
m_bButton(FALSE) {
@@ -35,50 +27,51 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp(
m_matrix.SetIdentity();
}
-CFWL_PictureBoxImp::~CFWL_PictureBoxImp() {}
+IFWL_PictureBox::~IFWL_PictureBox() {}
-FWL_Error CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_PictureBox::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_PictureBox;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_PictureBoxImp::GetClassID() const {
+FWL_Type IFWL_PictureBox::GetClassID() const {
return FWL_Type::PictureBox;
}
-FWL_Error CFWL_PictureBoxImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_PictureBox::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_PictureBoxImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PictureBoxImp::Finalize() {
+FWL_Error IFWL_PictureBox::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pDataProvider)
return FWL_Error::Indefinite;
CFX_DIBitmap* pBitmap =
static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider)
- ->GetPicture(m_pInterface);
+ ->GetPicture(this);
if (pBitmap) {
rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(),
(FX_FLOAT)pBitmap->GetHeight());
}
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PictureBoxImp::Update() {
+
+FWL_Error IFWL_PictureBox::Update() {
if (IsLocked()) {
return FWL_Error::Succeeded;
}
@@ -88,8 +81,9 @@ FWL_Error CFWL_PictureBoxImp::Update() {
GetClientRect(m_rtClient);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_PictureBox::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -104,17 +98,18 @@ FWL_Error CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics,
DrawBkground(pGraphics, pTheme, pMatrix);
return FWL_Error::Succeeded;
}
-void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_PictureBox::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
IFWL_PictureBoxDP* pPictureDP =
static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider);
if (!pPictureDP)
return;
- CFX_DIBitmap* pPicture = pPictureDP->GetPicture(m_pInterface);
+ CFX_DIBitmap* pPicture = pPictureDP->GetPicture(this);
CFX_Matrix matrix;
- pPictureDP->GetMatrix(m_pInterface, matrix);
+ pPictureDP->GetMatrix(this, matrix);
if (!pPicture)
return;
@@ -131,7 +126,8 @@ void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
(m_rtClient.height - fy) / 2),
&matrix);
}
-FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) {
+
+FX_BOOL IFWL_PictureBox::VStyle(FX_BOOL dwStyle) {
switch (dwStyle & FWL_STYLEEXT_PTB_VAlignMask) {
case FWL_STYLEEXT_PTB_Top: {
return m_bTop = TRUE;
@@ -149,8 +145,7 @@ FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) {
return FALSE;
}
-CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(
- CFWL_PictureBoxImp* pOwner)
+CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner)
: m_pOwner(pOwner) {}
void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics,
diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h
index f40454a42d..eb9c70efca 100644
--- a/xfa/fwl/basewidget/ifwl_picturebox.h
+++ b/xfa/fwl/core/ifwl_picturebox.h
@@ -4,12 +4,11 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_IFWL_PICTUREBOX_H_
-#define XFA_FWL_BASEWIDGET_IFWL_PICTUREBOX_H_
+#ifndef XFA_FWL_CORE_IFWL_PICTUREBOX_H_
+#define XFA_FWL_CORE_IFWL_PICTUREBOX_H_
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
@@ -29,7 +28,10 @@
#define FWL_STYLEEXT_PTB_VAlignMask 3L << 2
#define FWL_STYLEEXT_PTB_StretchAlignMask 7L << 4
+class CFWL_PictureBoxImpDelegate;
+class CFWL_WidgetImpProperties;
class CFX_DIBitmap;
+class IFWL_Widget;
class IFWL_PictureBoxDP : public IFWL_DataProvider {
public:
@@ -46,8 +48,44 @@ class IFWL_PictureBox : public IFWL_Widget {
static IFWL_PictureBox* Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter);
+ IFWL_PictureBox(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_PictureBox() override;
+
+ // IFWL_Widget
+ FWL_Error GetClassName(CFX_WideString& wsClass) const override;
+ FWL_Type GetClassID() const override;
+ FWL_Error Initialize() override;
+ FWL_Error Finalize() override;
+ FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override;
+ FWL_Error Update() override;
+ FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
+ protected:
+ friend class CFWL_PictureBoxImpDelegate;
+
+ void DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+
+ FX_BOOL VStyle(FX_BOOL dwStyle);
+ CFX_RectF m_rtClient;
+ CFX_RectF m_rtImage;
+ CFX_Matrix m_matrix;
+ FX_BOOL m_bTop;
+ FX_BOOL m_bVCenter;
+ FX_BOOL m_bButton;
+};
+
+class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate {
+ public:
+ CFWL_PictureBoxImpDelegate(IFWL_PictureBox* pOwner);
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
+
protected:
- IFWL_PictureBox();
+ IFWL_PictureBox* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_IFWL_PICTUREBOX_H_
+#endif // XFA_FWL_CORE_IFWL_PICTUREBOX_H_
diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/core/ifwl_pushbutton.cpp
index 834342ec93..a3efb10296 100644
--- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp
+++ b/xfa/fwl/core/ifwl_pushbutton.cpp
@@ -4,34 +4,26 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_pushbuttonimp.h"
+#include "xfa/fwl/core/ifwl_pushbutton.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
#include "xfa/fwl/core/cfwl_message.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/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_pushbutton.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
// static
IFWL_PushButton* IFWL_PushButton::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_PushButton* pPushButton = new IFWL_PushButton;
- CFWL_PushButtonImp* pPushButtonImpl =
- new CFWL_PushButtonImp(properties, pOuter);
- pPushButton->SetImpl(pPushButtonImpl);
- pPushButtonImpl->SetInterface(pPushButton);
- return pPushButton;
+ return new IFWL_PushButton(properties, pOuter);
}
-IFWL_PushButton::IFWL_PushButton() {}
-CFWL_PushButtonImp::CFWL_PushButtonImp(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_PushButton::IFWL_PushButton(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_bBtnDown(FALSE),
m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
m_iTTOAlign(FDE_TTOALIGNMENT_Center) {
@@ -39,32 +31,32 @@ CFWL_PushButtonImp::CFWL_PushButtonImp(
m_rtCaption.Set(0, 0, 0, 0);
}
-CFWL_PushButtonImp::~CFWL_PushButtonImp() {}
+IFWL_PushButton::~IFWL_PushButton() {}
-FWL_Error CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_PushButton::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_PushButton;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_PushButtonImp::GetClassID() const {
+FWL_Type IFWL_PushButton::GetClassID() const {
return FWL_Type::PushButton;
}
-FWL_Error CFWL_PushButtonImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_PushButton::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_PushButtonImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PushButtonImp::Finalize() {
+FWL_Error IFWL_PushButton::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_PushButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pThemeProvider) {
@@ -74,7 +66,7 @@ FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect,
IFWL_PushButtonDP* pData =
static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider);
if (pData) {
- pData->GetCaption(m_pInterface, wsCaption);
+ pData->GetCaption(this, wsCaption);
}
int32_t iLen = wsCaption.GetLength();
if (iLen > 0) {
@@ -84,22 +76,22 @@ FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect,
FX_FLOAT* fcaption =
static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin));
rect.Inflate(*fcaption, *fcaption);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void IFWL_PushButton::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((dwStates & FWL_WGTSTATE_Disabled) && bSet) {
m_pProperties->m_dwStates = FWL_WGTSTATE_Disabled;
return;
}
- CFWL_WidgetImp::SetStates(dwStates, bSet);
+ IFWL_Widget::SetStates(dwStates, bSet);
}
-FWL_Error CFWL_PushButtonImp::Update() {
+FWL_Error IFWL_PushButton::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -114,8 +106,9 @@ FWL_Error CFWL_PushButtonImp::Update() {
m_rtCaption.Inflate(-*fcaption, -*fcaption);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_PushButton::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -139,7 +132,7 @@ FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics,
FX_FLOAT ipicheight = 0;
CFX_WideString wsCaption;
if (pData) {
- pData->GetCaption(m_pInterface, wsCaption);
+ pData->GetCaption(this, wsCaption);
}
CFX_RectF rtText;
rtText.Set(0, 0, 0, 0);
@@ -152,7 +145,7 @@ FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics,
break;
case FWL_STYLEEXT_PSB_IconOnly:
if (pData) {
- pPicture = pData->GetPicture(m_pInterface);
+ pPicture = pData->GetPicture(this);
}
if (pPicture) {
CFX_PointF point;
@@ -302,11 +295,12 @@ FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics,
}
return FWL_Error::Succeeded;
}
-void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_PushButton::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_dwStates = GetPartStates();
param.m_pGraphics = pGraphics;
@@ -319,18 +313,19 @@ void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&param);
}
-void CFWL_PushButtonImp::DrawText(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_PushButton::DrawText(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (!m_pProperties->m_pDataProvider)
return;
CFX_WideString wsCaption;
- m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
+ m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
if (wsCaption.IsEmpty()) {
return;
}
CFWL_ThemeText param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Caption;
param.m_dwStates = GetPartStates();
param.m_pGraphics = pGraphics;
@@ -343,7 +338,8 @@ void CFWL_PushButtonImp::DrawText(CFX_Graphics* pGraphics,
param.m_iTTOAlign = m_iTTOAlign;
pTheme->DrawText(&param);
}
-uint32_t CFWL_PushButtonImp::GetPartStates() {
+
+uint32_t IFWL_PushButton::GetPartStates() {
uint32_t dwStates = CFWL_PartState_Normal;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) {
dwStates |= CFWL_PartState_Focused;
@@ -359,7 +355,8 @@ uint32_t CFWL_PushButtonImp::GetPartStates() {
}
return dwStates;
}
-void CFWL_PushButtonImp::UpdateTextOutStyles() {
+
+void IFWL_PushButton::UpdateTextOutStyles() {
m_iTTOAlign = FDE_TTOALIGNMENT_Center;
switch (m_pProperties->m_dwStyleExes &
(FWL_STYLEEXT_PSB_HLayoutMask | FWL_STYLEEXT_PSB_VLayoutMask)) {
@@ -407,8 +404,7 @@ void CFWL_PushButtonImp::UpdateTextOutStyles() {
}
}
-CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate(
- CFWL_PushButtonImp* pOwner)
+CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate(IFWL_PushButton* pOwner)
: m_pOwner(pOwner) {}
void CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -457,9 +453,7 @@ void CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKeyDown(pKey);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -480,6 +474,7 @@ void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_PushButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
m_pOwner->SetFocus(TRUE);
@@ -489,6 +484,7 @@ void CFWL_PushButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_pProperties->m_dwStates |= FWL_STATE_PSB_Pressed;
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_PushButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bBtnDown = FALSE;
if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
@@ -500,11 +496,12 @@ void CFWL_PushButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmClick);
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_PushButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
FX_BOOL bRepaint = FALSE;
if (m_pOwner->m_bBtnDown) {
@@ -540,20 +537,22 @@ void CFWL_PushButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
}
+
void CFWL_PushButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bBtnDown = FALSE;
m_pOwner->m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Hovered;
m_pOwner->m_pProperties->m_dwStates &= ~FWL_STATE_PSB_Pressed;
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_PushButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
if (pMsg->m_dwKeyCode == FWL_VKEY_Return) {
CFWL_EvtMouse wmMouse;
- wmMouse.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmMouse.m_pSrcTarget = m_pOwner;
wmMouse.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
m_pOwner->DispatchEvent(&wmMouse);
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner;
m_pOwner->DispatchEvent(&wmClick);
return;
}
diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/core/ifwl_pushbutton.h
index 31ad5519bb..9901c1a44c 100644
--- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h
+++ b/xfa/fwl/core/ifwl_pushbutton.h
@@ -4,24 +4,51 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_PUSHBUTTON_H_
+#define XFA_FWL_CORE_IFWL_PUSHBUTTON_H_
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
+#define FWL_CLASS_PushButton L"FWL_PUSHBUTTON"
+#define FWL_STYLEEXT_PSB_Left (0L << 0)
+#define FWL_STYLEEXT_PSB_Center (1L << 0)
+#define FWL_STYLEEXT_PSB_Right (2L << 0)
+#define FWL_STYLEEXT_PSB_Top (0L << 2)
+#define FWL_STYLEEXT_PSB_VCenter (1L << 2)
+#define FWL_STYLEEXT_PSB_Bottom (2L << 2)
+#define FWL_STYLEEXT_PSB_TextOnly (0L << 4)
+#define FWL_STYLEEXT_PSB_IconOnly (1L << 4)
+#define FWL_STYLEEXT_PSB_TextIcon (2L << 4)
+#define FWL_STYLEEXT_PSB_HLayoutMask (3L << 0)
+#define FWL_STYLEEXT_PSB_VLayoutMask (3L << 2)
+#define FWL_STYLEEXT_PSB_ModeMask (3L << 4)
+#define FWL_STATE_PSB_Hovered (1 << FWL_WGTSTATE_MAX)
+#define FWL_STATE_PSB_Pressed (1 << (FWL_WGTSTATE_MAX + 1))
+#define FWL_STATE_PSB_Default (1 << (FWL_WGTSTATE_MAX + 2))
+
class CFWL_MsgMouse;
-class CFWL_WidgetImpProperties;
class CFWL_PushButtonImpDelegate;
+class CFWL_WidgetImpProperties;
+class CFX_DIBitmap;
class IFWL_Widget;
-class CFWL_PushButtonImp : public CFWL_WidgetImp {
+class IFWL_PushButtonDP : public IFWL_DataProvider {
public:
- CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_PushButtonImp() override;
+ virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) = 0;
+};
+
+class IFWL_PushButton : public IFWL_Widget {
+ public:
+ static IFWL_PushButton* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_PushButton(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_PushButton() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -53,7 +80,7 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp {
class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner);
+ CFWL_PushButtonImpDelegate(IFWL_PushButton* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -66,7 +93,7 @@ class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKeyDown(CFWL_MsgKey* pMsg);
- CFWL_PushButtonImp* m_pOwner;
+ IFWL_PushButton* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_PUSHBUTTONIMP_H_
+#endif // XFA_FWL_CORE_IFWL_PUSHBUTTON_H_
diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/core/ifwl_scrollbar.cpp
index 7e68ea2272..15478ff092 100644
--- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp
+++ b/xfa/fwl/core/ifwl_scrollbar.cpp
@@ -4,14 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_scrollbarimp.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
#include "xfa/fwl/core/cfwl_message.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/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#define FWL_SCROLLBAR_Elapse 500
@@ -21,52 +20,12 @@
IFWL_ScrollBar* IFWL_ScrollBar::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_ScrollBar* pScrollBar = new IFWL_ScrollBar;
- CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(properties, pOuter);
- pScrollBar->SetImpl(pScrollBarImpl);
- pScrollBarImpl->SetInterface(pScrollBar);
- return pScrollBar;
+ return new IFWL_ScrollBar(properties, pOuter);
}
-IFWL_ScrollBar::IFWL_ScrollBar() {}
-FX_BOOL IFWL_ScrollBar::IsVertical() {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->IsVertical();
-}
-FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetRange(fMin, fMax);
-}
-FWL_Error IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetRange(fMin, fMax);
-}
-FX_FLOAT IFWL_ScrollBar::GetPageSize() {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPageSize();
-}
-FWL_Error IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPageSize(fPageSize);
-}
-FX_FLOAT IFWL_ScrollBar::GetStepSize() {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetStepSize();
-}
-FWL_Error IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetStepSize(fStepSize);
-}
-FX_FLOAT IFWL_ScrollBar::GetPos() {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPos();
-}
-FWL_Error IFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPos(fPos);
-}
-FX_FLOAT IFWL_ScrollBar::GetTrackPos() {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetTrackPos();
-}
-FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetTrackPos(fTrackPos);
-}
-FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
- return static_cast<CFWL_ScrollBarImp*>(GetImpl())->DoScroll(dwCode, fPos);
-}
-CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+
+IFWL_ScrollBar::IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_pTimerInfo(nullptr),
m_fRangeMin(0),
m_fRangeMax(-1),
@@ -99,31 +58,32 @@ CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
m_rtMaxTrack.Reset();
}
-CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {}
+IFWL_ScrollBar::~IFWL_ScrollBar() {}
-FWL_Error CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_ScrollBar::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ScrollBar;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_ScrollBarImp::GetClassID() const {
+FWL_Type IFWL_ScrollBar::GetClassID() const {
return FWL_Type::ScrollBar;
}
-FWL_Error CFWL_ScrollBarImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_ScrollBar::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ScrollBarImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ScrollBarImp::Finalize() {
+FWL_Error IFWL_ScrollBar::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_ScrollBar::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>(
@@ -135,13 +95,14 @@ FWL_Error CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
} else {
rect.Set(0, 0, (*pfMinWidth) * 3, (*pfMinWidth));
}
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ScrollBarImp::Update() {
+
+FWL_Error IFWL_ScrollBar::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -151,8 +112,9 @@ FWL_Error CFWL_ScrollBarImp::Update() {
Layout();
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_ScrollBar::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
if (!m_pProperties->m_pThemeProvider)
@@ -171,51 +133,63 @@ FWL_Error CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics,
DrawThumb(pGraphics, pTheme, pMatrix);
return FWL_Error::Succeeded;
}
-inline FX_BOOL CFWL_ScrollBarImp::IsVertical() {
+
+inline FX_BOOL IFWL_ScrollBar::IsVertical() {
return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert;
}
-FWL_Error CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
+
+FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
fMin = m_fRangeMin;
fMax = m_fRangeMax;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
+
+FWL_Error IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
m_fRangeMin = fMin;
m_fRangeMax = fMax;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ScrollBarImp::GetPageSize() {
+
+FX_FLOAT IFWL_ScrollBar::GetPageSize() {
return m_fPageSize;
}
-FWL_Error CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) {
+
+FWL_Error IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
m_fPageSize = fPageSize;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ScrollBarImp::GetStepSize() {
+
+FX_FLOAT IFWL_ScrollBar::GetStepSize() {
return m_fStepSize;
}
-FWL_Error CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) {
+
+FWL_Error IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
m_fStepSize = fStepSize;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ScrollBarImp::GetPos() {
+
+FX_FLOAT IFWL_ScrollBar::GetPos() {
return m_fPos;
}
-FWL_Error CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) {
+
+FWL_Error IFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
m_fPos = fPos;
return FWL_Error::Succeeded;
}
-FX_FLOAT CFWL_ScrollBarImp::GetTrackPos() {
+
+FX_FLOAT IFWL_ScrollBar::GetTrackPos() {
return m_fTrackPos;
}
-FWL_Error CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) {
+
+FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
m_fTrackPos = fTrackPos;
CalcThumbButtonRect(m_rtThumb);
CalcMinTrackRect(m_rtMinTrack);
CalcMaxTrackRect(m_rtMaxTrack);
return FWL_Error::Succeeded;
}
-FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
+
+FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
switch (dwCode) {
case FWL_SCBCODE_Min:
case FWL_SCBCODE_Max:
@@ -234,7 +208,7 @@ FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) {
return OnScroll(dwCode, fPos);
}
-void CFWL_ScrollBarImp::Run(IFWL_TimerInfo* pTimerInfo) {
+void IFWL_ScrollBar::Run(IFWL_TimerInfo* pTimerInfo) {
if (m_pTimerInfo)
m_pTimerInfo->StopTimer();
@@ -242,16 +216,17 @@ void CFWL_ScrollBarImp::Run(IFWL_TimerInfo* pTimerInfo) {
m_pTimerInfo = StartTimer(0, true);
}
-FWL_Error CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) {
+FWL_Error IFWL_ScrollBar::SetOuter(IFWL_Widget* pOuter) {
m_pOuter = pOuter;
return FWL_Error::Succeeded;
}
-void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- FX_BOOL bLower,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ScrollBar::DrawTrack(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ FX_BOOL bLower,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = bLower ? CFWL_Part::LowerTrack : CFWL_Part::UpperTrack;
param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
? CFWL_PartState_Disabled
@@ -261,12 +236,13 @@ void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics,
param.m_rtPart = bLower ? m_rtMinTrack : m_rtMaxTrack;
pTheme->DrawBackground(&param);
}
-void CFWL_ScrollBarImp::DrawArrowBtn(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- FX_BOOL bMinBtn,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ScrollBar::DrawArrowBtn(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ FX_BOOL bMinBtn,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = bMinBtn ? CFWL_Part::ForeArrow : CFWL_Part::BackArrow;
param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
? CFWL_PartState_Disabled
@@ -278,11 +254,12 @@ void CFWL_ScrollBarImp::DrawArrowBtn(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&param);
}
}
-void CFWL_ScrollBarImp::DrawThumb(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ScrollBar::DrawThumb(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Thumb;
param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
? CFWL_PartState_Disabled
@@ -292,13 +269,14 @@ void CFWL_ScrollBarImp::DrawThumb(CFX_Graphics* pGraphics,
param.m_rtPart = m_rtThumb;
pTheme->DrawBackground(&param);
}
-void CFWL_ScrollBarImp::Layout() {
+
+void IFWL_ScrollBar::Layout() {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
m_fMinThumb = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::Size));
- m_bCustomLayout = pTheme->IsCustomizedLayout(m_pInterface);
+ m_bCustomLayout = pTheme->IsCustomizedLayout(this);
GetClientRect(m_rtClient);
CalcButtonLen();
CalcMinButtonRect(m_rtMinBtn);
@@ -307,7 +285,8 @@ void CFWL_ScrollBarImp::Layout() {
CalcMinTrackRect(m_rtMinTrack);
CalcMaxTrackRect(m_rtMaxTrack);
}
-void CFWL_ScrollBarImp::CalcButtonLen() {
+
+void IFWL_ScrollBar::CalcButtonLen() {
m_fButtonLen = IsVertical() ? m_rtClient.width : m_rtClient.height;
FX_FLOAT fLength = IsVertical() ? m_rtClient.height : m_rtClient.width;
if (fLength < m_fButtonLen * 2) {
@@ -317,7 +296,8 @@ void CFWL_ScrollBarImp::CalcButtonLen() {
m_bMinSize = FALSE;
}
}
-void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) {
+
+void IFWL_ScrollBar::CalcMinButtonRect(CFX_RectF& rect) {
if (m_bCustomLayout)
return;
@@ -327,7 +307,7 @@ void CFWL_ScrollBarImp::CalcMinButtonRect(CFX_RectF& rect) {
rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height;
}
-void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) {
+void IFWL_ScrollBar::CalcMaxButtonRect(CFX_RectF& rect) {
if (m_bCustomLayout)
return;
@@ -338,7 +318,7 @@ void CFWL_ScrollBarImp::CalcMaxButtonRect(CFX_RectF& rect) {
rect.height = IsVertical() ? m_fButtonLen : m_rtClient.height;
}
-void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) {
+void IFWL_ScrollBar::CalcThumbButtonRect(CFX_RectF& rect) {
if (!IsEnabled()) {
m_rtThumb.Reset();
return;
@@ -433,7 +413,8 @@ void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) {
rect.height = IsVertical() ? fThumbSize : rtClient.height;
}
}
-void CFWL_ScrollBarImp::CalcMinTrackRect(CFX_RectF& rect) {
+
+void IFWL_ScrollBar::CalcMinTrackRect(CFX_RectF& rect) {
if (m_bMinSize) {
rect.Empty();
return;
@@ -465,7 +446,8 @@ void CFWL_ScrollBarImp::CalcMinTrackRect(CFX_RectF& rect) {
}
}
}
-void CFWL_ScrollBarImp::CalcMaxTrackRect(CFX_RectF& rect) {
+
+void IFWL_ScrollBar::CalcMaxTrackRect(CFX_RectF& rect) {
if (m_bMinSize) {
rect.Empty();
return;
@@ -495,7 +477,8 @@ void CFWL_ScrollBarImp::CalcMaxTrackRect(CFX_RectF& rect) {
}
}
}
-FX_FLOAT CFWL_ScrollBarImp::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) {
+
+FX_FLOAT IFWL_ScrollBar::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) {
FX_FLOAT fDiffX = fx - m_cpTrackPointX;
FX_FLOAT fDiffY = fy - m_cpTrackPointY;
FX_FLOAT fRange = m_fRangeMax - m_fRangeMin;
@@ -540,7 +523,8 @@ FX_FLOAT CFWL_ScrollBarImp::GetTrackPointPos(FX_FLOAT fx, FX_FLOAT fy) {
}
return fPos;
}
-void CFWL_ScrollBarImp::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) {
+
+void IFWL_ScrollBar::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) {
FX_BOOL bDisabled = m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled;
if (bDisabled || m_bCustomLayout) {
rect = bLower ? m_rtMinTrack : m_rtMaxTrack;
@@ -577,7 +561,8 @@ void CFWL_ScrollBarImp::GetTrackRect(CFX_RectF& rect, FX_BOOL bLower) {
}
}
}
-FX_BOOL CFWL_ScrollBarImp::SendEvent() {
+
+FX_BOOL IFWL_ScrollBar::SendEvent() {
if (m_iMinButtonState == CFWL_PartState_Pressed) {
DoScroll(FWL_SCBCODE_StepBackward, m_fTrackPos);
return FALSE;
@@ -601,18 +586,19 @@ FX_BOOL CFWL_ScrollBarImp::SendEvent() {
}
return TRUE;
}
-FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) {
+
+FX_BOOL IFWL_ScrollBar::OnScroll(uint32_t dwCode, FX_FLOAT fPos) {
FX_BOOL bRet = TRUE;
CFWL_EvtScroll ev;
ev.m_iScrollCode = dwCode;
- ev.m_pSrcTarget = m_pInterface;
+ ev.m_pSrcTarget = this;
ev.m_fPos = fPos;
ev.m_pRet = &bRet;
DispatchEvent(&ev);
return bRet;
}
-CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner)
+CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner)
: m_pOwner(pOwner) {}
void CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -639,9 +625,7 @@ void CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnMouseLeave();
break;
}
- default: {
- break;
- }
+ default: { break; }
}
} else if (dwMsgCode == CFWL_MessageType::MouseWheel) {
CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage);
@@ -703,6 +687,7 @@ void CFWL_ScrollBarImpDelegate::OnLButtonUp(uint32_t dwFlags,
DoMouseUp(4, m_pOwner->m_rtMaxTrack, m_pOwner->m_iMaxTrackState, fx, fy);
m_pOwner->SetGrab(FALSE);
}
+
void CFWL_ScrollBarImpDelegate::OnMouseMove(uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
@@ -712,6 +697,7 @@ void CFWL_ScrollBarImpDelegate::OnMouseMove(uint32_t dwFlags,
DoMouseMove(3, m_pOwner->m_rtMinTrack, m_pOwner->m_iMinTrackState, fx, fy);
DoMouseMove(4, m_pOwner->m_rtMaxTrack, m_pOwner->m_iMaxTrackState, fx, fy);
}
+
void CFWL_ScrollBarImpDelegate::OnMouseLeave() {
DoMouseLeave(0, m_pOwner->m_rtMinBtn, m_pOwner->m_iMinButtonState);
DoMouseLeave(1, m_pOwner->m_rtThumb, m_pOwner->m_iThumbButtonState);
@@ -719,6 +705,7 @@ void CFWL_ScrollBarImpDelegate::OnMouseLeave() {
DoMouseLeave(3, m_pOwner->m_rtMinTrack, m_pOwner->m_iMinTrackState);
DoMouseLeave(4, m_pOwner->m_rtMaxTrack, m_pOwner->m_iMaxTrackState);
}
+
void CFWL_ScrollBarImpDelegate::OnMouseWheel(FX_FLOAT fx,
FX_FLOAT fy,
uint32_t dwFlags,
@@ -728,6 +715,7 @@ void CFWL_ScrollBarImpDelegate::OnMouseWheel(FX_FLOAT fx,
m_pOwner->SendEvent();
m_pOwner->m_iMouseWheel = 0;
}
+
void CFWL_ScrollBarImpDelegate::DoMouseDown(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
@@ -742,6 +730,7 @@ void CFWL_ScrollBarImpDelegate::DoMouseDown(int32_t iItem,
iState = CFWL_PartState_Pressed;
m_pOwner->Repaint(&rtItem);
}
+
void CFWL_ScrollBarImpDelegate::DoMouseUp(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
@@ -756,6 +745,7 @@ void CFWL_ScrollBarImpDelegate::DoMouseUp(int32_t iItem,
m_pOwner->Repaint(&rtItem);
m_pOwner->OnScroll(FWL_SCBCODE_EndScroll, m_pOwner->m_fTrackPos);
}
+
void CFWL_ScrollBarImpDelegate::DoMouseMove(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState,
@@ -776,6 +766,7 @@ void CFWL_ScrollBarImpDelegate::DoMouseMove(int32_t iItem,
m_pOwner->OnScroll(FWL_SCBCODE_TrackPos, fPos);
}
}
+
void CFWL_ScrollBarImpDelegate::DoMouseLeave(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState) {
@@ -785,6 +776,7 @@ void CFWL_ScrollBarImpDelegate::DoMouseLeave(int32_t iItem,
iState = CFWL_PartState_Normal;
m_pOwner->Repaint(&rtItem);
}
+
void CFWL_ScrollBarImpDelegate::DoMouseHover(int32_t iItem,
const CFX_RectF& rtItem,
int32_t& iState) {
diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/core/ifwl_scrollbar.h
index 4a7a4634ab..2a46e0f33d 100644
--- a/xfa/fwl/basewidget/fwl_scrollbarimp.h
+++ b/xfa/fwl/core/ifwl_scrollbar.h
@@ -4,24 +4,49 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_SCROLLBAR_H_
+#define XFA_FWL_CORE_IFWL_SCROLLBAR_H_
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "core/fxcrt/fx_system.h"
+#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
+#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_dataprovider.h"
#include "xfa/fwl/core/ifwl_timer.h"
#include "xfa/fwl/core/ifwl_widget.h"
+class CFWL_ScrollBarImpDelegate;
class CFWL_WidgetImpProperties;
class IFWL_Widget;
-class CFWL_ScrollBarImpDelegate;
-class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer {
+#define FWL_CLASS_ScrollBar L"FWL_SCROLLBAR"
+#define FWL_STYLEEXT_SCB_Horz (0L << 0)
+#define FWL_STYLEEXT_SCB_Vert (1L << 0)
+
+enum FWL_SCBCODE {
+ FWL_SCBCODE_None = 1,
+ FWL_SCBCODE_Min,
+ FWL_SCBCODE_Max,
+ FWL_SCBCODE_PageBackward,
+ FWL_SCBCODE_PageForward,
+ FWL_SCBCODE_StepBackward,
+ FWL_SCBCODE_StepForward,
+ FWL_SCBCODE_Pos,
+ FWL_SCBCODE_TrackPos,
+ FWL_SCBCODE_EndScroll,
+};
+
+class IFWL_ScrollBarDP : public IFWL_DataProvider {};
+
+class IFWL_ScrollBar : public IFWL_Widget, public IFWL_Timer {
public:
- CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_ScrollBarImp() override;
+ static IFWL_ScrollBar* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_ScrollBar(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_ScrollBar() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -104,11 +129,14 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer {
CFX_RectF m_rtMaxTrack;
FX_BOOL m_bCustomLayout;
FX_FLOAT m_fMinThumb;
+
+ protected:
+ IFWL_ScrollBar();
};
class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner);
+ CFWL_ScrollBarImpDelegate(IFWL_ScrollBar* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr) override;
@@ -141,7 +169,7 @@ class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate {
void DoMouseLeave(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
void DoMouseHover(int32_t iItem, const CFX_RectF& rtItem, int32_t& iState);
- CFWL_ScrollBarImp* m_pOwner;
+ IFWL_ScrollBar* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_SCROLLBARIMP_H_
+#endif // XFA_FWL_CORE_IFWL_SCROLLBAR_H_
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp
index 4eddce7439..dbba2f67f4 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp
+++ b/xfa/fwl/core/ifwl_spinbutton.cpp
@@ -4,14 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_spinbuttonimp.h"
+#include "xfa/fwl/core/ifwl_spinbutton.h"
-#include "xfa/fwl/basewidget/ifwl_spinbutton.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_widgetimpproperties.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_spinbutton.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_timer.h"
@@ -28,26 +27,12 @@ const int kElapseTime = 200;
IFWL_SpinButton* IFWL_SpinButton::Create(
const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_SpinButton* pSpinButton = new IFWL_SpinButton;
- CFWL_SpinButtonImp* pSpinButtonImpl =
- new CFWL_SpinButtonImp(properties, nullptr);
- pSpinButton->SetImpl(pSpinButtonImpl);
- pSpinButtonImpl->SetInterface(pSpinButton);
- return pSpinButton;
-}
-IFWL_SpinButton::IFWL_SpinButton() {}
-FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
- return static_cast<CFWL_SpinButtonImp*>(GetImpl())
- ->EnableButton(bEnable, bUp);
-}
-FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) {
- return static_cast<CFWL_SpinButtonImp*>(GetImpl())->IsButtonEnable(bUp);
+ return new IFWL_SpinButton(properties, nullptr);
}
-CFWL_SpinButtonImp::CFWL_SpinButtonImp(
- const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_WidgetImp(properties, pOuter),
+IFWL_SpinButton::IFWL_SpinButton(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Widget(properties, pOuter),
m_dwUpState(CFWL_PartState_Normal),
m_dwDnState(CFWL_PartState_Normal),
m_iButtonIndex(0),
@@ -59,41 +44,42 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp(
m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert;
}
-CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {}
+IFWL_SpinButton::~IFWL_SpinButton() {}
-FWL_Error CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_SpinButton::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_SpinButton;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_SpinButtonImp::GetClassID() const {
+FWL_Type IFWL_SpinButton::GetClassID() const {
return FWL_Type::SpinButton;
}
-FWL_Error CFWL_SpinButtonImp::Initialize() {
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+FWL_Error IFWL_SpinButton::Initialize() {
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_SpinButtonImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_SpinButtonImp::Finalize() {
+FWL_Error IFWL_SpinButton::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect,
- FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_SpinButton::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, kMinWidth, kMinHeight);
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_SpinButtonImp::Update() {
+
+FWL_Error IFWL_SpinButton::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -111,7 +97,8 @@ FWL_Error CFWL_SpinButtonImp::Update() {
}
return FWL_Error::Succeeded;
}
-FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
+
+FWL_WidgetHit IFWL_SpinButton::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
if (m_rtClient.Contains(fx, fy))
return FWL_WidgetHit::Client;
if (HasBorder() && (m_rtClient.Contains(fx, fy)))
@@ -128,8 +115,9 @@ FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::DownButton;
return FWL_WidgetHit::Unknown;
}
-FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+
+FWL_Error IFWL_SpinButton::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics)
return FWL_Error::Indefinite;
CFX_RectF rtClip(m_rtClient);
@@ -148,17 +136,17 @@ FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
}
-void CFWL_SpinButtonImp::Run(IFWL_TimerInfo* pTimerInfo) {
+void IFWL_SpinButton::Run(IFWL_TimerInfo* pTimerInfo) {
if (!m_pTimerInfo)
return;
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pInterface;
+ wmPosChanged.m_pSrcTarget = this;
wmPosChanged.m_bUp = m_iButtonIndex == 0;
DispatchEvent(&wmPosChanged);
}
-FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
+FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
if (bUp) {
if (bEnable) {
m_dwUpState = CFWL_PartState_Normal;
@@ -174,17 +162,19 @@ FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) {
}
return FWL_Error::Succeeded;
}
-FX_BOOL CFWL_SpinButtonImp::IsButtonEnable(FX_BOOL bUp) {
+
+FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) {
if (bUp) {
return (m_dwUpState != CFWL_PartState_Disabled);
}
return (m_dwDnState != CFWL_PartState_Disabled);
}
-void CFWL_SpinButtonImp::DrawUpButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_SpinButton::DrawUpButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::UpButton;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_dwUpState + 1;
@@ -194,11 +184,12 @@ void CFWL_SpinButtonImp::DrawUpButton(CFX_Graphics* pGraphics,
params.m_rtPart = m_rtUpButton;
pTheme->DrawBackground(&params);
}
-void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_SpinButton::DrawDownButton(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground params;
- params.m_pWidget = m_pInterface;
+ params.m_pWidget = this;
params.m_iPart = CFWL_Part::DownButton;
params.m_pGraphics = pGraphics;
params.m_dwStates = m_dwDnState + 1;
@@ -209,8 +200,7 @@ void CFWL_SpinButtonImp::DrawDownButton(CFX_Graphics* pGraphics,
pTheme->DrawBackground(&params);
}
-CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate(
- CFWL_SpinButtonImp* pOwner)
+CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate(IFWL_SpinButton* pOwner)
: m_pOwner(pOwner) {}
void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
@@ -257,9 +247,7 @@ void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
OnKeyDown(pKey);
break;
}
- default: {
- break;
- }
+ default: { break; }
}
CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
}
@@ -280,6 +268,7 @@ void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_bLButtonDwn = TRUE;
m_pOwner->SetGrab(TRUE);
@@ -302,7 +291,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_pOwner->m_dwDnState = CFWL_PartState_Pressed;
}
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmPosChanged.m_pSrcTarget = m_pOwner;
wmPosChanged.m_bUp = bUpPress;
m_pOwner->DispatchEvent(&wmPosChanged);
m_pOwner->Repaint(bUpPress ? &m_pOwner->m_rtUpButton
@@ -338,6 +327,7 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvalidate);
}
}
+
void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
if (!m_pOwner->m_pProperties->m_pDataProvider)
return;
@@ -407,6 +397,7 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
m_pOwner->Repaint(&rtInvlidate);
}
}
+
void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
if (!pMsg)
return;
@@ -420,6 +411,7 @@ void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
+
void CFWL_SpinButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
if (!m_pOwner->m_pProperties->m_pDataProvider)
return;
@@ -436,7 +428,7 @@ void CFWL_SpinButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
return;
}
CFWL_EvtSpbClick wmPosChanged;
- wmPosChanged.m_pSrcTarget = m_pOwner->m_pInterface;
+ wmPosChanged.m_pSrcTarget = m_pOwner;
wmPosChanged.m_bUp = bUpEnable;
m_pOwner->DispatchEvent(&wmPosChanged);
m_pOwner->Repaint(bUpEnable ? &m_pOwner->m_rtUpButton
diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/core/ifwl_spinbutton.h
index 3eca307cdc..717ba9f011 100644
--- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h
+++ b/xfa/fwl/core/ifwl_spinbutton.h
@@ -4,24 +4,33 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_SPINBUTTON_H_
+#define XFA_FWL_CORE_IFWL_SPINBUTTON_H_
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/cfwl_event.h"
#include "xfa/fwl/core/ifwl_timer.h"
#include "xfa/fwl/core/ifwl_widget.h"
+#include "xfa/fxfa/cxfa_eventparam.h"
+
+#define FWL_CLASS_SpinButton L"FWL_SPINBUTTON"
+#define FWL_STYLEEXE_SPB_Vert (1L << 0)
class CFWL_MsgMouse;
class CFWL_SpinButtonImpDelegate;
class CFWL_WidgetImpProperties;
-class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
+FWL_EVENT_DEF(CFWL_EvtSpbClick, CFWL_EventType::Click, FX_BOOL m_bUp;)
+
+class IFWL_SpinButton : public IFWL_Widget, public IFWL_Timer {
public:
- CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_SpinButtonImp() override;
+ static IFWL_SpinButton* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_SpinButton(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+ ~IFWL_SpinButton() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -60,7 +69,7 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer {
class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner);
+ CFWL_SpinButtonImpDelegate(IFWL_SpinButton* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -73,7 +82,7 @@ class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKeyDown(CFWL_MsgKey* pMsg);
- CFWL_SpinButtonImp* m_pOwner;
+ IFWL_SpinButton* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_SPINBUTTONIMP_H_
+#endif // XFA_FWL_CORE_IFWL_SPINBUTTON_H_
diff --git a/xfa/fwl/core/fwl_timerimp.cpp b/xfa/fwl/core/ifwl_timer.cpp
index 941113e7ca..941113e7ca 100644
--- a/xfa/fwl/core/fwl_timerimp.cpp
+++ b/xfa/fwl/core/ifwl_timer.cpp
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/core/ifwl_tooltip.cpp
index cf89483a9d..f0c46555a0 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp
+++ b/xfa/fwl/core/ifwl_tooltip.cpp
@@ -4,46 +4,26 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fwl/basewidget/fwl_tooltipctrlimp.h"
+#include "xfa/fwl/core/ifwl_tooltip.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_tooltip.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_formimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
+#include "xfa/fwl/core/ifwl_tooltip.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
// static
IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties,
IFWL_Widget* pOuter) {
- IFWL_ToolTip* pToolTip = new IFWL_ToolTip;
- CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(properties, pOuter);
- pToolTip->SetImpl(pToolTipImpl);
- pToolTipImpl->SetInterface(pToolTip);
- return pToolTip;
+ return new IFWL_ToolTip(properties, pOuter);
}
-void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
- static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor);
-}
-
-void IFWL_ToolTip::Show() {
- static_cast<CFWL_ToolTipImp*>(GetImpl())->Show();
-}
-
-void IFWL_ToolTip::Hide() {
- static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide();
-}
-
-IFWL_ToolTip::IFWL_ToolTip() {}
-
-CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter)
- : CFWL_FormImp(properties, pOuter),
+IFWL_ToolTip::IFWL_ToolTip(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter)
+ : IFWL_Form(properties, pOuter),
m_bBtnDown(FALSE),
m_dwTTOStyles(FDE_TTOSTYLE_SingleLine),
m_iTTOAlign(FDE_TTOALIGNMENT_Center),
@@ -56,33 +36,34 @@ CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
m_TimerHide.m_pToolTip = this;
}
-CFWL_ToolTipImp::~CFWL_ToolTipImp() {}
+IFWL_ToolTip::~IFWL_ToolTip() {}
-FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const {
+FWL_Error IFWL_ToolTip::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_ToolTip;
return FWL_Error::Succeeded;
}
-FWL_Type CFWL_ToolTipImp::GetClassID() const {
+FWL_Type IFWL_ToolTip::GetClassID() const {
return FWL_Type::ToolTip;
}
-FWL_Error CFWL_ToolTipImp::Initialize() {
+FWL_Error IFWL_ToolTip::Initialize() {
m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
- if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded)
+ if (IFWL_Widget::Initialize() != FWL_Error::Succeeded)
return FWL_Error::Indefinite;
m_pDelegate = new CFWL_ToolTipImpDelegate(this);
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ToolTipImp::Finalize() {
+FWL_Error IFWL_ToolTip::Finalize() {
delete m_pDelegate;
m_pDelegate = nullptr;
- return CFWL_WidgetImp::Finalize();
+ return IFWL_Widget::Finalize();
}
-FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
+
+FWL_Error IFWL_ToolTip::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pThemeProvider) {
@@ -92,7 +73,7 @@ FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
if (pData) {
- pData->GetCaption(m_pInterface, wsCaption);
+ pData->GetCaption(this, wsCaption);
}
int32_t iLen = wsCaption.GetLength();
if (iLen > 0) {
@@ -101,13 +82,14 @@ FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
rect.width += 25;
rect.height += 16;
}
- CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
+ IFWL_Widget::GetWidgetRect(rect, TRUE);
} else {
rect = m_pProperties->m_rtWidget;
}
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ToolTipImp::Update() {
+
+FWL_Error IFWL_ToolTip::Update() {
if (IsLocked()) {
return FWL_Error::Indefinite;
}
@@ -119,14 +101,15 @@ FWL_Error CFWL_ToolTipImp::Update() {
m_rtCaption = m_rtClient;
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
+
+FWL_Error IFWL_ToolTip::GetClientRect(CFX_RectF& rect) {
FX_FLOAT x = 0;
FX_FLOAT y = 0;
FX_FLOAT t = 0;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (pTheme) {
CFWL_ThemePart part;
- part.m_pWidget = m_pInterface;
+ part.m_pWidget = this;
x = *static_cast<FX_FLOAT*>(
pTheme->GetCapacity(&part, CFWL_WidgetCapacity::CXBorder));
y = *static_cast<FX_FLOAT*>(
@@ -138,8 +121,8 @@ FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) {
return FWL_Error::Succeeded;
}
-FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix) {
+FWL_Error IFWL_ToolTip::DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix) {
if (!pGraphics || !m_pProperties->m_pThemeProvider)
return FWL_Error::Indefinite;
@@ -149,11 +132,11 @@ FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics,
return FWL_Error::Succeeded;
}
-void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+void IFWL_ToolTip::DrawBkground(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
CFWL_ThemeBackground param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Background;
param.m_dwStates = m_pProperties->m_dwStates;
param.m_pGraphics = pGraphics;
@@ -166,18 +149,19 @@ void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics,
}
pTheme->DrawBackground(&param);
}
-void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics,
- IFWL_ThemeProvider* pTheme,
- const CFX_Matrix* pMatrix) {
+
+void IFWL_ToolTip::DrawText(CFX_Graphics* pGraphics,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix) {
if (!m_pProperties->m_pDataProvider)
return;
CFX_WideString wsCaption;
- m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
+ m_pProperties->m_pDataProvider->GetCaption(this, wsCaption);
if (wsCaption.IsEmpty()) {
return;
}
CFWL_ThemeText param;
- param.m_pWidget = m_pInterface;
+ param.m_pWidget = this;
param.m_iPart = CFWL_Part::Caption;
param.m_dwStates = m_pProperties->m_dwStates;
param.m_pGraphics = pGraphics;
@@ -190,7 +174,8 @@ void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics,
param.m_iTTOAlign = m_iTTOAlign;
pTheme->DrawText(&param);
}
-void CFWL_ToolTipImp::UpdateTextOutStyles() {
+
+void IFWL_ToolTip::UpdateTextOutStyles() {
m_iTTOAlign = FDE_TTOALIGNMENT_Center;
m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
if (m_pProperties->m_dwStyleExes & FWL_WGTSTYLE_RTLReading) {
@@ -201,19 +186,19 @@ void CFWL_ToolTipImp::UpdateTextOutStyles() {
}
}
-void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) {
+void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
m_rtAnchor = rtAnchor;
}
-void CFWL_ToolTipImp::Show() {
+void IFWL_ToolTip::Show() {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
- int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
+ int32_t nInitDelay = pData->GetInitialDelay(this);
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible))
m_pTimerInfoShow = m_TimerShow.StartTimer(nInitDelay, false);
}
-void CFWL_ToolTipImp::Hide() {
+void IFWL_ToolTip::Hide() {
SetStates(FWL_WGTSTATE_Invisible, TRUE);
if (m_pTimerInfoHide) {
m_pTimerInfoHide->StopTimer();
@@ -225,17 +210,17 @@ void CFWL_ToolTipImp::Hide() {
}
}
-void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) {
+void IFWL_ToolTip::SetStates(uint32_t dwStates, FX_BOOL bSet) {
if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
IFWL_ToolTipDP* pData =
static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
- int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
+ int32_t nAutoPopDelay = pData->GetAutoPopDelay(this);
m_pTimerInfoHide = m_TimerHide.StartTimer(nAutoPopDelay, false);
}
- CFWL_WidgetImp::SetStates(dwStates, bSet);
+ IFWL_Widget::SetStates(dwStates, bSet);
}
-void CFWL_ToolTipImp::RefreshToolTipPos() {
+void IFWL_ToolTip::RefreshToolTipPos() {
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_TTP_NoAnchor) == 0) {
CFX_RectF rtPopup;
CFX_RectF rtWidget(m_pProperties->m_rtWidget);
@@ -263,10 +248,11 @@ void CFWL_ToolTipImp::RefreshToolTipPos() {
Update();
}
}
-CFWL_ToolTipImp::CFWL_ToolTipTimer::CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip)
+
+IFWL_ToolTip::CFWL_ToolTipTimer::CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip)
: m_pToolTip(pToolTip) {}
-void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
+void IFWL_ToolTip::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
if (m_pToolTip->m_pTimerInfoShow == pTimerInfo &&
m_pToolTip->m_pTimerInfoShow) {
if (m_pToolTip->GetStates() & FWL_WGTSTATE_Invisible) {
@@ -285,7 +271,7 @@ void CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(IFWL_TimerInfo* pTimerInfo) {
}
}
-CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner)
+CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner)
: m_pOwner(pOwner) {}
void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/core/ifwl_tooltip.h
index f814eea256..69f0e13596 100644
--- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h
+++ b/xfa/fwl/core/ifwl_tooltip.h
@@ -4,24 +4,44 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_
-#define XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_
+#ifndef XFA_FWL_CORE_IFWL_TOOLTIP_H_
+#define XFA_FWL_CORE_IFWL_TOOLTIP_H_
-#include "xfa/fwl/core/fwl_formimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/ifwl_form.h"
#include "xfa/fwl/core/ifwl_timer.h"
class CFWL_WidgetImpProperties;
class IFWL_Widget;
class CFWL_ToolTipImpDelegate;
-class CFWL_ToolTipImp : public CFWL_FormImp {
+#define FWL_CLASS_ToolTip L"FWL_TOOLTIP"
+#define FWL_STYLEEXT_TTP_Rectangle (0L << 3)
+#define FWL_STYLEEXT_TTP_RoundCorner (1L << 3)
+#define FWL_STYLEEXT_TTP_Balloon (1L << 4)
+#define FWL_STYLEEXT_TTP_Multiline (1L << 5)
+#define FWL_STYLEEXT_TTP_NoAnchor (1L << 6)
+
+class IFWL_ToolTipDP : public IFWL_DataProvider {
public:
- CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties,
- IFWL_Widget* pOuter);
- ~CFWL_ToolTipImp() override;
+ // IFWL_DataProvider
+ FWL_Error GetCaption(IFWL_Widget* pWidget,
+ CFX_WideString& wsCaption) override = 0;
+
+ virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0;
+ virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0;
+ virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0;
+ virtual CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) = 0;
+};
+
+class IFWL_ToolTip : public IFWL_Form {
+ public:
+ static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties,
+ IFWL_Widget* pOuter);
+
+ IFWL_ToolTip(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+ ~IFWL_ToolTip() override;
- // CFWL_WidgetImp
+ // IFWL_Widget
FWL_Error GetClassName(CFX_WideString& wsClass) const override;
FWL_Type GetClassID() const override;
FWL_Error Initialize() override;
@@ -44,12 +64,12 @@ class CFWL_ToolTipImp : public CFWL_FormImp {
class CFWL_ToolTipTimer : public IFWL_Timer {
public:
CFWL_ToolTipTimer() {}
- explicit CFWL_ToolTipTimer(CFWL_ToolTipImp* pToolTip);
+ explicit CFWL_ToolTipTimer(IFWL_ToolTip* pToolTip);
~CFWL_ToolTipTimer() override {}
void Run(IFWL_TimerInfo* pTimerInfo) override;
- CFWL_ToolTipImp* m_pToolTip;
+ IFWL_ToolTip* m_pToolTip;
};
void DrawBkground(CFX_Graphics* pGraphics,
@@ -75,7 +95,7 @@ class CFWL_ToolTipImp : public CFWL_FormImp {
class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate {
public:
- CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner);
+ CFWL_ToolTipImpDelegate(IFWL_ToolTip* pOwner);
void OnProcessMessage(CFWL_Message* pMessage) override;
void OnProcessEvent(CFWL_Event* pEvent) override;
void OnDrawWidget(CFX_Graphics* pGraphics,
@@ -88,7 +108,7 @@ class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate {
void OnMouseMove(CFWL_MsgMouse* pMsg);
void OnMouseLeave(CFWL_MsgMouse* pMsg);
void OnKeyDown(CFWL_MsgKey* pMsg);
- CFWL_ToolTipImp* m_pOwner;
+ IFWL_ToolTip* m_pOwner;
};
-#endif // XFA_FWL_BASEWIDGET_FWL_TOOLTIPCTRLIMP_H_
+#endif // XFA_FWL_CORE_IFWL_TOOLTIP_H_
diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/ifwl_widget.cpp
index 890f0da8af..68755bf24a 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(&param);
}
-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(&param);
}
-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(&param);
}
-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;
}
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 6d7d53c400..9db7a0505a 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -9,22 +9,24 @@
#include <memory>
-#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
-#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
+#include "xfa/fwl/core/cfwl_event.h"
+#include "xfa/fwl/core/cfwl_themepart.h"
+#include "xfa/fwl/core/fwl_widgethit.h"
+#include "xfa/fwl/core/ifwl_widgetdelegate.h"
+#include "xfa/fwl/theme/cfwl_widgettp.h"
-// FWL contains three parallel inheritance hierarchies, which reference each
+// FWL contains two parallel inheritance hierarchies, which reference each
// other via pointers as follows:
//
-// m_pAssociate
-// <----------------------------------
-// CFWL_Widget ----------> IFWL_Widget ----------> CFWL_WidgetImp
-// | m_pIface | m_pImpl |
-// A A A
-// | | |
-// CFWL_... IFWL_... CFWL_...Imp
+// m_pAssociate
+// <----------
+// CFWL_Widget ----------> IFWL_Widget
+// | m_pIface |
+// A A
+// | |
+// CFWL_... IFWL_...
//
// TODO(tsepez): Collapse these into a single hierarchy.
//
@@ -49,73 +51,165 @@ enum class FWL_Type {
ToolTip
};
-class CFWL_WidgetImp;
-class CFX_Graphics;
+class CFWL_AppImp;
+class CFWL_MsgKey;
+class CFWL_Widget;
+class CFWL_WidgetImpProperties;
+class CFWL_WidgetMgr;
class IFWL_App;
class IFWL_DataProvider;
-class IFWL_Form;
class IFWL_ThemeProvider;
-class IFWL_WidgetDelegate;
+class IFWL_Widget;
+enum class FWL_Type;
class IFWL_Widget {
public:
- IFWL_Widget();
virtual ~IFWL_Widget();
- FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
- FWL_Error GetGlobalRect(CFX_RectF& rect);
- FWL_Error SetWidgetRect(const CFX_RectF& rect);
- FWL_Error GetClientRect(CFX_RectF& rect);
- IFWL_Widget* GetParent();
- FWL_Error SetParent(IFWL_Widget* pParent);
- IFWL_Widget* GetOwner();
- FWL_Error SetOwner(IFWL_Widget* pOwner);
- IFWL_Widget* GetOuter();
- uint32_t GetStyles();
- FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved);
- uint32_t GetStylesEx();
- FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded,
- uint32_t dwStylesExRemoved);
- uint32_t GetStates();
- void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ virtual FWL_Error Initialize();
+ virtual FWL_Error Finalize();
+ virtual FWL_Error GetClassName(CFX_WideString& wsClass) const;
+ virtual FWL_Type GetClassID() const = 0;
+ virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
+
+ virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE);
+ virtual FWL_Error GetGlobalRect(CFX_RectF& rect);
+ virtual FWL_Error SetWidgetRect(const CFX_RectF& rect);
+ virtual FWL_Error GetClientRect(CFX_RectF& rect);
+ virtual IFWL_Widget* GetParent();
+ virtual FWL_Error SetParent(IFWL_Widget* pParent);
+ virtual IFWL_Widget* GetOwner();
+ virtual FWL_Error SetOwner(IFWL_Widget* pOwner);
+ virtual IFWL_Widget* GetOuter();
+ virtual uint32_t GetStyles();
+ virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded,
+ uint32_t dwStylesRemoved);
+ virtual uint32_t GetStylesEx();
+ virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded,
+ uint32_t dwStylesExRemoved);
+ virtual uint32_t GetStates();
+ virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE);
+ virtual FWL_Error Update();
+ virtual FWL_Error LockUpdate();
+ virtual FWL_Error UnlockUpdate();
+ virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
+ virtual FWL_Error TransformTo(IFWL_Widget* pWidget,
+ FX_FLOAT& fx,
+ FX_FLOAT& fy);
+ virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
+ virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
+ virtual FWL_Error SetMatrix(const CFX_Matrix& matrix);
+ virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr);
+ virtual IFWL_ThemeProvider* GetThemeProvider();
+ virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
+ virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
+ virtual IFWL_App* GetOwnerApp() const;
+
+ FWL_Error SetOwnerApp(IFWL_App* pOwnerApp);
+ CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent);
+
uint32_t GetEventKey() const;
void SetEventKey(uint32_t key);
+
void* GetLayoutItem() const;
void SetLayoutItem(void* pItem);
- void* GetAssociateWidget() const;
- void SetAssociateWidget(void* pAssociate);
- FWL_Error Update();
- FWL_Error LockUpdate();
- FWL_Error UnlockUpdate();
- FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy);
- FWL_Error TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
- FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt);
- FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE);
- FWL_Error SetMatrix(const CFX_Matrix& matrix);
- FWL_Error DrawWidget(CFX_Graphics* pGraphics,
- const CFX_Matrix* pMatrix = nullptr);
- IFWL_ThemeProvider* GetThemeProvider();
- FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
- IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate);
- 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_Error GetClassName(CFX_WideString& wsClass) const;
- FWL_Type GetClassID() const;
- FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const;
- FWL_Error Initialize();
- FWL_Error Finalize();
- CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); }
+ CFWL_Widget* GetAssociateWidget() const;
+ void SetAssociateWidget(CFWL_Widget* pAssociate);
protected:
- // Takes ownership of |pImpl|.
- void SetImpl(CFWL_WidgetImp* pImpl) { m_pImpl.reset(pImpl); }
+ friend class CFWL_WidgetImpDelegate;
- private:
- std::unique_ptr<CFWL_WidgetImp> m_pImpl;
+ IFWL_Widget(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter);
+
+ FX_BOOL IsEnabled() const;
+ FX_BOOL IsVisible() const;
+ FX_BOOL IsActive() const;
+ FX_BOOL IsOverLapper() const;
+ FX_BOOL IsPopup() const;
+ FX_BOOL IsChild() const;
+ FX_BOOL IsLocked() const;
+ FX_BOOL IsOffscreen() const;
+ FX_BOOL HasBorder() const;
+ FX_BOOL HasEdge() const;
+ void GetEdgeRect(CFX_RectF& rtEdge);
+ FX_FLOAT GetBorderSize(FX_BOOL bCX = TRUE);
+ FX_FLOAT GetEdgeWidth();
+ void GetRelativeRect(CFX_RectF& rect);
+ void* GetThemeCapacity(CFWL_WidgetCapacity dwCapacity);
+ IFWL_ThemeProvider* GetAvailableTheme();
+ IFWL_Widget* GetRootOuter();
+ CFX_SizeF CalcTextSize(const CFX_WideString& wsText,
+ IFWL_ThemeProvider* pTheme,
+ FX_BOOL bMultiLine = FALSE,
+ int32_t iLineWidth = -1);
+ void CalcTextRect(const CFX_WideString& wsText,
+ IFWL_ThemeProvider* pTheme,
+ uint32_t dwTTOStyles,
+ int32_t iTTOAlign,
+ CFX_RectF& rect);
+ void SetFocus(FX_BOOL bFocus);
+ void SetGrab(FX_BOOL bSet);
+ FX_BOOL GetPopupPos(FX_FLOAT fMinHeight,
+ FX_FLOAT fMaxHeight,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ FX_BOOL GetPopupPosMenu(FX_FLOAT fMinHeight,
+ FX_FLOAT fMaxHeight,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ FX_BOOL GetPopupPosComboBox(FX_FLOAT fMinHeight,
+ FX_FLOAT fMaxHeight,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ FX_BOOL GetPopupPosGeneral(FX_FLOAT fMinHeight,
+ FX_FLOAT fMaxHeight,
+ const CFX_RectF& rtAnchor,
+ CFX_RectF& rtPopup);
+ FX_BOOL GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy);
+ void RegisterEventTarget(IFWL_Widget* pEventSource = nullptr,
+ uint32_t dwFilter = FWL_EVENT_ALL_MASK);
+ void UnregisterEventTarget();
+ void DispatchKeyEvent(CFWL_MsgKey* pNote);
+ void DispatchEvent(CFWL_Event* pEvent);
+ void Repaint(const CFX_RectF* pRect = nullptr);
+ void DrawBackground(CFX_Graphics* pGraphics,
+ CFWL_Part iPartBk,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawBorder(CFX_Graphics* pGraphics,
+ CFWL_Part iPartBorder,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void DrawEdge(CFX_Graphics* pGraphics,
+ CFWL_Part iPartEdge,
+ IFWL_ThemeProvider* pTheme,
+ const CFX_Matrix* pMatrix = nullptr);
+ void NotifyDriver();
+
+ FX_BOOL IsParent(IFWL_Widget* pParent);
+
+ CFWL_WidgetMgr* const m_pWidgetMgr;
+ IFWL_App* m_pOwnerApp;
+ std::unique_ptr<CFWL_WidgetImpProperties> m_pProperties;
+ IFWL_WidgetDelegate* m_pDelegate;
+ IFWL_WidgetDelegate* m_pCurDelegate;
+ IFWL_Widget* m_pOuter;
+ void* m_pLayoutItem;
+ CFWL_Widget* m_pAssociate;
+ int32_t m_iLock;
+ uint32_t m_nEventKey;
+};
+
+class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate {
+ public:
+ CFWL_WidgetImpDelegate();
+ ~CFWL_WidgetImpDelegate() override {}
+ void OnProcessMessage(CFWL_Message* pMessage) override;
+ void OnProcessEvent(CFWL_Event* pEvent) override;
+ void OnDrawWidget(CFX_Graphics* pGraphics,
+ const CFX_Matrix* pMatrix = nullptr) override;
};
#endif // XFA_FWL_CORE_IFWL_WIDGET_H_
diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h
index 83a58c10bd..4bb3d608aa 100644
--- a/xfa/fwl/lightwidget/cfwl_barcode.h
+++ b/xfa/fwl/lightwidget/cfwl_barcode.h
@@ -7,8 +7,8 @@
#ifndef XFA_FWL_LIGHTWIDGET_CFWL_BARCODE_H_
#define XFA_FWL_LIGHTWIDGET_CFWL_BARCODE_H_
-#include "xfa/fwl/basewidget/ifwl_barcode.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_barcode.h"
#include "xfa/fwl/lightwidget/cfwl_edit.h"
class CFWL_Widget;
diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h
index ef66280b85..343970c3a4 100644
--- a/xfa/fwl/lightwidget/cfwl_checkbox.h
+++ b/xfa/fwl/lightwidget/cfwl_checkbox.h
@@ -7,7 +7,7 @@
#ifndef XFA_FWL_LIGHTWIDGET_CFWL_CHECKBOX_H_
#define XFA_FWL_LIGHTWIDGET_CFWL_CHECKBOX_H_
-#include "xfa/fwl/basewidget/ifwl_checkbox.h"
+#include "xfa/fwl/core/ifwl_checkbox.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_CheckBox : public CFWL_Widget {
diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp
index 4ec323ae7d..9c4cd05e57 100644
--- a/xfa/fwl/lightwidget/cfwl_combobox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp
@@ -248,12 +248,13 @@ FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetCaption(
return FWL_Error::Succeeded;
}
-int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(IFWL_Widget* pWidget) {
+int32_t CFWL_ComboBox::CFWL_ComboBoxDP::CountItems(const IFWL_Widget* pWidget) {
return m_ItemArray.size();
}
-IFWL_ListItem* CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(IFWL_Widget* pWidget,
- int32_t nIndex) {
+IFWL_ListItem* CFWL_ComboBox::CFWL_ComboBoxDP::GetItem(
+ const IFWL_Widget* pWidget,
+ int32_t nIndex) {
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
return nullptr;
diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h
index bbcec3bb8b..b6dee570cb 100644
--- a/xfa/fwl/lightwidget/cfwl_combobox.h
+++ b/xfa/fwl/lightwidget/cfwl_combobox.h
@@ -10,7 +10,7 @@
#include <memory>
#include <vector>
-#include "xfa/fwl/basewidget/ifwl_combobox.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_WidgetProperties;
@@ -82,8 +82,8 @@ class CFWL_ComboBox : public CFWL_Widget {
CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP
- int32_t CountItems(IFWL_Widget* pWidget) override;
- IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t CountItems(const IFWL_Widget* pWidget) override;
+ IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
IFWL_ListItem* pItem,
diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp
index 828f9cfdf8..fccf8eac63 100644
--- a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp
@@ -8,8 +8,8 @@
#include <memory>
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
#include "xfa/fwl/core/ifwl_widget.h"
IFWL_DateTimePicker* CFWL_DateTimePicker::GetWidget() {
diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h
index e73919cff4..309988446d 100644
--- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h
+++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h
@@ -7,7 +7,7 @@
#ifndef XFA_FWL_LIGHTWIDGET_CFWL_DATETIMEPICKER_H_
#define XFA_FWL_LIGHTWIDGET_CFWL_DATETIMEPICKER_H_
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_DateTimePicker : public CFWL_Widget {
diff --git a/xfa/fwl/lightwidget/cfwl_edit.cpp b/xfa/fwl/lightwidget/cfwl_edit.cpp
index 5637040e4d..191bbd68eb 100644
--- a/xfa/fwl/lightwidget/cfwl_edit.cpp
+++ b/xfa/fwl/lightwidget/cfwl_edit.cpp
@@ -180,7 +180,7 @@ FWL_Error CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
FWL_Error CFWL_Edit::SetBackColor(uint32_t dwColor) {
if (!GetWidget())
return FWL_Error::Indefinite;
- return GetWidget()->SetBackColor(dwColor);
+ return GetWidget()->SetBackgroundColor(dwColor);
}
FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h
index 6c70c437f1..cbca3d9cf4 100644
--- a/xfa/fwl/lightwidget/cfwl_edit.h
+++ b/xfa/fwl/lightwidget/cfwl_edit.h
@@ -9,7 +9,7 @@
#include <vector>
-#include "xfa/fwl/basewidget/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_WidgetProperties;
diff --git a/xfa/fwl/lightwidget/cfwl_listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp
index eb984d670e..a0fff486cd 100644
--- a/xfa/fwl/lightwidget/cfwl_listbox.cpp
+++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp
@@ -217,11 +217,11 @@ FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget,
return FWL_Error::Succeeded;
}
-int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) {
+int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(const IFWL_Widget* pWidget) {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
-IFWL_ListItem* CFWL_ListBox::CFWL_ListBoxDP::GetItem(IFWL_Widget* pWidget,
+IFWL_ListItem* CFWL_ListBox::CFWL_ListBoxDP::GetItem(const IFWL_Widget* pWidget,
int32_t nIndex) {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return nullptr;
diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h
index a3bba8bfea..4a251ca9f2 100644
--- a/xfa/fwl/lightwidget/cfwl_listbox.h
+++ b/xfa/fwl/lightwidget/cfwl_listbox.h
@@ -10,8 +10,8 @@
#include <memory>
#include <vector>
-#include "xfa/fwl/basewidget/ifwl_listbox.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
@@ -60,8 +60,8 @@ class CFWL_ListBox : public CFWL_Widget {
CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP:
- int32_t CountItems(IFWL_Widget* pWidget) override;
- IFWL_ListItem* GetItem(IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t CountItems(const IFWL_Widget* pWidget) override;
+ IFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
int32_t GetItemIndex(IFWL_Widget* pWidget, IFWL_ListItem* pItem) override;
FX_BOOL SetItemIndex(IFWL_Widget* pWidget,
IFWL_ListItem* pItem,
diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h
index c039892b66..149f3c9965 100644
--- a/xfa/fwl/lightwidget/cfwl_picturebox.h
+++ b/xfa/fwl/lightwidget/cfwl_picturebox.h
@@ -7,8 +7,8 @@
#ifndef XFA_FWL_LIGHTWIDGET_CFWL_PICTUREBOX_H_
#define XFA_FWL_LIGHTWIDGET_CFWL_PICTUREBOX_H_
-#include "xfa/fwl/basewidget/ifwl_picturebox.h"
#include "xfa/fwl/core/fwl_error.h"
+#include "xfa/fwl/core/ifwl_picturebox.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_PictureBox : public CFWL_Widget {
diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h
index 13629fa923..0199dbb778 100644
--- a/xfa/fwl/lightwidget/cfwl_pushbutton.h
+++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h
@@ -7,7 +7,7 @@
#ifndef XFA_FWL_LIGHTWIDGET_CFWL_PUSHBUTTON_H_
#define XFA_FWL_LIGHTWIDGET_CFWL_PUSHBUTTON_H_
-#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
+#include "xfa/fwl/core/ifwl_pushbutton.h"
#include "xfa/fwl/lightwidget/cfwl_widget.h"
class CFWL_PushButton : public CFWL_Widget {
diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp
index 3a5478a433..fe2b35c46b 100644
--- a/xfa/fwl/lightwidget/cfwl_widget.cpp
+++ b/xfa/fwl/lightwidget/cfwl_widget.cpp
@@ -11,7 +11,6 @@
#include "xfa/fwl/core/cfwl_widgetmgr.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/fwl_noteimp.h"
-#include "xfa/fwl/core/fwl_widgetimp.h"
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index 609add6c0e..c6cc79e488 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_barcodetp.h"
-#include "xfa/fwl/basewidget/ifwl_barcode.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_barcode.h"
#include "xfa/fwl/core/ifwl_widget.h"
CFWL_BarcodeTP::CFWL_BarcodeTP() {}
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index b517172fff..28d606a2f3 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_carettp.h"
-#include "xfa/fwl/basewidget/ifwl_caret.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_caret.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 2eef204a25..b3dffdccf8 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -8,9 +8,9 @@
#include "core/fxge/cfx_pathdata.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_checkbox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
+#include "xfa/fwl/core/ifwl_checkbox.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 9fdb776820..d322a8e793 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_comboboxtp.h"
-#include "xfa/fwl/basewidget/ifwl_combobox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index d43694c6db..36738d9a59 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_datetimepickertp.h"
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {}
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 97f2fbc95c..ca37f0c7e8 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_edittp.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
#include "xfa/fxfa/xfa_ffwidget.h"
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 1d381a4280..69fc0719f8 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_listboxtp.h"
-#include "xfa/fwl/basewidget/ifwl_listbox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 3cbe007b5f..01d2854c2d 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -7,9 +7,9 @@
#include "xfa/fwl/theme/cfwl_monthcalendartp.h"
#include "xfa/fde/tto/fde_textout.h"
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index 439082b052..2604156e41 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_pictureboxtp.h"
-#include "xfa/fwl/basewidget/ifwl_picturebox.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_picturebox.h"
#include "xfa/fwl/core/ifwl_widget.h"
CFWL_PictureBoxTP::CFWL_PictureBoxTP() {}
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 982a6f4b6d..62b8ffef65 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_pushbuttontp.h"
-#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_pushbutton.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 40d55786fe..e680bdd6db 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -6,8 +6,8 @@
#include "xfa/fwl/theme/cfwl_scrollbartp.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
#include "xfa/fwl/core/ifwl_widget.h"
#include "xfa/fxgraphics/cfx_color.h"
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 00c83489b2..cc9cc28a06 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -6,9 +6,9 @@
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/ifwl_app.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include "xfa/fwl/lightwidget/cfwl_combobox.h"
#include "xfa/fwl/lightwidget/cfwl_listbox.h"
#include "xfa/fxfa/app/xfa_fffield.h"
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 04fbb8afe3..a12a978dbe 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -6,9 +6,9 @@
#include "xfa/fxfa/app/xfa_fffield.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include "xfa/fwl/lightwidget/cfwl_edit.h"
#include "xfa/fwl/lightwidget/cfwl_picturebox.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index bd5b22ff77..ae594ea71f 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -8,9 +8,9 @@
#include <vector>
-#include "xfa/fwl/basewidget/ifwl_edit.h"
#include "xfa/fwl/core/cfwl_message.h"
#include "xfa/fwl/core/fwl_noteimp.h"
+#include "xfa/fwl/core/ifwl_edit.h"
#include "xfa/fwl/lightwidget/cfwl_datetimepicker.h"
#include "xfa/fwl/lightwidget/cfwl_edit.h"
#include "xfa/fxfa/app/xfa_fffield.h"
diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp
index 6826950042..45dca4d572 100644
--- a/xfa/fxfa/app/xfa_fwltheme.cpp
+++ b/xfa/fxfa/app/xfa_fwltheme.cpp
@@ -9,19 +9,19 @@
#include "xfa/fde/tto/fde_textout.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/fgas_gefont.h"
-#include "xfa/fwl/basewidget/ifwl_barcode.h"
-#include "xfa/fwl/basewidget/ifwl_caret.h"
-#include "xfa/fwl/basewidget/ifwl_checkbox.h"
-#include "xfa/fwl/basewidget/ifwl_combobox.h"
-#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
-#include "xfa/fwl/basewidget/ifwl_edit.h"
-#include "xfa/fwl/basewidget/ifwl_listbox.h"
-#include "xfa/fwl/basewidget/ifwl_monthcalendar.h"
-#include "xfa/fwl/basewidget/ifwl_picturebox.h"
-#include "xfa/fwl/basewidget/ifwl_pushbutton.h"
-#include "xfa/fwl/basewidget/ifwl_scrollbar.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
#include "xfa/fwl/core/cfwl_themetext.h"
+#include "xfa/fwl/core/ifwl_barcode.h"
+#include "xfa/fwl/core/ifwl_caret.h"
+#include "xfa/fwl/core/ifwl_checkbox.h"
+#include "xfa/fwl/core/ifwl_combobox.h"
+#include "xfa/fwl/core/ifwl_datetimepicker.h"
+#include "xfa/fwl/core/ifwl_edit.h"
+#include "xfa/fwl/core/ifwl_listbox.h"
+#include "xfa/fwl/core/ifwl_monthcalendar.h"
+#include "xfa/fwl/core/ifwl_picturebox.h"
+#include "xfa/fwl/core/ifwl_pushbutton.h"
+#include "xfa/fwl/core/ifwl_scrollbar.h"
#include "xfa/fxfa/xfa_ffapp.h"
#include "xfa/fxfa/xfa_ffwidget.h"
#include "xfa/fxgraphics/cfx_color.h"