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_datetimepickertp.h" | 7 #include "xfa/fwl/theme/cfwl_datetimepickertp.h" |
8 | 8 |
9 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" | 9 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" |
10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 break; | 35 break; |
36 } | 36 } |
37 case FWL_PART_DTP_DropDownButton: { | 37 case FWL_PART_DTP_DropDownButton: { |
38 DrawDropDownButton(pParams, &pParams->m_matrix); | 38 DrawDropDownButton(pParams, &pParams->m_matrix); |
39 break; | 39 break; |
40 } | 40 } |
41 default: {} | 41 default: {} |
42 } | 42 } |
43 return TRUE; | 43 return TRUE; |
44 } | 44 } |
45 #ifdef THEME_XPSimilar | 45 |
46 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 46 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, |
47 CFX_Matrix* pMatrix) { | 47 CFX_Matrix* pMatrix) { |
48 uint32_t dwStates = pParams->m_dwStates; | 48 uint32_t dwStates = pParams->m_dwStates; |
49 dwStates &= 0x03; | 49 dwStates &= 0x03; |
50 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 50 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; |
51 switch (eState & dwStates) { | 51 switch (eState & dwStates) { |
52 case FWL_PARTSTATE_DTP_Normal: { | 52 case FWL_PARTSTATE_DTP_Normal: { |
53 eState = FWLTHEME_STATE_Normal; | 53 eState = FWLTHEME_STATE_Normal; |
54 break; | 54 break; |
55 } | 55 } |
56 case FWL_PARTSTATE_DTP_Hovered: { | 56 case FWL_PARTSTATE_DTP_Hovered: { |
57 eState = FWLTHEME_STATE_Hover; | 57 eState = FWLTHEME_STATE_Hover; |
58 break; | 58 break; |
59 } | 59 } |
60 case FWL_PARTSTATE_DTP_Pressed: { | 60 case FWL_PARTSTATE_DTP_Pressed: { |
61 eState = FWLTHEME_STATE_Pressed; | 61 eState = FWLTHEME_STATE_Pressed; |
62 break; | 62 break; |
63 } | 63 } |
64 case FWL_PARTSTATE_DTP_Disabled: { | 64 case FWL_PARTSTATE_DTP_Disabled: { |
65 eState = FWLTHEME_STATE_Disabale; | 65 eState = FWLTHEME_STATE_Disabale; |
66 break; | 66 break; |
67 } | 67 } |
68 default: {} | 68 default: {} |
69 } | 69 } |
70 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, | 70 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, |
71 FWLTHEME_DIRECTION_Down, eState, pMatrix); | 71 FWLTHEME_DIRECTION_Down, eState, pMatrix); |
72 } | 72 } |
73 #else | 73 |
74 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | |
75 CFX_Matrix* pMatrix) { | |
76 FX_BOOL bPressed = ((pParams->m_dwStates & FWL_PARTSTATE_DTP_Pressed) == | |
77 FWL_PARTSTATE_DTP_Pressed); | |
78 FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; | |
79 FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; | |
80 Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, | |
81 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, | |
82 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); | |
83 CFX_Path path; | |
84 path.Create(); | |
85 path.AddRectangle(pParams->m_rtPart.left + fWidth, | |
86 pParams->m_rtPart.top + fWidth, | |
87 pParams->m_rtPart.width - 2 * fWidth, | |
88 pParams->m_rtPart.height - 2 * fWidth); | |
89 pParams->m_pGraphics->SaveGraphState(); | |
90 CFX_Color crFill(FWLTHEME_COLOR_Background); | |
91 pParams->m_pGraphics->SetFillColor(&crFill); | |
92 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); | |
93 pParams->m_pGraphics->RestoreGraphState(); | |
94 FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); | |
95 switch (pParams->m_dwStates & 0x03) { | |
96 case FWL_PARTSTATE_DTP_Normal: { | |
97 } | |
98 case FWL_PARTSTATE_DTP_Hovered: { | |
99 } | |
100 case FWL_PARTSTATE_DTP_Pressed: { | |
101 argbFill = 0xFF000000; | |
102 break; | |
103 } | |
104 case FWL_PARTSTATE_DTP_Disabled: { | |
105 argbFill = 0xFFF0F0F0; | |
106 break; | |
107 } | |
108 } | |
109 DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, | |
110 argbFill, bPressed, pMatrix); | |
111 } | |
112 #endif | |
113 void CFWL_DateTimePickerTP::initThemeData() { | 74 void CFWL_DateTimePickerTP::initThemeData() { |
114 uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor; | 75 uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor; |
115 *pData++ = 0; | 76 *pData++ = 0; |
116 *pData++ = 0; | 77 *pData++ = 0; |
117 *pData++ = ArgbEncode(255, 220, 220, 215), | 78 *pData++ = ArgbEncode(255, 220, 220, 215), |
118 *pData++ = ArgbEncode(255, 255, 255, 255), | 79 *pData++ = ArgbEncode(255, 255, 255, 255), |
119 *pData++ = ArgbEncode(255, 255, 240, 207), | 80 *pData++ = ArgbEncode(255, 255, 240, 207), |
120 *pData++ = ArgbEncode(255, 248, 179, 48), | 81 *pData++ = ArgbEncode(255, 248, 179, 48), |
121 *pData++ = ArgbEncode(255, 176, 176, 167), | 82 *pData++ = ArgbEncode(255, 176, 176, 167), |
122 *pData++ = ArgbEncode(255, 241, 239, 239), | 83 *pData++ = ArgbEncode(255, 241, 239, 239), |
123 *pData++ = ArgbEncode(255, 255, 255, 255), | 84 *pData++ = ArgbEncode(255, 255, 255, 255), |
124 *pData++ = ArgbEncode(255, 255, 255, 255), | 85 *pData++ = ArgbEncode(255, 255, 255, 255), |
125 *pData++ = ArgbEncode(255, 220, 220, 215), | 86 *pData++ = ArgbEncode(255, 220, 220, 215), |
126 *pData++ = ArgbEncode(255, 255, 255, 255), | 87 *pData++ = ArgbEncode(255, 255, 255, 255), |
127 *pData++ = ArgbEncode(255, 255, 240, 207), | 88 *pData++ = ArgbEncode(255, 255, 240, 207), |
128 *pData++ = ArgbEncode(255, 248, 179, 48), | 89 *pData++ = ArgbEncode(255, 248, 179, 48), |
129 *pData++ = ArgbEncode(255, 176, 176, 167), | 90 *pData++ = ArgbEncode(255, 176, 176, 167), |
130 *pData++ = ArgbEncode(255, 241, 239, 239), | 91 *pData++ = ArgbEncode(255, 241, 239, 239), |
131 *pData++ = ArgbEncode(255, 255, 255, 255), | 92 *pData++ = ArgbEncode(255, 255, 255, 255), |
132 *pData++ = ArgbEncode(255, 255, 255, 255), | 93 *pData++ = ArgbEncode(255, 255, 255, 255), |
133 *pData++ = ArgbEncode(255, 220, 220, 215), | 94 *pData++ = ArgbEncode(255, 220, 220, 215), |
134 *pData++ = ArgbEncode(255, 255, 255, 255), | 95 *pData++ = ArgbEncode(255, 255, 255, 255), |
135 *pData++ = ArgbEncode(255, 255, 240, 207), | 96 *pData++ = ArgbEncode(255, 255, 240, 207), |
136 *pData++ = ArgbEncode(255, 248, 179, 48), | 97 *pData++ = ArgbEncode(255, 248, 179, 48), |
137 *pData++ = ArgbEncode(255, 176, 176, 167), | 98 *pData++ = ArgbEncode(255, 176, 176, 167), |
138 *pData++ = ArgbEncode(255, 241, 239, 239), | 99 *pData++ = ArgbEncode(255, 241, 239, 239), |
139 *pData++ = ArgbEncode(255, 255, 255, 255), | 100 *pData++ = ArgbEncode(255, 255, 255, 255), |
140 *pData++ = ArgbEncode(255, 255, 255, 255); | 101 *pData++ = ArgbEncode(255, 255, 255, 255); |
141 } | 102 } |
OLD | NEW |