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_widgettp.h" | 7 #include "xfa/fwl/theme/cfwl_widgettp.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return &m_dwValue; | 142 return &m_dwValue; |
143 } | 143 } |
144 case CFWL_WidgetCapacity::LineHeight: { | 144 case CFWL_WidgetCapacity::LineHeight: { |
145 m_fValue = kLineHeight; | 145 m_fValue = kLineHeight; |
146 break; | 146 break; |
147 } | 147 } |
148 case CFWL_WidgetCapacity::UIMargin: { | 148 case CFWL_WidgetCapacity::UIMargin: { |
149 m_rtMargin.Set(0, 0, 0, 0); | 149 m_rtMargin.Set(0, 0, 0, 0); |
150 return &m_rtMargin; | 150 return &m_rtMargin; |
151 } | 151 } |
152 default: { return NULL; } | 152 default: { return nullptr; } |
153 } | 153 } |
154 return &m_fValue; | 154 return &m_fValue; |
155 } | 155 } |
156 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { | 156 FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { |
157 return FWL_GetThemeLayout(m_dwThemeID); | 157 return FWL_GetThemeLayout(m_dwThemeID); |
158 } | 158 } |
159 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, | 159 FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, |
160 CFX_RectF& rect) { | 160 CFX_RectF& rect) { |
161 return FWL_Error::Succeeded; | 161 return FWL_Error::Succeeded; |
162 } | 162 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 FWLTHEME_STATE eState, | 657 FWLTHEME_STATE eState, |
658 CFX_Matrix* pMatrix) { | 658 CFX_Matrix* pMatrix) { |
659 DrawBtn(pGraphics, pRect, eState, pMatrix); | 659 DrawBtn(pGraphics, pRect, eState, pMatrix); |
660 if (!CFWL_ArrowData::IsInstance()) { | 660 if (!CFWL_ArrowData::IsInstance()) { |
661 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); | 661 CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); |
662 } | 662 } |
663 CFWL_ArrowData::CColorData* pColorData = | 663 CFWL_ArrowData::CColorData* pColorData = |
664 CFWL_ArrowData::GetInstance()->m_pColorData; | 664 CFWL_ArrowData::GetInstance()->m_pColorData; |
665 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); | 665 DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); |
666 } | 666 } |
667 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { | 667 CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) { |
668 SetColorData(0); | 668 SetColorData(0); |
669 } | 669 } |
670 CFWL_FontData::CFWL_FontData() | 670 CFWL_FontData::CFWL_FontData() |
671 : m_dwStyles(0), | 671 : m_dwStyles(0), |
672 m_dwCodePage(0), | 672 m_dwCodePage(0), |
673 m_pFont(0), | 673 m_pFont(0), |
674 m_pFontMgr(NULL) | 674 m_pFontMgr(nullptr) |
675 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 675 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
676 , | 676 , |
677 m_pFontSource(NULL) | 677 m_pFontSource(nullptr) |
678 #endif | 678 #endif |
679 { | 679 { |
680 } | 680 } |
681 CFWL_FontData::~CFWL_FontData() { | 681 CFWL_FontData::~CFWL_FontData() { |
682 if (m_pFont) { | 682 if (m_pFont) { |
683 m_pFont->Release(); | 683 m_pFont->Release(); |
684 } | 684 } |
685 if (m_pFontMgr) { | 685 if (m_pFontMgr) { |
686 m_pFontMgr->Release(); | 686 m_pFontMgr->Release(); |
687 } | 687 } |
688 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 688 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
689 if (m_pFontSource != NULL) { | 689 if (m_pFontSource) |
690 m_pFontSource->Release(); | 690 m_pFontSource->Release(); |
691 } | |
692 #endif | 691 #endif |
693 } | 692 } |
694 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, | 693 FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, |
695 uint32_t dwFontStyles, | 694 uint32_t dwFontStyles, |
696 uint16_t wCodePage) { | 695 uint16_t wCodePage) { |
697 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && | 696 return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && |
698 m_dwCodePage == wCodePage; | 697 m_dwCodePage == wCodePage; |
699 } | 698 } |
700 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, | 699 FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, |
701 uint32_t dwFontStyles, | 700 uint32_t dwFontStyles, |
702 uint16_t dwCodePage) { | 701 uint16_t dwCodePage) { |
703 m_wsFamily = wsFontFamily; | 702 m_wsFamily = wsFontFamily; |
704 m_dwStyles = dwFontStyles; | 703 m_dwStyles = dwFontStyles; |
705 m_dwCodePage = dwCodePage; | 704 m_dwCodePage = dwCodePage; |
706 if (!m_pFontMgr) { | 705 if (!m_pFontMgr) { |
707 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 706 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
708 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); | 707 m_pFontMgr = IFGAS_FontMgr::Create(FX_GetDefFontEnumerator()); |
709 #else | 708 #else |
710 m_pFontSource = new CFX_FontSourceEnum_File; | 709 m_pFontSource = new CFX_FontSourceEnum_File; |
711 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); | 710 m_pFontMgr = IFGAS_FontMgr::Create(m_pFontSource); |
712 #endif | 711 #endif |
713 } | 712 } |
714 m_pFont = IFGAS_Font::LoadFont(wsFontFamily.c_str(), dwFontStyles, dwCodePage, | 713 m_pFont = IFGAS_Font::LoadFont(wsFontFamily.c_str(), dwFontStyles, dwCodePage, |
715 m_pFontMgr); | 714 m_pFontMgr); |
716 return m_pFont != NULL; | 715 return !!m_pFont; |
717 } | 716 } |
718 | 717 |
719 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; | 718 CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; |
720 CFWL_FontManager* CFWL_FontManager::GetInstance() { | 719 CFWL_FontManager* CFWL_FontManager::GetInstance() { |
721 if (!s_FontManager) | 720 if (!s_FontManager) |
722 s_FontManager = new CFWL_FontManager; | 721 s_FontManager = new CFWL_FontManager; |
723 return s_FontManager; | 722 return s_FontManager; |
724 } | 723 } |
725 void CFWL_FontManager::DestroyInstance() { | 724 void CFWL_FontManager::DestroyInstance() { |
726 delete s_FontManager; | 725 delete s_FontManager; |
(...skipping 21 matching lines...) Expand all Loading... |
748 CFWL_ArrowData::DestroyInstance(); | 747 CFWL_ArrowData::DestroyInstance(); |
749 CFWL_FontManager::DestroyInstance(); | 748 CFWL_FontManager::DestroyInstance(); |
750 } | 749 } |
751 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { | 750 uint32_t FWL_GetThemeLayout(uint32_t dwThemeID) { |
752 return 0xffff0000 & dwThemeID; | 751 return 0xffff0000 & dwThemeID; |
753 } | 752 } |
754 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { | 753 uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { |
755 return 0x0000ffff & dwThemeID; | 754 return 0x0000ffff & dwThemeID; |
756 } | 755 } |
757 | 756 |
758 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; | 757 CFWL_ArrowData* CFWL_ArrowData::m_pInstance = nullptr; |
759 | 758 |
760 CFWL_ArrowData* CFWL_ArrowData::GetInstance() { | 759 CFWL_ArrowData* CFWL_ArrowData::GetInstance() { |
761 if (!m_pInstance) | 760 if (!m_pInstance) |
762 m_pInstance = new CFWL_ArrowData; | 761 m_pInstance = new CFWL_ArrowData; |
763 return m_pInstance; | 762 return m_pInstance; |
764 } | 763 } |
765 | 764 |
766 FX_BOOL CFWL_ArrowData::IsInstance() { | 765 FX_BOOL CFWL_ArrowData::IsInstance() { |
767 return !!m_pInstance; | 766 return !!m_pInstance; |
768 } | 767 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); | 808 m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251); |
810 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); | 809 m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251); |
811 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); | 810 m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235); |
812 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); | 811 m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); |
813 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); | 812 m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133); |
814 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); | 813 m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133); |
815 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); | 814 m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133); |
816 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); | 815 m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); |
817 } | 816 } |
818 } | 817 } |
OLD | NEW |