duilib 之 搜索查找控件 总结

 

查找,一般指的是在容器BOX中,查找符合条件的子控件

一  duilib自有的控件搜索 及封装

0)基本搜索控件函数    FindControl

duilib中,基本控件Control中,

有控件搜索的 虚函数 FindControl

typedef Control* (CALLBACK* FINDCONTROLPROC)(Control*, LPVOID);


	/// 控件搜索
	/**
	 * @brief 根据坐标查找指定控件
	 * @param[in] Proc
	 * @param[in] pData
	 * @param[in] uFlags
	 * @param[in] scrollPos
	 * @return 返回控件的指针
	 */
    virtual Control* FindControl(FINDCONTROLPROC Proc, LPVOID pData, UINT uFlags, CPoint scrollPos = CPoint());



Control* Control::FindControl(FINDCONTROLPROC Proc, LPVOID pData, UINT uFlags, CPoint scrollPos)
{
    if( (uFlags & UIFIND_VISIBLE) != 0 && !IsVisible() ) return NULL;
    if( (uFlags & UIFIND_ENABLED) != 0 && !IsEnabled() ) return NULL;
	if( (uFlags & UIFIND_HITTEST) != 0 && (!m_bMouseEnabled || !::PtInRect(&m_rcIte

你可能感兴趣的:(duilib)