summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-10-29 17:29:06 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-29 17:29:06 +0000
commitea08d171755bd4088d01261c55d1bfe0ff0f9f39 (patch)
treeedd21e3bbde0b1bd13b067ce7682111f32f0d8e4
parentb7c4a0243e82f6c4ff91cd90b5bae336100c3c70 (diff)
downloadpdfium-ea08d171755bd4088d01261c55d1bfe0ff0f9f39.tar.xz
Fold virtual CPWL_Wnd::OnCreate into subclass constructors.
All they do is twiddle their own CreateParameters. Since we now have the create paramters earlier, we need not have a special method for this. Change-Id: I5b94c578275c71516afb87bd085f5fb58b3962e2 Reviewed-on: https://pdfium-review.googlesource.com/c/44730 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
-rw-r--r--fpdfsdk/pwl/cpwl_button.cpp8
-rw-r--r--fpdfsdk/pwl/cpwl_button.h1
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.cpp10
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.h1
-rw-r--r--fpdfsdk/pwl/cpwl_edit_ctrl.cpp9
-rw-r--r--fpdfsdk/pwl/cpwl_edit_ctrl.h1
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.cpp2
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.cpp16
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.h2
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.cpp9
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h3
11 files changed, 21 insertions, 41 deletions
diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp
index 9f746cf1c8..cf0f348a8b 100644
--- a/fpdfsdk/pwl/cpwl_button.cpp
+++ b/fpdfsdk/pwl/cpwl_button.cpp
@@ -12,14 +12,12 @@
CPWL_Button::CPWL_Button(const CreateParams& cp,
std::unique_ptr<PrivateData> pAttachedData)
- : CPWL_Wnd(cp, std::move(pAttachedData)) {}
+ : CPWL_Wnd(cp, std::move(pAttachedData)) {
+ GetCreationParams()->eCursorType = FXCT_HAND;
+}
CPWL_Button::~CPWL_Button() = default;
-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;
diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h
index 5835b7a0db..6d4aec6b8a 100644
--- a/fpdfsdk/pwl/cpwl_button.h
+++ b/fpdfsdk/pwl/cpwl_button.h
@@ -18,7 +18,6 @@ class CPWL_Button : public CPWL_Wnd {
~CPWL_Button() override;
// CPWL_Wnd
- 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 eef4496118..eefe017a5a 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -160,15 +160,13 @@ bool CPWL_CBButton::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
CPWL_ComboBox::CPWL_ComboBox(const CreateParams& cp,
std::unique_ptr<PrivateData> pAttachedData)
- : CPWL_Wnd(cp, std::move(pAttachedData)) {}
+ : CPWL_Wnd(cp, std::move(pAttachedData)) {
+ GetCreationParams()->dwFlags &= ~PWS_HSCROLL;
+ GetCreationParams()->dwFlags &= ~PWS_VSCROLL;
+}
CPWL_ComboBox::~CPWL_ComboBox() = default;
-void CPWL_ComboBox::OnCreate(CreateParams* pParamsToAdjust) {
- pParamsToAdjust->dwFlags &= ~PWS_HSCROLL;
- pParamsToAdjust->dwFlags &= ~PWS_VSCROLL;
-}
-
void CPWL_ComboBox::OnDestroy() {
// Until cleanup takes place in the virtual destructor for CPWL_Wnd
// subclasses, implement the virtual OnDestroy method that does the
diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h
index ee6ed90910..c059b5ca2a 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.h
+++ b/fpdfsdk/pwl/cpwl_combo_box.h
@@ -51,7 +51,6 @@ class CPWL_ComboBox final : public CPWL_Wnd {
CPWL_Edit* GetEdit() const { return m_pEdit.Get(); }
// CPWL_Wnd:
- 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;
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
index 1b398a66c6..af74213a4b 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
@@ -21,16 +21,15 @@
CPWL_EditCtrl::CPWL_EditCtrl(const CreateParams& cp,
std::unique_ptr<PrivateData> pAttachedData)
: CPWL_Wnd(cp, std::move(pAttachedData)),
- m_pEdit(pdfium::MakeUnique<CPWL_EditImpl>()) {}
+ m_pEdit(pdfium::MakeUnique<CPWL_EditImpl>()) {
+ GetCreationParams()->eCursorType = FXCT_VBEAM;
+}
CPWL_EditCtrl::~CPWL_EditCtrl() = default;
-void CPWL_EditCtrl::OnCreate(CreateParams* pParamsToAdjust) {
- pParamsToAdjust->eCursorType = FXCT_VBEAM;
-}
void CPWL_EditCtrl::OnCreated() {
- SetFontSize(GetCreationParams().fFontSize);
+ SetFontSize(GetCreationParams()->fFontSize);
m_pEdit->SetFontMap(GetFontMap());
m_pEdit->SetNotify(this);
m_pEdit->Initialize();
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h
index cb89943f88..aeeb7f6557 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h
@@ -46,7 +46,6 @@ class CPWL_EditCtrl : public CPWL_Wnd {
void SetReadyToInput();
// 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;
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 003fe11956..827742b3e3 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -79,7 +79,7 @@ void CPWL_ListBox::OnCreated() {
SetHoverSel(HasFlag(PLBS_HOVERSEL));
m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));
- m_pList->SetFontSize(GetCreationParams().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 0209ba09c2..d3c8e847ed 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -111,14 +111,12 @@ CPWL_SBButton::CPWL_SBButton(const CreateParams& cp,
PWL_SBBUTTON_TYPE eButtonType)
: CPWL_Wnd(cp, std::move(pAttachedData)),
m_eScrollBarType(eScrollBarType),
- m_eSBButtonType(eButtonType) {}
+ m_eSBButtonType(eButtonType) {
+ GetCreationParams()->eCursorType = FXCT_ARROW;
+}
CPWL_SBButton::~CPWL_SBButton() = default;
-void CPWL_SBButton::OnCreate(CreateParams* pParamsToAdjust) {
- pParamsToAdjust->eCursorType = FXCT_ARROW;
-}
-
void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device) {
if (!IsVisible())
@@ -302,14 +300,12 @@ bool CPWL_SBButton::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) {
CPWL_ScrollBar::CPWL_ScrollBar(const CreateParams& cp,
std::unique_ptr<PrivateData> pAttachedData,
PWL_SCROLLBAR_TYPE sbType)
- : CPWL_Wnd(cp, std::move(pAttachedData)), m_sbType(sbType) {}
+ : CPWL_Wnd(cp, std::move(pAttachedData)), m_sbType(sbType) {
+ GetCreationParams()->eCursorType = FXCT_ARROW;
+}
CPWL_ScrollBar::~CPWL_ScrollBar() = default;
-void CPWL_ScrollBar::OnCreate(CreateParams* pParamsToAdjust) {
- pParamsToAdjust->eCursorType = FXCT_ARROW;
-}
-
void CPWL_ScrollBar::OnDestroy() {
// Until cleanup takes place in the virtual destructor for CPWL_Wnd
// subclasses, implement the virtual OnDestroy method that does the
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h
index 82c995b607..414f718c33 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.h
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.h
@@ -50,7 +50,6 @@ class CPWL_SBButton final : public CPWL_Wnd {
~CPWL_SBButton() override;
// CPWL_Wnd
- 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;
@@ -121,7 +120,6 @@ class CPWL_ScrollBar final : public CPWL_Wnd {
~CPWL_ScrollBar() override;
// CPWL_Wnd:
- void OnCreate(CreateParams* pParamsToAdjust) override;
void OnDestroy() override;
bool RePosChildWnd() override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 90aa15cfee..66b069dbb4 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -122,7 +122,6 @@ CPWL_Wnd::~CPWL_Wnd() {
void CPWL_Wnd::Realize() {
ASSERT(!m_bCreated);
- OnCreate(&m_CreationParams);
m_CreationParams.rcRectWnd.Normalize();
m_rcWindow = m_CreationParams.rcRectWnd;
m_rcClip = m_rcWindow;
@@ -144,8 +143,6 @@ void CPWL_Wnd::Realize() {
m_bCreated = true;
}
-void CPWL_Wnd::OnCreate(CreateParams* pParamsToAdjust) {}
-
void CPWL_Wnd::OnCreated() {}
void CPWL_Wnd::OnDestroy() {}
@@ -604,10 +601,8 @@ void CPWL_Wnd::CreateChildWnd(const CreateParams& cp) {}
void CPWL_Wnd::SetCursor() {
if (IsValid()) {
- if (CFX_SystemHandler* pSH = GetSystemHandler()) {
- int32_t nCursorType = GetCreationParams().eCursorType;
- pSH->SetCursor(nCursorType);
- }
+ if (CFX_SystemHandler* pSH = GetSystemHandler())
+ pSH->SetCursor(GetCreationParams()->eCursorType);
}
}
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 64fe1310e2..339c336caa 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -260,13 +260,12 @@ class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> {
virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
const CFX_Matrix& mtUser2Device);
- virtual void OnCreate(CreateParams* pParamsToAdjust);
virtual void OnCreated();
virtual void OnDestroy();
bool IsNotifying() const { return m_bNotifying; }
bool IsValid() const { return m_bCreated; }
- const CreateParams& GetCreationParams() const { return m_CreationParams; }
+ CreateParams* GetCreationParams() { return &m_CreationParams; }
// Returns |true| iff this instance is still allocated.
bool InvalidateRectMove(const CFX_FloatRect& rcOld,