| 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/core/cfwl_themebackground.h" | 9 #include "xfa/fwl/core/cfwl_themebackground.h" | 
| 10 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 10 #include "xfa/fwl/core/ifwl_datetimepicker.h" | 
| 11 | 11 | 
| 12 CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {} | 12 CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {} | 
| 13 | 13 | 
| 14 CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {} | 14 CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {} | 
| 15 | 15 | 
| 16 bool CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { | 16 bool CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { | 
| 17   return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker; | 17   return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker; | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 20 void CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 
| 21   if (!pParams) | 21   if (!pParams) | 
| 22     return FALSE; | 22     return; | 
|  | 23 | 
| 23   switch (pParams->m_iPart) { | 24   switch (pParams->m_iPart) { | 
| 24     case CFWL_Part::Border: { | 25     case CFWL_Part::Border: { | 
| 25       DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); | 26       DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); | 
| 26       break; | 27       break; | 
| 27     } | 28     } | 
| 28     case CFWL_Part::Edge: { | 29     case CFWL_Part::Edge: { | 
| 29       DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), | 30       DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), | 
| 30                &pParams->m_rtPart, &pParams->m_matrix); | 31                &pParams->m_rtPart, &pParams->m_matrix); | 
| 31       break; | 32       break; | 
| 32     } | 33     } | 
| 33     case CFWL_Part::DropDownButton: { | 34     case CFWL_Part::DropDownButton: { | 
| 34       DrawDropDownButton(pParams, &pParams->m_matrix); | 35       DrawDropDownButton(pParams, &pParams->m_matrix); | 
| 35       break; | 36       break; | 
| 36     } | 37     } | 
| 37     default: {} | 38     default: | 
|  | 39       break; | 
| 38   } | 40   } | 
| 39   return TRUE; |  | 
| 40 } | 41 } | 
| 41 | 42 | 
| 42 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 43 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, | 
| 43                                                CFX_Matrix* pMatrix) { | 44                                                CFX_Matrix* pMatrix) { | 
| 44   uint32_t dwStates = pParams->m_dwStates; | 45   uint32_t dwStates = pParams->m_dwStates; | 
| 45   dwStates &= 0x03; | 46   dwStates &= 0x03; | 
| 46   FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 47   FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; | 
| 47   switch (eState & dwStates) { | 48   switch (eState & dwStates) { | 
| 48     case CFWL_PartState_Normal: { | 49     case CFWL_PartState_Normal: { | 
| 49       eState = FWLTHEME_STATE_Normal; | 50       eState = FWLTHEME_STATE_Normal; | 
| 50       break; | 51       break; | 
| 51     } | 52     } | 
| 52     case CFWL_PartState_Hovered: { | 53     case CFWL_PartState_Hovered: { | 
| 53       eState = FWLTHEME_STATE_Hover; | 54       eState = FWLTHEME_STATE_Hover; | 
| 54       break; | 55       break; | 
| 55     } | 56     } | 
| 56     case CFWL_PartState_Pressed: { | 57     case CFWL_PartState_Pressed: { | 
| 57       eState = FWLTHEME_STATE_Pressed; | 58       eState = FWLTHEME_STATE_Pressed; | 
| 58       break; | 59       break; | 
| 59     } | 60     } | 
| 60     case CFWL_PartState_Disabled: { | 61     case CFWL_PartState_Disabled: { | 
| 61       eState = FWLTHEME_STATE_Disabale; | 62       eState = FWLTHEME_STATE_Disable; | 
| 62       break; | 63       break; | 
| 63     } | 64     } | 
| 64     default: {} | 65     default: | 
|  | 66       break; | 
| 65   } | 67   } | 
| 66   DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, | 68   DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, | 
| 67                FWLTHEME_DIRECTION_Down, eState, pMatrix); | 69                FWLTHEME_DIRECTION_Down, eState, pMatrix); | 
| 68 } | 70 } | 
| 69 | 71 | 
| OLD | NEW | 
|---|