| 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_formtp.h" | 7 #include "xfa/fwl/theme/cfwl_formtp.h" |
| 8 | 8 |
| 9 #include "xfa/fde/tto/fde_textout.h" | 9 #include "xfa/fde/tto/fde_textout.h" |
| 10 #include "xfa/fwl/core/cfwl_themebackground.h" | 10 #include "xfa/fwl/core/cfwl_themebackground.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #define FWLTHEME_FORMBTN_Size 21 | 28 #define FWLTHEME_FORMBTN_Size 21 |
| 29 | 29 |
| 30 CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { | 30 CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { |
| 31 m_pThemeData = new SBThemeData; | 31 m_pThemeData = new SBThemeData; |
| 32 SetThemeData(0); | 32 SetThemeData(0); |
| 33 m_rtDisLBorder.Reset(); | 33 m_rtDisLBorder.Reset(); |
| 34 m_rtDisRBorder.Reset(); | 34 m_rtDisRBorder.Reset(); |
| 35 m_rtDisBBorder.Reset(); | 35 m_rtDisBBorder.Reset(); |
| 36 m_rtDisCaption.Reset(); | 36 m_rtDisCaption.Reset(); |
| 37 } | 37 } |
| 38 |
| 38 CFWL_FormTP::~CFWL_FormTP() { | 39 CFWL_FormTP::~CFWL_FormTP() { |
| 39 if (m_pThemeData) { | 40 delete m_pThemeData; |
| 40 delete m_pThemeData; | |
| 41 m_pThemeData = NULL; | |
| 42 } | |
| 43 } | 41 } |
| 42 |
| 44 FWL_ERR CFWL_FormTP::Initialize() { | 43 FWL_ERR CFWL_FormTP::Initialize() { |
| 45 InitTTO(); | 44 InitTTO(); |
| 46 InitCaption(TRUE); | 45 InitCaption(TRUE); |
| 47 InitCaption(FALSE); | 46 InitCaption(FALSE); |
| 48 return CFWL_WidgetTP::Initialize(); | 47 return CFWL_WidgetTP::Initialize(); |
| 49 } | 48 } |
| 49 |
| 50 FWL_ERR CFWL_FormTP::Finalize() { | 50 FWL_ERR CFWL_FormTP::Finalize() { |
| 51 FinalizeTTO(); | 51 FinalizeTTO(); |
| 52 if (m_pActiveBitmap) { | 52 delete m_pActiveBitmap; |
| 53 delete m_pActiveBitmap; | 53 m_pActiveBitmap = nullptr; |
| 54 m_pActiveBitmap = NULL; | 54 delete m_pDeactivebitmap; |
| 55 } | 55 m_pDeactivebitmap = nullptr; |
| 56 if (m_pDeactivebitmap) { | |
| 57 delete m_pDeactivebitmap; | |
| 58 m_pDeactivebitmap = NULL; | |
| 59 } | |
| 60 return CFWL_WidgetTP::Finalize(); | 56 return CFWL_WidgetTP::Finalize(); |
| 61 } | 57 } |
| 58 |
| 62 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { | 59 FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { |
| 63 if (!pWidget) | 60 if (!pWidget) |
| 64 return FALSE; | 61 return FALSE; |
| 65 uint32_t dwHash = pWidget->GetClassID(); | 62 uint32_t dwHash = pWidget->GetClassID(); |
| 66 return dwHash == FWL_CLASSHASH_Form; | 63 return dwHash == FWL_CLASSHASH_Form; |
| 67 } | 64 } |
| 68 uint32_t CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, | 65 uint32_t CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, |
| 69 uint32_t dwThemeID, | 66 uint32_t dwThemeID, |
| 70 FX_BOOL bChildren) { | 67 FX_BOOL bChildren) { |
| 71 if (m_pThemeData) { | 68 if (m_pThemeData) { |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 clrBack = ArgbEncode(0xff, iRB + (iRF - iRB) * iAlfaF / 255, | 840 clrBack = ArgbEncode(0xff, iRB + (iRF - iRB) * iAlfaF / 255, |
| 844 iGB + (iGF - iGB) * iAlfaF / 255, | 841 iGB + (iGF - iGB) * iAlfaF / 255, |
| 845 iBB + (iBF - iBB) * iAlfaF / 255); | 842 iBB + (iBF - iBB) * iAlfaF / 255); |
| 846 } | 843 } |
| 847 void CFWL_FormTP::InitCaption(FX_BOOL bActive) { | 844 void CFWL_FormTP::InitCaption(FX_BOOL bActive) { |
| 848 if (bActive) { | 845 if (bActive) { |
| 849 CFX_FxgeDevice dev; | 846 CFX_FxgeDevice dev; |
| 850 CFX_Graphics gs; | 847 CFX_Graphics gs; |
| 851 CFX_Path path; | 848 CFX_Path path; |
| 852 path.Create(); | 849 path.Create(); |
| 853 if (m_pActiveBitmap) { | 850 delete m_pActiveBitmap; |
| 854 delete m_pActiveBitmap; | |
| 855 m_pActiveBitmap = NULL; | |
| 856 } | |
| 857 m_pActiveBitmap = new CFX_DIBitmap; | 851 m_pActiveBitmap = new CFX_DIBitmap; |
| 858 m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); | 852 m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); |
| 859 dev.Attach(m_pActiveBitmap); | 853 dev.Attach(m_pActiveBitmap); |
| 860 gs.Create(&dev); | 854 gs.Create(&dev); |
| 861 path.AddRectangle(0, 0, 1, 5); | 855 path.AddRectangle(0, 0, 1, 5); |
| 862 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0], | 856 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0], |
| 863 m_pThemeData->clrHeadBK[0][1], &path); | 857 m_pThemeData->clrHeadBK[0][1], &path); |
| 864 path.Clear(); | 858 path.Clear(); |
| 865 path.AddRectangle(0, 5, 1, 15); | 859 path.AddRectangle(0, 5, 1, 15); |
| 866 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1], | 860 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1], |
| 867 m_pThemeData->clrHeadBK[0][2], &path); | 861 m_pThemeData->clrHeadBK[0][2], &path); |
| 868 path.Clear(); | 862 path.Clear(); |
| 869 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); | 863 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); |
| 870 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, | 864 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, |
| 871 m_pThemeData->clrHeadBK[0][2], | 865 m_pThemeData->clrHeadBK[0][2], |
| 872 m_pThemeData->clrHeadBK[0][3], &path); | 866 m_pThemeData->clrHeadBK[0][3], &path); |
| 873 } else { | 867 } else { |
| 874 CFX_FxgeDevice dev; | 868 CFX_FxgeDevice dev; |
| 875 CFX_Graphics gs; | 869 CFX_Graphics gs; |
| 876 CFX_Path path; | 870 CFX_Path path; |
| 877 path.Create(); | 871 path.Create(); |
| 878 if (m_pDeactivebitmap) { | 872 delete m_pDeactivebitmap; |
| 879 delete m_pDeactivebitmap; | |
| 880 m_pDeactivebitmap = NULL; | |
| 881 } | |
| 882 m_pDeactivebitmap = new CFX_DIBitmap; | 873 m_pDeactivebitmap = new CFX_DIBitmap; |
| 883 m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); | 874 m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); |
| 884 dev.Attach(m_pDeactivebitmap); | 875 dev.Attach(m_pDeactivebitmap); |
| 885 gs.Create(&dev); | 876 gs.Create(&dev); |
| 886 path.AddRectangle(0, 0, 1, 5); | 877 path.AddRectangle(0, 0, 1, 5); |
| 887 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0], | 878 DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0], |
| 888 m_pThemeData->clrHeadBK[1][1], &path); | 879 m_pThemeData->clrHeadBK[1][1], &path); |
| 889 path.Clear(); | 880 path.Clear(); |
| 890 path.AddRectangle(0, 5, 1, 15); | 881 path.AddRectangle(0, 5, 1, 15); |
| 891 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], | 882 DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], |
| 892 m_pThemeData->clrHeadBK[1][2], &path); | 883 m_pThemeData->clrHeadBK[1][2], &path); |
| 893 path.Clear(); | 884 path.Clear(); |
| 894 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); | 885 path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); |
| 895 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, | 886 DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, |
| 896 m_pThemeData->clrHeadBK[1][2], | 887 m_pThemeData->clrHeadBK[1][2], |
| 897 m_pThemeData->clrHeadBK[1][3], &path); | 888 m_pThemeData->clrHeadBK[1][3], &path); |
| 898 } | 889 } |
| 899 } | 890 } |
| OLD | NEW |