#pragma once #include "../__INCLUDE/LvAdapterHandle.hpp" class CNodeAdapter : public LvAdapterHandle { public: CNodeAdapter(SListView* pOwner) : LvAdapterHandle(pOwner) , m_funBtnDel(&CNodeAdapter::OnEventDelBtn, this) , m_callBackItemClick(nullptr) , m_callBackBtnClick(nullptr) , m_count(0) , m_callshowview(nullptr) { m_seleset = true; } ~CNodeAdapter() { } virtual SStringT GetColumnName(int iCol) const { return L"col_nick"; } void SetItemClickCallBack(std::function fun) { m_callBackItemClick = fun; } void SetBtnClickCallBack(std::function fun) { m_callBackBtnClick = fun; } void SetCount(int count) { m_count = count; notifyDataSetChanged(); } void SetShowView(std::function fun) { m_callshowview = fun; } private: int getCount() { return m_count; } void ShowView(int nItem, SWindow* pItem) { if (m_callshowview) { m_callshowview(nItem, pItem); } /*auto process_info = Clogin_info::getSingletonPtr()->m_server_gourp_tiles[nItem]; pItem->FindChildByName2(L"titile")->SetWindowTextW(S_CA2W(process_info.title.c_str(), CP_UTF8));*/ } void ItemHover(int nItem, SItemPanel* pItem, const CPoint& pt) { SWindow* pBtn = pItem->FindChildByName(L"ml_btn_del"); if (NULL != pBtn) pBtn->SetVisible(TRUE, TRUE); SWindow* pCount = pItem->FindChildByName(L"ml_count"); if (NULL != pCount) pCount->SetVisible(FALSE, TRUE); } void ItemLeave(int nItem, SItemPanel* pItem) { SWindow* pBtn = pItem->FindChildByName(L"ml_btn_del"); if (NULL != pBtn) pBtn->SetVisible(FALSE, TRUE); SWindow* pCount = pItem->FindChildByName(L"ml_count"); if (NULL != pCount && !pCount->GetWindowText().IsEmpty()) { pCount->SetVisible(TRUE, TRUE); } } void ItemClick(int nItem, SItemPanel* pItem, const CPoint& pt) { if (nullptr != m_callBackItemClick) m_callBackItemClick(nItem); } bool IsItemClick(int nItem, const SStringT& szSndName) { if (0 == szSndName.CompareNoCase(L"ml_btn_del")) return false; return true; } bool OnEventDelBtn(EventArgs* e) { e->bubbleUp = false; EventCmd* pEvt = sobj_cast(e); if (NULL == pEvt) return true; SImageButton* pBtn = sobj_cast(pEvt->sender); if (NULL == pBtn) return true; SItemPanel* pItem = sobj_cast(pBtn->GetParent()); if (NULL == pItem) return true; if (nullptr != m_callBackBtnClick) m_callBackBtnClick(static_cast(pItem->GetItemIndex())); return true; } private: std::function m_callBackItemClick; // item ���� �ص� std::function m_callBackBtnClick; // item btn �ص� std::function m_callshowview; int m_count; INT m_nCurCheck; bool m_seleset; MemberFunctionSlot m_funBtnDel; };