コード例 #1
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
                                   IFWL_Widget* pMessageForm) {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pWidgetMgr)
    return FALSE;
  IFWL_Widget* pTarget = NULL;
  if (m_pGrab)
    pTarget = m_pGrab;
  if (!pTarget) {
    pTarget =
        pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
    while (pTarget && pTarget->GetClassID() == FWL_CLASSHASH_Grid) {
      pTarget = pTarget->GetParent();
    }
  }
  if (pTarget) {
    if (pMessageForm != pTarget) {
      pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy);
    }
  }
  if (!pTarget)
    return FALSE;
  pMsg->m_pDstTarget = pTarget;
  return TRUE;
}
コード例 #2
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pWidgetMgr)
    return FALSE;
  pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
                                (FX_FLOAT)pMsg->m_iHeight);
  return TRUE;
}
コード例 #3
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FWL_ERR CFWL_NoteLoop::EndModalLoop() {
  m_bContinueModal = FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
  adapterWidgetMgr->EndLoop();
#endif
  return FWL_ERR_Succeeded;
}
コード例 #4
0
ファイル: fwl_contentimp.cpp プロジェクト: andoma/pdfium
FWL_ERR CFWL_ContentImp::RemoveAllWidgets() {
  CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pMgr)
    return FWL_ERR_Indefinite;
  while (IFWL_Widget* widget =
             pMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild)) {
    pMgr->SetParent(NULL, widget);
  }
  return FWL_ERR_Succeeded;
}
コード例 #5
0
void CFWL_CheckBoxImp::NextStates() {
  FX_DWORD dwFirststate = m_pProperties->m_dwStates;
  if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
    if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
        FWL_STATE_CKB_Unchecked) {
      CFWL_WidgetMgr* pWidgetMgr =
          static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
      if (!pWidgetMgr->IsFormDisabled()) {
        CFX_PtrArray radioarr;
        pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr);
        IFWL_CheckBox* pCheckBox = NULL;
        int32_t iCount = radioarr.GetSize();
        for (int32_t i = 0; i < iCount; i++) {
          pCheckBox = static_cast<IFWL_CheckBox*>(radioarr[i]);
          if (pCheckBox != m_pInterface &&
              pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
            pCheckBox->SetCheckState(0);
            CFX_RectF rt;
            pCheckBox->GetWidgetRect(rt);
            rt.left = rt.top = 0;
            m_pWidgetMgr->RepaintWidget(pCheckBox, &rt);
            break;
          }
        }
      }
      m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
    }
  } else {
    if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
        FWL_STATE_CKB_Neutral) {
      m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
      if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
        m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
      }
    } else if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
               FWL_STATE_CKB_Checked) {
      m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask;
    } else {
      if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) {
        m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral;
      } else {
        m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
      }
    }
  }
  Repaint(&m_rtClient);
  FX_DWORD dwLaststate = m_pProperties->m_dwStates;
  if (dwFirststate != dwLaststate) {
    CFWL_EvtCkbCheckStateChanged wmCheckBoxState;
    wmCheckBoxState.m_pSrcTarget = m_pInterface;
    DispatchEvent(&wmCheckBoxState);
  }
}
コード例 #6
0
static void FWL_SetChildThemeID(IFWL_Widget* pParent, uint32_t dwThemeID) {
  CFWL_WidgetMgr* pWidgetMgr = CFWL_WidgetMgr::GetInstance();
  IFWL_Widget* pChild = pWidgetMgr->GetFirstChildWidget(pParent);
  while (pChild) {
    IFWL_ThemeProvider* pTheme = pChild->GetThemeProvider();
    if (pTheme) {
      pTheme->SetThemeID(pChild, dwThemeID, FALSE);
    }
    FWL_SetChildThemeID(pChild, dwThemeID);
    pChild = pWidgetMgr->GetNextSiblingWidget(pChild);
  }
}
コード例 #7
0
ファイル: fwl_contentimp.cpp プロジェクト: andoma/pdfium
FWL_ERR CFWL_ContentImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) {
  if (!pChild)
    return FWL_ERR_Indefinite;
  pChild->SetParent(m_pInterface);
  if (nIndex == -1) {
    return FWL_ERR_Succeeded;
  }
  CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pMgr)
    return FWL_ERR_Indefinite;
  pMgr->SetWidgetIndex(pChild, nIndex);
  return FWL_ERR_Succeeded;
}
コード例 #8
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
                                  ? pMessage->m_pDstTarget
                                  : GetMessageForm(pMessage->m_pDstTarget);
  if (!pMessageForm)
    return FALSE;
  if (DispatchMessage(pMessage, pMessageForm)) {
    if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
      MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
    }
    return TRUE;
  }
  return FALSE;
}
コード例 #9
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FWL_ERR CFWL_NoteDriver::Run() {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pWidgetMgr)
    return FWL_ERR_Indefinite;
#if (_FX_OS_ == _FX_MACOSX_)
  IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
  CFWL_NoteLoop* pTopLoop = GetTopLoop();
  if (pTopLoop) {
    CFWL_WidgetImp* formImp = pTopLoop->GetForm();
    if (formImp) {
      IFWL_Widget* pForm = formImp->GetInterface();
      adapterWidgetMgr->RunLoop(pForm);
    }
  }
#elif(_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
  FX_BOOL bIdle = TRUE;
  int32_t iIdleCount = 0;
  CFWL_NoteLoop* pTopLoop = NULL;
  for (;;) {
    pTopLoop = GetTopLoop();
    if (!pTopLoop || !pTopLoop->ContinueModal()) {
      break;
    }
    if (UnqueueMessage(pTopLoop)) {
      continue;
    }
    while (bIdle && !(pWidgetMgr->CheckMessage_Native())) {
      if (FWL_ERR_Indefinite == pTopLoop->Idle(iIdleCount++)) {
        bIdle = FALSE;
      }
    }
    do {
      if (FWL_ERR_Indefinite == pWidgetMgr->DispatchMessage_Native()) {
        break;
      }
      if (pWidgetMgr->IsIdleMessage_Native()) {
        bIdle = TRUE;
        iIdleCount = 0;
      }
    } while (pWidgetMgr->CheckMessage_Native());
  }
#elif(_FX_OS_ == _FX_LINUX_DESKTOP_)
  CFWL_NoteLoop* pTopLoop = NULL;
  for (;;) {
    pTopLoop = GetTopLoop();
    if (!pTopLoop || !pTopLoop->ContinueModal()) {
      break;
    }
    if (UnqueueMessage(pTopLoop)) {
      continue;
    }
    if (pWidgetMgr->CheckMessage_Native()) {
      pWidgetMgr->DispatchMessage_Native();
    }
  }
#endif
  return FWL_ERR_Succeeded;
}
コード例 #10
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
                                 IFWL_Widget* pMessageForm) {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (!pWidgetMgr)
    return FALSE;
  IFWL_Widget* pDst =
      pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
  if (!pDst)
    return FALSE;
  while (pDst && pDst->GetClassID() == FWL_CLASSHASH_Grid) {
    pDst = pDst->GetParent();
  }
  pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy);
  pMsg->m_pDstTarget = pDst;
  return TRUE;
}
コード例 #11
0
ファイル: ifwl_widget.cpp プロジェクト: documentcloud/pdfium
void IFWL_Widget::SetStates(uint32_t dwStates, bool bSet) {
  bSet ? (m_pProperties->m_dwStates |= dwStates)
       : (m_pProperties->m_dwStates &= ~dwStates);
  if (!(dwStates & FWL_WGTSTATE_Invisible) || !bSet)
    return;

  CFWL_NoteDriver* noteDriver =
      static_cast<CFWL_NoteDriver*>(GetOwnerApp()->GetNoteDriver());
  CFWL_WidgetMgr* widgetMgr = GetOwnerApp()->GetWidgetMgr();
  noteDriver->NotifyTargetHide(this);
  IFWL_Widget* child = widgetMgr->GetFirstChildWidget(this);
  while (child) {
    noteDriver->NotifyTargetHide(child);
    NotifyHideChildWidget(widgetMgr, child, noteDriver);
    child = widgetMgr->GetNextSiblingWidget(child);
  }
  return;
}
コード例 #12
0
ファイル: ifwl_widget.cpp プロジェクト: documentcloud/pdfium
CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) {
  if (pParent == this)
    return CFX_SizeF();

  CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr();
  if (!pWidgetMgr)
    return CFX_SizeF();

  CFX_SizeF szRet(m_pProperties->m_rtWidget.left,
                  m_pProperties->m_rtWidget.top);

  IFWL_Widget* pDstWidget = GetParent();
  while (pDstWidget && pDstWidget != pParent) {
    CFX_RectF rtDst;
    pDstWidget->GetWidgetRect(rtDst);
    szRet += CFX_SizeF(rtDst.left, rtDst.top);
    pDstWidget = pWidgetMgr->GetParentWidget(pDstWidget);
  }
  return szRet;
}
コード例 #13
0
ファイル: cfwl_widgetmgr.cpp プロジェクト: hfiguiere/pdfium
IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent,
                                     IFWL_Widget* focus,
                                     FX_BOOL& bFind) {
  CFWL_WidgetMgr* pMgr = CFWL_WidgetMgr::GetInstance();
  IFWL_Widget* child = pMgr->GetFirstChildWidget(parent);
  while (child) {
    if (focus == child)
      bFind = TRUE;

    if ((child->GetStyles() & FWL_WGTSTYLE_TabStop) &&
        (!focus || (focus != child && bFind))) {
      return child;
    }
    IFWL_Widget* bRet = nextTab(child, focus, bFind);
    if (bRet)
      return bRet;

    child = pMgr->GetNextSiblingWidget(child);
  }
  return nullptr;
}
コード例 #14
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
  int32_t iTrackLoop = m_noteLoopQueue.GetSize();
  if (iTrackLoop <= 0)
    return NULL;
  IFWL_Widget* pMessageForm = NULL;
  if (iTrackLoop > 1) {
    CFWL_NoteLoop* pNootLoop =
        static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
    pMessageForm = pNootLoop->GetForm()->GetInterface();
  } else {
    pMessageForm = (m_forms.Find(pDstTarget) < 0) ? NULL : pDstTarget;
  }
  if (!pMessageForm && pDstTarget) {
    CFWL_WidgetMgr* pWidgetMgr =
        static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
    if (!pWidgetMgr)
      return NULL;
    pMessageForm =
        pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm);
  }
  return pMessageForm;
}
コード例 #15
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
                                    IFWL_Widget* pMessageForm) {
  CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
  if (pWidgetMgr->IsFormDisabled()) {
    m_pFocus = pMsg->m_pDstTarget;
    return TRUE;
  } else {
    IFWL_Widget* pWidget = pMsg->m_pDstTarget;
    CFWL_FormImp* pForm =
        pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
    if (pForm) {
      CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
      if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
        pMsg->m_pDstTarget = pSubFocus->GetInterface();
        if (m_pFocus != pMsg->m_pDstTarget) {
          m_pFocus = pMsg->m_pDstTarget;
          return TRUE;
        }
      }
    }
  }
  return FALSE;
}
コード例 #16
0
ファイル: fwl_noteimp.cpp プロジェクト: andoma/pdfium
FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
#if (_FX_OS_ != _FX_MACOSX_)
  if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
      pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
    CFWL_WidgetMgr* pWidgetMgr =
        static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
    IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
    IFWL_Widget* pFocus = m_pFocus;
    if (m_pFocus) {
      if (pWidgetMgr->GetWidget(m_pFocus, FWL_WGTRELATION_SystemForm) !=
          pForm) {
        pFocus = NULL;
      }
    }
    FX_BOOL bFind = FALSE;
    IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind);
    if (!pNextTabStop) {
      bFind = FALSE;
      pNextTabStop = pWidgetMgr->nextTab(pForm, NULL, bFind);
    }
    if (pNextTabStop == pFocus) {
      return TRUE;
    }
    if (pNextTabStop) {
      SetFocus(pNextTabStop);
    }
    return TRUE;
  }
#endif
  if (!m_pFocus) {
    if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
        pMsg->m_dwKeyCode == FWL_VKEY_Return) {
      CFWL_WidgetMgr* pWidgetMgr =
          static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
      IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
      if (defButton) {
        pMsg->m_pDstTarget = defButton;
        return TRUE;
      }
    }
    return FALSE;
  }
  pMsg->m_pDstTarget = m_pFocus;
  return TRUE;
}