void IFWL_ComboList::ChangeSelected(int32_t iSel) { if (!m_pProperties->m_pDataProvider) return; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); CFWL_ListItem* hItem = pData->GetItem(this, iSel); CFX_RectF rtInvalidate; rtInvalidate.Reset(); CFWL_ListItem* hOld = GetSelItem(0); int32_t iOld = pData->GetItemIndex(this, hOld); if (iOld == iSel) return; if (iOld > -1) { GetItemRect(iOld, rtInvalidate); SetSelItem(hOld, false); } if (hItem) { CFX_RectF rect; GetItemRect(iSel, rect); rtInvalidate.Union(rect); CFWL_ListItem* hSel = pData->GetItem(this, iSel); SetSelItem(hSel, true); } if (!rtInvalidate.IsEmpty()) Repaint(&rtInvalidate); }
FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, IFWL_Widget* pOwner) { if (HasToolTip(pEvt->m_pDstTarget)) { if (NULL == m_pToolTipImp) { CFWL_WidgetImpProperties prop; prop.m_pDataProvider = m_ToolTipDp; prop.m_pOwner = pOwner; CFX_RectF rtTooltip; rtTooltip.Set(150, 150, 100, 50); prop.m_rtWidget = rtTooltip; IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr); pToolTip->Initialize(); m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl()); m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0); m_pToolTipImp->SetStates(FWL_WGTSTATE_Invisible, TRUE); } if (pCurTarget->IsShowed()) { CFX_WideString wsCaption; pCurTarget->GetCaption(wsCaption); if (!wsCaption.IsEmpty()) { m_ToolTipDp->m_wsCaption = wsCaption; } CFX_RectF rt; rt.Reset(); CFX_SizeF sz; sz.Reset(); pCurTarget->GetToolTipSize(sz); if (sz.x > 0 && sz.y > 0) { rt.width = sz.x; rt.height = sz.y; } else { CFX_RectF r; m_pToolTipImp->GetWidgetRect(r, TRUE); rt.width = r.width; rt.height = r.height; } CFX_PointF pt; pt.Set(pEvt->m_fx, pEvt->m_fy); if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) { rt.left = pt.x; rt.top = pt.y; m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); } else { CFX_RectF rtAnchor; pCurTarget->GetWidget()->GetClientRect(rtAnchor); pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top); m_pToolTipImp->SetAnchor(rtAnchor); m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor); } m_pToolTipImp->SetWidgetRect(rt); m_pToolTipImp->Update(); m_pToolTipImp->Show(); } return TRUE; } return FALSE; }