void CFWL_DateTimePickerImpDelegate::DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { CFX_RectF rtInvalidate(m_pOwner->m_rtBtn); if (bSet) { m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused; if (m_pOwner->m_pEdit && !(m_pOwner->m_pEdit->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly)) { m_pOwner->m_rtBtn.Set(m_pOwner->m_pProperties->m_rtWidget.width, 0, m_pOwner->m_fBtn, m_pOwner->m_pProperties->m_rtWidget.height - 1); } rtInvalidate = m_pOwner->m_rtBtn; pMsg->m_pDstTarget = m_pOwner->m_pEdit.get(); IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); pDelegate->OnProcessMessage(pMsg); } else { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused; m_pOwner->m_rtBtn.Set(0, 0, 0, 0); if (m_pOwner->DisForm_IsMonthCalendarShowed()) { m_pOwner->ShowMonthCalendar(FALSE); } if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { pMsg->m_pSrcTarget = m_pOwner->m_pEdit.get(); IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); pDelegate->OnProcessMessage(pMsg); } } rtInvalidate.Inflate(2, 2); m_pOwner->Repaint(&rtInvalidate); }
FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { if (m_pFocus == pFocus) { return TRUE; } IFWL_Widget* pPrev = m_pFocus; m_pFocus = pFocus; if (pPrev) { CFWL_MsgKillFocus ms; ms.m_pDstTarget = pPrev; ms.m_pSrcTarget = pPrev; if (bNotify) { ms.m_dwExtend = 1; } IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL); if (pDelegate) { pDelegate->OnProcessMessage(&ms); } } if (pFocus) { IFWL_Widget* pWidget = FWL_GetWidgetMgr()->GetWidget(pFocus, FWL_WGTRELATION_SystemForm); CFWL_FormImp* pForm = pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr; if (pForm) { CFWL_WidgetImp* pNewFocus = static_cast<CFWL_WidgetImp*>(pFocus->GetImpl()); pForm->SetSubFocus(pNewFocus); } CFWL_MsgSetFocus ms; ms.m_pDstTarget = pFocus; if (bNotify) { ms.m_dwExtend = 1; } IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL); if (pDelegate) { pDelegate->OnProcessMessage(&ms); } } return TRUE; }
int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { return DisForm_OnProcessMessage(pMessage); } FX_DWORD dwHashCode = pMessage->GetClassID(); if (dwHashCode == FWL_MSGHASH_SetFocus || dwHashCode == FWL_MSGHASH_KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); pDelegate->OnProcessMessage(pMessage); } return 1; }
int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) return 0; FX_DWORD dwMsgCode = pMessage->GetClassID(); int32_t iRet = 1; switch (dwMsgCode) { case FWL_MSGHASH_SetFocus: case FWL_MSGHASH_KillFocus: { OnFocusChanged(pMessage, dwMsgCode == FWL_MSGHASH_SetFocus); break; } case FWL_MSGHASH_Mouse: { CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage); FX_DWORD dwCmd = pMouse->m_dwCmd; switch (dwCmd) { case FWL_MSGMOUSECMD_LButtonDown: { OnLButtonDown(pMouse); break; } case FWL_MSGMOUSECMD_LButtonUp: { OnLButtonUp(pMouse); break; } case FWL_MSGMOUSECMD_MouseMove: { OnMouseMove(pMouse); break; } case FWL_MSGMOUSECMD_MouseLeave: { OnMouseLeave(pMouse); break; } default: {} } break; } default: { iRet = 0; } } if (dwMsgCode == FWL_MSGHASH_Key && m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); return pDelegate->OnProcessMessage(pMessage); } return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); }
int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { FX_DWORD dwCode = pMessage->GetClassID(); if (dwCode == FWL_MSGHASH_SetFocus || dwCode == FWL_MSGHASH_KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); return pDelegate->OnProcessMessage(pMessage); } else if (dwCode == FWL_MSGHASH_Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) { OnLButtonDownEx(pMsg); return 1; } else if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) { OnLButtonUpEx(pMsg); return 1; } } return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); }
FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) { if (pNote->IsEvent()) { int32_t iCount = m_eventTargets.GetCount(); if (iCount < 1) { return TRUE; } if (FWL_EVTHASH_Mouse == static_cast<CFWL_Event*>(pNote)->GetClassID()) { CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote); if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) { if (m_pNoteLoop->GetForm() && CFWL_ToolTipContainer::getInstance()->ProcessEnter( pMouse, m_pNoteLoop->GetForm()->GetInterface())) { } } else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) { if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { } } else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) && (FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) { if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) { } } } m_sendEventCalled++; FX_POSITION pos = m_eventTargets.GetStartPosition(); while (pos) { void* key = NULL; CFWL_EventTarget* pEventTarget; m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget); if (pEventTarget && !pEventTarget->IsInvalid()) { pEventTarget->ProcessEvent(static_cast<CFWL_Event*>(pNote)); } } m_sendEventCalled--; } else { if (!pNote->m_pDstTarget) return FALSE; IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL); if (pDelegate) { pDelegate->OnProcessMessage(static_cast<CFWL_Message*>(pNote)); } } return TRUE; }
void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) { FX_BOOL bShowed = IsMonthCalendarShowed(); if (bShowed == bActivate) { return; } if (bActivate) { CFX_RectF rtMonthCal; m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); FX_FLOAT fPopupMin = rtMonthCal.height; FX_FLOAT fPopupMax = rtMonthCal.height; CFX_RectF rtAnchor(m_pProperties->m_rtWidget); rtAnchor.width = rtMonthCal.width; rtMonthCal.left = m_rtClient.left; rtMonthCal.top = rtAnchor.Height(); GetPopupPos(fPopupMin, fPopupMax, rtAnchor, rtMonthCal); m_pMonthCal->SetWidgetRect(rtMonthCal); if (m_iYear > 0 && m_iMonth > 0 && m_iDay > 0) { m_pMonthCal->SetSelect(m_iYear, m_iMonth, m_iDay); } m_pMonthCal->Update(); } m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible, !bActivate); if (bActivate) { CFWL_MsgSetFocus msg; msg.m_pDstTarget = m_pMonthCal.get(); msg.m_pSrcTarget = m_pEdit.get(); IFWL_WidgetDelegate* pDelegate = m_pEdit->SetDelegate(NULL); pDelegate->OnProcessMessage(&msg); } CFX_RectF rtInvalidate, rtCal; rtInvalidate.Set(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); m_pMonthCal->GetWidgetRect(rtCal); rtInvalidate.Union(rtCal); rtInvalidate.Inflate(2, 2); Repaint(&rtInvalidate); }
FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm) { FX_BOOL bRet = FALSE; switch (pMessage->GetClassID()) { case FWL_MSGHASH_Activate: { bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_Deactivate: { bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_SetFocus: { bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_KillFocus: { bRet = DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_Key: { bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_Mouse: { bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_MouseWheel: { bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_Size: { bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage)); break; } case FWL_MSGHASH_Cursor: { bRet = TRUE; break; } case FWL_MSGHASH_WindowMove: { bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage), pMessageForm); break; } case FWL_MSGHASH_DropFiles: { bRet = DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm); break; } default: { bRet = TRUE; break; } } if (bRet) { IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL); if (pDelegate) { pDelegate->OnProcessMessage(pMessage); } } return bRet; }