diff options
Diffstat (limited to 'xfa/fwl/theme')
-rw-r--r-- | xfa/fwl/theme/cfwl_checkboxtp.cpp | 12 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_formtp.cpp | 31 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_pushbuttontp.cpp | 9 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_scrollbartp.cpp | 10 | ||||
-rw-r--r-- | xfa/fwl/theme/cfwl_widgettp.cpp | 21 |
5 files changed, 34 insertions, 49 deletions
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index ccde660693..ac94c80d6d 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -22,21 +22,19 @@ #define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) #define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) -CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { - m_pThemeData = new CKBThemeData; +CFWL_CheckBoxTP::CFWL_CheckBoxTP() + : m_pThemeData(new CKBThemeData), m_pCheckPath(nullptr) { SetThemeData(0); } + CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } + delete m_pThemeData; if (m_pCheckPath) { m_pCheckPath->Clear(); delete m_pCheckPath; - m_pCheckPath = NULL; } } + FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox; } diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp index ec06f4ad24..4a18ea0cc4 100644 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ b/xfa/fwl/theme/cfwl_formtp.cpp @@ -35,30 +35,27 @@ CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { m_rtDisBBorder.Reset(); m_rtDisCaption.Reset(); } + CFWL_FormTP::~CFWL_FormTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } + delete m_pThemeData; } + FWL_ERR CFWL_FormTP::Initialize() { InitTTO(); InitCaption(TRUE); InitCaption(FALSE); return CFWL_WidgetTP::Initialize(); } + FWL_ERR CFWL_FormTP::Finalize() { FinalizeTTO(); - if (m_pActiveBitmap) { - delete m_pActiveBitmap; - m_pActiveBitmap = NULL; - } - if (m_pDeactivebitmap) { - delete m_pDeactivebitmap; - m_pDeactivebitmap = NULL; - } + delete m_pActiveBitmap; + m_pActiveBitmap = nullptr; + delete m_pDeactivebitmap; + m_pDeactivebitmap = nullptr; return CFWL_WidgetTP::Finalize(); } + FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { if (!pWidget) return FALSE; @@ -850,10 +847,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) { CFX_Graphics gs; CFX_Path path; path.Create(); - if (m_pActiveBitmap) { - delete m_pActiveBitmap; - m_pActiveBitmap = NULL; - } + delete m_pActiveBitmap; m_pActiveBitmap = new CFX_DIBitmap; m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); dev.Attach(m_pActiveBitmap); @@ -875,10 +869,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) { CFX_Graphics gs; CFX_Path path; path.Create(); - if (m_pDeactivebitmap) { - delete m_pDeactivebitmap; - m_pDeactivebitmap = NULL; - } + delete m_pDeactivebitmap; m_pDeactivebitmap = new CFX_DIBitmap; m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); dev.Attach(m_pDeactivebitmap); diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 5662ac09c2..780c580369 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -15,15 +15,14 @@ #define PUSHBUTTON_SIZE_Corner 2 -CFWL_PushButtonTP::CFWL_PushButtonTP() { - m_pThemeData = new PBThemeData; +CFWL_PushButtonTP::CFWL_PushButtonTP() : m_pThemeData(new PBThemeData) { SetThemeData(0); } + CFWL_PushButtonTP::~CFWL_PushButtonTP() { - if (m_pThemeData) { - delete m_pThemeData; - } + delete m_pThemeData; } + FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { return pWidget->GetClassID() == FWL_CLASSHASH_PushButton; } diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 11326edf59..0913a8daa2 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -15,16 +15,14 @@ #define FWL_SCROLL_PawLen 12.5f -CFWL_ScrollBarTP::CFWL_ScrollBarTP() { - m_pThemeData = new SBThemeData; +CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) { SetThemeData(0); } + CFWL_ScrollBarTP::~CFWL_ScrollBarTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } + delete m_pThemeData; } + FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { if (!pWidget) return FALSE; diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 7f4e547e24..1ff241636f 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -741,27 +741,26 @@ uint32_t FWL_GetThemeColor(uint32_t dwThemeID) { } CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; + CFWL_ArrowData* CFWL_ArrowData::GetInstance() { - if (!m_pInstance) { + if (!m_pInstance) m_pInstance = new CFWL_ArrowData; - } return m_pInstance; } + FX_BOOL CFWL_ArrowData::IsInstance() { - return (m_pInstance != NULL); + return !!m_pInstance; } + void CFWL_ArrowData::DestroyInstance() { - if (m_pInstance) { - delete m_pInstance; - m_pInstance = NULL; - } + delete m_pInstance; + m_pInstance = nullptr; } + CFWL_ArrowData::~CFWL_ArrowData() { - if (m_pColorData) { - delete m_pColorData; - m_pColorData = NULL; - } + delete m_pColorData; } + void CFWL_ArrowData::SetColorData(uint32_t dwID) { if (!m_pColorData) { m_pColorData = new CColorData; |