summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_combo_box.cpp44
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp3
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp160
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp17
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.h22
5 files changed, 116 insertions, 130 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
index 11a674b41b..ace59a8e13 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
@@ -19,7 +19,12 @@
#include "fpdfsdk/pdfwindow/cpwl_wnd.h"
#include "public/fpdf_fwlevent.h"
-#define PWLCB_DEFAULTFONTSIZE 12.0f
+namespace {
+
+constexpr float kDefaultFontSize = 12.0f;
+constexpr float kTriangleHalfLength = 3.0f;
+
+} // namespace
bool CPWL_CBListBox::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
CPWL_Wnd::OnLButtonUp(point, nFlag);
@@ -107,16 +112,14 @@ void CPWL_CBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) {
CFX_PointF ptCenter = GetCenterPoint();
- CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt3(ptCenter.x, ptCenter.y - kTriangleHalfLength * 0.5f);
- if (IsFloatBigger(rectWnd.right - rectWnd.left,
- PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
- IsFloatBigger(rectWnd.top - rectWnd.bottom,
- PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
+ if (IsFloatBigger(rectWnd.right - rectWnd.left, kTriangleHalfLength * 2) &&
+ IsFloatBigger(rectWnd.top - rectWnd.bottom, kTriangleHalfLength)) {
*psAppStream << "q\n"
<< "0 g\n"
<< pt1.x << " " << pt1.y << " m\n"
@@ -138,16 +141,14 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_PointF ptCenter = GetCenterPoint();
- CFX_PointF pt1(ptCenter.x - PWL_CBBUTTON_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt2(ptCenter.x + PWL_CBBUTTON_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_CBBUTTON_TRIANGLE_HALFLEN * 0.5f);
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt3(ptCenter.x, ptCenter.y - kTriangleHalfLength * 0.5f);
- if (IsFloatBigger(rectWnd.right - rectWnd.left,
- PWL_CBBUTTON_TRIANGLE_HALFLEN * 2) &&
- IsFloatBigger(rectWnd.top - rectWnd.bottom,
- PWL_CBBUTTON_TRIANGLE_HALFLEN)) {
+ if (IsFloatBigger(rectWnd.right - rectWnd.left, kTriangleHalfLength * 2) &&
+ IsFloatBigger(rectWnd.top - rectWnd.bottom, kTriangleHalfLength)) {
CFX_PathData path;
path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
@@ -306,7 +307,8 @@ void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) {
PWL_CREATEPARAM bcp = cp;
bcp.pParentWnd = this;
bcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND;
- bcp.sBackgroundColor = PWL_SCROLLBAR_BKCOLOR;
+ bcp.sBackgroundColor = CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f,
+ 220.0f / 255.0f, 220.0f / 255.0f);
bcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR;
bcp.dwBorderWidth = 2;
bcp.nBorderStyle = BorderStyle::BEVELED;
@@ -331,7 +333,7 @@ void CPWL_ComboBox::CreateListBox(const PWL_CREATEPARAM& cp) {
lcp.rcRectWnd = CFX_FloatRect();
if (cp.dwFlags & PWS_AUTOFONTSIZE)
- lcp.fFontSize = PWLCB_DEFAULTFONTSIZE;
+ lcp.fFontSize = kDefaultFontSize;
else
lcp.fFontSize = cp.fFontSize;
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
index b6ea701c26..8691898763 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -113,7 +113,8 @@ void CPWL_ListBox::GetThisAppearanceStream(std::ostringstream* psAppStream) {
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
- << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
+ << CPWL_Utils::GetColorAppStream(
+ CPWL_Color(COLORTYPE_RGB, 1, 1, 1))
<< sItem << "ET\n";
}
} else {
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
index fdbe8fcb02..888525855b 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -14,6 +14,16 @@
#include "fpdfsdk/pdfwindow/cpwl_utils.h"
#include "fpdfsdk/pdfwindow/cpwl_wnd.h"
+namespace {
+
+constexpr float kButtonWidth = 9.0f;
+constexpr float kPosButtonMinWidth = 2.0f;
+constexpr float kTriangleHalfLength = 2.0f;
+
+} // namespace
+
+#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.50)
+
PWL_FLOATRANGE::PWL_FLOATRANGE() {
Default();
}
@@ -143,14 +153,14 @@ void CPWL_SBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) {
case SBT_HSCROLL:
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength * 0.5f, ptCenter.y);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength * 0.5f,
+ ptCenter.y + kTriangleHalfLength);
+ CFX_PointF pt3(ptCenter.x + kTriangleHalfLength * 0.5f,
+ ptCenter.y - kTriangleHalfLength);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
*psAppStream << "0 g\n"
<< pt1.x << " " << pt1.y << " m\n"
<< pt2.x << " " << pt2.y << " l\n"
@@ -159,14 +169,14 @@ void CPWL_SBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) {
}
} break;
case PSBT_MAX: {
- CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x + kTriangleHalfLength * 0.5f, ptCenter.y);
+ CFX_PointF pt2(ptCenter.x - kTriangleHalfLength * 0.5f,
+ ptCenter.y + kTriangleHalfLength);
+ CFX_PointF pt3(ptCenter.x - kTriangleHalfLength * 0.5f,
+ ptCenter.y - kTriangleHalfLength);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
*psAppStream << "0 g\n"
<< pt1.x << " " << pt1.y << " m\n"
<< pt2.x << " " << pt2.y << " l\n"
@@ -181,14 +191,14 @@ void CPWL_SBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) {
case SBT_VSCROLL:
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
- ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
- ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt3(ptCenter.x, ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength,
+ ptCenter.y - kTriangleHalfLength * 0.5f);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength,
+ ptCenter.y - kTriangleHalfLength * 0.5f);
+ CFX_PointF pt3(ptCenter.x, ptCenter.y + kTriangleHalfLength * 0.5f);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
*psAppStream << "0 g\n"
<< pt1.x << " " << pt1.y << " m\n"
<< pt2.x << " " << pt2.y << " l\n"
@@ -197,14 +207,14 @@ void CPWL_SBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) {
}
} break;
case PSBT_MAX: {
- CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN,
- ptCenter.y + PWL_TRIANGLE_HALFLEN * 0.5f);
- CFX_PointF pt3(ptCenter.x, ptCenter.y - PWL_TRIANGLE_HALFLEN * 0.5f);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength,
+ ptCenter.y + kTriangleHalfLength * 0.5f);
+ CFX_PointF pt3(ptCenter.x, ptCenter.y - kTriangleHalfLength * 0.5f);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
*psAppStream << "0 g\n"
<< pt1.x << " " << pt1.y << " m\n"
<< pt2.x << " " << pt2.y << " l\n"
@@ -240,14 +250,14 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
switch (m_eSBButtonType) {
case PSBT_MIN: {
- CFX_PointF pt1(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CFX_PointF pt2(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CFX_PointF pt3(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x - kTriangleHalfLength * 0.5f, ptCenter.y);
+ CFX_PointF pt2(ptCenter.x + kTriangleHalfLength * 0.5f,
+ ptCenter.y + kTriangleHalfLength);
+ CFX_PointF pt3(ptCenter.x + kTriangleHalfLength * 0.5f,
+ ptCenter.y - kTriangleHalfLength);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
CFX_PathData path;
path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
@@ -260,14 +270,14 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
} break;
case PSBT_MAX: {
- CFX_PointF pt1(ptCenter.x + PWL_TRIANGLE_HALFLEN * 0.5f, ptCenter.y);
- CFX_PointF pt2(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y + PWL_TRIANGLE_HALFLEN);
- CFX_PointF pt3(ptCenter.x - PWL_TRIANGLE_HALFLEN * 0.5f,
- ptCenter.y - PWL_TRIANGLE_HALFLEN);
-
- if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 &&
- rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) {
+ CFX_PointF pt1(ptCenter.x + kTriangleHalfLength * 0.5f, ptCenter.y);
+ CFX_PointF pt2(ptCenter.x - kTriangleHalfLength * 0.5f,
+ ptCenter.y + kTriangleHalfLength);
+ CFX_PointF pt3(ptCenter.x - kTriangleHalfLength * 0.5f,
+ ptCenter.y - kTriangleHalfLength);
+
+ if (rectWnd.right - rectWnd.left > kTriangleHalfLength * 2 &&
+ rectWnd.top - rectWnd.bottom > kTriangleHalfLength) {
CFX_PathData path;
path.AppendPoint(pt1, FXPT_TYPE::MoveTo, false);
path.AppendPoint(pt2, FXPT_TYPE::LineTo, false);
@@ -585,18 +595,14 @@ void CPWL_ScrollBar::RePosChildWnd() {
switch (m_sbType) {
case SBT_HSCROLL:
if (rcClient.right - rcClient.left >
- PWL_SCROLLBAR_BUTTON_WIDTH * 2 + PWL_SCROLLBAR_POSBUTTON_MINWIDTH +
- 2) {
+ kButtonWidth * 2 + kPosButtonMinWidth + 2) {
rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
- rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.top);
+ rcClient.left + kButtonWidth, rcClient.top);
rcMaxButton =
- CFX_FloatRect(rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.bottom, rcClient.right, rcClient.top);
+ CFX_FloatRect(rcClient.right - kButtonWidth, rcClient.bottom,
+ rcClient.right, rcClient.top);
} else {
- fBWidth = (rcClient.right - rcClient.left -
- PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
- 2;
+ fBWidth = (rcClient.right - rcClient.left - kPosButtonMinWidth - 2) / 2;
if (fBWidth > 0) {
rcMinButton = CFX_FloatRect(rcClient.left, rcClient.bottom,
@@ -610,18 +616,14 @@ void CPWL_ScrollBar::RePosChildWnd() {
break;
case SBT_VSCROLL:
if (IsFloatBigger(rcClient.top - rcClient.bottom,
- PWL_SCROLLBAR_BUTTON_WIDTH * 2 +
- PWL_SCROLLBAR_POSBUTTON_MINWIDTH + 2)) {
- rcMinButton = CFX_FloatRect(rcClient.left,
- rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH,
+ kButtonWidth * 2 + kPosButtonMinWidth + 2)) {
+ rcMinButton = CFX_FloatRect(rcClient.left, rcClient.top - kButtonWidth,
rcClient.right, rcClient.top);
rcMaxButton =
CFX_FloatRect(rcClient.left, rcClient.bottom, rcClient.right,
- rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH);
+ rcClient.bottom + kButtonWidth);
} else {
- fBWidth = (rcClient.top - rcClient.bottom -
- PWL_SCROLLBAR_POSBUTTON_MINWIDTH - 2) /
- 2;
+ fBWidth = (rcClient.top - rcClient.bottom - kPosButtonMinWidth - 2) / 2;
if (IsFloatBigger(fBWidth, 0)) {
rcMinButton = CFX_FloatRect(rcClient.left, rcClient.top - fBWidth,
@@ -697,20 +699,16 @@ bool CPWL_ScrollBar::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
switch (m_sbType) {
case SBT_HSCROLL:
- rcMinArea =
- CFX_FloatRect(rcClient.left + PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.bottom, rcPosButton.left, rcClient.top);
+ rcMinArea = CFX_FloatRect(rcClient.left + kButtonWidth, rcClient.bottom,
+ rcPosButton.left, rcClient.top);
rcMaxArea = CFX_FloatRect(rcPosButton.right, rcClient.bottom,
- rcClient.right - PWL_SCROLLBAR_BUTTON_WIDTH,
- rcClient.top);
+ rcClient.right - kButtonWidth, rcClient.top);
break;
case SBT_VSCROLL:
- rcMinArea =
- CFX_FloatRect(rcClient.left, rcPosButton.top, rcClient.right,
- rcClient.top - PWL_SCROLLBAR_BUTTON_WIDTH);
- rcMaxArea = CFX_FloatRect(rcClient.left,
- rcClient.bottom + PWL_SCROLLBAR_BUTTON_WIDTH,
+ rcMinArea = CFX_FloatRect(rcClient.left, rcPosButton.top,
+ rcClient.right, rcClient.top - kButtonWidth);
+ rcMaxArea = CFX_FloatRect(rcClient.left, rcClient.bottom + kButtonWidth,
rcClient.right, rcPosButton.bottom);
break;
}
@@ -879,12 +877,12 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) {
fLeft = TrueToFace(m_sData.fScrollPos);
fRight = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth);
- if (fRight - fLeft < PWL_SCROLLBAR_POSBUTTON_MINWIDTH)
- fRight = fLeft + PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
+ if (fRight - fLeft < kPosButtonMinWidth)
+ fRight = fLeft + kPosButtonMinWidth;
if (fRight > rcPosArea.right) {
fRight = rcPosArea.right;
- fLeft = fRight - PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
+ fLeft = fRight - kPosButtonMinWidth;
}
rcPosButton =
@@ -895,12 +893,12 @@ void CPWL_ScrollBar::MovePosButton(bool bRefresh) {
fBottom = TrueToFace(m_sData.fScrollPos + m_sData.fClientWidth);
fTop = TrueToFace(m_sData.fScrollPos);
- if (IsFloatSmaller(fTop - fBottom, PWL_SCROLLBAR_POSBUTTON_MINWIDTH))
- fBottom = fTop - PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
+ if (IsFloatSmaller(fTop - fBottom, kPosButtonMinWidth))
+ fBottom = fTop - kPosButtonMinWidth;
if (IsFloatSmaller(fBottom, rcPosArea.bottom)) {
fBottom = rcPosArea.bottom;
- fTop = fBottom + PWL_SCROLLBAR_POSBUTTON_MINWIDTH;
+ fTop = fBottom + kPosButtonMinWidth;
}
rcPosButton =
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index 564c98c9e2..6e2e75c5a1 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -15,6 +15,13 @@
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
+namespace {
+
+constexpr float kDefaultFontSize = 9.0f;
+constexpr int kInvalidationInflate = 2;
+
+} // namespace
+
PWL_CREATEPARAM::PWL_CREATEPARAM()
: rcRectWnd(0, 0, 0, 0),
pSystemHandler(nullptr),
@@ -29,7 +36,7 @@ PWL_CREATEPARAM::PWL_CREATEPARAM()
sBorderColor(),
sTextColor(),
nTransparency(255),
- fFontSize(PWL_DEFAULT_FONTSIZE),
+ fFontSize(kDefaultFontSize),
sDash(3, 0, 0),
pAttachedData(nullptr),
pParentWnd(nullptr),
@@ -326,10 +333,10 @@ void CPWL_Wnd::InvalidateRect(CFX_FloatRect* pRect) {
}
FX_RECT rcWin = PWLtoWnd(rcRefresh);
- rcWin.left -= PWL_INVALIDATE_INFLATE;
- rcWin.top -= PWL_INVALIDATE_INFLATE;
- rcWin.right += PWL_INVALIDATE_INFLATE;
- rcWin.bottom += PWL_INVALIDATE_INFLATE;
+ rcWin.left -= kInvalidationInflate;
+ rcWin.top -= kInvalidationInflate;
+ rcWin.right += kInvalidationInflate;
+ rcWin.bottom += kInvalidationInflate;
if (CFX_SystemHandler* pSH = GetSystemHandler()) {
if (CPDFSDK_Widget* widget = static_cast<CPDFSDK_Widget*>(
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index 97c47527a2..a3c4cbbb42 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -34,7 +34,6 @@ struct PWL_SCROLL_INFO;
#define PWS_HSCROLL 0x10000000L
#define PWS_VSCROLL 0x08000000L
#define PWS_VISIBLE 0x04000000L
-#define PWS_DISABLE 0x02000000L
#define PWS_READONLY 0x01000000L
#define PWS_AUTOFONTSIZE 0x00800000L
#define PWS_AUTOTRANSPARENT 0x00400000L
@@ -65,14 +64,6 @@ struct PWL_SCROLL_INFO;
// combobox styles
#define PCBS_ALLOWCUSTOMTEXT 0x0001L
-// richedit styles
-#define PRES_MULTILINE 0x0001L
-#define PRES_AUTORETURN 0x0002L
-#define PRES_AUTOSCROLL 0x0004L
-#define PRES_UNDO 0x0100L
-#define PRES_MULTIPAGES 0x0200L
-#define PRES_TEXTOVERFLOW 0x0400L
-
#define PWL_CLASSNAME_EDIT "CPWL_Edit"
struct CPWL_Dash {
@@ -106,24 +97,11 @@ inline bool operator!=(const CPWL_Color& c1, const CPWL_Color& c2) {
}
#define PWL_SCROLLBAR_WIDTH 12.0f
-#define PWL_SCROLLBAR_BUTTON_WIDTH 9.0f
-#define PWL_SCROLLBAR_POSBUTTON_MINWIDTH 2.0f
#define PWL_SCROLLBAR_TRANSPARENCY 150
-#define PWL_SCROLLBAR_BKCOLOR \
- CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f, 220.0f / 255.0f)
-#define PWL_DEFAULT_SELTEXTCOLOR CPWL_Color(COLORTYPE_RGB, 1, 1, 1)
#define PWL_DEFAULT_SELBACKCOLOR \
CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f)
-#define PWL_DEFAULT_BACKCOLOR PWL_DEFAULT_SELTEXTCOLOR
-#define PWL_DEFAULT_TEXTCOLOR CPWL_Color(COLORTYPE_RGB, 0, 0, 0)
-#define PWL_DEFAULT_FONTSIZE 9.0f
#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY, 0)
#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY, 1)
-#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.50)
-#define PWL_DEFAULT_LIGHTGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.75)
-#define PWL_TRIANGLE_HALFLEN 2.0f
-#define PWL_CBBUTTON_TRIANGLE_HALFLEN 3.0f
-#define PWL_INVALIDATE_INFLATE 2
class IPWL_Provider : public CFX_Observable<IPWL_Provider> {
public: