summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-03 15:47:20 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-03 21:15:57 +0000
commit72f50f2021cd9f66016c962df8d27fc0c34748cd (patch)
tree735ae945128093c89634eb5bccba29af00f4d7fb
parentc635c93c974db1c55032c36e81e98f3d214a249f (diff)
downloadpdfium-72f50f2021cd9f66016c962df8d27fc0c34748cd.tar.xz
Cleanup ThemeProvider code
Remove unused methods, fold the arrow data into the CFWL_WidgetTP instead of a custom class and global object. Change-Id: Ie942052555d6c8668d27072c1fcc5e8e00597518 Reviewed-on: https://pdfium-review.googlesource.com/2139 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r--BUILD.gn2
-rw-r--r--xfa/fwl/theme/cfwl_arrowdata.cpp60
-rw-r--r--xfa/fwl/theme/cfwl_arrowdata.h37
-rw-r--r--xfa/fwl/theme/cfwl_barcodetp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_barcodetp.h1
-rw-r--r--xfa/fwl/theme/cfwl_carettp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_carettp.h1
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp20
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.h1
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.h1
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_datetimepickertp.h1
-rw-r--r--xfa/fwl/theme/cfwl_edittp.cpp15
-rw-r--r--xfa/fwl/theme/cfwl_edittp.h3
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.cpp14
-rw-r--r--xfa/fwl/theme/cfwl_listboxtp.h3
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp20
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.h1
-rw-r--r--xfa/fwl/theme/cfwl_pictureboxtp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_pictureboxtp.h1
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp14
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.h3
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp4
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.h1
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp332
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h57
27 files changed, 66 insertions, 546 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 1244bccf99..92bd5242a4 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1290,8 +1290,6 @@ if (pdf_enable_xfa) {
"xfa/fwl/ifwl_themeprovider.h",
"xfa/fwl/ifwl_widgetdelegate.h",
"xfa/fwl/ifwl_widgetmgrdelegate.h",
- "xfa/fwl/theme/cfwl_arrowdata.cpp",
- "xfa/fwl/theme/cfwl_arrowdata.h",
"xfa/fwl/theme/cfwl_barcodetp.cpp",
"xfa/fwl/theme/cfwl_barcodetp.h",
"xfa/fwl/theme/cfwl_carettp.cpp",
diff --git a/xfa/fwl/theme/cfwl_arrowdata.cpp b/xfa/fwl/theme/cfwl_arrowdata.cpp
deleted file mode 100644
index 523a8555bf..0000000000
--- a/xfa/fwl/theme/cfwl_arrowdata.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fwl/theme/cfwl_arrowdata.h"
-
-#include <algorithm>
-
-#include "third_party/base/ptr_util.h"
-
-namespace {
-
-CFWL_ArrowData* g_pInstance = nullptr;
-
-} // namespace
-
-CFWL_ArrowData* CFWL_ArrowData::GetInstance() {
- if (!g_pInstance)
- g_pInstance = new CFWL_ArrowData;
- return g_pInstance;
-}
-
-bool CFWL_ArrowData::HasInstance() {
- return !!g_pInstance;
-}
-
-void CFWL_ArrowData::DestroyInstance() {
- delete g_pInstance;
- g_pInstance = nullptr;
-}
-
-CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(nullptr) {
- SetColorData();
-}
-
-CFWL_ArrowData::~CFWL_ArrowData() {}
-
-void CFWL_ArrowData::SetColorData() {
- if (!m_pColorData)
- m_pColorData = pdfium::MakeUnique<CColorData>();
-
- m_pColorData->clrBorder[0] = ArgbEncode(255, 202, 216, 249);
- m_pColorData->clrBorder[1] = ArgbEncode(255, 171, 190, 233);
- m_pColorData->clrBorder[2] = ArgbEncode(255, 135, 147, 219);
- m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153);
- m_pColorData->clrStart[0] = ArgbEncode(255, 225, 234, 254);
- m_pColorData->clrStart[1] = ArgbEncode(255, 253, 255, 255);
- m_pColorData->clrStart[2] = ArgbEncode(255, 110, 142, 241);
- m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251);
- m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
- m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
- m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
- m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
- m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
- m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
-}
diff --git a/xfa/fwl/theme/cfwl_arrowdata.h b/xfa/fwl/theme/cfwl_arrowdata.h
deleted file mode 100644
index 0062e4d6a4..0000000000
--- a/xfa/fwl/theme/cfwl_arrowdata.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FWL_THEME_CFWL_ARROWDATA_H_
-#define XFA_FWL_THEME_CFWL_ARROWDATA_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_system.h"
-#include "core/fxge/fx_dib.h"
-
-class CFWL_ArrowData {
- public:
- struct CColorData {
- FX_ARGB clrBorder[4];
- FX_ARGB clrStart[4];
- FX_ARGB clrEnd[4];
- FX_ARGB clrSign[4];
- };
-
- static CFWL_ArrowData* GetInstance();
- static bool HasInstance();
- static void DestroyInstance();
-
- std::unique_ptr<CColorData> m_pColorData;
-
- private:
- CFWL_ArrowData();
- ~CFWL_ArrowData();
-
- void SetColorData();
-};
-
-#endif // XFA_FWL_THEME_CFWL_ARROWDATA_H_
diff --git a/xfa/fwl/theme/cfwl_barcodetp.cpp b/xfa/fwl/theme/cfwl_barcodetp.cpp
index f0bb22fded..cafdf17933 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.cpp
+++ b/xfa/fwl/theme/cfwl_barcodetp.cpp
@@ -14,10 +14,6 @@ CFWL_BarcodeTP::CFWL_BarcodeTP() {}
CFWL_BarcodeTP::~CFWL_BarcodeTP() {}
-bool CFWL_BarcodeTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::Barcode;
-}
-
void CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_barcodetp.h b/xfa/fwl/theme/cfwl_barcodetp.h
index adc79dc1a2..42b41e7d42 100644
--- a/xfa/fwl/theme/cfwl_barcodetp.h
+++ b/xfa/fwl/theme/cfwl_barcodetp.h
@@ -16,7 +16,6 @@ class CFWL_BarcodeTP : public CFWL_WidgetTP {
~CFWL_BarcodeTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
};
diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp
index 63d6270f77..06df3f51e4 100644
--- a/xfa/fwl/theme/cfwl_carettp.cpp
+++ b/xfa/fwl/theme/cfwl_carettp.cpp
@@ -15,10 +15,6 @@
CFWL_CaretTP::CFWL_CaretTP() {}
CFWL_CaretTP::~CFWL_CaretTP() {}
-bool CFWL_CaretTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::Caret;
-}
-
void CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_carettp.h b/xfa/fwl/theme/cfwl_carettp.h
index d618e72c11..f7d44b7f8e 100644
--- a/xfa/fwl/theme/cfwl_carettp.h
+++ b/xfa/fwl/theme/cfwl_carettp.h
@@ -15,7 +15,6 @@ class CFWL_CaretTP : public CFWL_WidgetTP {
~CFWL_CaretTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index 9109cb61c4..0bc75ec66b 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -36,8 +36,14 @@ CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
m_pCheckPath->Clear();
}
-bool CFWL_CheckBoxTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::CheckBox;
+void CFWL_CheckBoxTP::Initialize() {
+ CFWL_WidgetTP::Initialize();
+ InitTTO();
+}
+
+void CFWL_CheckBoxTP::Finalize() {
+ FinalizeTTO();
+ CFWL_WidgetTP::Finalize();
}
void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
@@ -50,16 +56,6 @@ void CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
CFWL_WidgetTP::DrawText(pParams);
}
-void CFWL_CheckBoxTP::Initialize() {
- InitTTO();
- CFWL_WidgetTP::Initialize();
-}
-
-void CFWL_CheckBoxTP::Finalize() {
- FinalizeTTO();
- CFWL_WidgetTP::Finalize();
-}
-
void CFWL_CheckBoxTP::DrawSignCheck(CFX_Graphics* pGraphics,
const CFX_RectF* pRtSign,
FX_ARGB argbFill,
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h
index 1dd204d532..979b970b39 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.h
+++ b/xfa/fwl/theme/cfwl_checkboxtp.h
@@ -20,7 +20,6 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP {
// CFWL_WidgeTP
void Initialize() override;
void Finalize() override;
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawText(CFWL_ThemeText* pParams) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 8f961c9884..567cb2ec2b 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -17,10 +17,6 @@ CFWL_ComboBoxTP::CFWL_ComboBoxTP() {}
CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {}
-bool CFWL_ComboBoxTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::ComboBox;
-}
-
void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h
index e25328101d..183d3a0743 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.h
+++ b/xfa/fwl/theme/cfwl_comboboxtp.h
@@ -15,7 +15,6 @@ class CFWL_ComboBoxTP : public CFWL_WidgetTP {
~CFWL_ComboBoxTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.cpp b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
index 5c4c86aa21..8902ef9351 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.cpp
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.cpp
@@ -13,10 +13,6 @@ CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() {}
CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() {}
-bool CFWL_DateTimePickerTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::DateTimePicker;
-}
-
void CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_datetimepickertp.h b/xfa/fwl/theme/cfwl_datetimepickertp.h
index 2e6ebba7da..11536a390c 100644
--- a/xfa/fwl/theme/cfwl_datetimepickertp.h
+++ b/xfa/fwl/theme/cfwl_datetimepickertp.h
@@ -15,7 +15,6 @@ class CFWL_DateTimePickerTP : public CFWL_WidgetTP {
~CFWL_DateTimePickerTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp
index 5d3447eaa2..eee5423201 100644
--- a/xfa/fwl/theme/cfwl_edittp.cpp
+++ b/xfa/fwl/theme/cfwl_edittp.cpp
@@ -15,11 +15,8 @@
#include "xfa/fxgraphics/cfx_path.h"
CFWL_EditTP::CFWL_EditTP() {}
-CFWL_EditTP::~CFWL_EditTP() {}
-bool CFWL_EditTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::Edit;
-}
+CFWL_EditTP::~CFWL_EditTP() {}
void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (CFWL_Part::CombTextLine == pParams->m_iPart) {
@@ -89,13 +86,3 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
break;
}
}
-
-void CFWL_EditTP::Initialize() {
- InitTTO();
- CFWL_WidgetTP::Initialize();
-}
-
-void CFWL_EditTP::Finalize() {
- FinalizeTTO();
- CFWL_WidgetTP::Finalize();
-}
diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h
index 0230c368af..e1c6ac9242 100644
--- a/xfa/fwl/theme/cfwl_edittp.h
+++ b/xfa/fwl/theme/cfwl_edittp.h
@@ -15,9 +15,6 @@ class CFWL_EditTP : public CFWL_WidgetTP {
~CFWL_EditTP() override;
// CFWL_WidgeTTP
- void Initialize() override;
- void Finalize() override;
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
};
diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp
index 2fc7ba7671..7a9ba92bee 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_listboxtp.cpp
@@ -16,10 +16,6 @@ CFWL_ListBoxTP::CFWL_ListBoxTP() {}
CFWL_ListBoxTP::~CFWL_ListBoxTP() {}
-bool CFWL_ListBoxTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::ListBox;
-}
-
void CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
@@ -63,16 +59,6 @@ void CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
}
-void CFWL_ListBoxTP::Initialize() {
- InitTTO();
- CFWL_WidgetTP::Initialize();
-}
-
-void CFWL_ListBoxTP::Finalize() {
- FinalizeTTO();
- CFWL_WidgetTP::Finalize();
-}
-
void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics,
uint32_t dwStates,
const CFX_RectF* prtItem,
diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h
index 4113f59599..dcf5ec89be 100644
--- a/xfa/fwl/theme/cfwl_listboxtp.h
+++ b/xfa/fwl/theme/cfwl_listboxtp.h
@@ -15,9 +15,6 @@ class CFWL_ListBoxTP : public CFWL_WidgetTP {
~CFWL_ListBoxTP() override;
// CFWL_WidgetTP
- void Initialize() override;
- void Finalize() override;
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index 7e9ea0a72f..d98cf24f85 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -21,8 +21,14 @@ CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() : m_pThemeData(new MCThemeData) {
CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() {}
-bool CFWL_MonthCalendarTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::MonthCalendar;
+void CFWL_MonthCalendarTP::Initialize() {
+ CFWL_WidgetTP::Initialize();
+ InitTTO();
+}
+
+void CFWL_MonthCalendarTP::Finalize() {
+ FinalizeTTO();
+ CFWL_WidgetTP::Finalize();
}
void CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
@@ -96,16 +102,6 @@ void CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) {
CFWL_WidgetTP::DrawText(pParams);
}
-void CFWL_MonthCalendarTP::Initialize() {
- InitTTO();
- CFWL_WidgetTP::Initialize();
-}
-
-void CFWL_MonthCalendarTP::Finalize() {
- FinalizeTTO();
- CFWL_WidgetTP::Finalize();
-}
-
void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams,
CFX_Matrix* pMatrix) {
CFX_Path path;
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
index a5ef6313d4..57438a0551 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.h
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -19,7 +19,6 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
// CFWL_WidgetTP
void Initialize() override;
void Finalize() override;
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
void DrawText(CFWL_ThemeText* pParams) override;
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.cpp b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
index 1d2f2ecd9c..27abbe27e3 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.cpp
@@ -14,10 +14,6 @@ CFWL_PictureBoxTP::CFWL_PictureBoxTP() {}
CFWL_PictureBoxTP::~CFWL_PictureBoxTP() {}
-bool CFWL_PictureBoxTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::PictureBox;
-}
-
void CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_pictureboxtp.h b/xfa/fwl/theme/cfwl_pictureboxtp.h
index 3152103143..4a118f21f8 100644
--- a/xfa/fwl/theme/cfwl_pictureboxtp.h
+++ b/xfa/fwl/theme/cfwl_pictureboxtp.h
@@ -15,7 +15,6 @@ class CFWL_PictureBoxTP : public CFWL_WidgetTP {
~CFWL_PictureBoxTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
};
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index bf3baedd50..a1e57836fa 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -21,10 +21,6 @@ CFWL_PushButtonTP::CFWL_PushButtonTP() : m_pThemeData(new PBThemeData) {
CFWL_PushButtonTP::~CFWL_PushButtonTP() {}
-bool CFWL_PushButtonTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::PushButton;
-}
-
void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
switch (pParams->m_iPart) {
case CFWL_Part::Border: {
@@ -83,16 +79,6 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
}
-void CFWL_PushButtonTP::Initialize() {
- InitTTO();
- CFWL_WidgetTP::Initialize();
-}
-
-void CFWL_PushButtonTP::Finalize() {
- FinalizeTTO();
- CFWL_WidgetTP::Finalize();
-}
-
void CFWL_PushButtonTP::SetThemeData() {
m_pThemeData->clrBorder[0] = ArgbEncode(255, 0, 60, 116);
m_pThemeData->clrBorder[1] = ArgbEncode(255, 0, 60, 116);
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
index 64a0088086..b2372bb066 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.h
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -17,9 +17,6 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP {
~CFWL_PushButtonTP() override;
// CFWL_WidgetTP
- void Initialize() override;
- void Finalize() override;
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 7f5d357c43..4cd2fb376d 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -25,10 +25,6 @@ CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) {
CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {}
-bool CFWL_ScrollBarTP::IsValidWidget(CFWL_Widget* pWidget) {
- return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar;
-}
-
void CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
if (!pParams)
return;
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.h b/xfa/fwl/theme/cfwl_scrollbartp.h
index fe625fb8f4..2389eff3c9 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.h
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -17,7 +17,6 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP {
~CFWL_ScrollBarTP() override;
// CFWL_WidgetTP
- bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
protected:
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 2d61a4100d..395571c2c4 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -19,13 +19,20 @@
#include "xfa/fwl/cfwl_widget.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
#include "xfa/fwl/ifwl_themeprovider.h"
-#include "xfa/fwl/theme/cfwl_arrowdata.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
#include "xfa/fxgraphics/cfx_shading.h"
-bool CFWL_WidgetTP::IsValidWidget(CFWL_Widget* pWidget) {
- return false;
+CFWL_WidgetTP::CFWL_WidgetTP()
+ : m_dwRefCount(1), m_pFDEFont(nullptr), m_pColorData(nullptr) {}
+
+CFWL_WidgetTP::~CFWL_WidgetTP() {}
+
+void CFWL_WidgetTP::Initialize() {}
+
+void CFWL_WidgetTP::Finalize() {
+ if (m_pTextOut)
+ FinalizeTTO();
}
void CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) {}
@@ -42,61 +49,36 @@ void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) {
m_pTextOut->SetRenderDevice(pGraphics->GetRenderDevice());
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
+
CFX_Matrix* pMatrix = &pParams->m_matrix;
pMatrix->Concat(*pGraphics->GetMatrix());
m_pTextOut->SetMatrix(*pMatrix);
m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart);
}
-void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
- if (!pParams || !m_pTextOut)
- return;
-
- m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
- m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext);
- m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(),
- pParams->m_wsText.GetLength(), rect);
-}
-
-void CFWL_WidgetTP::Initialize() {}
-
-void CFWL_WidgetTP::Finalize() {
- if (!m_pTextOut)
- FinalizeTTO();
-}
-
-CFWL_WidgetTP::~CFWL_WidgetTP() {}
-
-void CFWL_WidgetTP::SetFont(CFWL_Widget* pWidget,
- const FX_WCHAR* strFont,
- FX_FLOAT fFontSize,
- FX_ARGB rgbFont) {
- if (!m_pTextOut)
- return;
-
- m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0);
- m_pTextOut->SetFont(m_pFDEFont);
- m_pTextOut->SetFontSize(fFontSize);
- m_pTextOut->SetTextColor(rgbFont);
-}
-
-void CFWL_WidgetTP::SetFont(CFWL_Widget* pWidget,
- CFGAS_GEFont* pFont,
- FX_FLOAT fFontSize,
- FX_ARGB rgbFont) {
- if (!m_pTextOut)
+void CFWL_WidgetTP::InitializeArrowColorData() {
+ if (m_pColorData)
return;
- m_pTextOut->SetFont(pFont);
- m_pTextOut->SetFontSize(fFontSize);
- m_pTextOut->SetTextColor(rgbFont);
-}
-
-CFGAS_GEFont* CFWL_WidgetTP::GetFont(CFWL_Widget* pWidget) {
- return m_pFDEFont;
+ m_pColorData = pdfium::MakeUnique<CColorData>();
+ m_pColorData->clrBorder[0] = ArgbEncode(255, 202, 216, 249);
+ m_pColorData->clrBorder[1] = ArgbEncode(255, 171, 190, 233);
+ m_pColorData->clrBorder[2] = ArgbEncode(255, 135, 147, 219);
+ m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153);
+ m_pColorData->clrStart[0] = ArgbEncode(255, 225, 234, 254);
+ m_pColorData->clrStart[1] = ArgbEncode(255, 253, 255, 255);
+ m_pColorData->clrStart[2] = ArgbEncode(255, 110, 142, 241);
+ m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251);
+ m_pColorData->clrEnd[0] = ArgbEncode(255, 175, 204, 251);
+ m_pColorData->clrEnd[1] = ArgbEncode(255, 185, 218, 251);
+ m_pColorData->clrEnd[2] = ArgbEncode(255, 210, 222, 235);
+ m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236);
+ m_pColorData->clrSign[0] = ArgbEncode(255, 77, 97, 133);
+ m_pColorData->clrSign[1] = ArgbEncode(255, 77, 97, 133);
+ m_pColorData->clrSign[2] = ArgbEncode(255, 77, 97, 133);
+ m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128);
}
-CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pFDEFont(nullptr) {}
void CFWL_WidgetTP::InitTTO() {
if (m_pTextOut)
@@ -115,136 +97,6 @@ void CFWL_WidgetTP::FinalizeTTO() {
m_pTextOut.reset();
}
-void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics,
- FWLTHEME_EDGE eType,
- FX_FLOAT fWidth,
- const CFX_RectF* pRect,
- FX_ARGB cr1,
- FX_ARGB cr2,
- FX_ARGB cr3,
- FX_ARGB cr4,
- CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!pRect)
- return;
- pGraphics->SaveGraphState();
- if (eType == FWLTHEME_EDGE_Flat) {
- CFX_Path path;
- path.Create();
- path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
- path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2,
- pRect->height - 2);
- CFX_Color cr(ArgbEncode(255, 100, 100, 100));
- pGraphics->SetFillColor(&cr);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- path.Clear();
- path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2,
- pRect->height - 2);
- path.AddRectangle(pRect->left + 2, pRect->top + 2, pRect->width - 4,
- pRect->height - 4);
- cr.Set(0xFFFFFFFF);
- pGraphics->SetFillColor(&cr);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- } else {
- FX_FLOAT fLeft = pRect->left;
- FX_FLOAT fRight = pRect->right();
- FX_FLOAT fTop = pRect->top;
- FX_FLOAT fBottom = pRect->bottom();
- FX_FLOAT fHalfWidth = fWidth / 2.0f;
- CFX_Color crLT(eType == FWLTHEME_EDGE_Raised ? cr4 : cr1);
- pGraphics->SetFillColor(&crLT);
- CFX_Path pathLT;
- pathLT.Create();
- pathLT.MoveTo(fLeft, fBottom - fHalfWidth);
- pathLT.LineTo(fLeft, fTop);
- pathLT.LineTo(fRight - fHalfWidth, fTop);
- pathLT.LineTo(fRight - fHalfWidth, fTop + fHalfWidth);
- pathLT.LineTo(fLeft + fHalfWidth, fTop + fHalfWidth);
- pathLT.LineTo(fLeft + fHalfWidth, fBottom - fHalfWidth);
- pathLT.LineTo(fLeft, fBottom - fHalfWidth);
- pGraphics->FillPath(&pathLT, FXFILL_WINDING, pMatrix);
- crLT = CFX_Color(eType == FWLTHEME_EDGE_Raised ? cr3 : cr2);
- pGraphics->SetFillColor(&crLT);
- pathLT.Clear();
- pathLT.MoveTo(fLeft + fHalfWidth, fBottom - fWidth);
- pathLT.LineTo(fLeft + fHalfWidth, fTop + fHalfWidth);
- pathLT.LineTo(fRight - fWidth, fTop + fHalfWidth);
- pathLT.LineTo(fRight - fWidth, fTop + fWidth);
- pathLT.LineTo(fLeft + fWidth, fTop + fWidth);
- pathLT.LineTo(fLeft + fWidth, fBottom - fWidth);
- pathLT.LineTo(fLeft + fHalfWidth, fBottom - fWidth);
- pGraphics->FillPath(&pathLT, FXFILL_WINDING, pMatrix);
- CFX_Color crRB(eType == FWLTHEME_EDGE_Raised ? cr1 : cr3);
- pGraphics->SetFillColor(&crRB);
- CFX_Path pathRB;
- pathRB.Create();
- pathRB.MoveTo(fRight - fHalfWidth, fTop + fHalfWidth);
- pathRB.LineTo(fRight - fHalfWidth, fBottom - fHalfWidth);
- pathRB.LineTo(fLeft + fHalfWidth, fBottom - fHalfWidth);
- pathRB.LineTo(fLeft + fHalfWidth, fBottom - fWidth);
- pathRB.LineTo(fRight - fWidth, fBottom - fWidth);
- pathRB.LineTo(fRight - fWidth, fTop + fHalfWidth);
- pathRB.LineTo(fRight - fHalfWidth, fTop + fHalfWidth);
- pGraphics->FillPath(&pathRB, FXFILL_WINDING, pMatrix);
- crRB = CFX_Color(eType == FWLTHEME_EDGE_Raised ? cr2 : cr4);
- pGraphics->SetFillColor(&crRB);
- pathRB.Clear();
- pathRB.MoveTo(fRight, fTop);
- pathRB.LineTo(fRight, fBottom);
- pathRB.LineTo(fLeft, fBottom);
- pathRB.LineTo(fLeft, fBottom - fHalfWidth);
- pathRB.LineTo(fRight - fHalfWidth, fBottom - fHalfWidth);
- pathRB.LineTo(fRight - fHalfWidth, fTop);
- pathRB.LineTo(fRight, fTop);
- pGraphics->FillPath(&pathRB, FXFILL_WINDING, pMatrix);
- }
- pGraphics->RestoreGraphState();
-}
-
-void CFWL_WidgetTP::Draw3DCircle(CFX_Graphics* pGraphics,
- FWLTHEME_EDGE eType,
- FX_FLOAT fWidth,
- const CFX_RectF* pRect,
- FX_ARGB cr1,
- FX_ARGB cr2,
- FX_ARGB cr3,
- FX_ARGB cr4,
- CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!pRect)
- return;
- pGraphics->SaveGraphState();
- CFX_Path path;
- path.Create();
- path.AddArc(pRect->left, pRect->top, pRect->width, pRect->height,
- FX_PI * 3 / 4, FX_PI);
- CFX_Color crFill1(eType == FWLTHEME_EDGE_Raised ? cr4 : cr1);
- pGraphics->SetStrokeColor(&crFill1);
- pGraphics->StrokePath(&path, pMatrix);
- CFX_RectF rtInner(*pRect);
- rtInner.Deflate(pRect->width / 4, pRect->height / 4);
- path.Clear();
- path.AddArc(rtInner.left, rtInner.top, rtInner.width, rtInner.height,
- FX_PI * 3 / 4, FX_PI);
- CFX_Color crFill2(eType == FWLTHEME_EDGE_Raised ? cr3 : cr2);
- pGraphics->SetStrokeColor(&crFill2);
- pGraphics->StrokePath(&path, pMatrix);
- path.Clear();
- path.AddArc(pRect->left, pRect->top, pRect->width, pRect->height,
- FX_PI * 7 / 4, FX_PI);
- CFX_Color crFill3(eType == FWLTHEME_EDGE_Raised ? cr1 : cr3);
- pGraphics->SetStrokeColor(&crFill3);
- pGraphics->StrokePath(&path, pMatrix);
- path.AddArc(rtInner.left, rtInner.top, rtInner.width, rtInner.height,
- FX_PI * 7 / 4, FX_PI);
- CFX_Color crFill4(eType == FWLTHEME_EDGE_Raised ? cr2 : cr4);
- pGraphics->SetStrokeColor(&crFill4);
- pGraphics->StrokePath(&path, pMatrix);
- pGraphics->RestoreGraphState();
-}
-
void CFWL_WidgetTP::DrawBorder(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
@@ -311,53 +163,6 @@ void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics,
pGraphics->RestoreGraphState();
}
-void CFWL_WidgetTP::DrawAnnulusRect(CFX_Graphics* pGraphics,
- FX_ARGB fillColor,
- const CFX_RectF* pRect,
- FX_FLOAT fRingWidth,
- CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!pRect)
- return;
- pGraphics->SaveGraphState();
- CFX_Color cr(fillColor);
- pGraphics->SetFillColor(&cr);
- CFX_Path path;
- path.Create();
- CFX_RectF rtInner(*pRect);
- rtInner.Deflate(fRingWidth, fRingWidth);
- path.AddRectangle(rtInner.left, rtInner.top, rtInner.width, rtInner.height);
- path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
- pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- pGraphics->RestoreGraphState();
-}
-
-void CFWL_WidgetTP::DrawAnnulusCircle(CFX_Graphics* pGraphics,
- FX_ARGB fillColor,
- const CFX_RectF* pRect,
- FX_FLOAT fWidth,
- CFX_Matrix* pMatrix) {
- if (!pGraphics)
- return;
- if (!pRect)
- return;
- if (fWidth > pRect->width / 2) {
- return;
- }
- pGraphics->SaveGraphState();
- CFX_Color cr(fillColor);
- pGraphics->SetFillColor(&cr);
- CFX_Path path;
- path.Create();
- path.AddEllipse(*pRect);
- CFX_RectF rtIn(*pRect);
- rtIn.Inflate(-fWidth, -fWidth);
- path.AddEllipse(rtIn);
- pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix);
- pGraphics->RestoreGraphState();
-}
-
void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
@@ -376,61 +181,6 @@ void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics,
pGraphics->StrokePath(&path, pMatrix);
pGraphics->RestoreGraphState();
}
-#define FWLTHEME_ARROW_Denominator 3
-void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics,
- const CFX_RectF* pRect,
- FWLTHEME_DIRECTION eDict,
- FX_ARGB argbFill,
- bool bPressed,
- CFX_Matrix* pMatrix) {
- CFX_RectF rtArrow(*pRect);
- CFX_Path path;
- path.Create();
- FX_FLOAT fBtn =
- std::min(pRect->width, pRect->height) / FWLTHEME_ARROW_Denominator;
- rtArrow.left = pRect->left + (pRect->width - fBtn) / 2;
- rtArrow.top = pRect->top + (pRect->height - fBtn) / 2;
- rtArrow.width = fBtn;
- rtArrow.height = fBtn;
- if (bPressed) {
- rtArrow.Offset(1, 1);
- }
- switch (eDict) {
- case FWLTHEME_DIRECTION_Up: {
- path.MoveTo(rtArrow.left, rtArrow.bottom());
- path.LineTo(rtArrow.right(), rtArrow.bottom());
- path.LineTo(rtArrow.left + fBtn / 2, rtArrow.top);
- path.LineTo(rtArrow.left, rtArrow.bottom());
- break;
- }
- case FWLTHEME_DIRECTION_Left: {
- path.MoveTo(rtArrow.right(), rtArrow.top);
- path.LineTo(rtArrow.right(), rtArrow.bottom());
- path.LineTo(rtArrow.left, rtArrow.top + fBtn / 2);
- path.LineTo(rtArrow.right(), rtArrow.top);
- break;
- }
- case FWLTHEME_DIRECTION_Right: {
- path.MoveTo(rtArrow.left, rtArrow.top);
- path.LineTo(rtArrow.left, rtArrow.bottom());
- path.LineTo(rtArrow.right(), rtArrow.top + fBtn / 2);
- path.LineTo(rtArrow.left, rtArrow.top);
- break;
- }
- case FWLTHEME_DIRECTION_Down:
- default: {
- path.MoveTo(rtArrow.left, rtArrow.top);
- path.LineTo(rtArrow.right(), rtArrow.top);
- path.LineTo(rtArrow.left + fBtn / 2, rtArrow.bottom());
- path.LineTo(rtArrow.left, rtArrow.top);
- }
- }
- pGraphics->SaveGraphState();
- CFX_Color cr(argbFill);
- pGraphics->SetFillColor(&cr);
- pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix);
- pGraphics->RestoreGraphState();
-}
void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
@@ -494,20 +244,19 @@ void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics,
CFX_Matrix* pMatrix) {
CFX_Path path;
path.Create();
- if (!CFWL_ArrowData::HasInstance())
- CFWL_ArrowData::GetInstance();
- CFWL_ArrowData::CColorData* pColorData =
- CFWL_ArrowData::GetInstance()->m_pColorData.get();
+ InitializeArrowColorData();
+
FX_FLOAT fRight = pRect->right();
FX_FLOAT fBottom = pRect->bottom();
path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom,
- pColorData->clrStart[eState - 1],
- pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING,
+ m_pColorData->clrStart[eState - 1],
+ m_pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING,
pMatrix);
+
CFX_Color rcStroke;
- rcStroke.Set(pColorData->clrBorder[eState - 1]);
+ rcStroke.Set(m_pColorData->clrBorder[eState - 1]);
pGraphics->SetStrokeColor(&rcStroke);
pGraphics->StrokePath(&path, pMatrix);
}
@@ -518,12 +267,10 @@ void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics,
FWLTHEME_STATE eState,
CFX_Matrix* pMatrix) {
DrawBtn(pGraphics, pRect, eState, pMatrix);
- if (!CFWL_ArrowData::HasInstance())
- CFWL_ArrowData::GetInstance();
- CFWL_ArrowData::CColorData* pColorData =
- CFWL_ArrowData::GetInstance()->m_pColorData.get();
- DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix);
+ InitializeArrowColorData();
+ DrawArrow(pGraphics, pRect, eDict, m_pColorData->clrSign[eState - 1],
+ pMatrix);
}
CFWL_FontData::CFWL_FontData() : m_dwStyles(0), m_dwCodePage(0) {}
@@ -587,6 +334,5 @@ CFGAS_GEFont* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily,
}
void FWLTHEME_Release() {
- CFWL_ArrowData::DestroyInstance();
CFWL_FontManager::DestroyInstance();
}
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 50dd478cfd..33a5febbec 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -35,48 +35,25 @@ class CFWL_WidgetTP {
virtual void Initialize();
virtual void Finalize();
- virtual bool IsValidWidget(CFWL_Widget* pWidget);
-
virtual void DrawBackground(CFWL_ThemeBackground* pParams);
virtual void DrawText(CFWL_ThemeText* pParams);
- virtual void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect);
CFGAS_GEFont* GetFont() const { return m_pFDEFont; }
- void SetFont(CFWL_Widget* pWidget,
- const FX_WCHAR* strFont,
- FX_FLOAT fFontSize,
- FX_ARGB rgbFont);
- void SetFont(CFWL_Widget* pWidget,
- CFGAS_GEFont* pFont,
- FX_FLOAT fFontSize,
- FX_ARGB rgbFont);
- CFGAS_GEFont* GetFont(CFWL_Widget* pWidget);
-
protected:
+ struct CColorData {
+ FX_ARGB clrBorder[4];
+ FX_ARGB clrStart[4];
+ FX_ARGB clrEnd[4];
+ FX_ARGB clrSign[4];
+ };
+
CFWL_WidgetTP();
+ void InitializeArrowColorData();
void InitTTO();
void FinalizeTTO();
- void Draw3DRect(CFX_Graphics* pGraphics,
- FWLTHEME_EDGE eType,
- FX_FLOAT fWidth,
- const CFX_RectF* pRect,
- FX_ARGB cr1,
- FX_ARGB cr2,
- FX_ARGB cr3,
- FX_ARGB cr4,
- CFX_Matrix* pMatrix = nullptr);
- void Draw3DCircle(CFX_Graphics* pGraphics,
- FWLTHEME_EDGE eType,
- FX_FLOAT fWidth,
- const CFX_RectF* pRect,
- FX_ARGB cr1,
- FX_ARGB cr2,
- FX_ARGB cr3,
- FX_ARGB cr4,
- CFX_Matrix* pMatrix = nullptr);
void DrawBorder(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
@@ -97,28 +74,12 @@ class CFWL_WidgetTP {
CFX_Path* path,
int32_t fillMode = FXFILL_WINDING,
CFX_Matrix* pMatrix = nullptr);
- void DrawAnnulusRect(CFX_Graphics* pGraphics,
- FX_ARGB fillColor,
- const CFX_RectF* pRect,
- FX_FLOAT fRingWidth = 1,
- CFX_Matrix* pMatrix = nullptr);
- void DrawAnnulusCircle(CFX_Graphics* pGraphics,
- FX_ARGB fillColor,
- const CFX_RectF* pRect,
- FX_FLOAT fWidth = 1,
- CFX_Matrix* pMatrix = nullptr);
void DrawFocus(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix = nullptr);
void DrawArrow(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
FWLTHEME_DIRECTION eDict,
- FX_ARGB argbFill,
- bool bPressed,
- CFX_Matrix* pMatrix = nullptr);
- void DrawArrow(CFX_Graphics* pGraphics,
- const CFX_RectF* pRect,
- FWLTHEME_DIRECTION eDict,
FX_ARGB argSign,
CFX_Matrix* pMatrix = nullptr);
void DrawBtn(CFX_Graphics* pGraphics,
@@ -130,9 +91,11 @@ class CFWL_WidgetTP {
FWLTHEME_DIRECTION eDict,
FWLTHEME_STATE eState,
CFX_Matrix* pMatrix = nullptr);
+
uint32_t m_dwRefCount;
std::unique_ptr<CFDE_TextOut> m_pTextOut;
CFGAS_GEFont* m_pFDEFont;
+ std::unique_ptr<CColorData> m_pColorData;
};
void FWLTHEME_Release();