summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp18
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit_ctrl.h1
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp19
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.h1
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp23
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.h1
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.h3
8 files changed, 31 insertions, 37 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
index d8a157a189..e6076e15ae 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp
@@ -64,6 +64,11 @@ void CPWL_EditCtrl::RePosChildWnd() {
m_pEdit->SetPlateRect(GetClientRect());
}
+void CPWL_EditCtrl::SetScrollInfo(const PWL_SCROLL_INFO& info) {
+ if (CPWL_Wnd* pChild = GetVScrollBar())
+ pChild->SetScrollInfo(info);
+}
+
void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd,
uint32_t msg,
intptr_t wParam,
@@ -71,15 +76,6 @@ void CPWL_EditCtrl::OnNotify(CPWL_Wnd* pWnd,
CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
switch (msg) {
- case PNM_SETSCROLLINFO:
- switch (wParam) {
- case SBT_VSCROLL:
- if (CPWL_Wnd* pChild = GetVScrollBar()) {
- pChild->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam);
- }
- break;
- }
- break;
case PNM_SETSCROLLPOS:
switch (wParam) {
case SBT_VSCROLL:
@@ -441,14 +437,12 @@ void CPWL_EditCtrl::IOnSetScrollInfoY(float fPlateMin,
float fSmallStep,
float fBigStep) {
PWL_SCROLL_INFO Info;
-
Info.fPlateWidth = fPlateMax - fPlateMin;
Info.fContentMin = fContentMin;
Info.fContentMax = fContentMax;
Info.fSmallStep = fSmallStep;
Info.fBigStep = fBigStep;
-
- OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&Info);
+ SetScrollInfo(Info);
if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
index 1c4c92507a..822f527bcd 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
+++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h
@@ -56,6 +56,7 @@ class CPWL_EditCtrl : public CPWL_Wnd {
uint32_t msg,
intptr_t wParam = 0,
intptr_t lParam = 0) override;
+ void SetScrollInfo(const PWL_SCROLL_INFO& info) 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 f612c2945b..25842b3d63 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -31,15 +31,12 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
float fSmallStep,
float fBigStep) {
PWL_SCROLL_INFO Info;
-
Info.fPlateWidth = fPlateMax - fPlateMin;
Info.fContentMin = fContentMin;
Info.fContentMax = fContentMax;
Info.fSmallStep = fSmallStep;
Info.fBigStep = fBigStep;
-
- m_pList->OnNotify(m_pList.Get(), PNM_SETSCROLLINFO, SBT_VSCROLL,
- reinterpret_cast<intptr_t>(&Info));
+ m_pList->SetScrollInfo(Info);
if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
@@ -288,6 +285,11 @@ bool CPWL_ListBox::OnMouseMove(const CFX_PointF& point, uint32_t nFlag) {
return true;
}
+void CPWL_ListBox::SetScrollInfo(const PWL_SCROLL_INFO& info) {
+ if (CPWL_Wnd* pChild = GetVScrollBar())
+ pChild->SetScrollInfo(info);
+}
+
void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
uint32_t msg,
intptr_t wParam,
@@ -297,15 +299,6 @@ void CPWL_ListBox::OnNotify(CPWL_Wnd* pWnd,
float fPos;
switch (msg) {
- case PNM_SETSCROLLINFO:
- switch (wParam) {
- case SBT_VSCROLL:
- if (CPWL_Wnd* pChild = GetVScrollBar()) {
- pChild->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam);
- }
- break;
- }
- break;
case PNM_SETSCROLLPOS:
switch (wParam) {
case SBT_VSCROLL:
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.h b/fpdfsdk/pdfwindow/cpwl_list_box.h
index 3eeed0d641..6a2118e667 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.h
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.h
@@ -69,6 +69,7 @@ class CPWL_ListBox : public CPWL_Wnd {
uint32_t msg,
intptr_t wParam = 0,
intptr_t lParam = 0) override;
+ void SetScrollInfo(const PWL_SCROLL_INFO& info) 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 33bdedbf2f..45814cff2f 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -6,6 +6,7 @@
#include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h"
+#include <algorithm>
#include <sstream>
#include "core/fxge/cfx_pathdata.h"
@@ -750,6 +751,17 @@ bool CPWL_ScrollBar::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
return true;
}
+void CPWL_ScrollBar::SetScrollInfo(const PWL_SCROLL_INFO& info) {
+ if (info == m_OriginInfo)
+ return;
+
+ m_OriginInfo = info;
+ float fMax =
+ std::max(0.0f, info.fContentMax - info.fContentMin - info.fPlateWidth);
+ SetScrollRange(0, fMax, info.fPlateWidth);
+ SetScrollStep(info.fBigStep, info.fSmallStep);
+}
+
void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
uint32_t msg,
intptr_t wParam,
@@ -796,17 +808,6 @@ void CPWL_ScrollBar::OnNotify(CPWL_Wnd* pWnd,
OnPosButtonMouseMove(*(CFX_PointF*)lParam);
}
break;
- case PNM_SETSCROLLINFO: {
- PWL_SCROLL_INFO* pInfo = reinterpret_cast<PWL_SCROLL_INFO*>(lParam);
- if (pInfo && *pInfo != m_OriginInfo) {
- m_OriginInfo = *pInfo;
- float fMax =
- pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth;
- fMax = fMax > 0.0f ? fMax : 0.0f;
- SetScrollRange(0, fMax, pInfo->fPlateWidth);
- SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep);
- }
- } break;
case PNM_SETSCROLLPOS: {
float fPos = *(float*)lParam;
switch (m_sbType) {
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.h b/fpdfsdk/pdfwindow/cpwl_scroll_bar.h
index c67109fe39..a875d6ec80 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.h
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.h
@@ -135,6 +135,7 @@ class CPWL_ScrollBar : public CPWL_Wnd {
uint32_t msg,
intptr_t wParam = 0,
intptr_t lParam = 0) override;
+ void SetScrollInfo(const PWL_SCROLL_INFO& info) override;
void CreateChildWnd(const PWL_CREATEPARAM& cp) override;
void TimerProc() override;
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index e99d71b1de..8ac7d48cba 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -427,6 +427,8 @@ void CPWL_Wnd::OnNotify(CPWL_Wnd* pWnd,
intptr_t wParam,
intptr_t lParam) {}
+void CPWL_Wnd::SetScrollInfo(const PWL_SCROLL_INFO& info) {}
+
bool CPWL_Wnd::IsValid() const {
return m_bCreated;
}
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index 39ed4028a9..9ffae162f3 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -25,6 +25,7 @@ class CPWL_Wnd;
class CFX_SystemHandler;
class IPVT_FontMap;
class IPWL_Provider;
+struct PWL_SCROLL_INFO;
// window styles
#define PWS_CHILD 0x80000000L
@@ -73,7 +74,6 @@ class IPWL_Provider;
#define PRES_TEXTOVERFLOW 0x0400L
// notification messages
-#define PNM_SETSCROLLINFO 2
#define PNM_SETSCROLLPOS 3
#define PNM_SCROLLWINDOW 4
#define PNM_LBUTTONDOWN 5
@@ -220,6 +220,7 @@ class CPWL_Wnd : public CPWL_TimerHandler {
uint32_t msg,
intptr_t wParam = 0,
intptr_t lParam = 0);
+ virtual void SetScrollInfo(const PWL_SCROLL_INFO& info);
virtual void SetFocus();
virtual void KillFocus();
virtual void SetCursor();