summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-01-03 15:46:55 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-01-03 21:10:00 +0000
commitc635c93c974db1c55032c36e81e98f3d214a249f (patch)
tree145a60ec7a1d43755e85e36890f73ba0e4625361 /xfa/fwl/theme
parent3cdcfeb04b5c496199d8c88ebd2402c3db4413ab (diff)
downloadpdfium-c635c93c974db1c55032c36e81e98f3d214a249f.tar.xz
Remove the ::GetCapacity methods.
The GetCapacity methods return a void* because they return different types of internal class memory based on what the calling parameter was. This is confusing and makes it difficult to tell when then enum values can be removed. This CL removes GetCapacity and adds methods as needed to get the real values. Change-Id: I64c2edc858220624880e27f4ed49c2dae080f462 Reviewed-on: https://pdfium-review.googlesource.com/2137 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fwl/theme')
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.cpp15
-rw-r--r--xfa/fwl/theme/cfwl_comboboxtp.h2
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.cpp164
-rw-r--r--xfa/fwl/theme/cfwl_monthcalendartp.h2
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp9
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.h2
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp9
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.h2
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp70
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.h60
10 files changed, 2 insertions, 333 deletions
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp
index 10409a8eeb..8f961c9884 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp
@@ -13,12 +13,6 @@
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
-namespace {
-
-const float kComboFormHandler = 8.0f;
-
-} // namespace
-
CFWL_ComboBoxTP::CFWL_ComboBoxTP() {}
CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {}
@@ -84,15 +78,6 @@ void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams,
pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix);
}
-void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) {
- if (dwCapacity == CFWL_WidgetCapacity::ComboFormHandler) {
- m_fValue = kComboFormHandler;
- return &m_fValue;
- }
- return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
-}
-
void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams,
uint32_t dwStates,
CFX_Matrix* pMatrix) {
diff --git a/xfa/fwl/theme/cfwl_comboboxtp.h b/xfa/fwl/theme/cfwl_comboboxtp.h
index 6abca29d60..e25328101d 100644
--- a/xfa/fwl/theme/cfwl_comboboxtp.h
+++ b/xfa/fwl/theme/cfwl_comboboxtp.h
@@ -17,8 +17,6 @@ class CFWL_ComboBoxTP : public CFWL_WidgetTP {
// CFWL_WidgetTP
bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
- void* GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) override;
protected:
void DrawDropDownButton(CFWL_ThemeBackground* pParams,
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
index a76d959cca..7e9ea0a72f 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp
@@ -15,40 +15,6 @@
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"
-namespace {
-
-const int kWidth = 200;
-const int kHeight = 160;
-
-const int kHeaderWidth = 200;
-const int kHeaderHeight = 30;
-
-const int kButtonWidth = 18;
-const int kButtonHeight = 16;
-const int kButtonHorizontalMargin = 5;
-const int kButtonVerticalMargin = (kHeaderHeight - kButtonHeight) / 2;
-
-const int kHeaderTextWidth = 100;
-const int kHeaderTextHeight = 20;
-const int kHeaderTextHorizontalMargin = (kHeaderWidth - kHeaderTextWidth) / 2;
-const int kHeaderTextVerticalMargin = (kHeaderHeight - kHeaderTextHeight) / 2;
-
-const int kDatesCellWidth = (kHeaderWidth / 7);
-const int kDatesCellHeight = 16;
-const int kWeekWidth = kDatesCellWidth * 7;
-const int kWeekNumWidth = 26;
-const int kWeekNumHeight = (6 * kDatesCellHeight);
-
-const int kHorizontalSeparatorWidth = kWeekWidth - 10;
-const int kHorizontalSeparatorHeight = 1;
-const int kVerticalSeparatorWidth = 1;
-const int kVerticalSeparatorHeight = kWeekNumHeight;
-const int kSeparatorDOffset = -4;
-const int kSeparatorX = 3;
-const int kSeparatorY = kHeaderHeight + kDatesCellHeight + kSeparatorDOffset;
-
-} // namespace
-
CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() : m_pThemeData(new MCThemeData) {
SetThemeData();
}
@@ -130,136 +96,6 @@ void CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) {
CFWL_WidgetTP::DrawText(pParams);
}
-void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) {
- bool bDefPro = false;
- bool bDwordVal = false;
- switch (dwCapacity) {
- case CFWL_WidgetCapacity::HeaderWidth: {
- m_fValue = kHeaderWidth;
- break;
- }
- case CFWL_WidgetCapacity::HeaderHeight: {
- m_fValue = kHeaderHeight;
- break;
- }
- case CFWL_WidgetCapacity::HeaderBtnWidth: {
- m_fValue = kButtonWidth;
- break;
- }
- case CFWL_WidgetCapacity::HeaderBtnHeight: {
- m_fValue = kButtonHeight;
- break;
- }
- case CFWL_WidgetCapacity::HeaderBtnHMargin: {
- bDwordVal = true;
- m_dwValue = kButtonHorizontalMargin;
- break;
- }
- case CFWL_WidgetCapacity::HeaderBtnVMargin: {
- m_fValue = kButtonVerticalMargin;
- break;
- }
- case CFWL_WidgetCapacity::HeaderTextWidth: {
- m_fValue = kHeaderTextWidth;
- break;
- }
- case CFWL_WidgetCapacity::HeaderTextHeight: {
- m_fValue = kHeaderTextHeight;
- break;
- }
- case CFWL_WidgetCapacity::HeaderTextHMargin: {
- m_fValue = kHeaderTextHorizontalMargin;
- break;
- }
- case CFWL_WidgetCapacity::HeaderTextVMargin: {
- m_fValue = kHeaderTextVerticalMargin;
- break;
- }
- case CFWL_WidgetCapacity::HSepWidth: {
- m_fValue = kHorizontalSeparatorWidth;
- break;
- }
- case CFWL_WidgetCapacity::HSepHeight: {
- m_fValue = kHorizontalSeparatorHeight;
- break;
- }
- case CFWL_WidgetCapacity::VSepWidth: {
- m_fValue = kVerticalSeparatorWidth;
- break;
- }
- case CFWL_WidgetCapacity::VSepHeight: {
- m_fValue = kVerticalSeparatorHeight;
- break;
- }
- case CFWL_WidgetCapacity::WeekNumWidth: {
- m_fValue = kWeekNumWidth;
- break;
- }
- case CFWL_WidgetCapacity::WeekNumHeight: {
- m_fValue = kWeekNumHeight;
- break;
- }
- case CFWL_WidgetCapacity::WeekWidth: {
- m_fValue = kWeekWidth;
- break;
- }
- case CFWL_WidgetCapacity::WeekHeight: {
- m_fValue = kDatesCellHeight;
- break;
- }
- case CFWL_WidgetCapacity::SepDOffset: {
- m_fValue = kSeparatorDOffset;
- break;
- }
- case CFWL_WidgetCapacity::SepX: {
- m_fValue = kSeparatorX;
- break;
- }
- case CFWL_WidgetCapacity::SepY: {
- m_fValue = kSeparatorY;
- break;
- }
- case CFWL_WidgetCapacity::DatesCellWidth: {
- m_fValue = kDatesCellWidth;
- break;
- }
- case CFWL_WidgetCapacity::DatesCellHeight: {
- m_fValue = kDatesCellHeight;
- break;
- }
- case CFWL_WidgetCapacity::TodayWidth: {
- m_fValue = kHeaderWidth;
- break;
- }
- case CFWL_WidgetCapacity::TodayHeight: {
- m_fValue = kDatesCellHeight;
- break;
- }
- case CFWL_WidgetCapacity::TodayFlagWidth: {
- m_fValue = kDatesCellWidth;
- break;
- }
- case CFWL_WidgetCapacity::Width: {
- m_fValue = kWidth;
- break;
- }
- case CFWL_WidgetCapacity::Height: {
- m_fValue = kHeight;
- break;
- }
- default:
- bDefPro = true;
- break;
- }
- if (!bDefPro) {
- if (bDwordVal)
- return &m_dwValue;
- return &m_fValue;
- }
- return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
-}
-
void CFWL_MonthCalendarTP::Initialize() {
InitTTO();
CFWL_WidgetTP::Initialize();
diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h
index a0b1322858..a5ef6313d4 100644
--- a/xfa/fwl/theme/cfwl_monthcalendartp.h
+++ b/xfa/fwl/theme/cfwl_monthcalendartp.h
@@ -22,8 +22,6 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP {
bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
void DrawText(CFWL_ThemeText* pParams) override;
- void* GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) override;
protected:
struct MCThemeData {
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 5515ffb578..bf3baedd50 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -83,15 +83,6 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
}
}
-void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) {
- if (dwCapacity == CFWL_WidgetCapacity::Margin) {
- m_fValue = 0;
- return &m_fValue;
- }
- return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
-}
-
void CFWL_PushButtonTP::Initialize() {
InitTTO();
CFWL_WidgetTP::Initialize();
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h
index b0efe036ec..64a0088086 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.h
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.h
@@ -21,8 +21,6 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP {
void Finalize() override;
bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
- void* GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) override;
protected:
struct PBThemeData {
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 0129f353ad..7f5d357c43 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -29,15 +29,6 @@ bool CFWL_ScrollBarTP::IsValidWidget(CFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_Type::ScrollBar;
}
-void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) {
- if (dwCapacity == CFWL_WidgetCapacity::Size) {
- m_fValue = 5;
- return &m_fValue;
- }
- return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity);
-}
-
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 10138d6cf7..fe625fb8f4 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.h
+++ b/xfa/fwl/theme/cfwl_scrollbartp.h
@@ -19,8 +19,6 @@ class CFWL_ScrollBarTP : public CFWL_WidgetTP {
// CFWL_WidgetTP
bool IsValidWidget(CFWL_Widget* pWidget) override;
void DrawBackground(CFWL_ThemeBackground* pParams) override;
- void* GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) override;
protected:
struct SBThemeData {
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 3867257e0c..2d61a4100d 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -24,20 +24,6 @@
#include "xfa/fxgraphics/cfx_path.h"
#include "xfa/fxgraphics/cfx_shading.h"
-namespace {
-
-const float kEdgeFlat = 2.0f;
-const float kEdgeRaised = 2.0f;
-const float kEdgeSunken = 2.0f;
-const float kLineHeight = 12.0f;
-const float kScrollBarWidth = 17.0f;
-const float kCXBorder = 1.0f;
-const float kCYBorder = 1.0f;
-
-#define FWLTHEME_CAPACITY_TextSelColor (ArgbEncode(255, 153, 193, 218))
-
-} // namespace
-
bool CFWL_WidgetTP::IsValidWidget(CFWL_Widget* pWidget) {
return false;
}
@@ -62,62 +48,6 @@ void CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) {
m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart);
}
-void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity) {
- switch (dwCapacity) {
- case CFWL_WidgetCapacity::CXBorder: {
- m_fValue = kCXBorder;
- break;
- }
- case CFWL_WidgetCapacity::CYBorder: {
- m_fValue = kCYBorder;
- break;
- }
- case CFWL_WidgetCapacity::EdgeFlat: {
- m_fValue = kEdgeFlat;
- break;
- }
- case CFWL_WidgetCapacity::EdgeRaised: {
- m_fValue = kEdgeRaised;
- break;
- }
- case CFWL_WidgetCapacity::EdgeSunken: {
- m_fValue = kEdgeSunken;
- break;
- }
- case CFWL_WidgetCapacity::FontSize: {
- m_fValue = FWLTHEME_CAPACITY_FontSize;
- break;
- }
- case CFWL_WidgetCapacity::TextColor: {
- m_dwValue = FWLTHEME_CAPACITY_TextColor;
- return &m_dwValue;
- }
- case CFWL_WidgetCapacity::ScrollBarWidth: {
- m_fValue = kScrollBarWidth;
- break;
- }
- case CFWL_WidgetCapacity::Font: {
- return m_pFDEFont;
- }
- case CFWL_WidgetCapacity::TextSelColor: {
- m_dwValue = FWLTHEME_CAPACITY_TextSelColor;
- return &m_dwValue;
- }
- case CFWL_WidgetCapacity::LineHeight: {
- m_fValue = kLineHeight;
- break;
- }
- case CFWL_WidgetCapacity::UIMargin: {
- m_rtMargin.Set(0, 0, 0, 0);
- return &m_rtMargin;
- }
- default:
- return nullptr;
- }
- return &m_fValue;
-}
-
void CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
if (!pParams || !m_pTextOut)
return;
diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h
index 11135121c0..50dd478cfd 100644
--- a/xfa/fwl/theme/cfwl_widgettp.h
+++ b/xfa/fwl/theme/cfwl_widgettp.h
@@ -16,59 +16,6 @@
#include "xfa/fwl/theme/cfwl_utils.h"
#include "xfa/fxgraphics/cfx_graphics.h"
-enum class CFWL_WidgetCapacity {
- None = 0,
-
- BigIcon,
- ComboFormHandler,
- CXBorder,
- CYBorder,
- CYCaption,
- CYNarrowCaption,
- DatesCellHeight,
- DatesCellWidth,
- EdgeFlat,
- EdgeRaised,
- EdgeSunken,
- Font,
- FontSize,
- HeaderBtnHeight,
- HeaderBtnHMargin,
- HeaderBtnVMargin,
- HeaderBtnWidth,
- HeaderHeight,
- HeaderTextHeight,
- HeaderTextHMargin,
- HeaderTextVMargin,
- HeaderTextWidth,
- HeaderWidth,
- Height,
- HSepHeight,
- HSepWidth,
- LineHeight,
- Margin,
- ScrollBarWidth,
- SepDOffset,
- SepX,
- SepY,
- Size,
- SmallIcon,
- SpaceAboveBelow,
- TextColor,
- TextSelColor,
- TodayFlagWidth,
- TodayHeight,
- TodayWidth,
- UIMargin,
- VSepHeight,
- VSepWidth,
- WeekHeight,
- WeekNumHeight,
- WeekNumWidth,
- WeekWidth,
- Width
-};
-
class CFDE_TextOut;
class CFGAS_GEFont;
class CFWL_ThemeBackground;
@@ -92,10 +39,10 @@ class CFWL_WidgetTP {
virtual void DrawBackground(CFWL_ThemeBackground* pParams);
virtual void DrawText(CFWL_ThemeText* pParams);
- virtual void* GetCapacity(CFWL_ThemePart* pThemePart,
- CFWL_WidgetCapacity dwCapacity);
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,
@@ -186,9 +133,6 @@ class CFWL_WidgetTP {
uint32_t m_dwRefCount;
std::unique_ptr<CFDE_TextOut> m_pTextOut;
CFGAS_GEFont* m_pFDEFont;
- FX_FLOAT m_fValue;
- uint32_t m_dwValue;
- CFX_RectF m_rtMargin;
};
void FWLTHEME_Release();