Example #1
0
void CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) {
  if (!pMessage)
    return;
  if (!pMessage->m_pDstTarget)
    return;

  IFWL_Widget* pDstWidget = pMessage->m_pDstTarget;
  IFWL_App* pApp = pDstWidget->GetOwnerApp();
  if (!pApp)
    return;

  CFWL_NoteDriver* pNoteDriver =
      static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
  if (!pNoteDriver)
    return;

  if (m_pWidgetMgr->IsThreadEnabled())
    pMessage = static_cast<CFWL_Message*>(pMessage->Clone());
  if (m_pWidgetMgr->IsFormDisabled())
    pNoteDriver->ProcessMessage(pMessage);
  else
    pNoteDriver->QueueMessage(pMessage);

#if (_FX_OS_ == _FX_MACOSX_)
  CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop();
  if (pTopLoop)
    pNoteDriver->UnqueueMessage(pTopLoop);
#endif

  if (m_pWidgetMgr->IsThreadEnabled())
    pMessage->Release();

  return;
}
Example #2
0
IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
  if (!pNoteThread)
    return NULL;
  CFWL_NoteDriver* noteDriver =
      static_cast<CFWL_NoteDriver*>(pNoteThread->GetNoteDriver());
  if (!noteDriver)
    return NULL;
  if (noteDriver->CountLoop() == 1) {
    return NULL;
  }
  CFWL_NoteLoop* topLoop = noteDriver->GetTopLoop();
  if (!topLoop)
    return NULL;
  CFWL_WidgetImp* widget = topLoop->GetForm();
  if (!widget)
    return NULL;
  return widget->GetInterface();
}