Home | History | Annotate | Download | only in theme
      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 
     12 CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {}
     13 
     14 CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {}
     15 
     16 void CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
     17   if (!pParams)
     18     return;
     19 
     20   switch (pParams->m_iPart) {
     21     case CFWL_Part::Border: {
     22       DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
     23       break;
     24     }
     25     case CFWL_Part::DropDownButton: {
     26       DrawDropDownButton(pParams, &pParams->m_matrix);
     27       break;
     28     }
     29     default:
     30       break;
     31   }
     32 }
     33 
     34 void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
     35                                                CFX_Matrix* pMatrix) {
     36   uint32_t dwStates = pParams->m_dwStates;
     37   dwStates &= 0x03;
     38   FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
     39   switch (eState & dwStates) {
     40     case CFWL_PartState_Normal: {
     41       eState = FWLTHEME_STATE_Normal;
     42       break;
     43     }
     44     case CFWL_PartState_Hovered: {
     45       eState = FWLTHEME_STATE_Hover;
     46       break;
     47     }
     48     case CFWL_PartState_Pressed: {
     49       eState = FWLTHEME_STATE_Pressed;
     50       break;
     51     }
     52     case CFWL_PartState_Disabled: {
     53       eState = FWLTHEME_STATE_Disable;
     54       break;
     55     }
     56     default:
     57       break;
     58   }
     59   DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart,
     60                FWLTHEME_DIRECTION_Down, eState, pMatrix);
     61 }
     62 
     63