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/basewidget/ifwl_scrollbar.h" | 9 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 break; | 90 break; |
91 } | 91 } |
92 case FWL_PART_SCB_UpperTrack: { | 92 case FWL_PART_SCB_UpperTrack: { |
93 DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); | 93 DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); |
94 break; | 94 break; |
95 } | 95 } |
96 default: {} | 96 default: {} |
97 } | 97 } |
98 return TRUE; | 98 return TRUE; |
99 } | 99 } |
100 #ifdef THEME_XPSimilar | 100 |
101 void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, | 101 void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, |
102 const CFX_RectF* pRect, | 102 const CFX_RectF* pRect, |
103 FX_BOOL bVert, | 103 FX_BOOL bVert, |
104 FWLTHEME_STATE eState, | 104 FWLTHEME_STATE eState, |
105 FX_BOOL bPawButton, | 105 FX_BOOL bPawButton, |
106 CFX_Matrix* pMatrix) { | 106 CFX_Matrix* pMatrix) { |
107 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { | 107 if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { |
108 return; | 108 return; |
109 } | 109 } |
110 CFX_Path path; | 110 CFX_Path path; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 FWLTHEME_DIRECTION eDict, | 259 FWLTHEME_DIRECTION eDict, |
260 FWLTHEME_STATE eState, | 260 FWLTHEME_STATE eState, |
261 CFX_Matrix* pMatrix) { | 261 CFX_Matrix* pMatrix) { |
262 DrawTrack(pGraphics, pRect, | 262 DrawTrack(pGraphics, pRect, |
263 eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, | 263 eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, |
264 eState, TRUE, pMatrix); | 264 eState, TRUE, pMatrix); |
265 CFX_RectF rtArrowBtn(*pRect); | 265 CFX_RectF rtArrowBtn(*pRect); |
266 rtArrowBtn.Deflate(1, 1, 1, 1); | 266 rtArrowBtn.Deflate(1, 1, 1, 1); |
267 DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); | 267 DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); |
268 } | 268 } |
269 #else | 269 |
270 void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, | |
271 const CFX_RectF* pRect, | |
272 FX_BOOL bVert, | |
273 FWLTHEME_STATE eState, | |
274 FX_BOOL bPawButton, | |
275 CFX_Matrix* pMatrix) { | |
276 if (pRect->IsEmpty()) { | |
277 return; | |
278 } | |
279 CFX_RectF rtThumb(*pRect); | |
280 FX_FLOAT fWidth = 2; | |
281 Draw3DRect(pGraphics, FWLTHEME_EDGE_Raised, fWidth, pRect, | |
282 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, | |
283 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); | |
284 CFX_Path path; | |
285 path.Create(); | |
286 path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, | |
287 pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); | |
288 pGraphics->SaveGraphState(); | |
289 CFX_Color crFill(FWLTHEME_COLOR_Background); | |
290 pGraphics->SetFillColor(&crFill); | |
291 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
292 pGraphics->RestoreGraphState(); | |
293 } | |
294 void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, | |
295 const CFX_RectF* pRect, | |
296 FX_BOOL bVert, | |
297 FWLTHEME_STATE eState, | |
298 FX_BOOL bLowerTrack, | |
299 CFX_Matrix* pMatrix) { | |
300 if (pRect->IsEmpty()) { | |
301 return; | |
302 } | |
303 CFX_Path path; | |
304 path.Create(); | |
305 path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); | |
306 pGraphics->SaveGraphState(); | |
307 CFX_Color clrFill(0xFFF0F0F0); | |
308 pGraphics->SetFillColor(&clrFill); | |
309 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
310 pGraphics->RestoreGraphState(); | |
311 } | |
312 void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, | |
313 const CFX_RectF* pRect, | |
314 FWLTHEME_DIRECTION eDict, | |
315 FWLTHEME_STATE eState, | |
316 CFX_Matrix* pMatrix) { | |
317 CFX_RectF rtThumb(*pRect); | |
318 FX_FLOAT fWidth = eState == FWLTHEME_STATE_Pressed ? 1.0f : 2.0f; | |
319 FWLTHEME_EDGE eType = eState == FWLTHEME_STATE_Pressed ? FWLTHEME_EDGE_Flat | |
320 : FWLTHEME_EDGE_Raised; | |
321 Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1, | |
322 FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1, | |
323 FWLTHEME_COLOR_EDGERB2, pMatrix); | |
324 CFX_Path path; | |
325 path.Create(); | |
326 path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, | |
327 pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); | |
328 pGraphics->SaveGraphState(); | |
329 CFX_Color crFill(FWLTHEME_COLOR_Background); | |
330 pGraphics->SetFillColor(&crFill); | |
331 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
332 pGraphics->RestoreGraphState(); | |
333 DrawArrow(pGraphics, pRect, eDict, | |
334 eState == FWLTHEME_STATE_Disabale ? 0xFFA0A0A0 : 0xFF000000, | |
335 eState == FWLTHEME_STATE_Pressed, pMatrix); | |
336 } | |
337 #endif | |
338 void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) { | 270 void CFWL_ScrollBarTP::SetThemeData(uint32_t dwID) { |
339 m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); | 271 m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); |
340 m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); | 272 m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); |
341 m_pThemeData->clrBtnBK[3][0] = ArgbEncode(0xff, 164, 180, 139); | 273 m_pThemeData->clrBtnBK[3][0] = ArgbEncode(0xff, 164, 180, 139); |
342 m_pThemeData->clrBtnBK[3][1] = ArgbEncode(0xff, 141, 157, 115); | 274 m_pThemeData->clrBtnBK[3][1] = ArgbEncode(0xff, 141, 157, 115); |
343 m_pThemeData->clrBtnBorder[3] = ArgbEncode(0xff, 236, 233, 216); | 275 m_pThemeData->clrBtnBorder[3] = ArgbEncode(0xff, 236, 233, 216); |
344 if (dwID) { | 276 if (dwID) { |
345 m_pThemeData->clrPawColorLight[0] = ArgbEncode(0xff, 208, 223, 172); | 277 m_pThemeData->clrPawColorLight[0] = ArgbEncode(0xff, 208, 223, 172); |
346 m_pThemeData->clrPawColorDark[0] = ArgbEncode(0xff, 140, 157, 115); | 278 m_pThemeData->clrPawColorDark[0] = ArgbEncode(0xff, 140, 157, 115); |
347 m_pThemeData->clrBtnBK[0][0] = ArgbEncode(0xff, 162, 179, 141); | 279 m_pThemeData->clrBtnBK[0][0] = ArgbEncode(0xff, 162, 179, 141); |
(...skipping 24 matching lines...) Expand all Loading... |
372 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); | 304 m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); |
373 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); | 305 m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); |
374 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); | 306 m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); |
375 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); | 307 m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); |
376 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); | 308 m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); |
377 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); | 309 m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); |
378 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); | 310 m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); |
379 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); | 311 m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); |
380 } | 312 } |
381 } | 313 } |
OLD | NEW |