From bf15730b2c9577d4efd2124d84c6c8ccc5f66b43 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 15 Sep 2017 13:26:32 -0700 Subject: Move CPWL_CREATPARAM to CPWL_Wnd::CreateParams This nesting makes so much more sense when I read the code. Fix member naming for this in CPWL_Wnd. Pass in/out CreateParams arg as pointer. Kill Reset() method, only called during destroy and nothing needs explicit cleanup. Change-Id: If50e403e11c131e7656da09c0cb36866223d64c6 Reviewed-on: https://pdfium-review.googlesource.com/14070 Reviewed-by: Lei Zhang Commit-Queue: Tom Sepez --- fpdfsdk/formfiller/cffl_checkbox.cpp | 4 +- fpdfsdk/formfiller/cffl_checkbox.h | 4 +- fpdfsdk/formfiller/cffl_combobox.cpp | 8 +-- fpdfsdk/formfiller/cffl_combobox.h | 4 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 6 +- fpdfsdk/formfiller/cffl_formfiller.h | 4 +- fpdfsdk/formfiller/cffl_listbox.cpp | 8 +-- fpdfsdk/formfiller/cffl_listbox.h | 4 +- fpdfsdk/formfiller/cffl_pushbutton.cpp | 5 +- fpdfsdk/formfiller/cffl_pushbutton.h | 4 +- fpdfsdk/formfiller/cffl_radiobutton.cpp | 6 +- fpdfsdk/formfiller/cffl_radiobutton.h | 4 +- fpdfsdk/formfiller/cffl_textfield.cpp | 8 +-- fpdfsdk/formfiller/cffl_textfield.h | 4 +- fpdfsdk/pwl/cpwl_appstream.cpp | 2 +- fpdfsdk/pwl/cpwl_button.cpp | 8 +-- fpdfsdk/pwl/cpwl_button.h | 2 +- fpdfsdk/pwl/cpwl_combo_box.cpp | 20 +++--- fpdfsdk/pwl/cpwl_combo_box.h | 10 +-- fpdfsdk/pwl/cpwl_edit_ctrl.cpp | 12 ++-- fpdfsdk/pwl/cpwl_edit_ctrl.h | 8 +-- fpdfsdk/pwl/cpwl_list_box.cpp | 2 +- fpdfsdk/pwl/cpwl_scroll_bar.cpp | 14 ++-- fpdfsdk/pwl/cpwl_scroll_bar.h | 10 +-- fpdfsdk/pwl/cpwl_wnd.cpp | 116 ++++++++++++++------------------ fpdfsdk/pwl/cpwl_wnd.h | 94 ++++++++++---------------- 26 files changed, 163 insertions(+), 208 deletions(-) diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp index 9691f6dc6f..2863a56001 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.cpp +++ b/fpdfsdk/formfiller/cffl_checkbox.cpp @@ -18,8 +18,8 @@ CFFL_CheckBox::CFFL_CheckBox(CPDFSDK_FormFillEnvironment* pApp, CFFL_CheckBox::~CFFL_CheckBox() {} -CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_CheckBox* pWnd = new CPWL_CheckBox(); +CPWL_Wnd* CFFL_CheckBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_CheckBox(); pWnd->Create(cp); pWnd->SetCheck(m_pWidget->IsChecked()); return pWnd; diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h index f84fb3eb37..8ef3de6bca 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.h +++ b/fpdfsdk/formfiller/cffl_checkbox.h @@ -16,8 +16,8 @@ class CFFL_CheckBox : public CFFL_Button { CFFL_CheckBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_CheckBox() override; - // CFFL_Button - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + // CFFL_Button: + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags) override; diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index 98f98b3ee2..aeb31f5b88 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -32,8 +32,8 @@ CFFL_ComboBox::~CFFL_ComboBox() { DestroyWindows(); } -PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() { - PWL_CREATEPARAM cp = CFFL_TextObject::GetCreateParam(); +CPWL_Wnd::CreateParams CFFL_ComboBox::GetCreateParam() { + CPWL_Wnd::CreateParams cp = CFFL_TextObject::GetCreateParam(); if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) cp.dwFlags |= PCBS_ALLOWCUSTOMTEXT; @@ -42,8 +42,8 @@ PWL_CREATEPARAM CFFL_ComboBox::GetCreateParam() { return cp; } -CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_ComboBox* pWnd = new CPWL_ComboBox(); +CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_ComboBox(); pWnd->AttachFFLData(this); pWnd->Create(cp); diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index 0f510bef20..7d5a38ef56 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -25,8 +25,8 @@ class CFFL_ComboBox : public CFFL_TextObject, public IPWL_FocusHandler { ~CFFL_ComboBox() override; // CFFL_TextObject: - PWL_CREATEPARAM GetCreateParam() override; - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + CPWL_Wnd::CreateParams GetCreateParam() override; + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index e2a8c4e931..f405e3578d 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -299,8 +299,8 @@ bool CFFL_FormFiller::IsValid() const { return m_bValid; } -PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { - PWL_CREATEPARAM cp; +CPWL_Wnd::CreateParams CFFL_FormFiller::GetCreateParam() { + CPWL_Wnd::CreateParams cp; cp.pParentWnd = nullptr; cp.pProvider.Reset(this); cp.rcRectWnd = GetPDFWindowRect(); @@ -356,7 +356,7 @@ CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, return pWnd; if (!found) { - PWL_CREATEPARAM cp = GetCreateParam(); + CPWL_Wnd::CreateParams cp = GetCreateParam(); cp.pAttachedWidget.Reset(m_pWidget.Get()); CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index b5bf1c8197..b9af3897e4 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -130,8 +130,8 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { void DestroyPDFWindow(CPDFSDK_PageView* pPageView); void EscapeFiller(CPDFSDK_PageView* pPageView, bool bDestroyPDFWindow); - virtual PWL_CREATEPARAM GetCreateParam(); - virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) = 0; + virtual CPWL_Wnd::CreateParams GetCreateParam(); + virtual CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) = 0; virtual CFX_FloatRect GetFocusBox(CPDFSDK_PageView* pPageView); bool IsValid() const; diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index a5851b0643..9dad11d3a0 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -22,8 +22,8 @@ CFFL_ListBox::CFFL_ListBox(CPDFSDK_FormFillEnvironment* pApp, CFFL_ListBox::~CFFL_ListBox() {} -PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { - PWL_CREATEPARAM cp = CFFL_TextObject::GetCreateParam(); +CPWL_Wnd::CreateParams CFFL_ListBox::GetCreateParam() { + CPWL_Wnd::CreateParams cp = CFFL_TextObject::GetCreateParam(); uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_MULTISELECT) cp.dwFlags |= PLBS_MULTIPLESEL; @@ -37,8 +37,8 @@ PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { return cp; } -CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_ListBox* pWnd = new CPWL_ListBox(); +CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_ListBox(); pWnd->AttachFFLData(this); pWnd->Create(cp); pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller()); diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h index fc06e144a7..014865d567 100644 --- a/fpdfsdk/formfiller/cffl_listbox.h +++ b/fpdfsdk/formfiller/cffl_listbox.h @@ -20,8 +20,8 @@ class CFFL_ListBox : public CFFL_TextObject { ~CFFL_ListBox() override; // CFFL_TextObject: - PWL_CREATEPARAM GetCreateParam() override; - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + CPWL_Wnd::CreateParams GetCreateParam() override; + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; diff --git a/fpdfsdk/formfiller/cffl_pushbutton.cpp b/fpdfsdk/formfiller/cffl_pushbutton.cpp index f09a8f7d8d..7310da6761 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.cpp +++ b/fpdfsdk/formfiller/cffl_pushbutton.cpp @@ -15,9 +15,8 @@ CFFL_PushButton::CFFL_PushButton(CPDFSDK_FormFillEnvironment* pApp, CFFL_PushButton::~CFFL_PushButton() {} -CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_PushButton* pWnd = new CPWL_PushButton(); +CPWL_Wnd* CFFL_PushButton::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_PushButton(); pWnd->Create(cp); - return pWnd; } diff --git a/fpdfsdk/formfiller/cffl_pushbutton.h b/fpdfsdk/formfiller/cffl_pushbutton.h index 81c0d628a0..7ee076764e 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.h +++ b/fpdfsdk/formfiller/cffl_pushbutton.h @@ -14,8 +14,8 @@ class CFFL_PushButton : public CFFL_Button { CFFL_PushButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_PushButton() override; - // CFFL_Button - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + // CFFL_Button: + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; }; #endif // FPDFSDK_FORMFILLER_CFFL_PUSHBUTTON_H_ diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp index 6c8d5a3883..f8ada67ff3 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.cpp +++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp @@ -18,12 +18,10 @@ CFFL_RadioButton::CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp, CFFL_RadioButton::~CFFL_RadioButton() {} -CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_RadioButton* pWnd = new CPWL_RadioButton(); +CPWL_Wnd* CFFL_RadioButton::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_RadioButton(); pWnd->Create(cp); - pWnd->SetCheck(m_pWidget->IsChecked()); - return pWnd; } diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h index 981e2df62e..2838254708 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.h +++ b/fpdfsdk/formfiller/cffl_radiobutton.h @@ -16,8 +16,8 @@ class CFFL_RadioButton : public CFFL_Button { CFFL_RadioButton(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); ~CFFL_RadioButton() override; - // CFFL_Button - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + // CFFL_Button: + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags) override; diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index f6f768a049..8bf0825245 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -26,8 +26,8 @@ CFFL_TextField::~CFFL_TextField() { DestroyWindows(); } -PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { - PWL_CREATEPARAM cp = CFFL_TextObject::GetCreateParam(); +CPWL_Wnd::CreateParams CFFL_TextField::GetCreateParam() { + CPWL_Wnd::CreateParams cp = CFFL_TextObject::GetCreateParam(); int nFlags = m_pWidget->GetFieldFlags(); if (nFlags & FIELDFLAG_PASSWORD) cp.dwFlags |= PES_PASSWORD; @@ -67,8 +67,8 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { return cp; } -CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp) { - CPWL_Edit* pWnd = new CPWL_Edit(); +CPWL_Wnd* CFFL_TextField::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { + auto* pWnd = new CPWL_Edit(); pWnd->AttachFFLData(this); pWnd->Create(cp); pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller()); diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index 429799840f..6893516142 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -30,8 +30,8 @@ class CFFL_TextField : public CFFL_TextObject, public IPWL_FocusHandler { ~CFFL_TextField() override; // CFFL_TextObject: - PWL_CREATEPARAM GetCreateParam() override; - CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp) override; + CPWL_Wnd::CreateParams GetCreateParam() override; + CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; bool IsDataChanged(CPDFSDK_PageView* pPageView) override; void SaveData(CPDFSDK_PageView* pPageView) override; diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index 405a205507..c7188ada07 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -691,7 +691,7 @@ CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit, return CFX_ByteString(); CPWL_Icon icon; - PWL_CREATEPARAM cp; + CPWL_Wnd::CreateParams cp; cp.dwFlags = PWS_VISIBLE; icon.Create(cp); icon.SetIconFit(&fit); diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp index 525148a767..fc0479be2c 100644 --- a/fpdfsdk/pwl/cpwl_button.cpp +++ b/fpdfsdk/pwl/cpwl_button.cpp @@ -15,24 +15,20 @@ CFX_ByteString CPWL_Button::GetClassName() const { return "CPWL_Button"; } -void CPWL_Button::OnCreate(PWL_CREATEPARAM& cp) { - cp.eCursorType = FXCT_HAND; +void CPWL_Button::OnCreate(CreateParams* pParamsToAdjust) { + pParamsToAdjust->eCursorType = FXCT_HAND; } bool CPWL_Button::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); - m_bMouseDown = true; SetCapture(); - return true; } bool CPWL_Button::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonUp(point, nFlag); - ReleaseCapture(); m_bMouseDown = false; - return true; } diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h index 44cc1e2cfd..f26ae1c1f3 100644 --- a/fpdfsdk/pwl/cpwl_button.h +++ b/fpdfsdk/pwl/cpwl_button.h @@ -16,7 +16,7 @@ class CPWL_Button : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; - void OnCreate(PWL_CREATEPARAM& cp) override; + void OnCreate(CreateParams* pParamsToAdjust) override; bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 8c5e99ff09..03651949b2 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -151,9 +151,9 @@ CFX_ByteString CPWL_ComboBox::GetClassName() const { return "CPWL_ComboBox"; } -void CPWL_ComboBox::OnCreate(PWL_CREATEPARAM& cp) { - cp.dwFlags &= ~PWS_HSCROLL; - cp.dwFlags &= ~PWS_VSCROLL; +void CPWL_ComboBox::OnCreate(CreateParams* pParamsToAdjust) { + pParamsToAdjust->dwFlags &= ~PWS_HSCROLL; + pParamsToAdjust->dwFlags &= ~PWS_VSCROLL; } void CPWL_ComboBox::OnDestroy() { @@ -237,20 +237,20 @@ void CPWL_ComboBox::ClearSelection() { m_pEdit->ClearSelection(); } -void CPWL_ComboBox::CreateChildWnd(const PWL_CREATEPARAM& cp) { +void CPWL_ComboBox::CreateChildWnd(const CreateParams& cp) { CreateEdit(cp); CreateButton(cp); CreateListBox(cp); } -void CPWL_ComboBox::CreateEdit(const PWL_CREATEPARAM& cp) { +void CPWL_ComboBox::CreateEdit(const CreateParams& cp) { if (m_pEdit) return; m_pEdit = new CPWL_Edit(); m_pEdit->AttachFFLData(m_pFormFiller.Get()); - PWL_CREATEPARAM ecp = cp; + CreateParams ecp = cp; ecp.pParentWnd = this; ecp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PES_CENTER | PES_AUTOSCROLL | PES_UNDO; @@ -267,13 +267,13 @@ void CPWL_ComboBox::CreateEdit(const PWL_CREATEPARAM& cp) { m_pEdit->Create(ecp); } -void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) { +void CPWL_ComboBox::CreateButton(const CreateParams& cp) { if (m_pButton) return; m_pButton = new CPWL_CBButton; - PWL_CREATEPARAM bcp = cp; + CreateParams bcp = cp; bcp.pParentWnd = this; bcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND; bcp.sBackgroundColor = CFX_Color(COLORTYPE_RGB, 220.0f / 255.0f, @@ -285,14 +285,14 @@ void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) { m_pButton->Create(bcp); } -void CPWL_ComboBox::CreateListBox(const PWL_CREATEPARAM& cp) { +void CPWL_ComboBox::CreateListBox(const CreateParams& cp) { if (m_pList) return; m_pList = new CPWL_CBListBox(); m_pList->AttachFFLData(m_pFormFiller.Get()); - PWL_CREATEPARAM lcp = cp; + CreateParams lcp = cp; lcp.pParentWnd = this; lcp.dwFlags = PWS_CHILD | PWS_BORDER | PWS_BACKGROUND | PLBS_HOVERSEL | PWS_VSCROLL; diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index 7059faccbc..b431191452 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h @@ -51,13 +51,13 @@ class CPWL_ComboBox : public CPWL_Wnd { // CPWL_Wnd: CFX_ByteString GetClassName() const override; - void OnCreate(PWL_CREATEPARAM& cp) override; + void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; void NotifyLButtonDown(CPWL_Wnd* child, const CFX_PointF& pos) override; void NotifyLButtonUp(CPWL_Wnd* child, const CFX_PointF& pos) override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void CreateChildWnd(const CreateParams& cp) override; void RePosChildWnd() override; CFX_FloatRect GetFocusRect() const override; void SetFocus() override; @@ -84,9 +84,9 @@ class CPWL_ComboBox : public CPWL_Wnd { void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } private: - void CreateEdit(const PWL_CREATEPARAM& cp); - void CreateButton(const PWL_CREATEPARAM& cp); - void CreateListBox(const PWL_CREATEPARAM& cp); + void CreateEdit(const CreateParams& cp); + void CreateButton(const CreateParams& cp); + void CreateListBox(const CreateParams& cp); void SetPopup(bool bPopup); CFX_UnownedPtr m_pEdit; diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp index 3a79e0a1a8..7baaaa8ca5 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp @@ -24,12 +24,12 @@ CPWL_EditCtrl::CPWL_EditCtrl() CPWL_EditCtrl::~CPWL_EditCtrl() {} -void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM& cp) { - cp.eCursorType = FXCT_VBEAM; +void CPWL_EditCtrl::OnCreate(CreateParams* pParamsToAdjust) { + pParamsToAdjust->eCursorType = FXCT_VBEAM; } void CPWL_EditCtrl::OnCreated() { - SetFontSize(GetCreationParam().fFontSize); + SetFontSize(GetCreationParams().fFontSize); m_pEdit->SetFontMap(GetFontMap()); m_pEdit->SetNotify(this); @@ -85,19 +85,19 @@ void CPWL_EditCtrl::ScrollWindowVertically(float pos) { m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, pos)); } -void CPWL_EditCtrl::CreateChildWnd(const PWL_CREATEPARAM& cp) { +void CPWL_EditCtrl::CreateChildWnd(const CreateParams& cp) { if (!IsReadOnly()) CreateEditCaret(cp); } -void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM& cp) { +void CPWL_EditCtrl::CreateEditCaret(const CreateParams& cp) { if (m_pEditCaret) return; m_pEditCaret = new CPWL_Caret; m_pEditCaret->SetInvalidRect(GetClientRect()); - PWL_CREATEPARAM ecp = cp; + CreateParams ecp = cp; ecp.pParentWnd = this; ecp.dwFlags = PWS_CHILD | PWS_NOREFRESHCLIP; ecp.dwBorderWidth = 0; diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h index 03dc4be1e1..eb4470f734 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.h +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h @@ -44,8 +44,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { void SetReadyToInput(); - // CPWL_Wnd - void OnCreate(PWL_CREATEPARAM& cp) override; + // CPWL_Wnd: + void OnCreate(CreateParams* pParamsToAdjust) override; void OnCreated() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -55,7 +55,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { void SetScrollInfo(const PWL_SCROLL_INFO& info) override; void SetScrollPosition(float pos) override; void ScrollWindowVertically(float pos) override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void CreateChildWnd(const CreateParams& cp) override; void RePosChildWnd() override; void SetFontSize(float fFontSize) override; float GetFontSize() const override; @@ -88,7 +88,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { bool m_bMouseDown; private: - void CreateEditCaret(const PWL_CREATEPARAM& cp); + void CreateEditCaret(const CreateParams& cp); int32_t m_nCharSet; }; diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index a9c553ee5b..4090e792e4 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp @@ -83,7 +83,7 @@ void CPWL_ListBox::OnCreated() { SetHoverSel(HasFlag(PLBS_HOVERSEL)); m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL)); - m_pList->SetFontSize(GetCreationParam().fFontSize); + m_pList->SetFontSize(GetCreationParams().fFontSize); m_bHoverSel = HasFlag(PLBS_HOVERSEL); } diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp index ea38b0f591..15247293a0 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp @@ -131,8 +131,8 @@ CFX_ByteString CPWL_SBButton::GetClassName() const { return "CPWL_SBButton"; } -void CPWL_SBButton::OnCreate(PWL_CREATEPARAM& cp) { - cp.eCursorType = FXCT_ARROW; +void CPWL_SBButton::OnCreate(CreateParams* pParamsToAdjust) { + pParamsToAdjust->eCursorType = FXCT_ARROW; } void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -329,8 +329,8 @@ CFX_ByteString CPWL_ScrollBar::GetClassName() const { return "CPWL_ScrollBar"; } -void CPWL_ScrollBar::OnCreate(PWL_CREATEPARAM& cp) { - cp.eCursorType = FXCT_ARROW; +void CPWL_ScrollBar::OnCreate(CreateParams* pParamsToAdjust) { + pParamsToAdjust->eCursorType = FXCT_ARROW; } void CPWL_ScrollBar::OnDestroy() { @@ -539,8 +539,8 @@ void CPWL_ScrollBar::NotifyMouseMove(CPWL_Wnd* child, const CFX_PointF& pos) { OnPosButtonMouseMove(pos); } -void CPWL_ScrollBar::CreateButtons(const PWL_CREATEPARAM& cp) { - PWL_CREATEPARAM scp = cp; +void CPWL_ScrollBar::CreateButtons(const CreateParams& cp) { + CreateParams scp = cp; scp.pParentWnd = this; scp.dwBorderWidth = 2; scp.nBorderStyle = BorderStyle::BEVELED; @@ -863,7 +863,7 @@ float CPWL_ScrollBar::FaceToTrue(float fFace) { return fTrue; } -void CPWL_ScrollBar::CreateChildWnd(const PWL_CREATEPARAM& cp) { +void CPWL_ScrollBar::CreateChildWnd(const CreateParams& cp) { CreateButtons(cp); } diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h index e35a6a0fc2..44c72cbbe2 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.h +++ b/fpdfsdk/pwl/cpwl_scroll_bar.h @@ -50,7 +50,7 @@ class CPWL_SBButton : public CPWL_Wnd { // CPWL_Wnd CFX_ByteString GetClassName() const override; - void OnCreate(PWL_CREATEPARAM& cp) override; + void OnCreate(CreateParams* pParamsToAdjust) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; @@ -120,9 +120,9 @@ class CPWL_ScrollBar : public CPWL_Wnd { explicit CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType = SBT_HSCROLL); ~CPWL_ScrollBar() override; - // CPWL_Wnd + // CPWL_Wnd: CFX_ByteString GetClassName() const override; - void OnCreate(PWL_CREATEPARAM& cp) override; + void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; void RePosChildWnd() override; void DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -134,7 +134,7 @@ class CPWL_ScrollBar : public CPWL_Wnd { void NotifyLButtonDown(CPWL_Wnd* child, const CFX_PointF& pos) override; void NotifyLButtonUp(CPWL_Wnd* child, const CFX_PointF& pos) override; void NotifyMouseMove(CPWL_Wnd* child, const CFX_PointF& pos) override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; + void CreateChildWnd(const CreateParams& cp) override; void TimerProc() override; float GetScrollBarWidth() const; @@ -151,7 +151,7 @@ class CPWL_ScrollBar : public CPWL_Wnd { CFX_FloatRect GetScrollArea() const; private: - void CreateButtons(const PWL_CREATEPARAM& cp); + void CreateButtons(const CreateParams& cp); void OnMinButtonLBDown(const CFX_PointF& point); void OnMinButtonLBUp(const CFX_PointF& point); diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index e26df4d199..e259d1f9ef 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -21,7 +21,7 @@ constexpr float kDefaultFontSize = 9.0f; } // namespace -PWL_CREATEPARAM::PWL_CREATEPARAM() +CPWL_Wnd::CreateParams::CreateParams() : rcRectWnd(0, 0, 0, 0), pSystemHandler(nullptr), pFontMap(nullptr), @@ -42,7 +42,7 @@ PWL_CREATEPARAM::PWL_CREATEPARAM() pMsgControl(nullptr), eCursorType(FXCT_ARROW) {} -PWL_CREATEPARAM::PWL_CREATEPARAM(const PWL_CREATEPARAM& other) = default; +CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default; class CPWL_MsgControl : public CFX_Observable { friend class CPWL_Wnd; @@ -148,52 +148,47 @@ CFX_ByteString CPWL_Wnd::GetClassName() const { return "CPWL_Wnd"; } -void CPWL_Wnd::Create(const PWL_CREATEPARAM& cp) { +void CPWL_Wnd::Create(const CreateParams& cp) { if (IsValid()) return; - m_sPrivateParam = cp; - OnCreate(m_sPrivateParam); - - m_sPrivateParam.rcRectWnd.Normalize(); - m_rcWindow = m_sPrivateParam.rcRectWnd; + m_CreationParams = cp; + OnCreate(&m_CreationParams); + m_CreationParams.rcRectWnd.Normalize(); + m_rcWindow = m_CreationParams.rcRectWnd; m_rcClip = m_rcWindow; if (!m_rcClip.IsEmpty()) { m_rcClip.Inflate(1.0f, 1.0f); m_rcClip.Normalize(); } CreateMsgControl(); + if (m_CreationParams.pParentWnd) + m_CreationParams.pParentWnd->AddChild(this); - if (m_sPrivateParam.pParentWnd) - m_sPrivateParam.pParentWnd->AddChild(this); - - PWL_CREATEPARAM ccp = m_sPrivateParam; - + CreateParams ccp = m_CreationParams; ccp.dwFlags &= 0xFFFF0000L; // remove sub styles CreateScrollBar(ccp); CreateChildWnd(ccp); - m_bVisible = HasFlag(PWS_VISIBLE); OnCreated(); - RePosChildWnd(); m_bCreated = true; } -void CPWL_Wnd::OnCreate(PWL_CREATEPARAM& cp) {} +void CPWL_Wnd::OnCreate(CreateParams* pParamsToAdjust) {} void CPWL_Wnd::OnCreated() {} void CPWL_Wnd::OnDestroy() {} void CPWL_Wnd::InvalidateFocusHandler(IPWL_FocusHandler* handler) { - if (m_sPrivateParam.pFocusHandler == handler) - m_sPrivateParam.pFocusHandler = nullptr; + if (m_CreationParams.pFocusHandler == handler) + m_CreationParams.pFocusHandler = nullptr; } void CPWL_Wnd::InvalidateProvider(IPWL_Provider* provider) { - if (m_sPrivateParam.pProvider.Get() == provider) - m_sPrivateParam.pProvider.Reset(); + if (m_CreationParams.pProvider.Get() == provider) + m_CreationParams.pProvider.Reset(); } void CPWL_Wnd::Destroy() { @@ -208,13 +203,12 @@ void CPWL_Wnd::Destroy() { delete pChild; } } - if (m_sPrivateParam.pParentWnd) - m_sPrivateParam.pParentWnd->RemoveChild(this); + if (m_CreationParams.pParentWnd) + m_CreationParams.pParentWnd->RemoveChild(this); m_bCreated = false; } DestroyMsgControl(); - m_sPrivateParam.Reset(); m_Children.clear(); } @@ -235,7 +229,7 @@ void CPWL_Wnd::Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh) { if (bRefresh) InvalidateRectMove(rcOld, rcNew); - m_sPrivateParam.rcRectWnd = m_rcWindow; + m_CreationParams.rcRectWnd = m_rcWindow; } void CPWL_Wnd::InvalidateRectMove(const CFX_FloatRect& rcOld, @@ -310,7 +304,7 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) { if (CFX_SystemHandler* pSH = GetSystemHandler()) { if (CPDFSDK_Widget* widget = static_cast( - m_sPrivateParam.pAttachedWidget.Get())) { + m_CreationParams.pAttachedWidget.Get())) { pSH->InvalidateRect(widget, rcWin); } } @@ -413,16 +407,8 @@ void CPWL_Wnd::NotifyLButtonUp(CPWL_Wnd* child, const CFX_PointF& pos) {} void CPWL_Wnd::NotifyMouseMove(CPWL_Wnd* child, const CFX_PointF& pos) {} -bool CPWL_Wnd::IsValid() const { - return m_bCreated; -} - -const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const { - return m_sPrivateParam; -} - CPWL_Wnd* CPWL_Wnd::GetParentWindow() const { - return m_sPrivateParam.pParentWnd; + return m_CreationParams.pParentWnd; } CFX_FloatRect CPWL_Wnd::GetWindowRect() const { @@ -448,40 +434,40 @@ CFX_PointF CPWL_Wnd::GetCenterPoint() const { } bool CPWL_Wnd::HasFlag(uint32_t dwFlags) const { - return (m_sPrivateParam.dwFlags & dwFlags) != 0; + return (m_CreationParams.dwFlags & dwFlags) != 0; } void CPWL_Wnd::RemoveFlag(uint32_t dwFlags) { - m_sPrivateParam.dwFlags &= ~dwFlags; + m_CreationParams.dwFlags &= ~dwFlags; } void CPWL_Wnd::AddFlag(uint32_t dwFlags) { - m_sPrivateParam.dwFlags |= dwFlags; + m_CreationParams.dwFlags |= dwFlags; } CFX_Color CPWL_Wnd::GetBackgroundColor() const { - return m_sPrivateParam.sBackgroundColor; + return m_CreationParams.sBackgroundColor; } void CPWL_Wnd::SetBackgroundColor(const CFX_Color& color) { - m_sPrivateParam.sBackgroundColor = color; + m_CreationParams.sBackgroundColor = color; } CFX_Color CPWL_Wnd::GetTextColor() const { - return m_sPrivateParam.sTextColor; + return m_CreationParams.sTextColor; } BorderStyle CPWL_Wnd::GetBorderStyle() const { - return m_sPrivateParam.nBorderStyle; + return m_CreationParams.nBorderStyle; } void CPWL_Wnd::SetBorderStyle(BorderStyle nBorderStyle) { if (HasFlag(PWS_BORDER)) - m_sPrivateParam.nBorderStyle = nBorderStyle; + m_CreationParams.nBorderStyle = nBorderStyle; } int32_t CPWL_Wnd::GetBorderWidth() const { - return HasFlag(PWS_BORDER) ? m_sPrivateParam.dwBorderWidth : 0; + return HasFlag(PWS_BORDER) ? m_CreationParams.dwBorderWidth : 0; } int32_t CPWL_Wnd::GetInnerBorderWidth() const { @@ -489,30 +475,30 @@ int32_t CPWL_Wnd::GetInnerBorderWidth() const { } CFX_Color CPWL_Wnd::GetBorderColor() const { - return HasFlag(PWS_BORDER) ? m_sPrivateParam.sBorderColor : CFX_Color(); + return HasFlag(PWS_BORDER) ? m_CreationParams.sBorderColor : CFX_Color(); } const CPWL_Dash& CPWL_Wnd::GetBorderDash() const { - return m_sPrivateParam.sDash; + return m_CreationParams.sDash; } void* CPWL_Wnd::GetAttachedData() const { - return m_sPrivateParam.pAttachedData; + return m_CreationParams.pAttachedData; } CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const { return HasFlag(PWS_VSCROLL) ? m_pVScrollBar.Get() : nullptr; } -void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM& cp) { +void CPWL_Wnd::CreateScrollBar(const CreateParams& cp) { CreateVScrollBar(cp); } -void CPWL_Wnd::CreateVScrollBar(const PWL_CREATEPARAM& cp) { +void CPWL_Wnd::CreateVScrollBar(const CreateParams& cp) { if (m_pVScrollBar || !HasFlag(PWS_VSCROLL)) return; - PWL_CREATEPARAM scp = cp; + CreateParams scp = cp; // flags scp.dwFlags = @@ -569,7 +555,7 @@ bool CPWL_Wnd::ClientHitTest(const CFX_PointF& point) const { } const CPWL_Wnd* CPWL_Wnd::GetRootWnd() const { - auto* pParent = m_sPrivateParam.pParentWnd; + auto* pParent = m_CreationParams.pParentWnd; return pParent ? pParent->GetRootWnd() : this; } @@ -618,20 +604,20 @@ void CPWL_Wnd::RePosChildWnd() { pVSB->Move(rcVScroll, true, false); } -void CPWL_Wnd::CreateChildWnd(const PWL_CREATEPARAM& cp) {} +void CPWL_Wnd::CreateChildWnd(const CreateParams& cp) {} void CPWL_Wnd::SetCursor() { if (IsValid()) { if (CFX_SystemHandler* pSH = GetSystemHandler()) { - int32_t nCursorType = GetCreationParam().eCursorType; + int32_t nCursorType = GetCreationParams().eCursorType; pSH->SetCursor(nCursorType); } } } void CPWL_Wnd::CreateMsgControl() { - if (!m_sPrivateParam.pMsgControl) - m_sPrivateParam.pMsgControl = new CPWL_MsgControl(this); + if (!m_CreationParams.pMsgControl) + m_CreationParams.pMsgControl = new CPWL_MsgControl(this); } void CPWL_Wnd::DestroyMsgControl() { @@ -641,7 +627,7 @@ void CPWL_Wnd::DestroyMsgControl() { } CPWL_MsgControl* CPWL_Wnd::GetMsgControl() const { - return m_sPrivateParam.pMsgControl; + return m_CreationParams.pMsgControl; } bool CPWL_Wnd::IsCaptureMouse() const { @@ -673,27 +659,27 @@ CFX_FloatRect CPWL_Wnd::GetFocusRect() const { } float CPWL_Wnd::GetFontSize() const { - return m_sPrivateParam.fFontSize; + return m_CreationParams.fFontSize; } void CPWL_Wnd::SetFontSize(float fFontSize) { - m_sPrivateParam.fFontSize = fFontSize; + m_CreationParams.fFontSize = fFontSize; } CFX_SystemHandler* CPWL_Wnd::GetSystemHandler() const { - return m_sPrivateParam.pSystemHandler; + return m_CreationParams.pSystemHandler; } IPWL_FocusHandler* CPWL_Wnd::GetFocusHandler() const { - return m_sPrivateParam.pFocusHandler; + return m_CreationParams.pFocusHandler; } IPWL_Provider* CPWL_Wnd::GetProvider() const { - return m_sPrivateParam.pProvider.Get(); + return m_CreationParams.pProvider.Get(); } IPVT_FontMap* CPWL_Wnd::GetFontMap() const { - return m_sPrivateParam.pFontMap; + return m_CreationParams.pFontMap; } CFX_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const { @@ -719,7 +705,7 @@ CFX_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const { } int32_t CPWL_Wnd::GetTransparency() { - return m_sPrivateParam.nTransparency; + return m_CreationParams.nTransparency; } void CPWL_Wnd::SetTransparency(int32_t nTransparency) { @@ -727,7 +713,7 @@ void CPWL_Wnd::SetTransparency(int32_t nTransparency) { if (pChild) pChild->SetTransparency(nTransparency); } - m_sPrivateParam.nTransparency = nTransparency; + m_CreationParams.nTransparency = nTransparency; } CFX_Matrix CPWL_Wnd::GetWindowMatrix() const { @@ -778,11 +764,11 @@ CFX_Matrix CPWL_Wnd::GetChildToRoot() const { } CFX_Matrix CPWL_Wnd::GetChildMatrix() const { - return HasFlag(PWS_CHILD) ? m_sPrivateParam.mtChild : CFX_Matrix(); + return HasFlag(PWS_CHILD) ? m_CreationParams.mtChild : CFX_Matrix(); } void CPWL_Wnd::SetChildMatrix(const CFX_Matrix& mt) { - m_sPrivateParam.mtChild = mt; + m_CreationParams.mtChild = mt; } const CPWL_Wnd* CPWL_Wnd::GetFocused() const { diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index cd1c06005f..4074e9369f 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -118,58 +118,35 @@ class IPWL_FocusHandler { virtual void OnSetFocus(CPWL_Edit* pEdit) = 0; }; -struct PWL_CREATEPARAM { - public: - PWL_CREATEPARAM(); - PWL_CREATEPARAM(const PWL_CREATEPARAM& other); - - void Reset() { - rcRectWnd.Reset(); - pSystemHandler = nullptr; - pFontMap = nullptr; - pProvider.Reset(); - pFocusHandler = nullptr; - dwFlags = 0; - sBackgroundColor.Reset(); - pAttachedWidget.Reset(); - nBorderStyle = BorderStyle::SOLID; - dwBorderWidth = 0; - sBorderColor.Reset(); - sTextColor.Reset(); - nTransparency = 0; - fFontSize = 0.0f; - sDash.Reset(); - pAttachedData = nullptr; - pParentWnd = nullptr; - pMsgControl = nullptr; - eCursorType = 0; - mtChild.SetIdentity(); - } - - CFX_FloatRect rcRectWnd; // required - CFX_SystemHandler* pSystemHandler; // required - IPVT_FontMap* pFontMap; // required - IPWL_Provider::ObservedPtr pProvider; // required - IPWL_FocusHandler* pFocusHandler; // optional - uint32_t dwFlags; // optional - CFX_Color sBackgroundColor; // optional - CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required - BorderStyle nBorderStyle; // optional - int32_t dwBorderWidth; // optional - CFX_Color sBorderColor; // optional - CFX_Color sTextColor; // optional - int32_t nTransparency; // optional - float fFontSize; // optional - CPWL_Dash sDash; // optional - void* pAttachedData; // optional - CPWL_Wnd* pParentWnd; // ignore - CPWL_MsgControl* pMsgControl; // ignore - int32_t eCursorType; // ignore - CFX_Matrix mtChild; // ignore -}; - class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { public: + struct CreateParams { + public: + CreateParams(); + CreateParams(const CreateParams& other); + + CFX_FloatRect rcRectWnd; // required + CFX_SystemHandler* pSystemHandler; // required + IPVT_FontMap* pFontMap; // required + IPWL_Provider::ObservedPtr pProvider; // required + IPWL_FocusHandler* pFocusHandler; // optional + uint32_t dwFlags; // optional + CFX_Color sBackgroundColor; // optional + CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required + BorderStyle nBorderStyle; // optional + int32_t dwBorderWidth; // optional + CFX_Color sBorderColor; // optional + CFX_Color sTextColor; // optional + int32_t nTransparency; // optional + float fFontSize; // optional + CPWL_Dash sDash; // optional + void* pAttachedData; // optional + CPWL_Wnd* pParentWnd; // ignore + CPWL_MsgControl* pMsgControl; // ignore + int32_t eCursorType; // ignore + CFX_Matrix mtChild; // ignore + }; + CPWL_Wnd(); ~CPWL_Wnd() override; @@ -207,7 +184,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { void InvalidateFocusHandler(IPWL_FocusHandler* handler); void InvalidateProvider(IPWL_Provider* provider); - void Create(const PWL_CREATEPARAM& cp); + void Create(const CreateParams& cp); void Destroy(); void Move(const CFX_FloatRect& rcNew, bool bReset, bool bRefresh); @@ -274,13 +251,13 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { // CPWL_TimerHandler CFX_SystemHandler* GetSystemHandler() const override; - virtual void CreateChildWnd(const PWL_CREATEPARAM& cp); + virtual void CreateChildWnd(const CreateParams& cp); virtual void RePosChildWnd(); virtual void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device); - virtual void OnCreate(PWL_CREATEPARAM& cp); + virtual void OnCreate(CreateParams* pParamsToAdjust); virtual void OnCreated(); virtual void OnDestroy(); @@ -288,10 +265,9 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { virtual void OnKillFocus(); void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; } - - bool IsValid() const; - const PWL_CREATEPARAM& GetCreationParam() const; bool IsNotifying() const { return m_bNotifying; } + bool IsValid() const { return m_bCreated; } + const CreateParams& GetCreationParams() const { return m_CreationParams; } void InvalidateRectMove(const CFX_FloatRect& rcOld, const CFX_FloatRect& rcNew); @@ -322,8 +298,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { void AddChild(CPWL_Wnd* pWnd); void RemoveChild(CPWL_Wnd* pWnd); - void CreateScrollBar(const PWL_CREATEPARAM& cp); - void CreateVScrollBar(const PWL_CREATEPARAM& cp); + void CreateScrollBar(const CreateParams& cp); + void CreateVScrollBar(const CreateParams& cp); void AdjustStyle(); void CreateMsgControl(); @@ -331,8 +307,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { CPWL_MsgControl* GetMsgControl() const; + CreateParams m_CreationParams; std::vector m_Children; - PWL_CREATEPARAM m_sPrivateParam; CFX_UnownedPtr m_pVScrollBar; CFX_FloatRect m_rcWindow; CFX_FloatRect m_rcClip; -- cgit v1.2.3