diff options
Diffstat (limited to 'xfa/src/fwl/theme')
-rw-r--r-- | xfa/src/fwl/theme/barcodetp.cpp | 42 | ||||
-rw-r--r-- | xfa/src/fwl/theme/carettp.cpp | 49 | ||||
-rw-r--r-- | xfa/src/fwl/theme/checkboxtp.cpp | 532 | ||||
-rw-r--r-- | xfa/src/fwl/theme/comboboxtp.cpp | 156 | ||||
-rw-r--r-- | xfa/src/fwl/theme/datetimepickertp.cpp | 138 | ||||
-rw-r--r-- | xfa/src/fwl/theme/edittp.cpp | 89 | ||||
-rw-r--r-- | xfa/src/fwl/theme/formtp.cpp | 893 | ||||
-rw-r--r-- | xfa/src/fwl/theme/listboxtp.cpp | 101 | ||||
-rw-r--r-- | xfa/src/fwl/theme/monthcalendartp.cpp | 582 | ||||
-rw-r--r-- | xfa/src/fwl/theme/pictureboxtp.cpp | 36 | ||||
-rw-r--r-- | xfa/src/fwl/theme/pushbuttontp.cpp | 157 | ||||
-rw-r--r-- | xfa/src/fwl/theme/scrollbartp.cpp | 377 | ||||
-rw-r--r-- | xfa/src/fwl/theme/widgettp.cpp | 840 |
13 files changed, 0 insertions, 3992 deletions
diff --git a/xfa/src/fwl/theme/barcodetp.cpp b/xfa/src/fwl/theme/barcodetp.cpp deleted file mode 100644 index 477ce99d9b..0000000000 --- a/xfa/src/fwl/theme/barcodetp.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/barcodetp.h" - -#include "xfa/include/fwl/basewidget/fwl_barcode.h" -#include "xfa/include/fwl/core/fwl_theme.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -CFWL_BarcodeTP::CFWL_BarcodeTP() {} -CFWL_BarcodeTP::~CFWL_BarcodeTP() {} - -FX_BOOL CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Barcode; -} -FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_BCD_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_BCD_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_BCD_Background: { - FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, - &pParams->m_matrix); - break; - } - default: {} - } - return TRUE; -} diff --git a/xfa/src/fwl/theme/carettp.cpp b/xfa/src/fwl/theme/carettp.cpp deleted file mode 100644 index 88b01d9f3d..0000000000 --- a/xfa/src/fwl/theme/carettp.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/carettp.h" - -#include "xfa/include/fwl/basewidget/fwl_caret.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -CFWL_CaretTP::CFWL_CaretTP() {} -CFWL_CaretTP::~CFWL_CaretTP() {} - -FX_BOOL CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Caret; -} -FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_CAT_Background: { - if (!(pParams->m_dwStates & FWL_PARTSTATE_CAT_HightLight)) { - return TRUE; - } - DrawCaretBK(pParams->m_pGraphics, pParams->m_dwStates, - &(pParams->m_rtPart), (CFX_Color*)pParams->m_pData, - &(pParams->m_matrix)); - break; - } - } - return TRUE; -} -void CFWL_CaretTP::DrawCaretBK(CFX_Graphics* pGraphics, - FX_DWORD dwStates, - const CFX_RectF* pRect, - CFX_Color* crFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_Color crFilltemp; - crFill ? crFilltemp = *crFill : crFilltemp = ArgbEncode(255, 0, 0, 0); - CFX_RectF rect = *pRect; - path.AddRectangle(rect.left, rect.top, rect.width, rect.height); - pGraphics->SetFillColor(&crFilltemp); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); -} diff --git a/xfa/src/fwl/theme/checkboxtp.cpp b/xfa/src/fwl/theme/checkboxtp.cpp deleted file mode 100644 index ccad2bc733..0000000000 --- a/xfa/src/fwl/theme/checkboxtp.cpp +++ /dev/null @@ -1,532 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/checkboxtp.h" - -#include "xfa/include/fwl/basewidget/fwl_checkbox.h" -#include "xfa/include/fwl/core/fwl_widget.h" -#include "xfa/src/fde/tto/fde_textout.h" - -#define CHECKBOX_SIZE_SIGNMARGIN 3 -#define CHECKBOX_SIZE_SIGNBORDER 2 -#define CHECKBOX_SIZE_SIGNPATH 100 -#define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153)) -#define CHECKBOX_COLOR_BOXLT2 (ArgbEncode(255, 113, 111, 100)) -#define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226)) -#define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255)) -#define CHECKBOX_FXGE_CoordinatesAdjust - -CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) { - m_pThemeData = new CKBThemeData; - SetThemeData(0); -} -CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } - 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; -} -FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - 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; - m_pTextOut->SetTextColor((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled - ? FWLTHEME_CAPACITY_TextDisColor - : FWLTHEME_CAPACITY_TextColor); - return CFWL_WidgetTP::DrawText(pParams); -} -FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_CKB_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_CKB_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_CKB_Background: { - FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, - &pParams->m_matrix); - if (pParams->m_dwStates & FWL_PARTSTATE_CKB_Focused) { - pParams->m_rtPart = *(CFX_RectF*)pParams->m_pData; - DrawFocus(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - } - break; - } - case FWL_PART_CKB_CheckBox: { - DrawBoxBk(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, - pParams->m_dwStates, &pParams->m_matrix); - if (((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Checked) | - ((pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral)) { - DrawSign(pParams->m_pWidget, pParams->m_pGraphics, &pParams->m_rtPart, - pParams->m_dwStates, &pParams->m_matrix); - } - FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled; - DrawSignBorder(pParams->m_pWidget, pParams->m_pGraphics, - &pParams->m_rtPart, bDisable, &pParams->m_matrix); - break; - } - default: { return FALSE; } - } - return TRUE; -} -FWL_ERR CFWL_CheckBoxTP::Initialize() { - InitTTO(); - return CFWL_WidgetTP::Initialize(); -} -FWL_ERR CFWL_CheckBoxTP::Finalize() { - FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); -} -void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_DWORD dwStates, - CFX_Matrix* pMatrix) { - dwStates &= 0x03; - int32_t fillMode = FXFILL_WINDING; - FX_DWORD dwStyleEx = pWidget->GetStylesEx(); - dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask; - CFX_Path path; - path.Create(); - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - FX_BOOL bClipSign = - (dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered; - if ((dwStyleEx == FWL_STYLEEXT_CKB_ShapeSolidSquare) || - (dwStyleEx == FWL_STYLEEXT_CKB_ShapeSunkenSquare)) { - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - if (bClipSign) { - fillMode = FXFILL_ALTERNATE; - path.AddRectangle(pRect->left + CHECKBOX_SIZE_SIGNMARGIN, - pRect->top + CHECKBOX_SIZE_SIGNMARGIN, - pRect->width - CHECKBOX_SIZE_SIGNMARGIN * 2, - pRect->height - CHECKBOX_SIZE_SIGNMARGIN * 2); - } - } else { -#ifdef CHECKBOX_FXGE_CoordinatesAdjust - CFX_RectF rect(*pRect); - rect.Deflate(0, 0, 1, 1); - path.AddEllipse(rect); -#else - path.AddEllipse(*pRect); -#endif - if (bClipSign) { - fillMode = FXFILL_ALTERNATE; -#ifdef CHECKBOX_FXGE_CoordinatesAdjust - CFX_RectF rtClip(rect); -#else - CFX_RectF rtClip(*pRect); -#endif - rtClip.Deflate(CHECKBOX_SIZE_SIGNMARGIN - 1, - CHECKBOX_SIZE_SIGNMARGIN - 1); - path.AddEllipse(rtClip); - } - } - int32_t iTheme = 1; - if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Hovered) { - iTheme = 2; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Pressed) { - iTheme = 3; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask1) == - FWL_PARTSTATE_CKB_Disabled) { - iTheme = 4; - } - if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked) { - iTheme += 4; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral) { - iTheme += 8; - } - DrawAxialShading(pGraphics, pRect->left - 1, pRect->top - 1, fRight, fBottom, - 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, - FX_DWORD dwStates, - CFX_Matrix* pMatrix) { - CFX_RectF rtSign(*pRtBox); - rtSign.Deflate(CHECKBOX_SIZE_SIGNMARGIN, CHECKBOX_SIZE_SIGNMARGIN); - FX_DWORD dwColor = m_pThemeData->clrSignCheck; - FX_BOOL bCheck = TRUE; - if (((dwStates & FWL_PARTSTATE_CKB_Mask1) == FWL_PARTSTATE_CKB_Disabled) && - ((dwStates & FWL_PARTSTATE_CKB_Mask2) == FWL_PARTSTATE_CKB_Checked)) { - dwColor = m_pThemeData->clrSignBorderDisable; - } else if ((dwStates & FWL_PARTSTATE_CKB_Mask2) == - FWL_PARTSTATE_CKB_Neutral) { - switch (dwStates & FWL_PARTSTATE_CKB_Mask1) { - case FWL_PARTSTATE_CKB_Normal: { - bCheck = FALSE; - dwColor = m_pThemeData->clrSignNeutralNormal; - break; - } - case FWL_PARTSTATE_CKB_Hovered: { - bCheck = FALSE; - dwColor = m_pThemeData->clrSignNeutralHover; - break; - } - case FWL_PARTSTATE_CKB_Pressed: { - bCheck = FALSE, dwColor = m_pThemeData->clrSignNeutralPressed; - break; - } - case FWL_PARTSTATE_CKB_Disabled: { - bCheck = FALSE, dwColor = m_pThemeData->clrSignBorderDisable; - break; - } - } - } - if (bCheck) { - FX_DWORD dwStyle = pWidget->GetStylesEx(); - switch (dwStyle & FWL_STYLEEXT_CKB_SignShapeMask) { - case FWL_STYLEEXT_CKB_SignShapeCheck: { - DrawSignCheck(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_SignShapeCircle: { - rtSign.Deflate(1, 1); - DrawSignCircle(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_SignShapeCross: { - DrawSignCross(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_SignShapeDiamond: { - DrawSignDiamond(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_SignShapeSquare: { - DrawSignSquare(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_SignShapeStar: { - DrawSignStar(pGraphics, &rtSign, dwColor, pMatrix); - break; - } - } - } else { - 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); - } - CFX_Matrix mt; - mt.SetIdentity(); - mt.Translate(pRtSign->left, pRtSign->top); - mt.Concat(*pMatrix); - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(m_pCheckPath, FXFILL_WINDING, &mt); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics, - const CFX_RectF* pRtSign, - FX_ARGB argbFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - path.AddEllipse(*pRtSign); - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics, - const CFX_RectF* pRtSign, - FX_ARGB argbFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - FX_FLOAT fRight = pRtSign->right(); - FX_FLOAT fBottom = pRtSign->bottom(); - path.AddLine(pRtSign->left, pRtSign->top, fRight, fBottom); - path.AddLine(pRtSign->left, fBottom, fRight, pRtSign->top); - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&crFill); - pGraphics->SetLineWidth(1.0f); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics, - const CFX_RectF* pRtSign, - FX_ARGB argbFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - FX_FLOAT fWidth = pRtSign->width; - FX_FLOAT fHeight = pRtSign->height; - FX_FLOAT fBottom = pRtSign->bottom(); - path.MoveTo(pRtSign->left + fWidth / 2, pRtSign->top); - path.LineTo(pRtSign->left, pRtSign->top + fHeight / 2); - path.LineTo(pRtSign->left + fWidth / 2, fBottom); - path.LineTo(pRtSign->right(), pRtSign->top + fHeight / 2); - path.LineTo(pRtSign->left + fWidth / 2, pRtSign->top); - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics, - const CFX_RectF* pRtSign, - FX_ARGB argbFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width, - pRtSign->height); - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics, - const CFX_RectF* pRtSign, - FX_ARGB argbFill, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - FX_FLOAT fBottom = pRtSign->bottom(); - FX_FLOAT fRadius = - (pRtSign->top - fBottom) / (1 + (FX_FLOAT)cos(FX_PI / 5.0f)); - CFX_PointF ptCenter((pRtSign->left + pRtSign->right()) / 2.0f, - (pRtSign->top + fBottom) / 2.0f); - FX_FLOAT px[5], py[5]; - FX_FLOAT fAngel = FX_PI / 10.0f; - for (int32_t i = 0; i < 5; i++) { - px[i] = ptCenter.x + fRadius * (FX_FLOAT)cos(fAngel); - py[i] = ptCenter.y + fRadius * (FX_FLOAT)sin(fAngel); - fAngel += FX_PI * 2 / 5.0f; - } - path.MoveTo(px[0], py[0]); - int32_t nNext = 0; - for (int32_t j = 0; j < 5; j++) { - nNext += 2; - if (nNext >= 5) { - nNext -= 5; - } - path.LineTo(px[nNext], py[nNext]); - } - CFX_Color crFill(argbFill); - pGraphics->SaveGraphState(); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_CheckBoxTP::DrawSignBorder(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_RectF* pRtBox, - FX_BOOL bDisable, - CFX_Matrix* pMatrix) { - switch (pWidget->GetStylesEx() & FWL_STYLEEXT_CKB_ShapeMask) { - case FWL_STYLEEXT_CKB_ShapeSolidSquare: { - DrawAnnulusRect(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable - : m_pThemeData->clrSignBorderNormal, - pRtBox, 1, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_ShapeSunkenSquare: { - Draw3DRect(pGraphics, FWLTHEME_EDGE_Sunken, CHECKBOX_SIZE_SIGNBORDER, - pRtBox, CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2, - CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_ShapeSolidCircle: { - DrawAnnulusCircle(pGraphics, bDisable ? m_pThemeData->clrSignBorderDisable - : m_pThemeData->clrSignBorderNormal, - pRtBox, 1, pMatrix); - break; - } - case FWL_STYLEEXT_CKB_ShapeSunkenCircle: { - Draw3DCircle(pGraphics, FWLTHEME_EDGE_Sunken, CHECKBOX_SIZE_SIGNBORDER, - pRtBox, CHECKBOX_COLOR_BOXLT1, CHECKBOX_COLOR_BOXLT2, - CHECKBOX_COLOR_BOXRB1, CHECKBOX_COLOR_BOXRB2, pMatrix); - break; - } - } -} -void CFWL_CheckBoxTP::SetThemeData(FX_DWORD dwID) { - FX_DWORD* pData = (FX_DWORD*)&m_pThemeData->clrBoxBk; - if (dwID) { - *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); - m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 154, 167, 114); - m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187); - m_pThemeData->clrSignCheck = ArgbEncode(255, 164, 180, 138); - m_pThemeData->clrSignNeutral = ArgbEncode(2255, 28, 134, 26); - m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113); - m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33); - m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26); - } else { - *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); - m_pThemeData->clrSignBorderNormal = ArgbEncode(255, 28, 81, 128); - m_pThemeData->clrSignBorderDisable = ArgbEncode(255, 202, 200, 187); - m_pThemeData->clrSignCheck = ArgbEncode(255, 28, 81, 128); - m_pThemeData->clrSignNeutral = ArgbEncode(255, 28, 134, 26); - m_pThemeData->clrSignNeutralNormal = ArgbEncode(255, 114, 192, 113); - m_pThemeData->clrSignNeutralHover = ArgbEncode(255, 33, 161, 33); - m_pThemeData->clrSignNeutralPressed = ArgbEncode(255, 28, 134, 26); - } -} -void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) { - if (!m_pCheckPath) { - m_pCheckPath = new CFX_Path; - m_pCheckPath->Create(); - FX_FLOAT fWidth = CHECKBOX_SIZE_SIGNPATH; - FX_FLOAT fHeight = -CHECKBOX_SIZE_SIGNPATH; - FX_FLOAT fBottom = CHECKBOX_SIZE_SIGNPATH; - CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f); - CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f); - CFX_PointF pt3(fWidth / 3.0f, fBottom); - CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f); - CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f); - CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f); - CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f); - CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f); - CFX_PointF pt32(fWidth / 4.0f, fBottom); - CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f), - fBottom + fHeight * 4 / 5.0f); - CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f), - fBottom + fHeight * 4 / 5.0f); - CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f); - CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f); - CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f); - CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f); - m_pCheckPath->MoveTo(pt1.x, pt1.y); - FX_FLOAT px1 = pt12.x - pt1.x; - FX_FLOAT py1 = pt12.y - pt1.y; - FX_FLOAT px2 = pt21.x - pt2.x; - FX_FLOAT py2 = pt21.y - pt2.y; - m_pCheckPath->BezierTo(pt1.x + px1 * FWLTHEME_BEZIER, - pt1.y + py1 * FWLTHEME_BEZIER, - pt2.x + px2 * FWLTHEME_BEZIER, - pt2.y + py2 * FWLTHEME_BEZIER, pt2.x, pt2.y); - px1 = pt23.x - pt2.x; - py1 = pt23.y - pt2.y; - px2 = pt32.x - pt3.x; - py2 = pt32.y - pt3.y; - m_pCheckPath->BezierTo(pt2.x + px1 * FWLTHEME_BEZIER, - pt2.y + py1 * FWLTHEME_BEZIER, - pt3.x + px2 * FWLTHEME_BEZIER, - pt3.y + py2 * FWLTHEME_BEZIER, pt3.x, pt3.y); - px1 = pt34.x - pt3.x; - py1 = pt34.y - pt3.y; - px2 = pt43.x - pt4.x; - py2 = pt43.y - pt4.y; - m_pCheckPath->BezierTo(pt3.x + px1 * FWLTHEME_BEZIER, - pt3.y + py1 * FWLTHEME_BEZIER, - pt4.x + px2 * FWLTHEME_BEZIER, - pt4.y + py2 * FWLTHEME_BEZIER, pt4.x, pt4.y); - px1 = pt45.x - pt4.x; - py1 = pt45.y - pt4.y; - px2 = pt54.x - pt5.x; - py2 = pt54.y - pt5.y; - m_pCheckPath->BezierTo(pt4.x + px1 * FWLTHEME_BEZIER, - pt4.y + py1 * FWLTHEME_BEZIER, - pt5.x + px2 * FWLTHEME_BEZIER, - pt5.y + py2 * FWLTHEME_BEZIER, pt5.x, pt5.y); - px1 = pt51.x - pt5.x; - py1 = pt51.y - pt5.y; - px2 = pt15.x - pt1.x; - py2 = pt15.y - pt1.y; - m_pCheckPath->BezierTo(pt5.x + px1 * FWLTHEME_BEZIER, - pt5.y + py1 * FWLTHEME_BEZIER, - pt1.x + px2 * FWLTHEME_BEZIER, - pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y); - FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH; - CFX_Matrix mt; - mt.Set(1, 0, 0, 1, 0, 0); - mt.Scale(fScale, fScale); - CFX_PathData* pData = m_pCheckPath->GetPathData(); - pData->Transform(&mt); - } -} diff --git a/xfa/src/fwl/theme/comboboxtp.cpp b/xfa/src/fwl/theme/comboboxtp.cpp deleted file mode 100644 index 33be07d44c..0000000000 --- a/xfa/src/fwl/theme/comboboxtp.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/comboboxtp.h" - -#include "xfa/include/fwl/basewidget/fwl_combobox.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -#define FWLTHEME_CAPACITY_ComboFormHandler 8.0f - -CFWL_ComboBoxTP::CFWL_ComboBoxTP() { - m_dwThemeID = 0; -} -CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {} -FX_BOOL CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ComboBox; -} -FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_CMB_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_CMB_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_CMB_Background: { - CFX_Path path; - path.Create(); - CFX_RectF& rect = pParams->m_rtPart; - path.AddRectangle(rect.left, rect.top, rect.width, rect.height); - CFX_Color cr; - switch (pParams->m_dwStates) { - case FWL_PARTSTATE_CMB_Selected: - cr = FWLTHEME_COLOR_BKSelected; - break; - case FWL_PARTSTATE_CMB_Disabled: - cr = FWLTHEME_COLOR_EDGERB1; - break; - default: - cr = 0xFFFFFFFF; - } - pParams->m_pGraphics->SaveGraphState(); - pParams->m_pGraphics->SetFillColor(&cr); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); - pParams->m_pGraphics->RestoreGraphState(); - break; - } - case FWL_PART_CMB_DropDownButton: { - DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix); - break; - } - case FWL_PART_CMB_StretcgHandler: { - DrawStrethHandler(pParams, 0, &pParams->m_matrix); - break; - } - default: { return FALSE; } - } - return TRUE; -} -void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, - FX_DWORD dwStates, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, - pParams->m_rtPart.width - 1, pParams->m_rtPart.height); - CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); - pParams->m_pGraphics->SetFillColor(&cr); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); -} -void* CFWL_ComboBoxTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - if (dwCapacity == FWL_WGTCAPACITY_CMB_ComboFormHandler) { - m_fValue = FWLTHEME_CAPACITY_ComboFormHandler; - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -#ifdef THEME_XPSimilar -void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - FX_DWORD dwStates, - CFX_Matrix* pMatrix) { - FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; - switch (dwStates) { - case FWL_PARTSTATE_CMB_Normal: { - eState = FWLTHEME_STATE_Normal; - break; - } - case FWL_PARTSTATE_CMB_Hovered: { - eState = FWLTHEME_STATE_Hover; - break; - } - case FWL_PARTSTATE_CMB_Pressed: { - eState = FWLTHEME_STATE_Pressed; - break; - } - case FWL_PARTSTATE_CMB_Disabled: { - eState = FWLTHEME_STATE_Disabale; - break; - } - default: {} - } - DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, - FWLTHEME_DIRECTION_Down, eState, &pParams->m_matrix); -} -#else -void CFWL_ComboBoxTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - FX_DWORD dwStates, - CFX_Matrix* pMatrix) { - FX_BOOL bPressed = ((pParams->m_dwStates & FWL_CMBPARTSTATE_Pressed) == - FWL_CMBPARTSTATE_Pressed); - FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; - Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left + fWidth, - pParams->m_rtPart.top + fWidth, - pParams->m_rtPart.width - 2 * fWidth, - pParams->m_rtPart.height - 2 * fWidth); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pParams->m_pGraphics->SetFillColor(&crFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); - pParams->m_pGraphics->RestoreGraphState(); - FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); - switch (pParams->m_dwStates & 0x03) { - case FWL_CMBPARTSTATE_Normal: { - } - case FWL_CMBPARTSTATE_Hovered: { - } - case FWL_CMBPARTSTATE_Pressed: { - argbFill = 0xFF000000; - break; - } - case FWL_CMBPARTSTATE_Disabled: { - argbFill = 0xFFF0F0F0; - break; - } - } - DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, - argbFill, bPressed, &pParams->m_matrix); -} -#endif diff --git a/xfa/src/fwl/theme/datetimepickertp.cpp b/xfa/src/fwl/theme/datetimepickertp.cpp deleted file mode 100644 index 5efe0b850e..0000000000 --- a/xfa/src/fwl/theme/datetimepickertp.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/datetimepickertp.h" - -#include "xfa/include/fwl/basewidget/fwl_datetimepicker.h" - -CFWL_DateTimePickerTP::CFWL_DateTimePickerTP() { - m_pThemeData = new DTPThemeData; - initThemeData(); -} -CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() { - delete m_pThemeData; -} -FX_BOOL CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_DateTimePicker; -} -FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_DTP_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_DTP_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_DTP_DropDownButton: { - DrawDropDownButton(pParams, &pParams->m_matrix); - break; - } - default: {} - } - return TRUE; -} -#ifdef THEME_XPSimilar -void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - FX_DWORD dwStates = pParams->m_dwStates; - dwStates &= 0x03; - FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; - switch (eState & dwStates) { - case FWL_PARTSTATE_DTP_Normal: { - eState = FWLTHEME_STATE_Normal; - break; - } - case FWL_PARTSTATE_DTP_Hovered: { - eState = FWLTHEME_STATE_Hover; - break; - } - case FWL_PARTSTATE_DTP_Pressed: { - eState = FWLTHEME_STATE_Pressed; - break; - } - case FWL_PARTSTATE_DTP_Disabled: { - eState = FWLTHEME_STATE_Disabale; - break; - } - default: {} - } - DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, - FWLTHEME_DIRECTION_Down, eState, pMatrix); -} -#else -void CFWL_DateTimePickerTP::DrawDropDownButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - FX_BOOL bPressed = ((pParams->m_dwStates & FWL_PARTSTATE_DTP_Pressed) == - FWL_PARTSTATE_DTP_Pressed); - FX_FLOAT fWidth = bPressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = bPressed ? FWLTHEME_EDGE_Flat : FWLTHEME_EDGE_Raised; - Draw3DRect(pParams->m_pGraphics, eType, fWidth, &pParams->m_rtPart, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left + fWidth, - pParams->m_rtPart.top + fWidth, - pParams->m_rtPart.width - 2 * fWidth, - pParams->m_rtPart.height - 2 * fWidth); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pParams->m_pGraphics->SetFillColor(&crFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - FX_ARGB argbFill = ArgbEncode(255, 77, 97, 133); - switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_DTP_Normal: { - } - case FWL_PARTSTATE_DTP_Hovered: { - } - case FWL_PARTSTATE_DTP_Pressed: { - argbFill = 0xFF000000; - break; - } - case FWL_PARTSTATE_DTP_Disabled: { - argbFill = 0xFFF0F0F0; - break; - } - } - DrawArrow(pParams->m_pGraphics, &pParams->m_rtPart, FWLTHEME_DIRECTION_Down, - argbFill, bPressed, pMatrix); -} -#endif -void CFWL_DateTimePickerTP::initThemeData() { - FX_DWORD* pData = (FX_DWORD*)&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/src/fwl/theme/edittp.cpp b/xfa/src/fwl/theme/edittp.cpp deleted file mode 100644 index a206faffe8..0000000000 --- a/xfa/src/fwl/theme/edittp.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/edittp.h" - -#include "xfa/include/fwl/basewidget/fwl_edit.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -CFWL_EditTP::CFWL_EditTP() {} -CFWL_EditTP::~CFWL_EditTP() {} - -FX_BOOL CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_Edit; -} -FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { - switch (pParams->m_iPart) { - case FWL_PART_EDT_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_EDT_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_EDT_Background: { - if (pParams->m_pPath) { - CFX_Graphics* pGraphics = pParams->m_pGraphics; - pGraphics->SaveGraphState(); - CFX_Color crSelected(FWL_GetThemeColor(m_dwThemeID) == 0 - ? FWLTHEME_COLOR_BKSelected - : FWLTHEME_COLOR_Green_BKSelected); - pGraphics->SetFillColor(&crSelected); - pGraphics->FillPath(pParams->m_pPath, FXFILL_WINDING, - &pParams->m_matrix); - pGraphics->RestoreGraphState(); - } else { - FX_BOOL bStatic = - pParams->m_dwData == FWL_PARTDATA_EDT_StaticBackground; - CFX_Path path; - path.Create(); - path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, - pParams->m_rtPart.width, pParams->m_rtPart.height); - CFX_Color cr(FWLTHEME_COLOR_Background); - if (!bStatic) { - if ((pParams->m_dwStates & FWL_PARTSTATE_EDT_Disable) == - FWL_PARTSTATE_EDT_Disable) { - cr.Set(FWLTHEME_COLOR_EDGERB1); - } else if ((pParams->m_dwStates & FWL_PARTSTATE_EDT_ReadOnly) == - FWL_PARTSTATE_EDT_ReadOnly) { - cr.Set(ArgbEncode(255, 236, 233, 216)); - } else { - cr.Set(0xFFFFFFFF); - } - } - pParams->m_pGraphics->SaveGraphState(); - pParams->m_pGraphics->SetFillColor(&cr); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, - &pParams->m_matrix); - pParams->m_pGraphics->RestoreGraphState(); - } - break; - } - case FWL_PART_EDT_CombTextLine: { - FX_ARGB cr = 0xFF000000; - FX_FLOAT fWidth = 1.0f; - CFX_Color crLine(cr); - pParams->m_pGraphics->SetStrokeColor(&crLine); - pParams->m_pGraphics->SetLineWidth(fWidth); - pParams->m_pGraphics->StrokePath(pParams->m_pPath, &pParams->m_matrix); - break; - } - default: { break; } - } - return TRUE; -} -FWL_ERR CFWL_EditTP::Initialize() { - InitTTO(); - return CFWL_WidgetTP::Initialize(); -} -FWL_ERR CFWL_EditTP::Finalize() { - FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); -} diff --git a/xfa/src/fwl/theme/formtp.cpp b/xfa/src/fwl/theme/formtp.cpp deleted file mode 100644 index e8f3b6addc..0000000000 --- a/xfa/src/fwl/theme/formtp.cpp +++ /dev/null @@ -1,893 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/formtp.h" - -#include "xfa/include/fwl/core/fwl_form.h" -#include "xfa/include/fwl/core/fwl_widget.h" -#include "xfa/src/fde/tto/fde_textout.h" - -#define FWLTHEME_CAPACITY_CXFormBorder 3 -#define FWLTHEME_CAPACITY_CYFormBorder 3 -#define FWLTHEME_CAPACITY_CYNarrowCaption 18 -#define FWLTHEME_CAPACITY_CYCaption 29 -#define FWLTHEME_CAPACITY_BigIconSize 32 -#define FWLTHEME_CAPACITY_SmallIconSize 16 -#define FWLTHEME_CAPACITY_FormTextColor 0xFFFFFFFF -#define FWLTHEME_FORMBTN_Margin 5 -#define FWLTHEME_FORMBTN_Span 2 -#define FWLTHEME_FORMBTN_Size 21 - -CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { - m_pThemeData = new SBThemeData; - SetThemeData(0); - m_rtDisLBorder.Reset(); - m_rtDisRBorder.Reset(); - m_rtDisBBorder.Reset(); - m_rtDisCaption.Reset(); -} -CFWL_FormTP::~CFWL_FormTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } -} -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; - } - return CFWL_WidgetTP::Finalize(); -} -FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - FX_DWORD dwHash = pWidget->GetClassID(); - return dwHash == FWL_CLASSHASH_Form; -} -FX_DWORD CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - if (m_pThemeData) { - SetThemeData(FWL_GetThemeColor(dwThemeID)); - } - InitCaption(TRUE); - InitCaption(FALSE); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); -} -FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - int32_t iActive = 0; - if (pParams->m_dwStates & FWL_PARTSTATE_FRM_Inactive) { - iActive = 1; - } - FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; - switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_FRM_Hover: { - eState = FWLTHEME_STATE_Hover; - break; - } - case FWL_PARTSTATE_FRM_Pressed: { - eState = FWLTHEME_STATE_Pressed; - break; - } - case FWL_PARTSTATE_FRM_Disabled: { - eState = FWLTHEME_STATE_Disabale; - break; - } - default: {} - } - switch (pParams->m_iPart) { - case FWL_PART_FRM_Border: { - DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_FRM_Background: { - FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, - &pParams->m_matrix); - break; - } - case FWL_PART_FRM_Caption: { - DrawCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_NarrowCaption: { - DrawNarrowCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_CloseBox: { - DrawCloseBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_MinimizeBox: { - DrawMinimizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_MaximizeBox: { - DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - pParams->m_dwData, &pParams->m_matrix, iActive); - break; - } - case FWL_PART_FRM_Icon: { - DrawIconImage(pParams->m_pGraphics, pParams->m_pImage, &pParams->m_rtPart, - eState, &pParams->m_matrix, iActive); - break; - } - default: {} - } - return TRUE; -} -FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) { - if (!m_pTextOut) - return FALSE; - if (pParams->m_iPart == FWL_PART_FRM_Caption) { - m_pTextOut->SetTextColor(0xFFFFFFFF); - } else { - m_pTextOut->SetTextColor(0xFF000000); - } - return CFWL_WidgetTP::DrawText(pParams); -} -void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - FX_BOOL bDefPro = FALSE; - FX_BOOL bDwordVal = FALSE; - switch (dwCapacity) { - case FWL_WGTCAPACITY_CXBorder: { - m_fValue = FWLTHEME_CAPACITY_CXFormBorder; - break; - } - case FWL_WGTCAPACITY_CYBorder: { - m_fValue = FWLTHEME_CAPACITY_CYFormBorder; - break; - } - case FWL_WGTCAPACITY_FRM_CYCaption: { - m_fValue = FWLTHEME_CAPACITY_CYCaption; - break; - } - case FWL_WGTCAPACITY_FRM_CYNarrowCaption: { - m_fValue = FWLTHEME_CAPACITY_CYCaption; - break; - } - case FWL_WGTCAPACITY_TextColor: { - bDwordVal = TRUE; - m_dwValue = FWLTHEME_CAPACITY_FormTextColor; - break; - } - case FWL_WGTCAPACITY_FRM_BigIcon: { - m_fValue = FWLTHEME_CAPACITY_BigIconSize; - break; - } - case FWL_WGTCAPACITY_FRM_SmallIcon: { - m_fValue = FWLTHEME_CAPACITY_SmallIconSize; - break; - } - default: { bDefPro = TRUE; } - } - if (!bDefPro) { - if (bDwordVal) { - return &m_dwValue; - } - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) { - switch (pThemePart->m_iPart) { - case FWL_PART_FRM_CloseBox: { - CalCloseBox(pThemePart->m_pWidget, rtPart); - break; - } - case FWL_PART_FRM_MaximizeBox: { - CalMaxBox(pThemePart->m_pWidget, rtPart); - break; - } - case FWL_PART_FRM_MinimizeBox: { - CalMinBox(pThemePart->m_pWidget, rtPart); - break; - } - case FWL_PART_FRM_HeadText: { - CalCaption(pThemePart->m_pWidget, rtPart); - break; - } - case FWL_PART_FRM_Icon: { - CalIcon(pThemePart->m_pWidget, rtPart); - break; - } - default: {} - } - return FWL_ERR_Succeeded; -} -void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - FX_DWORD dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_CloseBox) { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, - rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, - FWLTHEME_FORMBTN_Size); - } else { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Span, - rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); - } -} -void CFWL_FormTP::CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - FX_DWORD dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_MaximizeBox) { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Size + - FWLTHEME_FORMBTN_Span * 2, - rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, - FWLTHEME_FORMBTN_Size); - } else { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + FWLTHEME_FORMBTN_Size + - FWLTHEME_FORMBTN_Span * 2, - rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); - } -} -void CFWL_FormTP::CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - FX_DWORD dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_MinimizeBox) { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + - FWLTHEME_FORMBTN_Size * 2 + FWLTHEME_FORMBTN_Span * 3, - rtWidget.top + FWLTHEME_FORMBTN_Margin, FWLTHEME_FORMBTN_Size, - FWLTHEME_FORMBTN_Size); - } else { - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin + - FWLTHEME_FORMBTN_Size * 2 + FWLTHEME_FORMBTN_Span * 3, - rtWidget.top + FWLTHEME_FORMBTN_Margin, 0, 0); - } -} -void CFWL_FormTP::CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect) { - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - rect.Set(rtWidget.left + FWLTHEME_FORMBTN_Margin, - rtWidget.top + FWLTHEME_FORMBTN_Margin - 2, - rtWidget.width - FWLTHEME_FORMBTN_Margin * 2, - FWLTHEME_FORMBTN_Size + 2 * FWLTHEME_FORMBTN_Margin + 4); -} -void CFWL_FormTP::CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect) {} -void CFWL_FormTP::DrawFormBorder(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - CFX_RectF rt; - rt.Set(pRect->left, pRect->top, 1, pRect->height); - FX_FLOAT fBottom, fRight; - fBottom = pRect->bottom(); - fRight = pRect->right(); - CFX_Path path; - path.Create(); - CFX_Color clrLine; - path.Clear(); - path.MoveTo(pRect->left, pRect->top); - path.LineTo(pRect->left, fBottom - 1); - path.LineTo(fRight - 1, fBottom - 1); - path.LineTo(fRight - 1, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][2]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 1, pRect->top); - path.LineTo(pRect->left + 1, fBottom - 2); - path.LineTo(fRight - 2, fBottom - 2); - path.LineTo(fRight - 2, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][1]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 2, pRect->top); - path.LineTo(pRect->left + 2, fBottom - 3); - path.LineTo(fRight - 3, fBottom - 3); - path.LineTo(fRight - 3, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][0]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 3, pRect->top); - path.LineTo(pRect->left + 3, fBottom - 4); - path.LineTo(fRight - 4, fBottom - 4); - path.LineTo(fRight - 4, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][4]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - m_rtDisLBorder.Set(pRect->left, pRect->top + 29, 4, pRect->height - 29); - m_rtDisRBorder.Set(pRect->right() - 4, pRect->top + 29, 4, - pRect->height - 29); - m_rtDisBBorder.Set(pRect->left, pRect->bottom() - 4, pRect->width, 4); - m_rtDisCaption.Set(pRect->left, pRect->top, pRect->width, 29); -} -void CFWL_FormTP::DrawCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - CFX_RectF rt; - FX_FLOAT fBottom, fRight; - fBottom = pRect->bottom(); - fRight = pRect->right(); - rt.Set(pRect->left, pRect->top, pRect->width, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][0], &rt, - pMatrix); - rt.Offset(0, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][1], &rt, - pMatrix); - rt.Offset(0, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][2], &rt, - pMatrix); - rt.Set(pRect->left, pRect->bottom() - 1, pRect->width, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][2], &rt, - pMatrix); - rt.Offset(0, -1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][1], &rt, - pMatrix); - rt.Set(pRect->left, pRect->top, 1, pRect->height); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][2], &rt, - pMatrix); - rt.Set(pRect->left + 1, pRect->top + 1, 1, fBottom - 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][1], &rt, - pMatrix); - rt.Set(pRect->left + 2, pRect->top + 2, 1, fBottom - 2); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][0], &rt, - pMatrix); - rt.Set(fRight - 1, pRect->top, pRect->width, pRect->height); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][2], &rt, - pMatrix); - rt.Set(fRight - 2, pRect->top + 1, 1, fBottom - 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][1], &rt, - pMatrix); - rt.Set(fRight - 3, pRect->top + 2, 1, fBottom - 2); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][0], &rt, - pMatrix); - CFX_RectF rect(*pRect); - rect.Set(rect.left + 3, rect.top + 3, rect.width - 6, rect.height - 5); - if (iActive == 0) { - pGraphics->StretchImage(m_pActiveBitmap, rect, pMatrix); - } else { - pGraphics->StretchImage(m_pDeactivebitmap, rect, pMatrix); - } -} -void CFWL_FormTP::DrawNarrowCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) {} -void CFWL_FormTP::DrawCloseBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - pGraphics->SaveGraphState(); - CFX_RectF rt(*pRect); - pGraphics->SetLineWidth(1.0f); - CFX_Path path; - path.Create(); - path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); - path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); - CFX_Color crFill; - crFill = m_pThemeData->clrBtnEdgeOut[iActive]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); - path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); - path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); - path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); - crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); - path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); - crFill = m_pThemeData->clrCloseBtEdgeLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); - path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); - crFill = m_pThemeData->clrCloseBtEdgeDark[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); - DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, - fBottom - 2, - m_pThemeData->clrCloseBtBKStart[iActive][eState - 1], - m_pThemeData->clrCloseBtBKEnd[iActive][eState - 1], &path, - FXFILL_WINDING, pMatrix); - CFX_RectF rtX(*pRect); - rtX.Inflate(-5, -5); - path.Clear(); - FX_FLOAT frtXRight = rtX.right(); - FX_FLOAT frtXBottom = rtX.bottom(); - path.AddLine(rtX.left, rtX.top + 1, frtXRight - 1, frtXBottom); - path.AddLine(rtX.left, rtX.top, frtXRight, frtXBottom); - path.AddLine(rtX.left + 1, rtX.top, frtXRight, frtXBottom - 1); - path.AddLine(rtX.left, frtXBottom - 1, frtXRight - 1, rtX.top); - path.AddLine(rtX.left, frtXBottom, frtXRight, rtX.top); - path.AddLine(rtX.left + 1, frtXBottom, frtXRight, rtX.top + 1); - CFX_Color clrLine(0xffffffff); - pGraphics->SetLineWidth(1.0f); - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_FormTP::DrawMinMaxBoxCommon(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - pGraphics->SaveGraphState(); - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - CFX_RectF rt(*pRect); - pGraphics->SetLineWidth(1.0f); - CFX_Path path; - path.Create(); - path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); - path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); - CFX_Color crFill; - crFill = m_pThemeData->clrBtnEdgeOut[iActive]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); - path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); - path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); - path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); - crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); - path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); - crFill = m_pThemeData->clrNormalBtEdgeLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); - path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); - crFill = m_pThemeData->clrNormalBtEdgeDark[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); - path.Clear(); - path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); - DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, - fBottom - 2, - m_pThemeData->clrNormalBtBKStart[iActive][eState - 1], - m_pThemeData->clrNormalBtBKEnd[iActive][eState - 1], &path, - FXFILL_WINDING, pMatrix); -} -void CFWL_FormTP::DrawMinimizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); - CFX_RectF rtMin; - rtMin.Set(pRect->left + 5, pRect->top + 13, pRect->width - 14, - pRect->height - 18); - FillSoildRect(pGraphics, 0xFFFFFFFF, &rtMin, pMatrix); -} -void CFWL_FormTP::DrawMaximizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - FX_BOOL bMax, - CFX_Matrix* pMatrix, - int32_t iActive) { - DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - if (bMax) { - CFX_Path path; - path.Create(); - path.AddLine(pRect->left + 7, pRect->top + 6, pRect->left + 14, - pRect->top + 6); - path.AddLine(pRect->left + 4, pRect->top + 9, pRect->left + 11, - pRect->top + 9); - pGraphics->SaveGraphState(); - pGraphics->SetLineWidth(2); - CFX_Color crStroke(0xFFFFFFFF); - pGraphics->SetStrokeColor(&crStroke); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->SetLineWidth(1); - path.Clear(); - path.AddLine(pRect->left + 4, pRect->top + 10, pRect->left + 4, - pRect->top + 14); - path.AddLine(pRect->left + 10, pRect->top + 10, pRect->left + 10, - pRect->top + 14); - path.AddLine(pRect->left + 13, pRect->top + 7, pRect->left + 13, - pRect->top + 11); - path.AddLine(pRect->left + 4, pRect->top + 14, pRect->left + 10, - pRect->top + 14); - path.AddLine(pRect->left + 12, pRect->top + 11, pRect->left + 12, - pRect->top + 11); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); - } else { - CFX_RectF rtMax(*pRect); - rtMax.Inflate(-5, -5); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + 5, pRect->top + 5, fWidth - 10, - fHeight - 10); - path.AddRectangle(pRect->left + 6, pRect->top + 8, fWidth - 12, - fHeight - 14); - pGraphics->SaveGraphState(); - CFX_Color crFill(0xFFFFFFFF); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); - pGraphics->RestoreGraphState(); - } -} -void CFWL_FormTP::DrawIconImage(CFX_Graphics* pGraphics, - CFX_DIBitmap* pDIBitmap, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - pGraphics->StretchImage(pDIBitmap, *pRect, pMatrix); -} -void CFWL_FormTP::SetThemeData(FX_DWORD dwID) { - m_pThemeData->clrTransWhite = ArgbEncode(0x65, 255, 255, 255); - m_pThemeData->clrCloseBtBKStart[0][0] = ArgbEncode(0xff, 240, 166, 148); - m_pThemeData->clrCloseBtBKEnd[0][0] = ArgbEncode(0xff, 228, 61, 5); - m_pThemeData->clrCloseBtBKStart[0][1] = ArgbEncode(0xff, 255, 184, 176); - m_pThemeData->clrCloseBtBKEnd[0][1] = ArgbEncode(0xff, 252, 107, 71); - m_pThemeData->clrCloseBtBKStart[0][2] = ArgbEncode(0xff, 141, 44, 20); - m_pThemeData->clrCloseBtBKEnd[0][2] = ArgbEncode(0xff, 202, 72, 33); - m_pThemeData->clrCloseBtEdgeLight[0][0] = ArgbEncode(0xff, 255, 122, 107); - m_pThemeData->clrCloseBtEdgeDark[0][0] = ArgbEncode(0xff, 218, 77, 54); - m_pThemeData->clrCloseBtEdgeLight[0][1] = ArgbEncode(0xff, 255, 93, 74); - m_pThemeData->clrCloseBtEdgeDark[0][1] = ArgbEncode(0xff, 218, 74, 51); - m_pThemeData->clrCloseBtEdgeLight[0][2] = ArgbEncode(0xff, 191, 61, 28); - m_pThemeData->clrCloseBtEdgeDark[0][2] = ArgbEncode(0xff, 93, 30, 13); - if (dwID) { - m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 170, 184, 131); - m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 168, 182, 128); - m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 117, 141, 94); - m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 171, 189, 133); - m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 155, 175, 125); - m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 128, 146, 103); - m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 94, 118, 79); - m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 234, 245, 201); - m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 175, 189, 133); - m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 153, 168, 121); - m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 150, 168, 103); - m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 182, 195, 162); - m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 128, 144, 84); - m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 234, 241, 208); - m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 169, 186, 112); - m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 199, 199, 190); - m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 133, 148, 88); - m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 163, 176, 137); - m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 118, 135, 83); - m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 172, 193, 123); - m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); - m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); - m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 117, 141, 94); - m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 171, 189, 133); - m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 164, 178, 127); - m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 171, 189, 133); - } else { - m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 0, 85, 226); - m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 0, 85, 226); - m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 0, 32, 200); - m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 0, 61, 220); - m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 0, 54, 210); - m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 0, 56, 234); - m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 0, 50, 193); - m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 0, 19, 139); - m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 0, 88, 238); - m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 63, 151, 255); - m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 0, 96, 252); - m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 63, 151, 255); - m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 0, 67, 207); - m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 0, 49, 112); - m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 0, 87, 188); - m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 154, 183, 250); - m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 17, 110, 248); - m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 164, 194, 255); - m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 29, 158, 255); - m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 68, 120, 245); - m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 24, 72, 187); - m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 72, 122, 245); - m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 35, 87, 195); - m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 60, 114, 244); - m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 21, 70, 185); - m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); - m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); - m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 0, 72, 241); - m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 0, 61, 220); - m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 0, 30, 160); - m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 0, 19, 140); - m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 22, 106, 239); - } - m_pThemeData->clrCloseBtBKStart[1][0] = m_pThemeData->clrCloseBtBKStart[0][0]; - m_pThemeData->clrCloseBtBKEnd[1][0] = m_pThemeData->clrCloseBtBKEnd[0][0]; - m_pThemeData->clrCloseBtBKStart[1][1] = m_pThemeData->clrCloseBtBKStart[0][1]; - m_pThemeData->clrCloseBtBKEnd[1][1] = m_pThemeData->clrCloseBtBKEnd[0][1]; - m_pThemeData->clrCloseBtBKStart[1][2] = m_pThemeData->clrCloseBtBKStart[0][2]; - m_pThemeData->clrCloseBtBKEnd[1][2] = m_pThemeData->clrCloseBtBKEnd[0][2]; - m_pThemeData->clrCloseBtEdgeLight[1][0] = - m_pThemeData->clrCloseBtEdgeLight[0][0]; - m_pThemeData->clrCloseBtEdgeDark[1][0] = - m_pThemeData->clrCloseBtEdgeDark[0][0]; - m_pThemeData->clrCloseBtEdgeLight[1][1] = - m_pThemeData->clrCloseBtEdgeLight[0][1]; - m_pThemeData->clrCloseBtEdgeDark[1][1] = - m_pThemeData->clrCloseBtEdgeDark[0][1]; - m_pThemeData->clrCloseBtEdgeLight[1][2] = - m_pThemeData->clrCloseBtEdgeLight[0][2]; - m_pThemeData->clrCloseBtEdgeDark[1][2] = - m_pThemeData->clrCloseBtEdgeDark[0][2]; - m_pThemeData->clrHeadBK[1][0] = m_pThemeData->clrHeadBK[0][0]; - m_pThemeData->clrHeadBK[1][1] = m_pThemeData->clrHeadBK[0][1]; - m_pThemeData->clrHeadBK[1][2] = m_pThemeData->clrHeadBK[0][2]; - m_pThemeData->clrHeadBK[1][3] = m_pThemeData->clrHeadBK[0][3]; - m_pThemeData->clrHeadEdgeLeft[1][2] = m_pThemeData->clrHeadEdgeLeft[0][2]; - m_pThemeData->clrHeadEdgeLeft[1][1] = m_pThemeData->clrHeadEdgeLeft[0][1]; - m_pThemeData->clrHeadEdgeLeft[1][0] = m_pThemeData->clrHeadEdgeLeft[0][0]; - m_pThemeData->clrHeadEdgeRight[1][0] = m_pThemeData->clrHeadEdgeRight[0][0]; - m_pThemeData->clrHeadEdgeRight[1][1] = m_pThemeData->clrHeadEdgeRight[0][1]; - m_pThemeData->clrHeadEdgeRight[1][2] = m_pThemeData->clrHeadEdgeRight[0][2]; - m_pThemeData->clrHeadEdgeTop[1][0] = m_pThemeData->clrHeadEdgeTop[0][0]; - m_pThemeData->clrHeadEdgeTop[1][1] = m_pThemeData->clrHeadEdgeTop[0][1]; - m_pThemeData->clrHeadEdgeTop[1][2] = m_pThemeData->clrHeadEdgeTop[0][2]; - m_pThemeData->clrHeadEdgeBottom[1][0] = m_pThemeData->clrHeadEdgeBottom[0][0]; - m_pThemeData->clrHeadEdgeBottom[1][1] = m_pThemeData->clrHeadEdgeBottom[0][1]; - m_pThemeData->clrHeadEdgeBottom[1][2] = m_pThemeData->clrHeadEdgeBottom[0][2]; - m_pThemeData->clrNormalBtBKStart[1][2] = - m_pThemeData->clrNormalBtBKStart[0][2]; - m_pThemeData->clrNormalBtBKEnd[1][2] = m_pThemeData->clrNormalBtBKEnd[0][2]; - m_pThemeData->clrNormalBtBKStart[1][0] = - m_pThemeData->clrNormalBtBKStart[0][0]; - m_pThemeData->clrNormalBtBKEnd[1][0] = m_pThemeData->clrNormalBtBKEnd[1][0]; - m_pThemeData->clrNormalBtBKStart[1][1] = - m_pThemeData->clrNormalBtBKStart[0][1]; - m_pThemeData->clrNormalBtBKEnd[1][1] = m_pThemeData->clrNormalBtBKEnd[0][1]; - m_pThemeData->clrNormalBtEdgeLight[1][0] = - m_pThemeData->clrNormalBtEdgeLight[0][0]; - m_pThemeData->clrNormalBtEdgeDark[1][0] = - m_pThemeData->clrNormalBtEdgeDark[0][0]; - m_pThemeData->clrNormalBtEdgeLight[1][1] = - m_pThemeData->clrNormalBtEdgeLight[0][1]; - m_pThemeData->clrNormalBtEdgeDark[1][1] = - m_pThemeData->clrNormalBtEdgeDark[0][1]; - m_pThemeData->clrNormalBtEdgeLight[1][2] = - m_pThemeData->clrNormalBtEdgeLight[0][2]; - m_pThemeData->clrNormalBtEdgeDark[1][2] = - m_pThemeData->clrNormalBtEdgeDark[0][2]; - m_pThemeData->clrBtnCornerLight[1][0] = m_pThemeData->clrBtnCornerLight[0][0]; - m_pThemeData->clrBtnCornerLight[1][1] = m_pThemeData->clrBtnCornerLight[0][1]; - m_pThemeData->clrBtnCornerLight[1][2] = m_pThemeData->clrBtnCornerLight[0][2]; - m_pThemeData->clrBtnEdgeOut[1] = m_pThemeData->clrBtnEdgeOut[0]; - m_pThemeData->clrFormBorder[1][0] = m_pThemeData->clrFormBorder[0][0]; - m_pThemeData->clrFormBorder[1][1] = m_pThemeData->clrFormBorder[0][1]; - m_pThemeData->clrFormBorder[1][2] = m_pThemeData->clrFormBorder[0][2]; - m_pThemeData->clrFormBorder[1][3] = m_pThemeData->clrFormBorder[0][3]; - m_pThemeData->clrFormBorder[1][4] = m_pThemeData->clrFormBorder[0][4]; - m_pThemeData->clrFormBorderLight[1] = m_pThemeData->clrFormBorderLight[0]; - DeactiveForm(); -} -void CFWL_FormTP::DeactiveForm() { - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][3]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrBtnEdgeOut[1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][3]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][4]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorderLight[1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][2]); -} -void CFWL_FormTP::TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack) { - int32_t iAlfaF, iRF, iGF, iBF; - int32_t iAlfaB, iRB, iGB, iBB; - ArgbDecode(clrFore, iAlfaF, iRF, iGF, iBF); - ArgbDecode(clrBack, iAlfaB, iRB, iGB, iBB); - clrBack = ArgbEncode(0xff, iRB + (iRF - iRB) * iAlfaF / 255, - iGB + (iGF - iGB) * iAlfaF / 255, - iBB + (iBF - iBB) * iAlfaF / 255); -} -void CFWL_FormTP::InitCaption(FX_BOOL bActive) { - if (bActive) { - CFX_FxgeDevice dev; - CFX_Graphics gs; - CFX_Path path; - path.Create(); - if (m_pActiveBitmap) { - delete m_pActiveBitmap; - m_pActiveBitmap = NULL; - } - m_pActiveBitmap = new CFX_DIBitmap; - m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); - dev.Attach(m_pActiveBitmap); - gs.Create(&dev); - path.AddRectangle(0, 0, 1, 5); - DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0], - m_pThemeData->clrHeadBK[0][1], &path); - path.Clear(); - path.AddRectangle(0, 5, 1, 15); - DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1], - m_pThemeData->clrHeadBK[0][2], &path); - path.Clear(); - path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); - DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, - m_pThemeData->clrHeadBK[0][2], - m_pThemeData->clrHeadBK[0][3], &path); - } else { - CFX_FxgeDevice dev; - CFX_Graphics gs; - CFX_Path path; - path.Create(); - if (m_pDeactivebitmap) { - delete m_pDeactivebitmap; - m_pDeactivebitmap = NULL; - } - m_pDeactivebitmap = new CFX_DIBitmap; - m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb); - dev.Attach(m_pDeactivebitmap); - gs.Create(&dev); - path.AddRectangle(0, 0, 1, 5); - DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0], - m_pThemeData->clrHeadBK[1][1], &path); - path.Clear(); - path.AddRectangle(0, 5, 1, 15); - DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], - m_pThemeData->clrHeadBK[1][2], &path); - path.Clear(); - path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19); - DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption, - m_pThemeData->clrHeadBK[1][2], - m_pThemeData->clrHeadBK[1][3], &path); - } -} diff --git a/xfa/src/fwl/theme/listboxtp.cpp b/xfa/src/fwl/theme/listboxtp.cpp deleted file mode 100644 index 8ffe669835..0000000000 --- a/xfa/src/fwl/theme/listboxtp.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/listboxtp.h" - -#include "xfa/include/fwl/basewidget/fwl_listbox.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -CFWL_ListBoxTP::CFWL_ListBoxTP() {} -CFWL_ListBoxTP::~CFWL_ListBoxTP() {} - -FX_BOOL CFWL_ListBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ListBox; -} -FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_LTB_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_LTB_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_LTB_Background: { - FillSoildRect(pParams->m_pGraphics, ArgbEncode(255, 255, 255, 255), - &pParams->m_rtPart, &pParams->m_matrix); - if (pParams->m_pData) { - FillSoildRect(pParams->m_pGraphics, FWLTHEME_COLOR_Background, - (CFX_RectF*)pParams->m_pData, &pParams->m_matrix); - } - break; - } - case FWL_PART_LTB_ListItem: { - DrawListBoxItem(pParams->m_pGraphics, pParams->m_dwStates, - &pParams->m_rtPart, pParams->m_pData, &pParams->m_matrix); - break; - } - case FWL_PART_LTB_Icon: { - pParams->m_pGraphics->StretchImage(pParams->m_pImage, pParams->m_rtPart, - &pParams->m_matrix); - break; - } - case FWL_PART_LTB_Check: { - FX_DWORD color = 0xFF000000; - if (pParams->m_dwStates == FWL_PARTSTATE_LTB_Checked) { - color = 0xFFFF0000; - } else if (pParams->m_dwStates == FWL_PARTSTATE_LTB_UnChecked) { - color = 0xFF0000FF; - } - FillSoildRect(pParams->m_pGraphics, color, &pParams->m_rtPart, - &pParams->m_matrix); - } - default: {} - } - return TRUE; -} -FWL_ERR CFWL_ListBoxTP::Initialize() { - InitTTO(); - return CFWL_WidgetTP::Initialize(); -} -FWL_ERR CFWL_ListBoxTP::Finalize() { - FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); -} -void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, - FX_DWORD dwStates, - const CFX_RectF* prtItem, - void* pData, - CFX_Matrix* pMatrix) { - if (dwStates & FWL_PARTSTATE_LTB_Selected) { - pGraphics->SaveGraphState(); - CFX_Color crFill(FWL_GetThemeColor(m_dwThemeID) == 0 - ? FWLTHEME_COLOR_BKSelected - : FWLTHEME_COLOR_Green_BKSelected); - pGraphics->SetFillColor(&crFill); - CFX_RectF rt(*prtItem); - CFX_Path path; - path.Create(); -#if (_FX_OS_ == _FX_MACOSX_) - path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1); -#else - path.AddRectangle(rt.left, rt.top, rt.width, rt.height); -#endif - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); - } - if (dwStates & FWL_PARTSTATE_LTB_Focused) { - if (pData) { - DrawFocus(pGraphics, (CFX_RectF*)pData, pMatrix); - } - } -} diff --git a/xfa/src/fwl/theme/monthcalendartp.cpp b/xfa/src/fwl/theme/monthcalendartp.cpp deleted file mode 100644 index 0dea73f675..0000000000 --- a/xfa/src/fwl/theme/monthcalendartp.cpp +++ /dev/null @@ -1,582 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/monthcalendartp.h" - -#include "xfa/include/fwl/basewidget/fwl_monthcalendar.h" -#include "xfa/include/fwl/core/fwl_widget.h" -#include "xfa/src/fde/tto/fde_textout.h" - -#define FWL_THEMECAPACITY_MC_HEADER_WIDTH 200 -#define FWL_THEMECAPACITY_MC_HEADER_HEIGHT 30 -#define FWL_THEMECAPACITY_MC_HEADER_BTN_WIDTH 18 -#define FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT 16 -#define FWL_THEMECAPACITY_MC_HEADER_BTN_HMARGIN 5 -#define FWL_THEMECAPACITY_MC_HEADER_BTN_VMARGIN \ - (FWL_THEMECAPACITY_MC_HEADER_HEIGHT - \ - FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT) / \ - 2 -#define FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT 100 -#define FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT 20 -#define FWL_THEMECAPACITY_MC_HEADER_TEXT_HMARGIN \ - (FWL_THEMECAPACITY_MC_HEADER_WIDTH - \ - FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT) / \ - 2 -#define FWL_THEMECAPACITY_MC_HEADER_TEXT_VMARGIN \ - (FWL_THEMECAPACITY_MC_HEADER_HEIGHT - \ - FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT) / \ - 2 -#define FWL_THEMECAPACITY_MC_HSEP_WIDTH (FWL_THEMECAPACITY_MC_WEEK_WIDTH - 10) -#define FWL_THEMECAPACITY_MC_HSEP_HEIGHT 1 -#define FWL_THEMECAPACITY_MC_VSEP_WIDTH 1 -#define FWL_THEMECAPACITY_MC_VSEP_HEIGHT FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT -#define FWL_THEMECAPACITY_MC_WEEKNUM_WIDTH 26 -#define FWL_THEMECAPACITY_MC_SEP_DOFFSET -4 -#define FWL_THEMECAPACITY_MC_SEP_X 3 -#define FWL_THEMECAPACITY_MC_SEP_Y \ - (FWL_THEMECAPACITY_MC_HEADER_HEIGHT + FWL_THEMECAPACITY_MC_WEEK_HEIGHT + \ - FWL_THEMECAPACITY_MC_SEP_DOFFSET) -#define FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT \ - (6 * FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT) -#define FWL_THEMECAPACITY_MC_WEEK_WIDTH \ - (FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH * 7) -#define FWL_THEMECAPACITY_MC_WEEK_HEIGHT FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT -#define FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH \ - (FWL_THEMECAPACITY_MC_HEADER_WIDTH / 7) -#define FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT 16 -#define FWL_THEMECAPACITY_MC_TODAY_WIDHT FWL_THEMECAPACITY_MC_HEADER_WIDTH -#define FWL_THEMECAPACITY_MC_TODAY_HEIGHT FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT -#define FWL_THEMECAPACITY_MC_TODAY_FLAG_WIDHT \ - FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH -#define FWL_MC_WIDTH 200 -#define FWL_MC_HEIGHT 160 - -CFWL_MonthCalendarTP::CFWL_MonthCalendarTP() { - m_pThemeData = new MCThemeData; - SetThemeData(0); -} -CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() { - delete m_pThemeData; -} -FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar; -} -FX_DWORD CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - 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; - switch (pParams->m_iPart) { - case FWL_PART_MCD_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_Background: { - DrawTotalBK(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_Header: { - DrawHeadBk(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_LBtn: { -#ifdef THEME_XPSimilar - FWLTHEME_STATE eState = GetState(pParams->m_dwStates); - DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, - FWLTHEME_DIRECTION_Left, eState, &pParams->m_matrix); -#else - DrawLButton(pParams, &pParams->m_matrix); -#endif - break; - } - case FWL_PART_MCD_RBtn: { -#ifdef THEME_XPSimilar - FWLTHEME_STATE eState = GetState(pParams->m_dwStates); - DrawArrowBtn(pParams->m_pGraphics, &pParams->m_rtPart, - FWLTHEME_DIRECTION_Right, eState, &pParams->m_matrix); -#else - DrawRButton(pParams, &pParams->m_matrix); -#endif - break; - } - case FWL_PART_MCD_HSeparator: { - DrawHSeperator(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_DatesIn: { - DrawDatesInBK(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_TodayCircle: { - DrawTodayCircle(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_DateInCircle: { - DrawDatesInCircle(pParams, &pParams->m_matrix); - break; - } - case FWL_PART_MCD_WeekNumSep: { - DrawWeekNumSep(pParams, &pParams->m_matrix); - break; - } - default: {} - } - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { - if (!m_pTextOut) - return FALSE; - if ((pParams->m_iPart == FWL_PART_MCD_DatesIn) && - !(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) && - (pParams->m_dwStates & - (FWL_PARTSTATE_MCD_Hovered | FWL_PARTSTATE_MCD_Selected))) { - m_pTextOut->SetTextColor(0xFFFFFFFF); - } else if (pParams->m_iPart == FWL_PART_MCD_Caption) { - m_pTextOut->SetTextColor(m_pThemeData->clrCaption); - } else { - m_pTextOut->SetTextColor(0xFF000000); - } - return CFWL_WidgetTP::DrawText(pParams); -} -void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - FX_BOOL bDefPro = FALSE; - FX_BOOL bDwordVal = FALSE; - switch (dwCapacity) { - case FWL_WGTCAPACITY_MC_HEADER_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_Height: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN: { - bDwordVal = TRUE; - m_dwValue = FWL_THEMECAPACITY_MC_HEADER_BTN_HMARGIN; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_BTN_VMARGIN; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTWIDHT; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXTHEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_HMARGIN; - break; - } - case FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN: { - m_fValue = FWL_THEMECAPACITY_MC_HEADER_TEXT_VMARGIN; - break; - } - case FWL_WGTCAPACITY_MC_HSEP_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_HSEP_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_HSEP_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_HSEP_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_VSEP_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_VSEP_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_VSEP_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_VSEP_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_WEEKNUM_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_WEEK_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_WEEK_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_WEEK_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_WEEK_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_SEP_DOFFSET: { - m_fValue = FWL_THEMECAPACITY_MC_SEP_DOFFSET; - break; - } - case FWL_WGTCAPACITY_MC_SEP_X: { - m_fValue = FWL_THEMECAPACITY_MC_SEP_X; - break; - } - case FWL_WGTCAPACITY_MC_SEP_Y: { - m_fValue = FWL_THEMECAPACITY_MC_SEP_Y; - break; - } - case FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH: { - m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_DATES_CELL_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_TODAY_WIDHT: { - m_fValue = FWL_THEMECAPACITY_MC_TODAY_WIDHT; - break; - } - case FWL_WGTCAPACITY_MC_TODAY_HEIGHT: { - m_fValue = FWL_THEMECAPACITY_MC_TODAY_HEIGHT; - break; - } - case FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT: { - m_fValue = FWL_THEMECAPACITY_MC_TODAY_FLAG_WIDHT; - break; - } - case FWL_WGTCAPACITY_MC_WIDTH: { - m_fValue = FWL_MC_WIDTH; - break; - } - case FWL_WGTCAPACITY_MC_HEIGHT: { - m_fValue = FWL_MC_HEIGHT; - break; - } - case FWL_MCCAPACITY_Sun: { - wsResource = L"Sun"; - return &wsResource; - } - case FWL_MCCAPACITY_Mon: { - wsResource = L"Mon"; - return &wsResource; - } - case FWL_MCCAPACITY_Tue: { - wsResource = L"Tue"; - return &wsResource; - } - case FWL_MCCAPACITY_Wed: { - wsResource = L"Wed"; - return &wsResource; - } - case FWL_MCCAPACITY_Thu: { - wsResource = L"Thu"; - return &wsResource; - } - case FWL_MCCAPACITY_Fri: { - wsResource = L"Fri"; - return &wsResource; - } - case FWL_MCCAPACITY_Sat: { - wsResource = L"Sat"; - return &wsResource; - } - case FWL_MCCAPACITY_January: { - wsResource = L"January"; - return &wsResource; - } - case FWL_MCCAPACITY_February: { - wsResource = L"February"; - return &wsResource; - } - case FWL_MCCAPACITY_March: { - wsResource = L"March"; - return &wsResource; - } - case FWL_MCCAPACITY_April: { - wsResource = L"April"; - return &wsResource; - } - case FWL_MCCAPACITY_May: { - wsResource = L"May"; - return &wsResource; - } - case FWL_MCCAPACITY_June: { - wsResource = L"June"; - return &wsResource; - } - case FWL_MCCAPACITY_July: { - wsResource = L"July"; - return &wsResource; - } - case FWL_MCCAPACITY_August: { - wsResource = L"August"; - return &wsResource; - } - case FWL_MCCAPACITY_September: { - wsResource = L"September"; - return &wsResource; - } - case FWL_MCCAPACITY_October: { - wsResource = L"October"; - return &wsResource; - } - case FWL_MCCAPACITY_November: { - wsResource = L"November"; - return &wsResource; - } - case FWL_MCCAPACITY_December: { - wsResource = L"December"; - return &wsResource; - } - case FWL_MCCAPACITY_Today: { - wsResource = L"Today"; - return &wsResource; - } - default: { bDefPro = TRUE; } - } - if (!bDefPro) { - if (bDwordVal) { - return &m_dwValue; - } - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -FWL_ERR CFWL_MonthCalendarTP::Initialize() { - InitTTO(); - return CFWL_WidgetTP::Initialize(); -} -FWL_ERR CFWL_MonthCalendarTP::Finalize() { - FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); -} -FX_BOOL CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtTotal(pParams->m_rtPart); - path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrBK(m_pThemeData->clrBK); - pParams->m_pGraphics->SetFillColor(&clrBK); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtHead = pParams->m_rtPart; - path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrHeadBK(m_pThemeData->clrBK); - pParams->m_pGraphics->SetFillColor(&clrHeadBK); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtLBtn; - rtLBtn = pParams->m_rtPart; - path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrLBtnEdge(ArgbEncode(0xff, 205, 219, 243)); - pParams->m_pGraphics->SetStrokeColor(&clrLBtnEdge); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) == - FWL_PARTSTATE_MCD_Pressed) { - CFX_Color clrLBtnFill(ArgbEncode(0xff, 174, 198, 242)); - pParams->m_pGraphics->SetFillColor(&clrLBtnFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } else { - CFX_Color clrLBtnFill(ArgbEncode(0xff, 227, 235, 249)); - pParams->m_pGraphics->SetFillColor(&clrLBtnFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } - path.Clear(); - path.MoveTo(rtLBtn.left + rtLBtn.Width() / 3 * 2, - rtLBtn.top + rtLBtn.height / 4); - path.LineTo(rtLBtn.left + rtLBtn.Width() / 3, rtLBtn.top + rtLBtn.height / 2); - path.LineTo(rtLBtn.left + rtLBtn.Width() / 3 * 2, - rtLBtn.bottom() - rtLBtn.height / 4); - CFX_Color clrFlag(ArgbEncode(0xff, 50, 104, 205)); - pParams->m_pGraphics->SetStrokeColor(&clrFlag); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtRBtn; - rtRBtn = pParams->m_rtPart; - path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrRBtnEdge(ArgbEncode(0xff, 205, 219, 243)); - pParams->m_pGraphics->SetStrokeColor(&clrRBtnEdge); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - if ((pParams->m_dwStates & FWL_PARTSTATE_MCD_Pressed) == - FWL_PARTSTATE_MCD_Pressed) { - CFX_Color clrRBtnFill(ArgbEncode(0xff, 174, 198, 242)); - pParams->m_pGraphics->SetFillColor(&clrRBtnFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } else { - CFX_Color clrRBtnFill(ArgbEncode(0xff, 227, 235, 249)); - pParams->m_pGraphics->SetFillColor(&clrRBtnFill); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } - path.Clear(); - path.MoveTo(rtRBtn.left + rtRBtn.Width() / 3, rtRBtn.top + rtRBtn.height / 4); - path.LineTo(rtRBtn.left + rtRBtn.Width() / 3 * 2, - rtRBtn.top + rtRBtn.height / 2); - path.LineTo(rtRBtn.left + rtRBtn.Width() / 3, - rtRBtn.bottom() - rtRBtn.height / 4); - CFX_Color clrFlag(ArgbEncode(0xff, 50, 104, 205)); - pParams->m_pGraphics->SetStrokeColor(&clrFlag); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtHSep; - rtHSep = pParams->m_rtPart; - path.MoveTo(rtHSep.left, rtHSep.top + rtHSep.height / 2); - path.LineTo(rtHSep.right(), rtHSep.top + rtHSep.height / 2); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrHSep(m_pThemeData->clrSeperator); - pParams->m_pGraphics->SetStrokeColor(&clrHSep); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtWeekSep; - rtWeekSep = pParams->m_rtPart; - path.MoveTo(rtWeekSep.left, rtWeekSep.top); - path.LineTo(rtWeekSep.left, rtWeekSep.bottom()); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrHSep(m_pThemeData->clrSeperator); - pParams->m_pGraphics->SetStrokeColor(&clrHSep); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - pParams->m_pGraphics->SaveGraphState(); - if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Selected) { - CFX_Path path; - path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; - path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, - rtSelDay.height); - CFX_Color clrSelDayBK; - clrSelDayBK = m_pThemeData->clrDatesSelectedBK; - pParams->m_pGraphics->SetFillColor(&clrSelDayBK); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } else if (pParams->m_dwStates & FWL_PARTSTATE_MCD_Hovered) { - CFX_Path path; - path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; - path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, - rtSelDay.height); - CFX_Color clrSelDayBK; - clrSelDayBK = m_pThemeData->clrDatesHoverBK; - pParams->m_pGraphics->SetFillColor(&clrSelDayBK); - pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - } - pParams->m_pGraphics->RestoreGraphState(); - return FALSE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtSelDay; - rtSelDay = pParams->m_rtPart; - path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, - rtSelDay.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrSelDayBK; - clrSelDayBK = m_pThemeData->clrDatesCircle; - pParams->m_pGraphics->SetStrokeColor(&clrSelDayBK); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FX_BOOL CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - CFX_RectF rtTodayCircle; - rtTodayCircle = pParams->m_rtPart; - path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, - rtTodayCircle.height); - pParams->m_pGraphics->SaveGraphState(); - CFX_Color clrTodayCircle; - clrTodayCircle = m_pThemeData->clrDatesCircle; - pParams->m_pGraphics->SetStrokeColor(&clrTodayCircle); - pParams->m_pGraphics->StrokePath(&path, pMatrix); - pParams->m_pGraphics->RestoreGraphState(); - return TRUE; -} -FWLTHEME_STATE CFWL_MonthCalendarTP::GetState(FX_DWORD dwFWLStates) { - if (dwFWLStates & FWL_PARTSTATE_MCD_Hovered) { - return FWLTHEME_STATE_Hover; - } else if (dwFWLStates & FWL_PARTSTATE_MCD_Pressed) { - return FWLTHEME_STATE_Pressed; - } - return FWLTHEME_STATE_Normal; -} -void CFWL_MonthCalendarTP::SetThemeData(FX_DWORD dwThemeID) { - if (dwThemeID == 0) { - m_pThemeData->clrCaption = ArgbEncode(0xff, 0, 153, 255); - m_pThemeData->clrSeperator = ArgbEncode(0xff, 141, 161, 239); - m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 193, 211, 251); - m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 173, 188, 239); - m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 103, 144, 209); - m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); - m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); - } else { - m_pThemeData->clrCaption = ArgbEncode(0xff, 128, 128, 0); - m_pThemeData->clrSeperator = ArgbEncode(0xff, 128, 128, 64); - m_pThemeData->clrDatesHoverBK = ArgbEncode(0xff, 217, 220, 191); - m_pThemeData->clrDatesSelectedBK = ArgbEncode(0xff, 204, 208, 183); - m_pThemeData->clrDatesCircle = ArgbEncode(0xff, 128, 128, 0); - m_pThemeData->clrToday = ArgbEncode(0xff, 0, 0, 0); - m_pThemeData->clrBK = ArgbEncode(0xff, 255, 255, 255); - } -} diff --git a/xfa/src/fwl/theme/pictureboxtp.cpp b/xfa/src/fwl/theme/pictureboxtp.cpp deleted file mode 100644 index 5d7c079e86..0000000000 --- a/xfa/src/fwl/theme/pictureboxtp.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/pictureboxtp.h" - -#include "xfa/include/fwl/basewidget/fwl_picturebox.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -CFWL_PictureBoxTP::CFWL_PictureBoxTP() {} -CFWL_PictureBoxTP::~CFWL_PictureBoxTP() {} - -FX_BOOL CFWL_PictureBoxTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_PictureBox; -} -FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - switch (pParams->m_iPart) { - case FWL_PART_PTB_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_PTB_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - default: {} - } - return TRUE; -} diff --git a/xfa/src/fwl/theme/pushbuttontp.cpp b/xfa/src/fwl/theme/pushbuttontp.cpp deleted file mode 100644 index 76e0eab7dc..0000000000 --- a/xfa/src/fwl/theme/pushbuttontp.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/pushbuttontp.h" - -#include "xfa/include/fwl/basewidget/fwl_pushbutton.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -#define PUSHBUTTON_SIZE_Corner 2 - -CFWL_PushButtonTP::CFWL_PushButtonTP() { - m_pThemeData = new PBThemeData; - SetThemeData(0); -} -CFWL_PushButtonTP::~CFWL_PushButtonTP() { - if (m_pThemeData) { - delete m_pThemeData; - } -} -FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) { - return pWidget->GetClassID() == FWL_CLASSHASH_PushButton; -} -FX_DWORD CFWL_PushButtonTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - SetThemeData(FWL_GetThemeColor(dwThemeID)); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); -} -FX_BOOL CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { - switch (pParams->m_iPart) { - case FWL_PART_PSB_Border: { - DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_PSB_Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case FWL_PART_PSB_Background: { - CFX_RectF& rect = pParams->m_rtPart; - FX_FLOAT fRight = rect.right(); - FX_FLOAT fBottom = rect.bottom(); - CFX_Path strokePath; - strokePath.Create(); - strokePath.MoveTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top); - strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, rect.top); - strokePath.LineTo(fRight, rect.top + PUSHBUTTON_SIZE_Corner); - strokePath.LineTo(fRight, fBottom - PUSHBUTTON_SIZE_Corner); - strokePath.LineTo(fRight - PUSHBUTTON_SIZE_Corner, fBottom); - strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, fBottom); - strokePath.LineTo(rect.left, fBottom - PUSHBUTTON_SIZE_Corner); - strokePath.LineTo(rect.left, rect.top + PUSHBUTTON_SIZE_Corner); - strokePath.LineTo(rect.left + PUSHBUTTON_SIZE_Corner, rect.top); - CFX_Path fillPath; - fillPath.Create(); - fillPath.AddSubpath(&strokePath); - CFX_Graphics* pGraphics = pParams->m_pGraphics; - pGraphics->SaveGraphState(); - CFX_RectF rtInner(rect); - rtInner.Deflate(PUSHBUTTON_SIZE_Corner + 1, PUSHBUTTON_SIZE_Corner + 1, - PUSHBUTTON_SIZE_Corner, PUSHBUTTON_SIZE_Corner); - fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width, - rtInner.height); - int32_t iColor = GetColorID(pParams->m_dwStates); - DrawAxialShading(pGraphics, rect.left + PUSHBUTTON_SIZE_Corner, rect.top, - rect.left + PUSHBUTTON_SIZE_Corner, rect.bottom(), - m_pThemeData->clrStart[iColor], - m_pThemeData->clrEnd[iColor], &fillPath, - FXFILL_ALTERNATE, &pParams->m_matrix); - CFX_Color crStroke(m_pThemeData->clrBorder[iColor]); - pGraphics->SetStrokeColor(&crStroke); - pGraphics->StrokePath(&strokePath, &pParams->m_matrix); - fillPath.Clear(); - fillPath.AddRectangle(rtInner.left, rtInner.top, rtInner.width, - rtInner.height); - 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) { - rtInner.Inflate(1, 1, 0, 0); - DrawFocus(pGraphics, &rtInner, &pParams->m_matrix); - } - pGraphics->RestoreGraphState(); - break; - } - default: {} - } - return TRUE; -} -void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - if (dwCapacity == FWL_WGTCAPACITY_PSB_Margin) { - m_fValue = 0; - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -FWL_ERR CFWL_PushButtonTP::Initialize() { - InitTTO(); - return CFWL_WidgetTP::Initialize(); -} -FWL_ERR CFWL_PushButtonTP::Finalize() { - FinalizeTTO(); - return CFWL_WidgetTP::Finalize(); -} -void CFWL_PushButtonTP::SetThemeData(FX_DWORD dwID) { - if (dwID) { - m_pThemeData->clrBorder[0] = ArgbEncode(255, 55, 98, 6); - m_pThemeData->clrBorder[1] = ArgbEncode(255, 55, 98, 6); - m_pThemeData->clrBorder[2] = ArgbEncode(255, 55, 98, 6); - m_pThemeData->clrBorder[3] = ArgbEncode(255, 55, 98, 6); - m_pThemeData->clrBorder[4] = ArgbEncode(255, 172, 168, 153); - m_pThemeData->clrStart[0] = ArgbEncode(255, 255, 255, 246); - m_pThemeData->clrStart[1] = ArgbEncode(255, 223, 205, 180); - m_pThemeData->clrStart[2] = ArgbEncode(255, 252, 197, 149); - m_pThemeData->clrStart[3] = ArgbEncode(255, 194, 209, 143); - m_pThemeData->clrStart[4] = ArgbEncode(255, 216, 216, 216); - m_pThemeData->clrEnd[0] = ArgbEncode(255, 227, 209, 184); - m_pThemeData->clrEnd[1] = ArgbEncode(255, 248, 244, 228); - m_pThemeData->clrEnd[2] = ArgbEncode(255, 207, 114, 37); - m_pThemeData->clrEnd[3] = ArgbEncode(255, 144, 193, 84); - m_pThemeData->clrEnd[4] = ArgbEncode(255, 172, 168, 153); - m_pThemeData->clrFill[0] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[1] = ArgbEncode(255, 226, 225, 218); - m_pThemeData->clrFill[2] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[3] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234); - } else { - m_pThemeData->clrBorder[0] = ArgbEncode(255, 0, 60, 116); - m_pThemeData->clrBorder[1] = ArgbEncode(255, 0, 60, 116); - m_pThemeData->clrBorder[2] = ArgbEncode(255, 0, 60, 116); - m_pThemeData->clrBorder[3] = ArgbEncode(255, 0, 60, 116); - m_pThemeData->clrBorder[4] = ArgbEncode(255, 201, 199, 186); - m_pThemeData->clrStart[0] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrStart[1] = ArgbEncode(255, 209, 204, 193); - m_pThemeData->clrStart[2] = ArgbEncode(255, 255, 240, 207); - m_pThemeData->clrStart[3] = ArgbEncode(255, 206, 231, 255); - m_pThemeData->clrStart[4] = ArgbEncode(255, 245, 244, 234); - m_pThemeData->clrEnd[0] = ArgbEncode(255, 214, 208, 197); - m_pThemeData->clrEnd[1] = ArgbEncode(255, 242, 241, 238); - m_pThemeData->clrEnd[2] = ArgbEncode(255, 229, 151, 0); - m_pThemeData->clrEnd[3] = ArgbEncode(255, 105, 130, 238); - m_pThemeData->clrEnd[4] = ArgbEncode(255, 245, 244, 234); - m_pThemeData->clrFill[0] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[1] = ArgbEncode(255, 226, 225, 218); - m_pThemeData->clrFill[2] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[3] = ArgbEncode(255, 255, 255, 255); - m_pThemeData->clrFill[4] = ArgbEncode(255, 245, 244, 234); - } -} -int32_t CFWL_PushButtonTP::GetColorID(FX_DWORD dwStates) { - return dwStates &= FWL_PARTSTATE_PSB_Mask; -} diff --git a/xfa/src/fwl/theme/scrollbartp.cpp b/xfa/src/fwl/theme/scrollbartp.cpp deleted file mode 100644 index 424ff549e5..0000000000 --- a/xfa/src/fwl/theme/scrollbartp.cpp +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/scrollbartp.h" - -#include "xfa/include/fwl/basewidget/fwl_scrollbar.h" -#include "xfa/include/fwl/core/fwl_widget.h" - -#define FWL_SCROLL_PawLen 12.5f - -CFWL_ScrollBarTP::CFWL_ScrollBarTP() { - m_pThemeData = new SBThemeData; - SetThemeData(0); -} -CFWL_ScrollBarTP::~CFWL_ScrollBarTP() { - if (m_pThemeData) { - delete m_pThemeData; - m_pThemeData = NULL; - } -} -FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) { - if (!pWidget) - return FALSE; - return pWidget->GetClassID() == FWL_CLASSHASH_ScrollBar; -} -void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - if (dwCapacity == FWL_CAPACITY_SCB_Size) { - m_fValue = 5; - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -FX_DWORD CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - if (m_pThemeData) { - SetThemeData(FWL_GetThemeColor(dwThemeID)); - } - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); -} -FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - IFWL_Widget* pWidget = pParams->m_pWidget; - FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; - switch (pParams->m_dwStates & 0x03) { - case FWL_PARTSTATE_SCB_Hovered: { - eState = FWLTHEME_STATE_Hover; - break; - } - case FWL_PARTSTATE_SCB_Pressed: { - eState = FWLTHEME_STATE_Pressed; - break; - } - case FWL_PARTSTATE_SCB_Disabled: { - eState = FWLTHEME_STATE_Disabale; - break; - } - } - CFX_Graphics* pGraphics = pParams->m_pGraphics; - CFX_RectF* pRect = &pParams->m_rtPart; - FX_BOOL bVert = pWidget->GetStylesEx(); - switch (pParams->m_iPart) { - case FWL_PART_SCB_ForeArrow: { - DrawMaxMinBtn(pGraphics, pRect, - bVert ? FWLTHEME_DIRECTION_Up : FWLTHEME_DIRECTION_Left, - eState, &pParams->m_matrix); - break; - } - case FWL_PART_SCB_BackArrow: { - DrawMaxMinBtn(pGraphics, pRect, - bVert ? FWLTHEME_DIRECTION_Down : FWLTHEME_DIRECTION_Right, - eState, &pParams->m_matrix); - break; - } - case FWL_PART_SCB_Thumb: { - DrawThumbBtn(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); - break; - } - case FWL_PART_SCB_LowerTrack: { - DrawTrack(pGraphics, pRect, bVert, eState, TRUE, &pParams->m_matrix); - break; - } - case FWL_PART_SCB_UpperTrack: { - DrawTrack(pGraphics, pRect, bVert, eState, FALSE, &pParams->m_matrix); - break; - } - default: {} - } - return TRUE; -} -#ifdef THEME_XPSimilar -void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bPawButton, - CFX_Matrix* pMatrix) { - if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { - return; - } - CFX_Path path; - path.Create(); - CFX_RectF rect(*pRect); - if (bVert) { - rect.Deflate(1, 0); - if (rect.IsEmpty(0.1f)) { - return; - } - path.AddRectangle(rect.left, rect.top, rect.width, rect.height); - DrawAxialShading(pGraphics, rect.left, rect.top, rect.right(), rect.top, - m_pThemeData->clrBtnBK[eState - 1][0], - m_pThemeData->clrBtnBK[eState - 1][1], &path, - FXFILL_WINDING, pMatrix); - CFX_Color rcStroke; - rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); - pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&rcStroke); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); - } else { - rect.Deflate(0, 1); - if (rect.IsEmpty(0.1f)) { - return; - } - path.AddRectangle(rect.left, rect.top, rect.width, rect.height); - DrawAxialShading(pGraphics, rect.left, rect.top, rect.left, rect.bottom(), - m_pThemeData->clrBtnBK[eState - 1][0], - m_pThemeData->clrBtnBK[eState - 1][1], &path, - FXFILL_WINDING, pMatrix); - CFX_Color rcStroke; - rcStroke.Set(m_pThemeData->clrBtnBorder[eState - 1]); - pGraphics->SaveGraphState(); - pGraphics->SetStrokeColor(&rcStroke); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); - } -} -void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - if (bVert) { - FX_FLOAT fPawLen = FWL_SCROLL_PawLen; - if (pRect->width / 2 <= fPawLen) { - fPawLen = (pRect->width - 6) / 2; - } - FX_FLOAT fX = pRect->left + pRect->width / 4; - FX_FLOAT fY = pRect->top + pRect->height / 2; - path.MoveTo(fX, fY - 4); - path.LineTo(fX + fPawLen, fY - 4); - path.MoveTo(fX, fY - 2); - path.LineTo(fX + fPawLen, fY - 2); - path.MoveTo(fX, fY); - path.LineTo(fX + fPawLen, fY); - path.MoveTo(fX, fY + 2); - path.LineTo(fX + fPawLen, fY + 2); - CFX_Color clrLight(m_pThemeData->clrPawColorLight[eState - 1]); - pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrLight); - pGraphics->StrokePath(&path); - fX++; - path.Clear(); - path.MoveTo(fX, fY - 3); - path.LineTo(fX + fPawLen, fY - 3); - path.MoveTo(fX, fY - 1); - path.LineTo(fX + fPawLen, fY - 1); - path.MoveTo(fX, fY + 1); - path.LineTo(fX + fPawLen, fY + 1); - path.MoveTo(fX, fY + 3); - path.LineTo(fX + fPawLen, fY + 3); - CFX_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); - pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrDark); - pGraphics->StrokePath(&path, pMatrix); - } else { - FX_FLOAT fPawLen = FWL_SCROLL_PawLen; - if (pRect->height / 2 <= fPawLen) { - fPawLen = (pRect->height - 6) / 2; - } - FX_FLOAT fX = pRect->left + pRect->width / 2; - FX_FLOAT fY = pRect->top + pRect->height / 4; - path.MoveTo(fX - 4, fY); - path.LineTo(fX - 4, fY + fPawLen); - path.MoveTo(fX - 2, fY); - path.LineTo(fX - 2, fY + fPawLen); - path.MoveTo(fX, fY); - path.LineTo(fX, fY + fPawLen); - path.MoveTo(fX + 2, fY); - path.LineTo(fX + 2, fY + fPawLen); - CFX_Color clrLight(m_pThemeData->clrPawColorLight[eState - 1]); - pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrLight); - pGraphics->StrokePath(&path, pMatrix); - fY++; - path.Clear(); - path.MoveTo(fX - 3, fY); - path.LineTo(fX - 3, fY + fPawLen); - path.MoveTo(fX - 1, fY); - path.LineTo(fX - 1, fY + fPawLen); - path.MoveTo(fX + 1, fY); - path.LineTo(fX + 1, fY + fPawLen); - path.MoveTo(fX + 3, fY); - path.LineTo(fX + 3, fY + fPawLen); - CFX_Color clrDark(m_pThemeData->clrPawColorDark[eState - 1]); - pGraphics->SetLineWidth(1); - pGraphics->SetStrokeColor(&clrDark); - pGraphics->StrokePath(&path, pMatrix); - } -} -void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bLowerTrack, - CFX_Matrix* pMatrix) { - if (eState < FWLTHEME_STATE_Normal || eState > FWLTHEME_STATE_Disabale) { - return; - } - pGraphics->SaveGraphState(); - CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); - CFX_Path path; - path.Create(); - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - if (bVert) { - path.AddRectangle(pRect->left, pRect->top, 1, pRect->height); - path.AddRectangle(fRight - 1, pRect->top, 1, pRect->height); - } else { - path.AddRectangle(pRect->left, pRect->top, pRect->width, 1); - path.AddRectangle(pRect->left, fBottom - 1, pRect->width, 1); - } - pGraphics->SetFillColor(&colorLine); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(pRect->left + 1, pRect->top, pRect->width - 2, - pRect->height); - FX_FLOAT x1 = bVert ? pRect->left + 1 : pRect->left; - FX_FLOAT y1 = bVert ? pRect->top : pRect->top + 1; - FX_FLOAT x2 = bVert ? fRight - 1 : pRect->left; - FX_FLOAT y2 = bVert ? pRect->top : fBottom - 1; - pGraphics->RestoreGraphState(); - DrawAxialShading(pGraphics, x1, y1, x2, y2, m_pThemeData->clrTrackBKStart, - m_pThemeData->clrTrackBKEnd, &path, FXFILL_WINDING, pMatrix); -} -void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_DIRECTION eDict, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - DrawTrack(pGraphics, pRect, - eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down, - eState, TRUE, pMatrix); - CFX_RectF rtArrowBtn(*pRect); - rtArrowBtn.Deflate(1, 1, 1, 1); - DrawArrowBtn(pGraphics, &rtArrowBtn, eDict, eState, pMatrix); -} -#else -void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bPawButton, - CFX_Matrix* pMatrix) { - if (pRect->IsEmpty()) { - return; - } - CFX_RectF rtThumb(*pRect); - FX_FLOAT fWidth = 2; - Draw3DRect(pGraphics, FWLTHEME_EDGE_Raised, fWidth, pRect, - FWLTHEME_COLOR_EDGELT1, FWLTHEME_COLOR_EDGELT2, - FWLTHEME_COLOR_EDGERB1, FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, - pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); - pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FX_BOOL bVert, - FWLTHEME_STATE eState, - FX_BOOL bLowerTrack, - CFX_Matrix* pMatrix) { - if (pRect->IsEmpty()) { - return; - } - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - pGraphics->SaveGraphState(); - CFX_Color clrFill(0xFFF0F0F0); - pGraphics->SetFillColor(&clrFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_ScrollBarTP::DrawMaxMinBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_DIRECTION eDict, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - CFX_RectF rtThumb(*pRect); - FX_FLOAT fWidth = eState == FWLTHEME_STATE_Pressed ? 1.0f : 2.0f; - FWLTHEME_EDGE eType = eState == FWLTHEME_STATE_Pressed ? FWLTHEME_EDGE_Flat - : FWLTHEME_EDGE_Raised; - Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1, - FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1, - FWLTHEME_COLOR_EDGERB2, pMatrix); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + fWidth, pRect->top + fWidth, - pRect->width - 2 * fWidth, pRect->height - 2 * fWidth); - pGraphics->SaveGraphState(); - CFX_Color crFill(FWLTHEME_COLOR_Background); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); - DrawArrow(pGraphics, pRect, eDict, - eState == FWLTHEME_STATE_Disabale ? 0xFFA0A0A0 : 0xFF000000, - eState == FWLTHEME_STATE_Pressed, pMatrix); -} -#endif -void CFWL_ScrollBarTP::SetThemeData(FX_DWORD dwID) { - m_pThemeData->clrPawColorLight[3] = ArgbEncode(0xff, 208, 223, 172); - m_pThemeData->clrPawColorDark[3] = ArgbEncode(0xff, 140, 157, 115); - m_pThemeData->clrBtnBK[3][0] = ArgbEncode(0xff, 164, 180, 139); - m_pThemeData->clrBtnBK[3][1] = ArgbEncode(0xff, 141, 157, 115); - m_pThemeData->clrBtnBorder[3] = ArgbEncode(0xff, 236, 233, 216); - if (dwID) { - m_pThemeData->clrPawColorLight[0] = ArgbEncode(0xff, 208, 223, 172); - m_pThemeData->clrPawColorDark[0] = ArgbEncode(0xff, 140, 157, 115); - m_pThemeData->clrBtnBK[0][0] = ArgbEncode(0xff, 162, 179, 141); - m_pThemeData->clrBtnBK[0][1] = ArgbEncode(0xff, 149, 167, 117); - m_pThemeData->clrBtnBorder[0] = ArgbEncode(0xff, 142, 153, 125); - m_pThemeData->clrPawColorLight[1] = ArgbEncode(0xff, 235, 245, 212); - m_pThemeData->clrPawColorDark[1] = ArgbEncode(0xff, 182, 198, 142); - m_pThemeData->clrBtnBK[1][0] = ArgbEncode(0xff, 200, 213, 170); - m_pThemeData->clrBtnBK[1][1] = ArgbEncode(0xff, 195, 208, 150); - m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 189, 203, 150); - m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 208, 223, 172); - m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 140, 157, 115); - m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 164, 180, 139); - m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 141, 157, 115); - m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 128, 146, 102); - m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); - m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); - } else { - m_pThemeData->clrPawColorLight[0] = ArgbEncode(0xff, 238, 244, 254); - m_pThemeData->clrPawColorDark[0] = ArgbEncode(0xff, 140, 176, 248); - m_pThemeData->clrBtnBK[0][0] = ArgbEncode(0xff, 197, 213, 252); - m_pThemeData->clrBtnBK[0][1] = ArgbEncode(0xff, 182, 205, 251); - m_pThemeData->clrBtnBorder[0] = ArgbEncode(0xff, 148, 176, 221); - m_pThemeData->clrPawColorLight[1] = ArgbEncode(0xff, 252, 253, 255); - m_pThemeData->clrPawColorDark[1] = ArgbEncode(0xff, 156, 197, 255); - m_pThemeData->clrBtnBK[1][0] = ArgbEncode(0xff, 216, 232, 255); - m_pThemeData->clrBtnBK[1][1] = ArgbEncode(0xff, 204, 225, 255); - m_pThemeData->clrBtnBorder[1] = ArgbEncode(0xff, 218, 230, 254); - m_pThemeData->clrPawColorLight[2] = ArgbEncode(0xff, 207, 221, 253); - m_pThemeData->clrPawColorDark[2] = ArgbEncode(0xff, 131, 158, 216); - m_pThemeData->clrBtnBK[2][0] = ArgbEncode(0xff, 167, 190, 245); - m_pThemeData->clrBtnBK[2][1] = ArgbEncode(0xff, 146, 179, 249); - m_pThemeData->clrBtnBorder[2] = ArgbEncode(0xff, 124, 159, 211); - m_pThemeData->clrTrackBKStart = ArgbEncode(0xff, 243, 241, 236); - m_pThemeData->clrTrackBKEnd = ArgbEncode(0xff, 254, 254, 251); - } -} diff --git a/xfa/src/fwl/theme/widgettp.cpp b/xfa/src/fwl/theme/widgettp.cpp deleted file mode 100644 index c26a62c561..0000000000 --- a/xfa/src/fwl/theme/widgettp.cpp +++ /dev/null @@ -1,840 +0,0 @@ -// Copyright 2014 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/include/fwl/theme/widgettp.h" - -#include <algorithm> - -#include "xfa/include/fwl/core/fwl_widgetmgr.h" -#include "xfa/src/fde/tto/fde_textout.h" - -static void FWL_SetChildThemeID(IFWL_Widget* pParent, FX_DWORD dwThemeID) { - IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr(); - IFWL_Widget* pChild = - pWidgetMgr->GetWidget(pParent, FWL_WGTRELATION_FirstChild); - while (pChild) { - IFWL_ThemeProvider* pTheme = pChild->GetThemeProvider(); - if (pTheme) { - pTheme->SetThemeID(pChild, dwThemeID, FALSE); - } - FWL_SetChildThemeID(pChild, dwThemeID); - pChild = pWidgetMgr->GetWidget(pChild, FWL_WGTRELATION_NextSibling); - } -} -FX_BOOL CFWL_WidgetTP::IsValidWidget(IFWL_Widget* pWidget) { - return FALSE; -} -FX_DWORD CFWL_WidgetTP::GetThemeID(IFWL_Widget* pWidget) { - return m_dwThemeID; -} -FX_DWORD CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, - FX_DWORD dwThemeID, - FX_BOOL bChildren) { - FX_DWORD dwOld = m_dwThemeID; - m_dwThemeID = dwThemeID; - if (CFWL_ArrowData::IsInstance()) { - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(dwThemeID)); - } - if (bChildren) { - FWL_SetChildThemeID(pWidget, dwThemeID); - } - return dwOld; -} -FWL_ERR CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) { - matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - _ctm.Set(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); - return FWL_ERR_Succeeded; -} -FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) { - return TRUE; -} -FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { - if (!m_pTextOut) { - InitTTO(); - } - int32_t iLen = pParams->m_wsText.GetLength(); - if (iLen <= 0) - return FALSE; - CFX_Graphics* pGraphics = pParams->m_pGraphics; - 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, iLen, pParams->m_rtPart); - return TRUE; -} -void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, - FX_DWORD dwCapacity) { - switch (dwCapacity) { - case FWL_WGTCAPACITY_CXBorder: { - m_fValue = FWLTHEME_CAPACITY_CXBorder; - break; - } - case FWL_WGTCAPACITY_CYBorder: { - m_fValue = FWLTHEME_CAPACITY_CYBorder; - break; - } - case FWL_WGTCAPACITY_EdgeFlat: { - m_fValue = FWLTHEME_CAPACITY_EdgeFlat; - break; - } - case FWL_WGTCAPACITY_EdgeRaised: { - m_fValue = FWLTHEME_CAPACITY_EdgeRaised; - break; - } - case FWL_WGTCAPACITY_EdgeSunken: { - m_fValue = FWLTHEME_CAPACITY_EdgeSunken; - break; - } - case FWL_WGTCAPACITY_FontSize: { - m_fValue = FWLTHEME_CAPACITY_FontSize; - break; - } - case FWL_WGTCAPACITY_TextColor: { - m_dwValue = FWLTHEME_CAPACITY_TextColor; - return &m_dwValue; - } - case FWL_WGTCAPACITY_ScrollBarWidth: { - m_fValue = FWLTHEME_CAPACITY_ScrollBarWidth; - break; - } - case FWL_WGTCAPACITY_Font: { - return m_pFDEFont; - } - case FWL_WGTCAPACITY_TextSelColor: { - m_dwValue = (m_dwThemeID == 0) ? FWLTHEME_CAPACITY_TextSelColor - : FWLTHEME_COLOR_Green_BKSelected; - return &m_dwValue; - } - case FWL_WGTCAPACITY_LineHeight: { - m_fValue = FWLTHEME_CAPACITY_LineHeight; - break; - } - case FWL_WGTCAPACITY_UIMargin: { - m_rtMargin.Set(0, 0, 0, 0); - return &m_rtMargin; - } - default: { return NULL; } - } - return &m_fValue; -} -FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { - return FWL_GetThemeLayout(m_dwThemeID); -} -FWL_ERR CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rect) { - return FWL_ERR_Succeeded; -} -FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) { - return TRUE; -} -FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { - if (!pParams) - return FALSE; - if (!m_pTextOut) - return FALSE; - m_pTextOut->SetAlignment(pParams->m_iTTOAlign); - m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); - return TRUE; -} -FWL_ERR CFWL_WidgetTP::Initialize() { - m_dwThemeID = 0; - _ctm.SetIdentity(); - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_WidgetTP::Finalize() { - if (!m_pTextOut) { - FinalizeTTO(); - } - return FWL_ERR_Succeeded; -} -CFWL_WidgetTP::~CFWL_WidgetTP() {} -FWL_ERR CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { - if (!m_pTextOut) { - return FWL_ERR_Succeeded; - } - m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); - m_pTextOut->SetFont(m_pFDEFont); - m_pTextOut->SetFontSize(fFontSize); - m_pTextOut->SetTextColor(rgbFont); - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - IFX_Font* pFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { - if (!m_pTextOut) { - return FWL_ERR_Succeeded; - } - m_pTextOut->SetFont(pFont); - m_pTextOut->SetFontSize(fFontSize); - m_pTextOut->SetTextColor(rgbFont); - return FWL_ERR_Succeeded; -} -IFX_Font* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { - return m_pFDEFont; -} -CFWL_WidgetTP::CFWL_WidgetTP() - : m_dwRefCount(1), m_pTextOut(NULL), m_pFDEFont(NULL), m_dwThemeID(0) {} -FX_ERR CFWL_WidgetTP::InitTTO() { - if (m_pTextOut) { - return FWL_ERR_Succeeded; - } - m_pFDEFont = - CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0); - m_pTextOut = IFDE_TextOut::Create(); - m_pTextOut->SetFont(m_pFDEFont); - m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); - m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); - m_pTextOut->SetEllipsisString(L"..."); - return FWL_ERR_Succeeded; -} -FX_ERR CFWL_WidgetTP::FinalizeTTO() { - if (m_pTextOut) { - m_pTextOut->Release(); - m_pTextOut = NULL; - } - return FWL_ERR_Succeeded; -} -#ifdef THEME_XPSimilar -void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, - FX_DWORD dwStyles, - const CFX_RectF* pRect, - CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) - return; - pGraphics->SaveGraphState(); - CFX_Color crStroke(FWL_GetThemeColor(m_dwThemeID) == 0 - ? ArgbEncode(255, 127, 157, 185) - : FWLTHEME_COLOR_Green_BKSelected); - pGraphics->SetStrokeColor(&crStroke); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left, pRect->top, pRect->width - 1, - pRect->height - 1); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - crStroke = ArgbEncode(255, 255, 255, 255); - pGraphics->SetStrokeColor(&crStroke); - path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 3, - pRect->height - 3); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); -} -#else -void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, - FX_DWORD dwStyles, - const CFX_RectF* pRect, - CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) - return; - FWLTHEME_EDGE eType; - FX_FLOAT fWidth; - switch (dwStyles & FWL_WGTSTYLE_EdgeMask) { - case FWL_WGTSTYLE_EdgeRaised: { - eType = FWLTHEME_EDGE_Raised, fWidth = FWLTHEME_CAPACITY_EdgeRaised; - break; - } - case FWL_WGTSTYLE_EdgeSunken: { - eType = FWLTHEME_EDGE_Sunken, fWidth = FWLTHEME_CAPACITY_EdgeSunken; - break; - } - case FWL_WGTSTYLE_EdgeFlat: - default: { return; } - } - Draw3DRect(pGraphics, eType, fWidth, pRect, FWLTHEME_COLOR_EDGELT1, - FWLTHEME_COLOR_EDGELT2, FWLTHEME_COLOR_EDGERB1, - FWLTHEME_COLOR_EDGERB2, pMatrix); -} -#endif -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, - FWLTHEME_PI * 3 / 4, FWLTHEME_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, - FWLTHEME_PI * 3 / 4, FWLTHEME_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, - FWLTHEME_PI * 7 / 4, FWLTHEME_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, - FWLTHEME_PI * 7 / 4, FWLTHEME_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) { - if (!pGraphics) - return; - if (!pRect) - return; - 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); - pGraphics->SaveGraphState(); - CFX_Color crFill(ArgbEncode(255, 0, 0, 0)); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_WidgetTP::FillBackground(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - CFX_Matrix* pMatrix) { - FillSoildRect(pGraphics, FWLTHEME_COLOR_Background, pRect, pMatrix); -} -void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, - FX_ARGB fillColor, - const CFX_RectF* pRect, - CFX_Matrix* pMatrix) { - if (!pGraphics) - return; - if (!pRect) - return; - pGraphics->SaveGraphState(); - CFX_Color crFill(fillColor); - pGraphics->SetFillColor(&crFill); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics, - FX_FLOAT fx1, - FX_FLOAT fy1, - FX_FLOAT fx2, - FX_FLOAT fy2, - FX_ARGB beginColor, - FX_ARGB endColor, - CFX_Path* path, - int32_t fillMode, - CFX_Matrix* pMatrix) { - if (!pGraphics || !path) - return; - - CFX_PointF begPoint(fx1, fy1); - CFX_PointF endPoint(fx2, fy2); - CFX_Shading shading; - shading.CreateAxial(begPoint, endPoint, FALSE, FALSE, beginColor, endColor); - pGraphics->SaveGraphState(); - CFX_Color color1(&shading); - pGraphics->SetFillColor(&color1); - pGraphics->FillPath(path, fillMode, pMatrix); - 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) { - if (!pGraphics) - return; - if (!pRect) - return; - pGraphics->SaveGraphState(); - CFX_Color cr(0xFF000000); - pGraphics->SetStrokeColor(&cr); - FX_FLOAT DashPattern[2] = {1, 1}; - pGraphics->SetLineDash(0.0f, DashPattern, 2); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); - 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, - FX_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, - FWLTHEME_DIRECTION eDict, - FX_ARGB argSign, - CFX_Matrix* pMatrix) { - FX_BOOL bVert = - (eDict == FWLTHEME_DIRECTION_Up || eDict == FWLTHEME_DIRECTION_Down); - FX_FLOAT fLeft = - (FX_FLOAT)(((pRect->width - (bVert ? 9 : 6)) / 2 + pRect->left) + 0.5); - FX_FLOAT fTop = - (FX_FLOAT)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5); - CFX_Path path; - path.Create(); - switch (eDict) { - case FWLTHEME_DIRECTION_Down: { - path.MoveTo(fLeft, fTop + 1); - path.LineTo(fLeft + 4, fTop + 5); - path.LineTo(fLeft + 8, fTop + 1); - path.LineTo(fLeft + 7, fTop); - path.LineTo(fLeft + 4, fTop + 3); - path.LineTo(fLeft + 1, fTop); - break; - } - case FWLTHEME_DIRECTION_Up: { - path.MoveTo(fLeft, fTop + 4); - path.LineTo(fLeft + 4, fTop); - path.LineTo(fLeft + 8, fTop + 4); - path.LineTo(fLeft + 7, fTop + 5); - path.LineTo(fLeft + 4, fTop + 2); - path.LineTo(fLeft + 1, fTop + 5); - break; - } - case FWLTHEME_DIRECTION_Right: { - path.MoveTo(fLeft + 1, fTop); - path.LineTo(fLeft + 5, fTop + 4); - path.LineTo(fLeft + 1, fTop + 8); - path.LineTo(fLeft, fTop + 7); - path.LineTo(fLeft + 3, fTop + 4); - path.LineTo(fLeft, fTop + 1); - break; - } - case FWLTHEME_DIRECTION_Left: { - path.MoveTo(fLeft, fTop + 4); - path.LineTo(fLeft + 4, fTop); - path.LineTo(fLeft + 5, fTop + 1); - path.LineTo(fLeft + 2, fTop + 4); - path.LineTo(fLeft + 5, fTop + 7); - path.LineTo(fLeft + 4, fTop + 8); - break; - } - } - CFX_Color cr(argSign); - pGraphics->SetFillColor(&cr); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); -} -void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - CFX_Path path; - path.Create(); - if (!CFWL_ArrowData::IsInstance()) { - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); - } - CFWL_ArrowData::CColorData* pColorData = - CFWL_ArrowData::GetInstance()->m_pColorData; - 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, - pMatrix); - CFX_Color rcStroke; - rcStroke.Set(pColorData->clrBorder[eState - 1]); - pGraphics->SetStrokeColor(&rcStroke); - pGraphics->StrokePath(&path, pMatrix); -} -void CFWL_WidgetTP::DrawArrowBtn(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_DIRECTION eDict, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix) { - DrawBtn(pGraphics, pRect, eState, pMatrix); - if (!CFWL_ArrowData::IsInstance()) { - CFWL_ArrowData::GetInstance()->SetColorData(FWL_GetThemeColor(m_dwThemeID)); - } - CFWL_ArrowData::CColorData* pColorData = - CFWL_ArrowData::GetInstance()->m_pColorData; - DrawArrow(pGraphics, pRect, eDict, pColorData->clrSign[eState - 1], pMatrix); -} -FWLCOLOR CFWL_WidgetTP::BlendColor(FWLCOLOR srcColor, - FWLCOLOR renderColor, - uint8_t scale) { - FWLCOLOR dstColor; - uint8_t n = 255 - scale; - dstColor.a = (uint8_t)( - ((FX_WORD)srcColor.a * n + (FX_WORD)renderColor.a * scale) >> 8); - dstColor.r = (uint8_t)( - ((FX_WORD)srcColor.r * n + (FX_WORD)renderColor.r * scale) >> 8); - dstColor.g = (uint8_t)( - ((FX_WORD)srcColor.g * n + (FX_WORD)renderColor.g * scale) >> 8); - dstColor.b = (uint8_t)( - ((FX_WORD)srcColor.b * n + (FX_WORD)renderColor.b * scale) >> 8); - return dstColor; -} -CFWL_ArrowData::CFWL_ArrowData() : m_pColorData(NULL) { - SetColorData(0); -} -CFWL_FontData::CFWL_FontData() - : m_dwStyles(0), - m_dwCodePage(0), - m_pFont(0), - m_pFontMgr(NULL) -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - , - m_pFontSource(NULL) -#endif -{ -} -CFWL_FontData::~CFWL_FontData() { - if (m_pFont) { - m_pFont->Release(); - } - if (m_pFontMgr) { - m_pFontMgr->Release(); - } -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - if (m_pFontSource != NULL) { - m_pFontSource->Release(); - } -#endif -} -FX_BOOL CFWL_FontData::Equal(const CFX_WideStringC& wsFontFamily, - FX_DWORD dwFontStyles, - FX_WORD wCodePage) { - return m_wsFamily == wsFontFamily && m_dwStyles == dwFontStyles && - m_dwCodePage == wCodePage; -} -FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily, - FX_DWORD dwFontStyles, - FX_WORD dwCodePage) { - m_wsFamily = wsFontFamily; - m_dwStyles = dwFontStyles; - m_dwCodePage = dwCodePage; - if (!m_pFontMgr) { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - m_pFontMgr = IFX_FontMgr::Create(FX_GetDefFontEnumerator()); -#else - m_pFontSource = FX_CreateDefaultFontSourceEnum(); - m_pFontMgr = IFX_FontMgr::Create(m_pFontSource); -#endif - } - m_pFont = IFX_Font::LoadFont(wsFontFamily.GetPtr(), dwFontStyles, dwCodePage, - m_pFontMgr); - return m_pFont != NULL; -} - -CFWL_FontManager* CFWL_FontManager::s_FontManager = nullptr; -CFWL_FontManager* CFWL_FontManager::GetInstance() { - if (!s_FontManager) - s_FontManager = new CFWL_FontManager; - return s_FontManager; -} -void CFWL_FontManager::DestroyInstance() { - delete s_FontManager; - s_FontManager = nullptr; -} -CFWL_FontManager::CFWL_FontManager() {} -CFWL_FontManager::~CFWL_FontManager() {} -IFX_Font* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily, - FX_DWORD dwFontStyles, - FX_WORD wCodePage) { - for (const auto& pData : m_FontsArray) { - if (pData->Equal(wsFontFamily, dwFontStyles, wCodePage)) - return pData->GetFont(); - } - std::unique_ptr<CFWL_FontData> pFontData(new CFWL_FontData); - if (!pFontData->LoadFont(wsFontFamily, dwFontStyles, wCodePage)) - return nullptr; - m_FontsArray.push_back(std::move(pFontData)); - return m_FontsArray.back()->GetFont(); -} -FX_BOOL FWLTHEME_Init() { - return TRUE; -} -void FWLTHEME_Release() { - CFWL_ArrowData::DestroyInstance(); - CFWL_FontManager::DestroyInstance(); -} -FX_DWORD FWL_GetThemeLayout(FX_DWORD dwThemeID) { - return 0xffff0000 & dwThemeID; -} -FX_DWORD FWL_GetThemeColor(FX_DWORD dwThemeID) { - return 0x0000ffff & dwThemeID; -} -FX_DWORD FWL_MakeThemeID(FX_DWORD dwLayout, FX_DWORD dwColor) { - return (dwLayout << 16) | (0x0000FFFF & dwColor); -} -CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL; -CFWL_ArrowData* CFWL_ArrowData::GetInstance() { - if (!m_pInstance) { - m_pInstance = new CFWL_ArrowData; - } - return m_pInstance; -} -FX_BOOL CFWL_ArrowData::IsInstance() { - return (m_pInstance != NULL); -} -void CFWL_ArrowData::DestroyInstance() { - if (m_pInstance) { - delete m_pInstance; - m_pInstance = NULL; - } -} -CFWL_ArrowData::~CFWL_ArrowData() { - if (m_pColorData) { - delete m_pColorData; - m_pColorData = NULL; - } -} -void CFWL_ArrowData::SetColorData(FX_DWORD dwID) { - if (!m_pColorData) { - m_pColorData = new CColorData; - } - if (dwID) { - m_pColorData->clrBorder[0] = ArgbEncode(255, 142, 153, 125); - m_pColorData->clrBorder[1] = ArgbEncode(255, 157, 171, 119); - m_pColorData->clrBorder[2] = ArgbEncode(255, 118, 131, 97); - m_pColorData->clrBorder[3] = ArgbEncode(255, 172, 168, 153); - m_pColorData->clrStart[0] = ArgbEncode(255, 203, 215, 186); - m_pColorData->clrStart[1] = ArgbEncode(255, 218, 232, 185); - m_pColorData->clrStart[2] = ArgbEncode(255, 203, 215, 186); - m_pColorData->clrStart[3] = ArgbEncode(255, 254, 254, 251); - m_pColorData->clrEnd[0] = ArgbEncode(255, 149, 167, 117); - m_pColorData->clrEnd[1] = ArgbEncode(255, 198, 211, 155); - m_pColorData->clrEnd[2] = ArgbEncode(255, 149, 167, 117); - m_pColorData->clrEnd[3] = ArgbEncode(255, 243, 241, 236); - m_pColorData->clrSign[0] = ArgbEncode(255, 255, 255, 255); - m_pColorData->clrSign[1] = ArgbEncode(255, 255, 255, 255); - m_pColorData->clrSign[2] = ArgbEncode(255, 255, 255, 255); - m_pColorData->clrSign[3] = ArgbEncode(255, 128, 128, 128); - } else { - 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); - } -} |