CProjectInfoPage::CProjectInfoPage(DuiLib::CPaintManagerUI* ppm) :m_pListProjs(NULL) ,m_pProjProcessor(NULL) //,m_pAddGroupMemWnd(NULL) ,m_pBtnPrevPage(NULL) ,m_pBtnNextPage(NULL) ,m_pBtnEndPage(NULL) ,m_nCurrentPageIndex(-1) ,m_nEndPageIndex(-1) { m_PaintManager = ppm; CDialogBuilder DlgBuilder; CVerticalLayoutUI *pProjectPage = NULL; CDialogBuilderCallbackEx cb(m_PaintManager); if (!DlgBuilder.GetMarkup()->IsValid()) { pProjectPage = static_cast<CVerticalLayoutUI*>(DlgBuilder.Create(_T("tab_project_page.xml"), (UINT)0, &cb, m_PaintManager)); } else { pProjectPage = static_cast<CVerticalLayoutUI*>(DlgBuilder.Create((UINT)0, m_PaintManager)); } static_cast<CTabLayoutUI*>(ppm->FindControl("SidebarTabContainer"))->Add(pProjectPage); m_PaintManager->AddNotifier(this); }
IMPL_LUA_FUNC(LuaCDialogBuilder, GetMarkup) { try { CDialogBuilder* self; self = static_cast<CDialogBuilder*>(LuaStatic::CheckUserData(l, 1)); CMarkup* pMarkup = self->GetMarkup(); if (pMarkup) LuaStatic::AddObject2Lua(l, pMarkup, METATABLE_NAME(pMarkup)); else lua_pushnil(l); return 1; } catch (...) { DuiException(_T("LuaCDialogBuilder::GetMarkup")); return 0; } }
void CProjectInfoPage::AddListItem(int nFromIndex, int nCount) { for (int i=nFromIndex; i<nCount+nFromIndex; i++) { CDialogBuilder DlgBuilder; CListContainerElementUI *plstItem = NULL; if (!DlgBuilder.GetMarkup()->IsValid()) { plstItem = static_cast<CListContainerElementUI*>(DlgBuilder.Create(_T("project_list_item.xml"), (UINT)0, NULL, m_PaintManager)); } else { plstItem = static_cast<CListContainerElementUI*>(DlgBuilder.Create((UINT)0, m_PaintManager)); } if (plstItem == NULL) return ; else { sProjectItem& oneProj = m_vecProjects[i]; sProjectItem* pNewData = new sProjectItem; pNewData->strCreateTime = oneProj.strCreateTime; pNewData->strDestOrgID = oneProj.strDestOrgID; pNewData->strDestOrgName = oneProj.strDestOrgName; pNewData->strProjID = oneProj.strProjID; pNewData->strProjName = oneProj.strProjName; pNewData->strRoomID = oneProj.strRoomID; pNewData->vecDestParticipants = oneProj.vecDestParticipants; CLabelUI *pLabelProjName = static_cast<CLabelUI *>(m_PaintManager->FindSubControlByName(plstItem, _T("lable_project_name"))); if (pLabelProjName != NULL) { pLabelProjName->SetText(oneProj.strProjName.c_str()); } tstring strShowDest; //判断是个人还是机构。 if (oneProj.strDestOrgID.empty() && oneProj.strDestOrgName.empty() && oneProj.vecDestParticipants.size()>0) { tstring strAccount = oneProj.vecDestParticipants[0]; strAccount += MMPC_ACCOUNT; //策略修改:取消了用户的备注名 sUserVCard oneUser; if (GetDBTaskModule()->LoadUserVCard(strAccount, oneUser)) { strShowDest = oneUser.strUserNickname.c_str(); } sUserVCard oneNewVCard; if(CController::Instance()->GetUserInfoMgr()->GetUserVCard(strAccount, oneNewVCard)) { strShowDest = oneNewVCard.strUserNickname; } if (strShowDest.empty()) { strShowDest = oneProj.vecDestParticipants[0]; } } else { strShowDest = oneProj.strDestOrgName; } CLabelUI *pLabelOrgName = static_cast<CLabelUI *>(m_PaintManager->FindSubControlByName(plstItem, _T("label_orgnization_name"))); if (pLabelOrgName != NULL) { pLabelOrgName->SetText(strShowDest.c_str()); } CLabelUI *pLabelTime = static_cast<CLabelUI *>(m_PaintManager->FindSubControlByName(plstItem, _T("label_project_time"))); if (pLabelTime != NULL) { pLabelTime->SetText(oneProj.strCreateTime.c_str()); } //用roomID来标识唯一的Item plstItem->SetTag((UINT_PTR)pNewData); plstItem->SetFixedHeight(50); if (!m_pListProjs->Add(plstItem)) { delete plstItem; } } } }