void CFWL_CheckBoxTP::DrawBoxBk(IFWL_Widget* pWidget, CFX_Graphics* pGraphics, const CFX_RectF* pRect, uint32_t dwStates, CFX_Matrix* pMatrix) { dwStates &= 0x03; int32_t fillMode = FXFILL_WINDING; uint32_t dwStyleEx = pWidget->GetStylesEx(); dwStyleEx &= FWL_STYLEEXT_CKB_ShapeMask; CFX_Path path; path.Create(); FX_FLOAT fRight = pRect->right(); FX_FLOAT fBottom = pRect->bottom(); bool bClipSign = !!(dwStates & CFWL_PartState_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 + kSignMargin, pRect->top + kSignMargin, pRect->width - kSignMargin * 2, pRect->height - kSignMargin * 2); } } else { CFX_RectF rect(*pRect); rect.Deflate(0, 0, 1, 1); path.AddEllipse(rect); if (bClipSign) { fillMode = FXFILL_ALTERNATE; CFX_RectF rtClip(rect); rtClip.Deflate(kSignMargin - 1, kSignMargin - 1); path.AddEllipse(rtClip); } } int32_t iTheme = 1; if (dwStates & CFWL_PartState_Hovered) { iTheme = 2; } else if (dwStates & CFWL_PartState_Pressed) { iTheme = 3; } else if (dwStates & CFWL_PartState_Disabled) { iTheme = 4; } if (dwStates & CFWL_PartState_Checked) { iTheme += 4; } else if (dwStates & CFWL_PartState_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::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_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 CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, CFX_Matrix* pMatrix, uint32_t dwStatus, FX_BOOL bEllipse) { if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { return; } if ((dwStatus & XFA_WidgetStatus_Highlight) && m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open) { CXFA_FFDoc* pDoc = GetDoc(); CFX_Color crHighlight(pDoc->GetDocProvider()->GetHighlightColor(pDoc)); pGS->SetFillColor(&crHighlight); CFX_Path path; path.Create(); if (bEllipse) { path.AddEllipse(m_rtUI); } else { path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); } pGS->FillPath(&path, FXFILL_WINDING, pMatrix); } }
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); }