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/fwl/theme/cfwl_datetimepickertp.h" 8 9 #include "xfa/fwl/cfwl_datetimepicker.h" 10 #include "xfa/fwl/cfwl_themebackground.h" 11 CFWL_DateTimePickerTP()12CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {} 13 ~CFWL_DateTimePickerTP()14CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {} 15 DrawBackground(const CFWL_ThemeBackground & pParams)16void CFWL_DateTimePickerTP::DrawBackground( 17 const CFWL_ThemeBackground& pParams) { 18 switch (pParams.m_iPart) { 19 case CFWL_Part::Border: 20 DrawBorder(pParams.m_pGraphics.Get(), pParams.m_rtPart, pParams.m_matrix); 21 break; 22 case CFWL_Part::DropDownButton: 23 DrawDropDownButton(pParams, pParams.m_matrix); 24 break; 25 default: 26 break; 27 } 28 } 29 DrawDropDownButton(const CFWL_ThemeBackground & pParams,const CFX_Matrix & matrix)30void CFWL_DateTimePickerTP::DrawDropDownButton( 31 const CFWL_ThemeBackground& pParams, 32 const CFX_Matrix& matrix) { 33 uint32_t dwStates = pParams.m_dwStates; 34 dwStates &= 0x03; 35 FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; 36 switch (eState & dwStates) { 37 case CFWL_PartState_Normal: { 38 eState = FWLTHEME_STATE_Normal; 39 break; 40 } 41 case CFWL_PartState_Hovered: { 42 eState = FWLTHEME_STATE_Hover; 43 break; 44 } 45 case CFWL_PartState_Pressed: { 46 eState = FWLTHEME_STATE_Pressed; 47 break; 48 } 49 case CFWL_PartState_Disabled: { 50 eState = FWLTHEME_STATE_Disable; 51 break; 52 } 53 default: 54 break; 55 } 56 DrawArrowBtn(pParams.m_pGraphics.Get(), pParams.m_rtPart, 57 FWLTHEME_DIRECTION_Down, eState, matrix); 58 } 59