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; }
void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) { IFWL_Widget* pTarget = pMsg->m_pDstTarget; if (pTarget == m_pHover) { return; } if (m_pHover) { CFWL_MsgMouse msLeave; msLeave.m_pDstTarget = m_pHover; msLeave.m_fx = pMsg->m_fx; msLeave.m_fy = pMsg->m_fy; pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy); msLeave.m_dwFlags = 0; msLeave.m_dwCmd = FWL_MSGMOUSECMD_MouseLeave; DispatchMessage(&msLeave, NULL); } if (pTarget->GetClassID() == FWL_CLASSHASH_Form) { m_pHover = NULL; return; } m_pHover = pTarget; CFWL_MsgMouse msHover; msHover.m_pDstTarget = pTarget; msHover.m_fx = pMsg->m_fx; msHover.m_fy = pMsg->m_fy; msHover.m_dwFlags = 0; msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover; DispatchMessage(&msHover, NULL); }
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; }
IFWL_Widget* CFWL_WidgetMgr::GetDefaultButton(IFWL_Widget* pParent) { if ((pParent->GetClassID() == FWL_Type::PushButton) && (pParent->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { return pParent; } IFWL_Widget* child = CFWL_WidgetMgr::GetInstance()->GetFirstChildWidget(pParent); while (child) { if ((child->GetClassID() == FWL_Type::PushButton) && (child->GetStates() & (1 << (FWL_WGTSTATE_MAX + 2)))) { return child; } IFWL_Widget* find = GetDefaultButton(child); if (find) { return find; } child = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(child); } return nullptr; }