summaryrefslogtreecommitdiff
path: root/xfa/fwl/theme/cfwl_pushbuttontp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-21 06:22:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-21 06:22:11 -0700
commitf87058d19a3448face48202c7040ee4d95ba39c1 (patch)
treedca273099a27add24bcfbc6a2ce5e46cf262dbc5 /xfa/fwl/theme/cfwl_pushbuttontp.cpp
parentb4e8708ce506be308fefc3eb85a427206ef320d8 (diff)
downloadpdfium-f87058d19a3448face48202c7040ee4d95ba39c1.tar.xz
Convert some FWL defines to enums.
This CL converts FWL_WGTCAPACITY_* defines to the CFWL_WidgetCapacity enum class. The FWL_PART_* defines to the FWL_Part enum class and the FWL_PartState_* defines to an enum. Review URL: https://codereview.chromium.org/1898713003
Diffstat (limited to 'xfa/fwl/theme/cfwl_pushbuttontp.cpp')
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 5889f30927..5662ac09c2 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -35,16 +35,16 @@ uint32_t CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget,
}
FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
switch (pParams->m_iPart) {
- case FWL_PART_PSB_Border: {
+ case CFWL_Part::Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
break;
}
- case FWL_PART_PSB_Edge: {
+ case CFWL_Part::Edge: {
DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(),
&pParams->m_rtPart, &pParams->m_matrix);
break;
}
- case FWL_PART_PSB_Background: {
+ case CFWL_Part::Background: {
CFX_RectF& rect = pParams->m_rtPart;
FX_FLOAT fRight = rect.right();
FX_FLOAT fBottom = rect.bottom();
@@ -84,7 +84,7 @@ FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
CFX_Color crFill(m_pThemeData->clrFill[iColor]);
pGraphics->SetFillColor(&crFill);
pGraphics->FillPath(&fillPath, FXFILL_WINDING, &pParams->m_matrix);
- if (pParams->m_dwStates & FWL_PARTSTATE_PSB_Focused) {
+ if (pParams->m_dwStates & CFWL_PartState_Focused) {
rtInner.Inflate(1, 1, 0, 0);
DrawFocus(pGraphics, &rtInner, &pParams->m_matrix);
}
@@ -96,8 +96,8 @@ FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) {
return TRUE;
}
void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart,
- uint32_t dwCapacity) {
- if (dwCapacity == FWL_WGTCAPACITY_PSB_Margin) {
+ CFWL_WidgetCapacity dwCapacity) {
+ if (dwCapacity == CFWL_WidgetCapacity::Margin) {
m_fValue = 0;
return &m_fValue;
}
@@ -157,5 +157,16 @@ void CFWL_PushButtonTP::SetThemeData(uint32_t dwID) {
}
}
int32_t CFWL_PushButtonTP::GetColorID(uint32_t dwStates) {
- return dwStates &= FWL_PARTSTATE_PSB_Mask;
+ int32_t color = 0;
+ if (dwStates & CFWL_PartState_Disabled)
+ color += 4;
+ if (dwStates & CFWL_PartState_Default) {
+ color += 3;
+ } else {
+ if (dwStates & CFWL_PartState_Hovered)
+ color += 2;
+ if (dwStates & CFWL_PartState_Pressed)
+ color += 1;
+ }
+ return color;
}