summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp12
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit_ctrl.h1
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp20
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.h5
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp19
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.h2
7 files changed, 17 insertions, 44 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
index f18aaaa130..2c005a4335 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
@@ -74,6 +74,10 @@ void CPWL_EditCtrl::SetScrollPosition(float pos) {
pChild->SetScrollPosition(pos);
}
+void CPWL_EditCtrl::ScrollWindowVertically(float pos) {
+ m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, pos));
+}
+
void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd,
uint32_t msg,
intptr_t wParam,
@@ -81,14 +85,6 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd,
CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
switch (msg) {
- case PNM_SCROLLWINDOW: {
- float fPos = *(float*)lParam;
- switch (wParam) {
- case SBT_VSCROLL:
- m_pEdit->SetScrollPos(CFX_PointF(m_pEdit->GetScrollPos().x, fPos));
- break;
- }
- } break;
case PNM_SETCARETINFO: {
if (PWL_CARET_INFO* pCaretInfo = (PWL_CARET_INFO*)wParam) {
SetCaret(pCaretInfo->bVisible, pCaretInfo->ptHead, pCaretInfo->ptFoot);
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
index d8cbc5ee83..f72a7b2043 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
@@ -58,6 +58,7 @@ class CPWL_EditCtrl : public CPWL_Wnd {
intptr_t lParam = 0) override;
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 RePosChildWnd() override;
void SetFontSize(float fFontSize) override;
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
index be6d00f62b..b6ea701c26 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -294,24 +294,8 @@ void CPWL_ListBox::SetScrollPosition(float pos) {
pChild->SetScrollPosition(pos);
}
-void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
- uint32_t msg,
- intptr_t wParam,
- intptr_t lParam) {
- CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
-
- float fPos;
-
- switch (msg) {
- case PNM_SCROLLWINDOW:
- fPos = *(float*)lParam;
- switch (wParam) {
- case SBT_VSCROLL:
- m_pList->SetScrollPos(CFX_PointF(0, fPos));
- break;
- }
- break;
- }
+void CPWL_ListBox::ScrollWindowVertically(float pos) {
+ m_pList->SetScrollPos(CFX_PointF(0, pos));
}
void CPWL_ListBox::KillFocus() {
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.h b/fpdfsdk/pdfwindow/cpwl_list_box.h
index 9acfd9ddc7..f1bfea7779 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.h
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.h
@@ -65,12 +65,9 @@ class CPWL_ListBox : public CPWL_Wnd {
const CFX_PointF& point,
uint32_t nFlag) override;
void KillFocus() override;
- void OnNotify(CPWL_Wnd* pWnd,
- uint32_t msg,
- intptr_t wParam = 0,
- intptr_t lParam = 0) override;
void SetScrollInfo(const PWL_SCROLL_INFO& info) override;
void SetScrollPosition(float pos) override;
+ void ScrollWindowVertically(float pos) override;
void RePosChildWnd() override;
CFX_FloatRect GetFocusRect() const override;
void SetFontSize(float fFontSize) override;
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
index 9b65cf1695..94ac2e6178 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -1051,19 +1051,12 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) {
}
void CPWL_ScrollBar::NotifyScrollWindow() {
- if (CPWL_Wnd* pParent = GetParentWindow()) {
- float fPos;
- switch (m_sbType) {
- case SBT_HSCROLL:
- fPos = m_OriginInfo.fContentMin + m_sData.fScrollPos;
- break;
- case SBT_VSCROLL:
- fPos = m_OriginInfo.fContentMax - m_sData.fScrollPos;
- break;
- }
- pParent->OnNotify(this, PNM_SCROLLWINDOW, (intptr_t)m_sbType,
- (intptr_t)&fPos);
- }
+ CPWL_Wnd* pParent = GetParentWindow();
+ if (!pParent || m_sbType != SBT_VSCROLL)
+ return;
+
+ pParent->ScrollWindowVertically(m_OriginInfo.fContentMax -
+ m_sData.fScrollPos);
}
CFX_FloatRect CPWL_ScrollBar::GetScrollArea() const {
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index f407dfc1e9..51c30a5f8c 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -431,6 +431,8 @@ void CPWL_Wnd::SetScrollInfo(const PWL_SCROLL_INFO& info) {}
void CPWL_Wnd::SetScrollPosition(float pos) {}
+void CPWL_Wnd::ScrollWindowVertically(float pos) {}
+
bool CPWL_Wnd::IsValid() const {
return m_bCreated;
}
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index c9c4130725..ab4cf7ae77 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -74,7 +74,6 @@ struct PWL_SCROLL_INFO;
#define PRES_TEXTOVERFLOW 0x0400L
// notification messages
-#define PNM_SCROLLWINDOW 4
#define PNM_LBUTTONDOWN 5
#define PNM_LBUTTONUP 6
#define PNM_MOUSEMOVE 7
@@ -221,6 +220,7 @@ class CPWL_Wnd : public CPWL_TimerHandler {
intptr_t lParam = 0);
virtual void SetScrollInfo(const PWL_SCROLL_INFO& info);
virtual void SetScrollPosition(float pos);
+ virtual void ScrollWindowVertically(float pos);
virtual void SetFocus();
virtual void KillFocus();
virtual void SetCursor();