代码拉取完成,页面将自动刷新
#include "StdAfx.h"
#include "ApproverLayout.h"
ApproverLayout::ApproverLayout(SWindow* pRoot, funApproverCallBack fun)
: VirtualDlgLayout(pRoot, _T("layout:layout_approver"))
, m_funCallBack(fun)
{
InitWnd(m_pCheckAllSel, L"check_allapprover");
InitWnd(m_pBtnOK, L"btn_approver_ok");
subscribeEvent(m_pCheckAllSel, &ApproverLayout::OnEventCheckCmd, this);
subscribeEvent(m_pBtnOK, &ApproverLayout::OnEventOKCmd, this);
m_pAdapter = new ApproverListAdapter(std::bind(&ApproverLayout::OnAdapterUpdate, this));
SMCListView* pMcList;
InitWnd(pMcList, L"mclist_approver");
pMcList->SetAdapter(m_pAdapter);
m_pAdapter->Release();
/*m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");
m_pAdapter->Add(121, L"aaad");*/
}
ApproverLayout::~ApproverLayout(void)
{
}
void ApproverLayout::Init(__int64 lBodyId)
{
m_pAdapter->DeleteAll();
m_pCheckAllSel->SetCheck(FALSE);
m_pBtnOK->EnableWindow(FALSE, TRUE);
m_lBodyId = lBodyId;
}
void ApproverLayout::AddApprover(UINT uId, LPCTSTR lpUserAlias)
{
m_pAdapter->Add(uId, lpUserAlias);
}
void ApproverLayout::OnAdapterUpdate()
{
UINT uSelCount = 0;
UINT uCount = m_pAdapter->getCount();
for (UINT i=0; i<uCount; ++i)
{
if(!m_pAdapter->IsChecked(i))
continue;
++uSelCount;
}
if(uSelCount == uCount)
m_pCheckAllSel->SetCheck(TRUE);
else
m_pCheckAllSel->SetCheck(FALSE);
if(uSelCount > 0)
{
m_pBtnOK->EnableWindow(TRUE, TRUE);
}
else
{
m_pBtnOK->EnableWindow(FALSE, TRUE);
}
}
bool ApproverLayout::OnEventCheckCmd(EventCmd* pEvt)
{
SCheckBox* pCheck = sobj_cast<SCheckBox>(pEvt->sender);
if(NULL == pCheck) return true;
bool bSel = TRUE == pCheck->IsChecked();
m_pAdapter->SetAllSelect(bSel);
OnAdapterUpdate();
return true;
}
bool ApproverLayout::OnEventOKCmd(EventCmd* pEvt)
{
if(NULL == pEvt) return true;
if(0 == m_lBodyId)
{
return true;
}
SStringT szApproverText;
UINT uId;
SStringT sName;
UINT uCount = m_pAdapter->getCount();
for (UINT i=0; i<uCount; ++i)
{
if(!m_pAdapter->IsChecked(i))
continue;
m_pAdapter->Get(i, uId, sName);
szApproverText.AppendFormat(_T("%d,"), uId);
}
szApproverText.TrimRight(',');
m_funCallBack(m_lBodyId, szApproverText);
ShowLayout(false);
return true;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。