Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: fpdfsdk/pdfwindow/PWL_Wnd.cpp

Issue 1980973002: Convert border style defines to an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" 9 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
10 #include "fpdfsdk/pdfwindow/PWL_Utils.h" 10 #include "fpdfsdk/pdfwindow/PWL_Utils.h"
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 } 578 }
579 579
580 CPWL_Color CPWL_Wnd::GetTextColor() const { 580 CPWL_Color CPWL_Wnd::GetTextColor() const {
581 return m_sPrivateParam.sTextColor; 581 return m_sPrivateParam.sTextColor;
582 } 582 }
583 583
584 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const { 584 CPWL_Color CPWL_Wnd::GetTextStrokeColor() const {
585 return m_sPrivateParam.sTextStrokeColor; 585 return m_sPrivateParam.sTextStrokeColor;
586 } 586 }
587 587
588 int32_t CPWL_Wnd::GetBorderStyle() const { 588 BorderStyle CPWL_Wnd::GetBorderStyle() const {
589 return m_sPrivateParam.nBorderStyle; 589 return m_sPrivateParam.nBorderStyle;
590 } 590 }
591 591
592 void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle) { 592 void CPWL_Wnd::SetBorderStyle(BorderStyle nBorderStyle) {
593 if (HasFlag(PWS_BORDER)) 593 if (HasFlag(PWS_BORDER))
594 m_sPrivateParam.nBorderStyle = nBorderStyle; 594 m_sPrivateParam.nBorderStyle = nBorderStyle;
595 } 595 }
596 596
597 int32_t CPWL_Wnd::GetBorderWidth() const { 597 int32_t CPWL_Wnd::GetBorderWidth() const {
598 if (HasFlag(PWS_BORDER)) 598 if (HasFlag(PWS_BORDER))
599 return m_sPrivateParam.dwBorderWidth; 599 return m_sPrivateParam.dwBorderWidth;
600 600
601 return 0; 601 return 0;
602 } 602 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 812 }
813 813
814 IPWL_Provider* CPWL_Wnd::GetProvider() const { 814 IPWL_Provider* CPWL_Wnd::GetProvider() const {
815 return m_sPrivateParam.pProvider; 815 return m_sPrivateParam.pProvider;
816 } 816 }
817 817
818 IPVT_FontMap* CPWL_Wnd::GetFontMap() const { 818 IPVT_FontMap* CPWL_Wnd::GetFontMap() const {
819 return m_sPrivateParam.pFontMap; 819 return m_sPrivateParam.pFontMap;
820 } 820 }
821 821
822 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const { 822 CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const {
823 CPWL_Color color;
824
825 switch (nBorderStyle) { 823 switch (nBorderStyle) {
826 case PBS_SOLID: 824 case BorderStyle::BEVELED:
827 break; 825 return CPWL_Color(COLORTYPE_GRAY, 1);
828 case PBS_DASH: 826 case BorderStyle::INSET:
829 break; 827 return CPWL_Color(COLORTYPE_GRAY, 0.5f);
830 case PBS_BEVELED: 828 default:
831 color = CPWL_Color(COLORTYPE_GRAY, 1); 829 return CPWL_Color();
832 break;
833 case PBS_INSET:
834 color = CPWL_Color(COLORTYPE_GRAY, 0.5f);
835 break;
836 case PBS_UNDERLINED:
837 break;
838 } 830 }
839
840 return color;
841 } 831 }
842 832
843 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const { 833 CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const {
844 CPWL_Color color;
845
846 switch (nBorderStyle) { 834 switch (nBorderStyle) {
847 case PBS_SOLID: 835 case BorderStyle::BEVELED:
848 break; 836 return CPWL_Utils::DevideColor(GetBackgroundColor(), 2);
849 case PBS_DASH: 837 case BorderStyle::INSET:
850 break; 838 return CPWL_Color(COLORTYPE_GRAY, 0.75f);
851 case PBS_BEVELED: 839 default:
852 color = CPWL_Utils::DevideColor(GetBackgroundColor(), 2); 840 return CPWL_Color();
853 break;
854 case PBS_INSET:
855 color = CPWL_Color(COLORTYPE_GRAY, 0.75f);
856 break;
857 case PBS_UNDERLINED:
858 break;
859 } 841 }
860
861 return color;
862 } 842 }
863 843
864 int32_t CPWL_Wnd::GetTransparency() { 844 int32_t CPWL_Wnd::GetTransparency() {
865 return m_sPrivateParam.nTransparency; 845 return m_sPrivateParam.nTransparency;
866 } 846 }
867 847
868 void CPWL_Wnd::SetTransparency(int32_t nTransparency) { 848 void CPWL_Wnd::SetTransparency(int32_t nTransparency) {
869 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { 849 for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
870 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { 850 if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
871 pChild->SetTransparency(nTransparency); 851 pChild->SetTransparency(nTransparency);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 return FALSE; 1002 return FALSE;
1023 } 1003 }
1024 1004
1025 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const { 1005 FX_BOOL CPWL_Wnd::IsALTpressed(uint32_t nFlag) const {
1026 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) { 1006 if (CFX_SystemHandler* pSystemHandler = GetSystemHandler()) {
1027 return pSystemHandler->IsALTKeyDown(nFlag); 1007 return pSystemHandler->IsALTKeyDown(nFlag);
1028 } 1008 }
1029 1009
1030 return FALSE; 1010 return FALSE;
1031 } 1011 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698