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

Side by Side Diff: xfa/src/fwl/theme/datetimepickertp.cpp

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 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
« no previous file with comments | « xfa/src/fwl/theme/comboboxtp.cpp ('k') | xfa/src/fwl/theme/edittp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #include "xfa/include/fwl/theme/datetimepickertp.h"
8
9 #include "xfa/include/fwl/basewidget/fwl_datetimepicker.h"
10
11 CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {
12 m_pThemeData = new DTPThemeData;
13 initThemeData();
14 }
15 CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {
16 delete m_pThemeData;
17 }
18 FX_BOOL CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) {
19 if (!pWidget)
20 return FALSE;
21 return pWidget->GetClassID() == FWL_CLASSHASH_DateTimePicker;
22 }
23 FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
24 if (!pParams)
25 return FALSE;
26 switch (pParams->m_iPart) {
27 case FWL_PART_DTP_Border: {
28 DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
29 break;
30 }
31 case FWL_PART_DTP_Edge: {
32 DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
33 &pParams->m_rtPart, &pParams->m_matrix);
34 break;
35 }
36 case FWL_PART_DTP_DropDownButton: {
37 DrawDropDownButton(pParams, &pParams->m_matrix);
38 break;
39 }
40 default: {}
41 }
42 return TRUE;
43 }
44 #ifdef THEME_XPSimilar
45 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
46 CFX_Matrix* pMatrix) {
47 FX_DWORD dwStates = pParams->m_dwStates;
48 dwStates &= 0x03;
49 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
50 switch (eState & dwStates) {
51 case FWL_PARTSTATE_DTP_Normal: {
52 eState = FWLTHEME_STATE_Normal;
53 break;
54 }
55 case FWL_PARTSTATE_DTP_Hovered: {
56 eState = FWLTHEME_STATE_Hover;
57 break;
58 }
59 case FWL_PARTSTATE_DTP_Pressed: {
60 eState = FWLTHEME_STATE_Pressed;
61 break;
62 }
63 case FWL_PARTSTATE_DTP_Disabled: {
64 eState = FWLTHEME_STATE_Disabale;
65 break;
66 }
67 default: {}
68 }
69 DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
70 FWLTHEME_DIRECTION_Down, eState, pMatrix);
71 }
72 #else
73 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
74 CFX_Matrix* pMatrix) {
75 FX_BOOL bPressed = ((pParams->m_dwStates & FWL_PARTSTATE_DTP_Pressed) ==
76 FWL_PARTSTATE_DTP_Pressed);
77 FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f;
78 FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised;
79 Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart,
80 FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2,
81 FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix);
82 CFX_Path path;
83 path.Create();
84 path.AddRectangle(pParams->m_rtPart.left + fWidth,
85 pParams->m_rtPart.top + fWidth,
86 pParams->m_rtPart.width - 2 * fWidth,
87 pParams->m_rtPart.height - 2 * fWidth);
88 pParams->m_pGraphics->SaveGraphState();
89 CFX_Color crFill(FWLTHEME_COLOR_Background);
90 pParams->m_pGraphics->SetFillColor(&crFill);
91 pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
92 pParams->m_pGraphics->RestoreGraphState();
93 FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133);
94 switch (pParams->m_dwStates & 0x03) {
95 case FWL_PARTSTATE_DTP_Normal: {
96 }
97 case FWL_PARTSTATE_DTP_Hovered: {
98 }
99 case FWL_PARTSTATE_DTP_Pressed: {
100 argbFill = 0xFF000000;
101 break;
102 }
103 case FWL_PARTSTATE_DTP_Disabled: {
104 argbFill = 0xFFF0F0F0;
105 break;
106 }
107 }
108 DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down,
109 argbFill, bPressed, pMatrix);
110 }
111 #endif
112 void CFWL_DateTimePickerTP::initThemeData() {
113 FX_DWORD* pData = (FX_DWORD*)&m_pThemeData->BoxBkColor;
114 *pData++ = 0, *pData++ = 0, *pData++ = ArgbEncode(255, 220, 220, 215),
115 *pData++ = ArgbEncode(255, 255, 255, 255),
116 *pData++ = ArgbEncode(255, 255, 240, 207),
117 *pData++ = ArgbEncode(255, 248, 179, 48),
118 *pData++ = ArgbEncode(255, 176, 176, 167),
119 *pData++ = ArgbEncode(255, 241, 239, 239),
120 *pData++ = ArgbEncode(255, 255, 255, 255),
121 *pData++ = ArgbEncode(255, 255, 255, 255),
122 *pData++ = ArgbEncode(255, 220, 220, 215),
123 *pData++ = ArgbEncode(255, 255, 255, 255),
124 *pData++ = ArgbEncode(255, 255, 240, 207),
125 *pData++ = ArgbEncode(255, 248, 179, 48),
126 *pData++ = ArgbEncode(255, 176, 176, 167),
127 *pData++ = ArgbEncode(255, 241, 239, 239),
128 *pData++ = ArgbEncode(255, 255, 255, 255),
129 *pData++ = ArgbEncode(255, 255, 255, 255),
130 *pData++ = ArgbEncode(255, 220, 220, 215),
131 *pData++ = ArgbEncode(255, 255, 255, 255),
132 *pData++ = ArgbEncode(255, 255, 240, 207),
133 *pData++ = ArgbEncode(255, 248, 179, 48),
134 *pData++ = ArgbEncode(255, 176, 176, 167),
135 *pData++ = ArgbEncode(255, 241, 239, 239),
136 *pData++ = ArgbEncode(255, 255, 255, 255),
137 *pData++ = ArgbEncode(255, 255, 255, 255);
138 }
OLDNEW
« no previous file with comments | « xfa/src/fwl/theme/comboboxtp.cpp ('k') | xfa/src/fwl/theme/edittp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698