Пример #1
0
void CFDE_TextOut::DrawLogicText(const FX_WCHAR* pwsStr,
                                 int32_t iLength,
                                 const CFX_RectF& rect) {
  CFX_RectF rtClip(m_rtLogicClip.left, m_rtLogicClip.top, m_rtLogicClip.width,
                   m_rtLogicClip.height);
  m_Matrix.TransformRect(rtClip);
  DrawText(pwsStr, iLength, rect, rtClip);
}
Пример #2
0
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);
}
Пример #3
0
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);
}