diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-05 14:18:14 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-05 19:46:20 +0000 |
commit | a9e28433600816a20406709c5652ba91697bc387 (patch) | |
tree | 8b0ad8cc5f67f5abbdf096501efb49443efd6288 /fpdfsdk/pdfwindow/cpwl_combo_box.cpp | |
parent | 7f6bec9b4c0cb2f53724ea83715d4fe22eed1d28 (diff) | |
download | pdfium-a9e28433600816a20406709c5652ba91697bc387.tar.xz |
Cleanup some CPWL_Wnd defines
This CL removes unused #define's and moves ones that are only used in a
single .cpp class to that file.
Change-Id: I6c503d5d4c031a870b7a1362086205a810d31478
Reviewed-on: https://pdfium-review.googlesource.com/7256
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_combo_box.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 44 |
1 files changed, 23 insertions, 21 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; |