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/include/fwl/theme/listboxtp.h" | 7 #include "xfa/include/fwl/theme/listboxtp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/ifwl_listbox.h" | 9 #include "xfa/fwl/basewidget/ifwl_listbox.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 DrawListBoxItem(pParams->m_pGraphics, pParams->m_dwStates, | 46 DrawListBoxItem(pParams->m_pGraphics, pParams->m_dwStates, |
47 &pParams->m_rtPart, pParams->m_pData, &pParams->m_matrix); | 47 &pParams->m_rtPart, pParams->m_pData, &pParams->m_matrix); |
48 break; | 48 break; |
49 } | 49 } |
50 case FWL_PART_LTB_Icon: { | 50 case FWL_PART_LTB_Icon: { |
51 pParams->m_pGraphics->StretchImage(pParams->m_pImage, pParams->m_rtPart, | 51 pParams->m_pGraphics->StretchImage(pParams->m_pImage, pParams->m_rtPart, |
52 &pParams->m_matrix); | 52 &pParams->m_matrix); |
53 break; | 53 break; |
54 } | 54 } |
55 case FWL_PART_LTB_Check: { | 55 case FWL_PART_LTB_Check: { |
56 FX_DWORD color = 0xFF000000; | 56 uint32_t color = 0xFF000000; |
57 if (pParams->m_dwStates == FWL_PARTSTATE_LTB_Checked) { | 57 if (pParams->m_dwStates == FWL_PARTSTATE_LTB_Checked) { |
58 color = 0xFFFF0000; | 58 color = 0xFFFF0000; |
59 } else if (pParams->m_dwStates == FWL_PARTSTATE_LTB_UnChecked) { | 59 } else if (pParams->m_dwStates == FWL_PARTSTATE_LTB_UnChecked) { |
60 color = 0xFF0000FF; | 60 color = 0xFF0000FF; |
61 } | 61 } |
62 FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart, | 62 FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart, |
63 &pParams->m_matrix); | 63 &pParams->m_matrix); |
64 } | 64 } |
65 default: {} | 65 default: {} |
66 } | 66 } |
67 return TRUE; | 67 return TRUE; |
68 } | 68 } |
69 FWL_ERR CFWL_ListBoxTP::Initialize() { | 69 FWL_ERR CFWL_ListBoxTP::Initialize() { |
70 InitTTO(); | 70 InitTTO(); |
71 return CFWL_WidgetTP::Initialize(); | 71 return CFWL_WidgetTP::Initialize(); |
72 } | 72 } |
73 FWL_ERR CFWL_ListBoxTP::Finalize() { | 73 FWL_ERR CFWL_ListBoxTP::Finalize() { |
74 FinalizeTTO(); | 74 FinalizeTTO(); |
75 return CFWL_WidgetTP::Finalize(); | 75 return CFWL_WidgetTP::Finalize(); |
76 } | 76 } |
77 void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, | 77 void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, |
78 FX_DWORD dwStates, | 78 uint32_t dwStates, |
79 const CFX_RectF* prtItem, | 79 const CFX_RectF* prtItem, |
80 void* pData, | 80 void* pData, |
81 CFX_Matrix* pMatrix) { | 81 CFX_Matrix* pMatrix) { |
82 if (dwStates & FWL_PARTSTATE_LTB_Selected) { | 82 if (dwStates & FWL_PARTSTATE_LTB_Selected) { |
83 pGraphics->SaveGraphState(); | 83 pGraphics->SaveGraphState(); |
84 CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0 | 84 CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0 |
85 ? FWLTHEME_COLOR_BKSelected | 85 ? FWLTHEME_COLOR_BKSelected |
86 : FWLTHEME_COLOR_Green_BKSelected); | 86 : FWLTHEME_COLOR_Green_BKSelected); |
87 pGraphics->SetFillColor(&crFill); | 87 pGraphics->SetFillColor(&crFill); |
88 CFX_RectF rt(*prtItem); | 88 CFX_RectF rt(*prtItem); |
89 CFX_Path path; | 89 CFX_Path path; |
90 path.Create(); | 90 path.Create(); |
91 #if (_FX_OS_ == _FX_MACOSX_) | 91 #if (_FX_OS_ == _FX_MACOSX_) |
92 path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1); | 92 path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1); |
93 #else | 93 #else |
94 path.AddRectangle(rt.left, rt.top, rt.width, rt.height); | 94 path.AddRectangle(rt.left, rt.top, rt.width, rt.height); |
95 #endif | 95 #endif |
96 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | 96 pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); |
97 pGraphics->RestoreGraphState(); | 97 pGraphics->RestoreGraphState(); |
98 } | 98 } |
99 if (dwStates & FWL_PARTSTATE_LTB_Focused) { | 99 if (dwStates & FWL_PARTSTATE_LTB_Focused) { |
100 if (pData) { | 100 if (pData) { |
101 DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); | 101 DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); |
102 } | 102 } |
103 } | 103 } |
104 } | 104 } |
OLD | NEW |