| OLD | NEW |
| 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 "xfa/fwl/theme/cfwl_scrollbartp.h" | 7 #include "xfa/fwl/theme/cfwl_scrollbartp.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 10 #include "xfa/fwl/core/ifwl_scrollbar.h" | 10 #include "xfa/fwl/core/ifwl_scrollbar.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 eState, &pParams->m_matrix); | 68 eState, &pParams->m_matrix); |
| 69 break; | 69 break; |
| 70 } | 70 } |
| 71 case CFWL_Part::BackArrow: { | 71 case CFWL_Part::BackArrow: { |
| 72 DrawMaxMinBtn(pGraphics, pRect, | 72 DrawMaxMinBtn(pGraphics, pRect, |
| 73 bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right, | 73 bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right, |
| 74 eState, &pParams->m_matrix); | 74 eState, &pParams->m_matrix); |
| 75 break; | 75 break; |
| 76 } | 76 } |
| 77 case CFWL_Part::Thumb: { | 77 case CFWL_Part::Thumb: { |
| 78 DrawThumbBtn(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); | 78 DrawThumbBtn(pGraphics, pRect, bVert, eState, true, &pParams->m_matrix); |
| 79 break; | 79 break; |
| 80 } | 80 } |
| 81 case CFWL_Part::LowerTrack: { | 81 case CFWL_Part::LowerTrack: { |
| 82 DrawTrack(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); | 82 DrawTrack(pGraphics, pRect, bVert, eState, true, &pParams->m_matrix); |
| 83 break; | 83 break; |
| 84 } | 84 } |
| 85 case CFWL_Part::UpperTrack: { | 85 case CFWL_Part::UpperTrack: { |
| 86 DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); | 86 DrawTrack(pGraphics, pRect, bVert, eState, false, &pParams->m_matrix); |
| 87 break; | 87 break; |
| 88 } | 88 } |
| 89 default: | 89 default: |
| 90 break; | 90 break; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, | 94 void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, |
| 95 const CFX_RectF* pRect, | 95 const CFX_RectF* pRect, |
| 96 FX_BOOL bVert, | 96 bool bVert, |
| 97 FWLTHEME_STATE eState, | 97 FWLTHEME_STATE eState, |
| 98 FX_BOOL bPawButton, | 98 bool bPawButton, |
| 99 CFX_Matrix* pMatrix) { | 99 CFX_Matrix* pMatrix) { |
| 100 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) | 100 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 CFX_Path path; | 103 CFX_Path path; |
| 104 path.Create(); | 104 path.Create(); |
| 105 CFX_RectF rect(*pRect); | 105 CFX_RectF rect(*pRect); |
| 106 if (bVert) { | 106 if (bVert) { |
| 107 rect.Deflate(1, 0); | 107 rect.Deflate(1, 0); |
| 108 if (rect.IsEmpty(0.1f)) | 108 if (rect.IsEmpty(0.1f)) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 133 rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); | 133 rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); |
| 134 pGraphics->SaveGraphState(); | 134 pGraphics->SaveGraphState(); |
| 135 pGraphics->SetStrokeColor(&rcStroke); | 135 pGraphics->SetStrokeColor(&rcStroke); |
| 136 pGraphics->StrokePath(&path, pMatrix); | 136 pGraphics->StrokePath(&path, pMatrix); |
| 137 pGraphics->RestoreGraphState(); | 137 pGraphics->RestoreGraphState(); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, | 141 void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, |
| 142 const CFX_RectF* pRect, | 142 const CFX_RectF* pRect, |
| 143 FX_BOOL bVert, | 143 bool bVert, |
| 144 FWLTHEME_STATE eState, | 144 FWLTHEME_STATE eState, |
| 145 CFX_Matrix* pMatrix) { | 145 CFX_Matrix* pMatrix) { |
| 146 CFX_Path path; | 146 CFX_Path path; |
| 147 path.Create(); | 147 path.Create(); |
| 148 if (bVert) { | 148 if (bVert) { |
| 149 FX_FLOAT fPawLen = kPawLength; | 149 FX_FLOAT fPawLen = kPawLength; |
| 150 if (pRect->width / 2 <= fPawLen) { | 150 if (pRect->width / 2 <= fPawLen) { |
| 151 fPawLen = (pRect->width - 6) / 2; | 151 fPawLen = (pRect->width - 6) / 2; |
| 152 } | 152 } |
| 153 FX_FLOAT fX = pRect->left + pRect->width / 4; | 153 FX_FLOAT fX = pRect->left + pRect->width / 4; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 path.LineTo(fX + 3, fY + fPawLen); | 209 path.LineTo(fX + 3, fY + fPawLen); |
| 210 CFX_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); | 210 CFX_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); |
| 211 pGraphics->SetLineWidth(1); | 211 pGraphics->SetLineWidth(1); |
| 212 pGraphics->SetStrokeColor(&clrDark); | 212 pGraphics->SetStrokeColor(&clrDark); |
| 213 pGraphics->StrokePath(&path, pMatrix); | 213 pGraphics->StrokePath(&path, pMatrix); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, | 217 void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, |
| 218 const CFX_RectF* pRect, | 218 const CFX_RectF* pRect, |
| 219 FX_BOOL bVert, | 219 bool bVert, |
| 220 FWLTHEME_STATE eState, | 220 FWLTHEME_STATE eState, |
| 221 FX_BOOL bLowerTrack, | 221 bool bLowerTrack, |
| 222 CFX_Matrix* pMatrix) { | 222 CFX_Matrix* pMatrix) { |
| 223 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) | 223 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disable) |
| 224 return; | 224 return; |
| 225 | 225 |
| 226 pGraphics->SaveGraphState(); | 226 pGraphics->SaveGraphState(); |
| 227 CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); | 227 CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); |
| 228 CFX_Path path; | 228 CFX_Path path; |
| 229 path.Create(); | 229 path.Create(); |
| 230 FX_FLOAT fRight = pRect->right(); | 230 FX_FLOAT fRight = pRect->right(); |
| 231 FX_FLOAT fBottom = pRect->bottom(); | 231 FX_FLOAT fBottom = pRect->bottom(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 250 m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix); | 250 m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, | 253 void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, |
| 254 const CFX_RectF* pRect, | 254 const CFX_RectF* pRect, |
| 255 FWLTHEME_DIRECTION eDict, | 255 FWLTHEME_DIRECTION eDict, |
| 256 FWLTHEME_STATE eState, | 256 FWLTHEME_STATE eState, |
| 257 CFX_Matrix* pMatrix) { | 257 CFX_Matrix* pMatrix) { |
| 258 DrawTrack(pGraphics, pRect, | 258 DrawTrack(pGraphics, pRect, |
| 259 eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, | 259 eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, |
| 260 eState, TRUE, pMatrix); | 260 eState, true, pMatrix); |
| 261 CFX_RectF rtArrowBtn(*pRect); | 261 CFX_RectF rtArrowBtn(*pRect); |
| 262 rtArrowBtn.Deflate(1, 1, 1, 1); | 262 rtArrowBtn.Deflate(1, 1, 1, 1); |
| 263 DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); | 263 DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) { | 266 void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) { |
| 267 m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); | 267 m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); |
| 268 m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); | 268 m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); |
| 269 m_pThemeData->clrBtnBK[3][0] = ArgbEncode(0xff, 164, 180, 139); | 269 m_pThemeData->clrBtnBK[3][0] = ArgbEncode(0xff, 164, 180, 139); |
| 270 m_pThemeData->clrBtnBK[3][1] = ArgbEncode(0xff, 141, 157, 115); | 270 m_pThemeData->clrBtnBK[3][1] = ArgbEncode(0xff, 141, 157, 115); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 300 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); | 300 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); |
| 301 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); | 301 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); |
| 302 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); | 302 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); |
| 303 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); | 303 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); |
| 304 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); | 304 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); |
| 305 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); | 305 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); |
| 306 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); | 306 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); |
| 307 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); | 307 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); |
| 308 } | 308 } |
| 309 } | 309 } |
| OLD | NEW |