Пример #1
0
void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
                         CPDFSDK_Annot* pAnnot,
                         CFX_RenderDevice* pDevice,
                         CPDF_Matrix* pUser2Device,
                         FX_DWORD dwFlags) {
  ASSERT(pPageView != NULL);
  CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
  CPDF_FormControl* pCtrl = pWidget->GetFormControl();
  CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode();

  if (eHM == CPDF_FormControl::Push) {
    if (m_bMouseDown) {
      if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
        pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
      else
        pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
                                NULL);
    } else if (m_bMouseIn) {
      if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
        pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
                                NULL);
      else
        pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
                                NULL);
    } else {
      pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
    }
  } else
    pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
}
Пример #2
0
void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView,
                         CPDFSDK_Annot* pAnnot,
                         CFX_RenderDevice* pDevice,
                         const CFX_Matrix& mtUser2Device) {
  ASSERT(pPageView);
  CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
  CPDF_FormControl* pCtrl = pWidget->GetFormControl();
  if (pCtrl->GetHighlightingMode() != CPDF_FormControl::Push) {
    pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal,
                            nullptr);
    return;
  }
  if (m_bMouseDown) {
    if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) {
      pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Down,
                              nullptr);
    } else {
      pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal,
                              nullptr);
    }
    return;
  }
  if (m_bMouseIn) {
    if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) {
      pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Rollover,
                              nullptr);
    } else {
      pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal,
                              nullptr);
    }
    return;
  }

  pWidget->DrawAppearance(pDevice, mtUser2Device, CPDF_Annot::Normal, nullptr);
}