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/include/fwl/theme/monthcalendartp.h" | 7 #include "xfa/include/fwl/theme/monthcalendartp.h" |
8 | 8 |
9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
10 #include "xfa/fwl/basewidget/ifwl_monthcalendar.h" | 10 #include "xfa/fwl/basewidget/ifwl_monthcalendar.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SetThemeData(0); | 64 SetThemeData(0); |
65 } | 65 } |
66 CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() { | 66 CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() { |
67 delete m_pThemeData; | 67 delete m_pThemeData; |
68 } | 68 } |
69 FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { | 69 FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { |
70 if (!pWidget) | 70 if (!pWidget) |
71 return FALSE; | 71 return FALSE; |
72 return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar; | 72 return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar; |
73 } | 73 } |
74 FX_DWORD CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, | 74 uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, |
75 FX_DWORD dwThemeID, | 75 uint32_t dwThemeID, |
76 FX_BOOL bChildren) { | 76 FX_BOOL bChildren) { |
77 if (m_pThemeData) { | 77 if (m_pThemeData) { |
78 SetThemeData(FWL_GetThemeColor(dwThemeID)); | 78 SetThemeData(FWL_GetThemeColor(dwThemeID)); |
79 } | 79 } |
80 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); | 80 return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); |
81 } | 81 } |
82 FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { | 82 FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { |
83 if (!pParams) | 83 if (!pParams) |
84 return FALSE; | 84 return FALSE; |
85 switch (pParams->m_iPart) { | 85 switch (pParams->m_iPart) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) { | 153 (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) { |
154 m_pTextOut->SetTextColor(0xFFFFFFFF); | 154 m_pTextOut->SetTextColor(0xFFFFFFFF); |
155 } else if (pParams->m_iPart == FWL_PART_MCD_Caption) { | 155 } else if (pParams->m_iPart == FWL_PART_MCD_Caption) { |
156 m_pTextOut->SetTextColor(m_pThemeData->clrCaption); | 156 m_pTextOut->SetTextColor(m_pThemeData->clrCaption); |
157 } else { | 157 } else { |
158 m_pTextOut->SetTextColor(0xFF000000); | 158 m_pTextOut->SetTextColor(0xFF000000); |
159 } | 159 } |
160 return CFWL_WidgetTP::DrawText(pParams); | 160 return CFWL_WidgetTP::DrawText(pParams); |
161 } | 161 } |
162 void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, | 162 void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, |
163 FX_DWORD dwCapacity) { | 163 uint32_t dwCapacity) { |
164 FX_BOOL bDefPro = FALSE; | 164 FX_BOOL bDefPro = FALSE; |
165 FX_BOOL bDwordVal = FALSE; | 165 FX_BOOL bDwordVal = FALSE; |
166 switch (dwCapacity) { | 166 switch (dwCapacity) { |
167 case FWL_WGTCAPACITY_MC_HEADER_WIDTH: { | 167 case FWL_WGTCAPACITY_MC_HEADER_WIDTH: { |
168 m_fValue = FWL_THEMECAPACITY_MC_HEADER_WIDTH; | 168 m_fValue = FWL_THEMECAPACITY_MC_HEADER_WIDTH; |
169 break; | 169 break; |
170 } | 170 } |
171 case FWL_WGTCAPACITY_MC_HEADER_Height: { | 171 case FWL_WGTCAPACITY_MC_HEADER_Height: { |
172 m_fValue = FWL_THEMECAPACITY_MC_HEADER_HEIGHT; | 172 m_fValue = FWL_THEMECAPACITY_MC_HEADER_HEIGHT; |
173 break; | 173 break; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, | 551 path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, |
552 rtTodayCircle.height); | 552 rtTodayCircle.height); |
553 pParams->m_pGraphics->SaveGraphState(); | 553 pParams->m_pGraphics->SaveGraphState(); |
554 CFX_Color clrTodayCircle; | 554 CFX_Color clrTodayCircle; |
555 clrTodayCircle = m_pThemeData->clrDatesCircle; | 555 clrTodayCircle = m_pThemeData->clrDatesCircle; |
556 pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle); | 556 pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle); |
557 pParams->m_pGraphics->StrokePath(&path, pMatrix); | 557 pParams->m_pGraphics->StrokePath(&path, pMatrix); |
558 pParams->m_pGraphics->RestoreGraphState(); | 558 pParams->m_pGraphics->RestoreGraphState(); |
559 return TRUE; | 559 return TRUE; |
560 } | 560 } |
561 FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(FX_DWORD dwFWLStates) { | 561 FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(uint32_t dwFWLStates) { |
562 if (dwFWLStates & FWL_PARTSTATE_MCD_Hovered) { | 562 if (dwFWLStates & FWL_PARTSTATE_MCD_Hovered) { |
563 return FWLTHEME_STATE_Hover; | 563 return FWLTHEME_STATE_Hover; |
564 } else if (dwFWLStates & FWL_PARTSTATE_MCD_Pressed) { | 564 } else if (dwFWLStates & FWL_PARTSTATE_MCD_Pressed) { |
565 return FWLTHEME_STATE_Pressed; | 565 return FWLTHEME_STATE_Pressed; |
566 } | 566 } |
567 return FWLTHEME_STATE_Normal; | 567 return FWLTHEME_STATE_Normal; |
568 } | 568 } |
569 void CFWL_MonthCalendarTP::SetThemeData(FX_DWORD dwThemeID) { | 569 void CFWL_MonthCalendarTP::SetThemeData(uint32_t dwThemeID) { |
570 if (dwThemeID == 0) { | 570 if (dwThemeID == 0) { |
571 m_pThemeData->clrCaption = ArgbEncode(0xff, 0, 153, 255); | 571 m_pThemeData->clrCaption = ArgbEncode(0xff, 0, 153, 255); |
572 m_pThemeData->clrSeperator = ArgbEncode(0xff, 141, 161, 239); | 572 m_pThemeData->clrSeperator = ArgbEncode(0xff, 141, 161, 239); |
573 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 193, 211, 251); | 573 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 193, 211, 251); |
574 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 173, 188, 239); | 574 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 173, 188, 239); |
575 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 103, 144, 209); | 575 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 103, 144, 209); |
576 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); | 576 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); |
577 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); | 577 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); |
578 } else { | 578 } else { |
579 m_pThemeData->clrCaption = ArgbEncode(0xff, 128, 128, 0); | 579 m_pThemeData->clrCaption = ArgbEncode(0xff, 128, 128, 0); |
580 m_pThemeData->clrSeperator = ArgbEncode(0xff, 128, 128, 64); | 580 m_pThemeData->clrSeperator = ArgbEncode(0xff, 128, 128, 64); |
581 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 217, 220, 191); | 581 m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 217, 220, 191); |
582 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 204, 208, 183); | 582 m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 204, 208, 183); |
583 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 128, 128, 0); | 583 m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 128, 128, 0); |
584 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); | 584 m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); |
585 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); | 585 m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); |
586 } | 586 } |
587 } | 587 } |
OLD | NEW |