summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp39
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.h51
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.cpp38
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.h5
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp13
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.h23
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp6
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.h7
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp7
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.h4
10 files changed, 86 insertions, 107 deletions
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index d00a097c61..45b0154bd6 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -28,17 +28,13 @@ const int kSignPath = 100;
#define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226))
#define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255))
-CFWL_CheckBoxTP::CFWL_CheckBoxTP()
- : m_pThemeData(new CKBThemeData), m_pCheckPath(nullptr) {
+CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pThemeData(new CKBThemeData) {
SetThemeData(0);
}
CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
- delete m_pThemeData;
- if (m_pCheckPath) {
+ if (m_pCheckPath)
m_pCheckPath->Clear();
- delete m_pCheckPath;
- }
}
bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
@@ -48,11 +44,11 @@ bool CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
uint32_t CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget,
uint32_t dwThemeID,
FX_BOOL bChildren) {
- if (m_pThemeData) {
+ if (m_pThemeData)
SetThemeData(FWL_GetThemeColor(dwThemeID));
- }
return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
+
FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
if (!m_pTextOut)
return FALSE;
@@ -61,6 +57,7 @@ FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
: FWLTHEME_CAPACITY_TextColor);
return CFWL_WidgetTP::DrawText(pParams);
}
+
FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return FALSE;
@@ -100,14 +97,17 @@ FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
return TRUE;
}
+
FWL_Error CFWL_CheckBoxTP::Initialize() {
InitTTO();
return CFWL_WidgetTP::Initialize();
}
+
FWL_Error CFWL_CheckBoxTP::Finalize() {
FinalizeTTO();
return CFWL_WidgetTP::Finalize();
}
+
void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
@@ -159,6 +159,7 @@ void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget,
m_pThemeData->clrBoxBk[iTheme][0],
m_pThemeData->clrBoxBk[iTheme][1], &path, fillMode, pMatrix);
}
+
void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRtBox,
@@ -216,19 +217,21 @@ void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget,
FillSoildRect(pGraphics, ArgbEncode(255, 33, 161, 33), &rtSign, pMatrix);
}
}
+
void CFWL_CheckBoxTP::DrawSignNeutral(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
CFX_Matrix* pMatrix) {
((CFX_RectF*)pRtSign)->Inflate(-3, -3);
FillSoildRect(pGraphics, m_pThemeData->clrSignNeutral, pRtSign, pMatrix);
}
+
void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
CFX_Matrix* pMatrix) {
- if (!m_pCheckPath) {
- initCheckPath(pRtSign->width);
- }
+ if (!m_pCheckPath)
+ InitCheckPath(pRtSign->width);
+
CFX_Matrix mt;
mt.SetIdentity();
mt.Translate(pRtSign->left, pRtSign->top);
@@ -236,9 +239,10 @@ void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics,
CFX_Color crFill(argbFill);
pGraphics->SaveGraphState();
pGraphics->SetFillColor(&crFill);
- pGraphics->FillPath(m_pCheckPath, FXFILL_WINDING, &mt);
+ pGraphics->FillPath(m_pCheckPath.get(), FXFILL_WINDING, &mt);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
@@ -252,6 +256,7 @@ void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics,
pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
@@ -269,6 +274,7 @@ void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics,
pGraphics->StrokePath(&path, pMatrix);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
@@ -289,6 +295,7 @@ void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics,
pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
@@ -303,6 +310,7 @@ void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics,
pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
@@ -336,6 +344,7 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics,
pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
pGraphics->RestoreGraphState();
}
+
void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRtBox,
@@ -368,6 +377,7 @@ void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget,
}
}
}
+
void CFWL_CheckBoxTP::SetThemeData(uint32_t dwID) {
uint32_t* pData = (uint32_t*)&m_pThemeData->clrBoxBk;
if (dwID) {
@@ -436,9 +446,10 @@ void CFWL_CheckBoxTP::SetThemeData(uint32_t dwID) {
m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26);
}
}
-void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) {
+
+void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
if (!m_pCheckPath) {
- m_pCheckPath = new CFX_Path;
+ m_pCheckPath.reset(new CFX_Path);
m_pCheckPath->Create();
FX_FLOAT fWidth = kSignPath;
FX_FLOAT fHeight = -kSignPath;
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
index ce44f70aef..42d86d180f 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
#define XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
+#include <memory>
+
#include "xfa/fwl/theme/cfwl_utils.h"
#include "xfa/fwl/theme/cfwl_widgettp.h"
@@ -26,61 +28,64 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP {
FWL_Error Finalize() override;
protected:
+ struct CKBThemeData {
+ FX_ARGB clrBoxBk[13][2];
+ FX_ARGB clrSignBorderNormal;
+ FX_ARGB clrSignBorderDisable;
+ FX_ARGB clrSignCheck;
+ FX_ARGB clrSignNeutral;
+ FX_ARGB clrSignNeutralNormal;
+ FX_ARGB clrSignNeutralHover;
+ FX_ARGB clrSignNeutralPressed;
+ };
+
void DrawBoxBk(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
uint32_t dwStates,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSign(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRtBox,
uint32_t dwStates,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignNeutral(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignCheck(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignCircle(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignCross(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignDiamond(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignSquare(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignStar(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
- CFX_Matrix* pMatrix = nullptr);
+ CFX_Matrix* pMatrix);
void DrawSignBorder(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_RectF* pRtBox,
- FX_BOOL bDisable = FALSE,
- CFX_Matrix* pMatrix = nullptr);
+ FX_BOOL bDisable,
+ CFX_Matrix* pMatrix);
void SetThemeData(uint32_t dwID);
- void initCheckPath(FX_FLOAT fCheckLen);
- struct CKBThemeData {
- FX_ARGB clrBoxBk[13][2];
- FX_ARGB clrSignBorderNormal;
- FX_ARGB clrSignBorderDisable;
- FX_ARGB clrSignCheck;
- FX_ARGB clrSignNeutral;
- FX_ARGB clrSignNeutralNormal;
- FX_ARGB clrSignNeutralHover;
- FX_ARGB clrSignNeutralPressed;
- } * m_pThemeData;
- CFX_Path* m_pCheckPath;
+ void InitCheckPath(FX_FLOAT fCheckLen);
+
+ std::unique_ptr<CKBThemeData> m_pThemeData;
+ std::unique_ptr<CFX_Path> m_pCheckPath;
};
#endif // XFA_FWL_THEME_CFWL_CHECKBOXTP_H_
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index a303a4ea1f..d43694c6db 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -9,14 +9,9 @@
#include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
-CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {
- m_pThemeData = new DTPThemeData;
- initThemeData();
-}
+CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {}
-CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {
- delete m_pThemeData;
-}
+CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {}
bool CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker;
@@ -72,32 +67,3 @@ void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
FWLTHEME_DIRECTION_Down, eState, pMatrix);
}
-void CFWL_DateTimePickerTP::initThemeData() {
- uint32_t* pData = (uint32_t*)&m_pThemeData->BoxBkColor;
- *pData++ = 0;
- *pData++ = 0;
- *pData++ = ArgbEncode(255, 220, 220, 215),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 240, 207),
- *pData++ = ArgbEncode(255, 248, 179, 48),
- *pData++ = ArgbEncode(255, 176, 176, 167),
- *pData++ = ArgbEncode(255, 241, 239, 239),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 220, 220, 215),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 240, 207),
- *pData++ = ArgbEncode(255, 248, 179, 48),
- *pData++ = ArgbEncode(255, 176, 176, 167),
- *pData++ = ArgbEncode(255, 241, 239, 239),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 220, 220, 215),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 240, 207),
- *pData++ = ArgbEncode(255, 248, 179, 48),
- *pData++ = ArgbEncode(255, 176, 176, 167),
- *pData++ = ArgbEncode(255, 241, 239, 239),
- *pData++ = ArgbEncode(255, 255, 255, 255),
- *pData++ = ArgbEncode(255, 255, 255, 255);
-}
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h
index 1b8899b73e..04bd910959 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.h
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.h
@@ -20,11 +20,6 @@ class CFWL_DateTimePickerTP : public CFWL_WidgetTP {
protected:
void DrawDropDownButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
- void initThemeData();
-
- struct DTPThemeData {
- FX_ARGB BoxBkColor[13][2];
- } * m_pThemeData;
};
#endif // XFA_FWL_THEME_CFWL_DATETIMEPICKERTP_H_
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index d04ebb16d2..7faa8e1533 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -49,26 +49,25 @@ const int kSeparatorY = kHeaderHeight + kDatesCellHeight + kSeparatorDOffset;
} // namespace
-CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() {
- m_pThemeData = new MCThemeData;
+CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() : m_pThemeData(new MCThemeData) {
SetThemeData(0);
}
-CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() {
- delete m_pThemeData;
-}
+CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() {}
bool CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_Type::MonthCalendar;
}
+
uint32_t CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget,
uint32_t dwThemeID,
FX_BOOL bChildren) {
- if (m_pThemeData) {
+ if (m_pThemeData)
SetThemeData(FWL_GetThemeColor(dwThemeID));
- }
+
return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
+
FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return FALSE;
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
index 7ecbb90cf2..b10258a7f9 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.h
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FWL_THEME_CFWL_MONTHCALENDARTP_H_
#define XFA_FWL_THEME_CFWL_MONTHCALENDARTP_H_
+#include <memory>
+
#include "xfa/fwl/theme/cfwl_widgettp.h"
class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
@@ -27,6 +29,16 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
FWL_Error Finalize() override;
protected:
+ struct MCThemeData {
+ FX_ARGB clrCaption;
+ FX_ARGB clrSeperator;
+ FX_ARGB clrDatesHoverBK;
+ FX_ARGB clrDatesSelectedBK;
+ FX_ARGB clrDatesCircle;
+ FX_ARGB clrToday;
+ FX_ARGB clrBK;
+ };
+
FX_BOOL DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
FX_BOOL DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
FX_BOOL DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix);
@@ -39,16 +51,7 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
FWLTHEME_STATE GetState(uint32_t dwFWLStates);
void SetThemeData(uint32_t dwThemeID);
- class MCThemeData {
- public:
- FX_ARGB clrCaption;
- FX_ARGB clrSeperator;
- FX_ARGB clrDatesHoverBK;
- FX_ARGB clrDatesSelectedBK;
- FX_ARGB clrDatesCircle;
- FX_ARGB clrToday;
- FX_ARGB clrBK;
- } * m_pThemeData;
+ std::unique_ptr<MCThemeData> m_pThemeData;
CFX_WideString wsResource;
};
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 17c02aef44..cf9991e0f4 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -19,9 +19,7 @@ CFWL_PushButtonTP::CFWL_PushButtonTP() : m_pThemeData(new PBThemeData) {
SetThemeData(0);
}
-CFWL_PushButtonTP::~CFWL_PushButtonTP() {
- delete m_pThemeData;
-}
+CFWL_PushButtonTP::~CFWL_PushButtonTP() {}
bool CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_Type::PushButton;
@@ -155,7 +153,7 @@ void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) {
m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234);
}
}
-int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) {
+int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) const {
int32_t color = 0;
if (dwStates & CFWL_PartState_Disabled)
color += 4;
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
index 6312cd5f29..6c091f7ffd 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.h
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FWL_THEME_CFWL_PUSHBUTTONTP_H_
#define XFA_FWL_THEME_CFWL_PUSHBUTTONTP_H_
+#include <memory>
+
#include "xfa/fwl/theme/cfwl_widgettp.h"
class CFWL_PushButtonTP : public CFWL_WidgetTP {
@@ -41,9 +43,10 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP {
void SetBackgroudColor(uint32_t* pData);
void SetCaptionColor(uint32_t* pData);
void SetCornerColor(uint32_t* pData);
- int32_t GetColorID(uint32_t dwStates);
- struct PBThemeData* m_pThemeData;
+ int32_t GetColorID(uint32_t dwStates) const;
+
+ std::unique_ptr<PBThemeData> m_pThemeData;
};
#endif // XFA_FWL_THEME_CFWL_PUSHBUTTONTP_H_
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index aa801adb6e..6583f0e030 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -23,9 +23,7 @@ CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) {
SetThemeData(0);
}
-CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {
- delete m_pThemeData;
-}
+CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {}
bool CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar;
@@ -41,9 +39,8 @@ void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart,
uint32_t CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget,
uint32_t dwThemeID,
FX_BOOL bChildren) {
- if (m_pThemeData) {
+ if (m_pThemeData)
SetThemeData(FWL_GetThemeColor(dwThemeID));
- }
return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h
index ce32f5e774..e9c6222cd3 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.h
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -7,6 +7,8 @@
#ifndef XFA_FWL_THEME_CFWL_SCROLLBARTP_H_
#define XFA_FWL_THEME_CFWL_SCROLLBARTP_H_
+#include <memory>
+
#include "xfa/fwl/theme/cfwl_widgettp.h"
class CFWL_ScrollBarTP : public CFWL_WidgetTP {
@@ -57,7 +59,7 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP {
CFX_Matrix* pMatrix = nullptr);
void SetThemeData(uint32_t dwID);
- struct SBThemeData* m_pThemeData;
+ std::unique_ptr<SBThemeData> m_pThemeData;
};
#endif // XFA_FWL_THEME_CFWL_SCROLLBARTP_H_