Ejemplo n.º 1
0
FX_BOOL CPDFSDK_PageView::OnLButtonUp(const CPDF_Point & point, FX_UINT nFlag)
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    ASSERT(pEnv);
    CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
    ASSERT(pAnnotHandlerMgr);
    CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y);
    CPDFSDK_Annot* pFocusAnnot = GetFocusAnnot();
    FX_BOOL bRet  = FALSE;
    if(pFocusAnnot && pFocusAnnot != pFXAnnot)
    {
        //Last focus Annot gets a chance to handle the event.
        bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag,point);
    }
    if(pFXAnnot && !bRet)
    {
        bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag,point);
        return bRet;
    }
    return bRet;
}
Ejemplo n.º 2
0
CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
{

    CPDFSDK_AnnotIterator annotIterator(this, FALSE);
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
    CPDFSDK_Annot* pSDKAnnot = NULL;
    int index = -1;
    while((pSDKAnnot = annotIterator.Next(index)))
    {
        if(pSDKAnnot->GetType() == "Widget")
        {
            pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
            CPDF_Point point(pageX, pageY);
            if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point))
                return pSDKAnnot;
        }
    }

    return NULL;
}
Ejemplo n.º 3
0
FX_BOOL CPDFSDK_PageView::OnMouseMove(const CPDF_Point & point, int nFlag)
{

    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
    ASSERT(pAnnotHandlerMgr);
    if(CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y))
    {
        if(m_CaptureWidget && m_CaptureWidget != pFXAnnot)
        {
            m_bExitWidget = TRUE;
            m_bEnterWidget = FALSE;
            pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
        }
        m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot;
        m_bOnWidget = TRUE;
        if(!m_bEnterWidget)
        {
            m_bEnterWidget = TRUE;
            m_bExitWidget = FALSE;
            pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot,nFlag);
        }
        pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point);
        return TRUE;
    }
    if(m_bOnWidget)
    {
        m_bOnWidget = FALSE;
        m_bExitWidget = TRUE;
        m_bEnterWidget = FALSE;
        if(m_CaptureWidget)
        {
            pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
            m_CaptureWidget = NULL;
        }
    }
    return FALSE;
}
Ejemplo n.º 4
0
FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag)
{
    CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
    ASSERT(pEnv);
    CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y);
    if(!pFXAnnot)
    {
        KillFocusAnnot(nFlag);
    }
    else
    {
        CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr();
        ASSERT(pAnnotHandlerMgr);

        FX_BOOL bRet = pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag,point);
        if(bRet)
        {
            SetFocusAnnot(pFXAnnot);
        }
        return bRet;
    }
    return FALSE;
}
Ejemplo n.º 5
0
FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) {
  if (m_pFocusAnnot) {
    CPDFSDK_AnnotHandlerMgr* pAnnotHandler = m_pEnv->GetAnnotHandlerMgr();
    CPDFSDK_Annot* pFocusAnnot = m_pFocusAnnot;
    m_pFocusAnnot = nullptr;
    if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
      if (pFocusAnnot->GetType() == FX_BSTRC("Widget")) {
        CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
        int nFieldType = pWidget->GetFieldType();
        if (FIELDTYPE_TEXTFIELD == nFieldType ||
            FIELDTYPE_COMBOBOX == nFieldType) {
          m_pEnv->FFI_OnSetFieldInputFocus(NULL, NULL, 0, FALSE);
        }
      }

      if (!m_pFocusAnnot)
        return TRUE;
    } else {
      m_pFocusAnnot = pFocusAnnot;
    }
  }
  return FALSE;
}