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); } } }
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(); }
void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { CFX_RectF rtFill(0, 0, m_pNormalWidget->GetWidgetRect().Size()); FX_FLOAT fLineWith = GetLineWidth(); rtFill.Deflate(fLineWith, fLineWith); CFX_Color cr(FXARGB_MAKE(128, 128, 255, 255)); pGraphics->SetFillColor(&cr); CFX_Path path; path.AddRectangle(rtFill.left, rtFill.top, rtFill.width, rtFill.height); pGraphics->FillPath(&path, FXFILL_WINDING, (CFX_Matrix*)pMatrix); } } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteOutLine) { if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { FX_FLOAT fLineWidth = GetLineWidth(); CFX_Color cr(FXARGB_MAKE(255, 128, 255, 255)); pGraphics->SetStrokeColor(&cr); pGraphics->SetLineWidth(fLineWidth); CFX_Path path; CFX_RectF rect = m_pNormalWidget->GetWidgetRect(); path.AddRectangle(0, 0, rect.width, rect.height); pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); } } }
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_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, uint32_t dwStates, CFX_Matrix* pMatrix) { CFX_Path path; 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 CXFA_FFLine::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix, uint32_t dwStatus) { if (!IsMatchVisibleStatus(dwStatus)) { return; } CXFA_Value value = m_pDataAcc->GetFormValue(); if (!value) { return; } CXFA_Line lineObj = value.GetLine(); FX_ARGB lineColor = 0xFF000000; int32_t iStrokeType = 0; FX_FLOAT fLineWidth = 1.0f; FX_BOOL bSlope = lineObj.GetSlop(); int32_t iCap = 0; CXFA_Edge edge = lineObj.GetEdge(); if (edge) { if (edge.GetPresence() != XFA_ATTRIBUTEENUM_Visible) { return; } lineColor = edge.GetColor(); iStrokeType = edge.GetStrokeType(); fLineWidth = edge.GetThickness(); iCap = edge.GetCapType(); } CFX_Matrix mtRotate; GetRotateMatrix(mtRotate); if (pMatrix) { mtRotate.Concat(*pMatrix); } CFX_RectF rtLine; GetRectWithoutRotate(rtLine); if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { XFA_RectWidthoutMargin(rtLine, mgWidget); } GetRectFromHand(rtLine, lineObj.GetHand(), fLineWidth); CFX_Path linePath; linePath.Create(); if (bSlope && rtLine.right() > 0.0f && rtLine.bottom() > 0.0f) { linePath.AddLine(rtLine.right(), rtLine.top, rtLine.left, rtLine.bottom()); } else { linePath.AddLine(rtLine.left, rtLine.top, rtLine.right(), rtLine.bottom()); } CFX_Color color(lineColor); pGS->SaveGraphState(); pGS->SetLineWidth(fLineWidth, TRUE); XFA_StrokeTypeSetLineDash(pGS, iStrokeType, iCap); pGS->SetStrokeColor(&color); pGS->SetLineCap(XFA_LineCapToFXGE(iCap)); pGS->StrokePath(&linePath, &mtRotate); pGS->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 CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { if (m_dwStatus & XFA_WidgetStatus_Focused) { CFX_Color cr(0xFF000000); pGS->SetStrokeColor(&cr); FX_FLOAT DashPattern[2] = {1, 1}; pGS->SetLineDash(0.0f, DashPattern, 2); pGS->SetLineWidth(0, FALSE); CFX_Path path; path.Create(); path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); pGS->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_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_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); }
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.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); }
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_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.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); }
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_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_WidgetTP::DrawBorder(CFX_Graphics* pGraphics, const CFX_RectF* pRect, CFX_Matrix* pMatrix) { if (!pGraphics) return; if (!pRect) return; CFX_Path path; 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(); }
FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { if (!pGraphics) return FWL_ERR_Indefinite; if ((m_pProperties->m_dwStyleExes & FWL_GRIDSTYLEEXT_ShowGridLines) == 0) { return FWL_ERR_Succeeded; } pGraphics->SaveGraphState(); if (pMatrix) { pGraphics->ConcatMatrix(pMatrix); } { FX_BOOL bDrawLine = FALSE; CFX_Path path; path.Create(); int32_t iColumns = m_Columns.GetSize(); for (int32_t i = 1; i < iColumns; i++) { CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]); if (!pColRow) { continue; } bDrawLine = TRUE; path.AddLine(pColRow->m_fActualPos, 0, pColRow->m_fActualPos, m_pProperties->m_rtWidget.height); } int32_t iRows = m_Rows.GetSize(); for (int32_t j = 1; j < iRows; j++) { CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[j]); if (!pColRow) { continue; } bDrawLine = TRUE; path.AddLine(0, pColRow->m_fActualPos, m_pProperties->m_rtWidget.width, pColRow->m_fActualPos); } if (bDrawLine) { CFX_Color cr(0xFFFF0000); pGraphics->SetStrokeColor(&cr); pGraphics->StrokePath(&path); } } pGraphics->RestoreGraphState(); return FWL_ERR_Succeeded; }
void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { if (!pParams) return; switch (pParams->m_iPart) { case CFWL_Part::Border: { DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix); break; } case CFWL_Part::Background: { CFX_Path path; CFX_RectF& rect = pParams->m_rtPart; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); FX_ARGB argb_color; switch (pParams->m_dwStates) { case CFWL_PartState_Selected: argb_color = FWLTHEME_COLOR_BKSelected; break; case CFWL_PartState_Disabled: argb_color = FWLTHEME_COLOR_EDGERB1; break; default: argb_color = 0xFFFFFFFF; } pParams->m_pGraphics->SaveGraphState(); CFX_Color cr(argb_color); pParams->m_pGraphics->SetFillColor(&cr); pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, &pParams->m_matrix); pParams->m_pGraphics->RestoreGraphState(); break; } case CFWL_Part::DropDownButton: { DrawDropDownButton(pParams, pParams->m_dwStates, &pParams->m_matrix); break; } case CFWL_Part::StretchHandler: { DrawStrethHandler(pParams, 0, &pParams->m_matrix); break; } default: break; } }
void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_STATE eState, CFX_Matrix* pMatrix) { CFX_Path path; InitializeArrowColorData(); FX_FLOAT fRight = pRect->right(); FX_FLOAT fBottom = pRect->bottom(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); DrawAxialShading(pGraphics, pRect->left, pRect->top, fRight, fBottom, m_pColorData->clrStart[eState - 1], m_pColorData->clrEnd[eState - 1], &path, FXFILL_WINDING, pMatrix); CFX_Color rcStroke; rcStroke.Set(m_pColorData->clrBorder[eState - 1]); pGraphics->SetStrokeColor(&rcStroke); pGraphics->StrokePath(&path, pMatrix); }
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 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_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); }
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::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::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_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::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_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 = kPawLength; 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 = kPawLength; 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_WidgetTP::DrawArrow(CFX_Graphics* pGraphics, const CFX_RectF* pRect, FWLTHEME_DIRECTION eDict, FX_ARGB argSign, CFX_Matrix* pMatrix) { 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; switch (eDict) { case FWLTHEME_DIRECTION_Down: { path.MoveTo(CFX_PointF(fLeft, fTop + 1)); path.LineTo(CFX_PointF(fLeft + 4, fTop + 5)); path.LineTo(CFX_PointF(fLeft + 8, fTop + 1)); path.LineTo(CFX_PointF(fLeft + 7, fTop)); path.LineTo(CFX_PointF(fLeft + 4, fTop + 3)); path.LineTo(CFX_PointF(fLeft + 1, fTop)); break; } case FWLTHEME_DIRECTION_Up: { path.MoveTo(CFX_PointF(fLeft, fTop + 4)); path.LineTo(CFX_PointF(fLeft + 4, fTop)); path.LineTo(CFX_PointF(fLeft + 8, fTop + 4)); path.LineTo(CFX_PointF(fLeft + 7, fTop + 5)); path.LineTo(CFX_PointF(fLeft + 4, fTop + 2)); path.LineTo(CFX_PointF(fLeft + 1, fTop + 5)); break; } case FWLTHEME_DIRECTION_Right: { path.MoveTo(CFX_PointF(fLeft + 1, fTop)); path.LineTo(CFX_PointF(fLeft + 5, fTop + 4)); path.LineTo(CFX_PointF(fLeft + 1, fTop + 8)); path.LineTo(CFX_PointF(fLeft, fTop + 7)); path.LineTo(CFX_PointF(fLeft + 3, fTop + 4)); path.LineTo(CFX_PointF(fLeft, fTop + 1)); break; } case FWLTHEME_DIRECTION_Left: { path.MoveTo(CFX_PointF(fLeft, fTop + 4)); path.LineTo(CFX_PointF(fLeft + 4, fTop)); path.LineTo(CFX_PointF(fLeft + 5, fTop + 1)); path.LineTo(CFX_PointF(fLeft + 2, fTop + 4)); path.LineTo(CFX_PointF(fLeft + 5, fTop + 7)); path.LineTo(CFX_PointF(fLeft + 4, fTop + 8)); break; } } CFX_Color cr(argSign); pGraphics->SetFillColor(&cr); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); }