Esempio n. 1
0
void CFWL_CheckBoxTP::DrawSign(IFWL_Widget* pWidget,
                               CFX_Graphics* pGraphics,
                               const CFX_RectF* pRtBox,
                               uint32_t dwStates,
                               CFX_Matrix* pMatrix) {
  CFX_RectF rtSign(*pRtBox);
  rtSign.Deflate(kSignMargin, kSignMargin);
  uint32_t dwColor = m_pThemeData->clrSignCheck;
  bool bCheck = true;
  if ((dwStates & CFWL_PartState_Disabled) &&
      (dwStates & CFWL_PartState_Checked)) {
    dwColor = m_pThemeData->clrSignBorderDisable;
  } else if (dwStates & CFWL_PartState_Neutral) {
    if (dwStates & CFWL_PartState_Hovered) {
      dwColor = m_pThemeData->clrSignNeutralHover;
    } else if (dwStates & CFWL_PartState_Pressed) {
      dwColor = m_pThemeData->clrSignNeutralPressed;
    } else if (dwStates & CFWL_PartState_Disabled) {
      dwColor = m_pThemeData->clrSignBorderDisable;
    } else {
      dwColor = m_pThemeData->clrSignNeutralNormal;
    }
    bCheck = false;
  }
  if (bCheck) {
    uint32_t 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);
  }
}
Esempio n. 2
0
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);
  }
}