void SessionLayout::_AddGroupMemberToList(IN const std::string& sID, IN const BOOL bCreator) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo)) { LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sID),util::stringToCString(m_sId)); return; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager); if (!pListElement) { LOG__(ERR, _T("群item创建失败")); return; } CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); PTR_VOID(pLogo); pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); if (bCreator) { CButtonUI* pCreator = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("Creator"))); PTR_VOID(pCreator); pCreator->SetVisible(true); pCreator->SetUserData(_T("Creator")); } CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); PTR_VOID(pNameLable); pNameLable->SetText(userInfo.getRealName()); pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pGroupMemberList->Add(pListElement); }
void SessionLayout::FreshAllGroupMemberAvatar() { if (!m_pGroupMemberList) { return; } for (int n = 0; n < m_pGroupMemberList->GetCount(); n++) { CListContainerElementUI* pItem = (CListContainerElementUI*)m_pGroupMemberList->GetItemAt(n); if (pItem) { CDuiString userData = pItem->GetUserData(); if (!userData.IsEmpty()) { std::string sid = util::cStringToString(CString(userData)); module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo)) { LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sid),util::stringToCString(m_sId)); continue;; } CButtonUI* btnAvatarInfo = (CButtonUI*)pItem->FindSubControl(_T("AvatarInfo")); if (btnAvatarInfo) { btnAvatarInfo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); } } } } m_pGroupMemberList->SortItems(GroupMemberListItemCompareFunc, 0); }
void SessionLayout::_AddGroupMemberToList(IN const std::string& sID) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo)) { APP_LOG(LOG_ERROR, _T("SessionLayout::_updateGroupMembersList(),can't find the userInfo")); return; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager); if (!pListElement) { APP_LOG(LOG_ERROR, _T("群item创建失败")); return; } CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); if (!pLogo) { return; } pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); if (!pNameLable) { return; } pNameLable->SetText(userInfo.getRealName()); pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pGroupMemberList->Add(pListElement); }
void SessionLayout::FreshGroupMemberAvatar(IN const std::string& sID) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sID, userInfo)) { APP_LOG(LOG_ERROR, _T("SessionLayout::_updateGroupMembersList(),can't find the userInfo")); return; } if (!m_pGroupMemberList) { return; } for (int n = 0; n < m_pGroupMemberList->GetCount(); n++) { CListContainerElementUI* pItem = (CListContainerElementUI*)m_pGroupMemberList->GetItemAt(n); if (pItem) { CDuiString userData = pItem->GetUserData(); if (!userData.IsEmpty()) { std::string sid = util::cStringToString(CString(userData)); if (sid == sID) { CButtonUI* btnAvatarInfo = (CButtonUI*)pItem->FindSubControl(_T("AvatarInfo")); if (btnAvatarInfo) { btnAvatarInfo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); } } } } } m_pGroupMemberList->SortItems(GroupMemberListItemCompareFunc, 0); }
bool CMusicListItemUI::Hot(bool bHot) { if( !IsEnabled()) return false; if (m_pMusicListHotTab == NULL) m_pMusicListHotTab = static_cast<CTabLayoutUI*>(m_pManager->FindSubControlByName(this, kMusicHotTabControlName)); if ( m_pMusicListHotTab != NULL ) { CButtonUI *pBtnPalyButton = static_cast<CButtonUI*>(m_pManager->FindSubControlByName(this, kPlayControlControlName)); CLabelUI *pLblMusicIndex = static_cast<CLabelUI*>(m_pManager->FindSubControlByName(this, kMusicIndexControlName)); if ( pBtnPalyButton == NULL || pLblMusicIndex == NULL ) return false; if (bHot) { m_pMusicListHotTab->SelectItem(1); pBtnPalyButton->SetVisible(true); pLblMusicIndex->SetVisible(false); } else { m_pMusicListHotTab->SelectItem(0); pBtnPalyButton->SetVisible(false); pLblMusicIndex->SetVisible(true); } } Invalidate(); return true; }
//显示道具页 void CRightFrame::ShowPropPage(UINT uPage) { if (uPage < 0) { return; } if (uPage >= m_uPropPageNums) { return; } //当前显示道具的页 m_uCurrPropPage = uPage; int iMinPos = uPage * m_uPropPageSize; int iMaxPos = iMinPos + m_uPropPageSize - 1; for (int i = 0; i < MAX_PROP_NUMS; ++i) { if (m_pPropBtn[i]) { m_pPropBtn[i]->SetVisible(i >= iMinPos && i <= iMaxPos); } } CButtonUI* pBtnPrev = static_cast<CButtonUI*>(m_pm.FindControl("Prop_Btn_Prev")); CButtonUI* pBtnNext = static_cast<CButtonUI*>(m_pm.FindControl("Prop_Btn_Next")); pBtnPrev->SetEnabled(uPage > 0); pBtnNext->SetEnabled(uPage < m_uPropPageNums - 1); return; }
void CColorPicker::InitWindow() { CVerticalLayoutUI* pColorContiner = static_cast<CVerticalLayoutUI*>(GetPaintMgr()->FindControl(_T("color"))); for (int i = 0; (i < 5) && (pColorContiner != NULL); i ++) { CHorizontalLayoutUI* pLine = new CHorizontalLayoutUI(); pLine->SetFixedHeight(12); pColorContiner->Add(pLine); for (int j = 0; j < 8; j++) { CButtonUI* pOne = new CButtonUI(); pOne->ApplyAttributeList(_T("bordersize=\"1\" bordercolor=\"#FF000000\" width=\"10\" height=\"10\"")); pOne->SetBkColor(Colors[i][j]); pLine->Add(pOne); if (i < 7) { CControlUI* pMargin = new CControlUI(); pMargin->SetFixedWidth(2); pLine->Add(pMargin); } } } SIZE size = GetPaintMgr()->GetInitSize(); MoveWindow( based_point_.x - static_cast<LONG>(size.cx / 2), based_point_.y - size.cy, size.cx, size.cy, FALSE); }
//设置某一安全的状态 void CSafeCenterWnd::SetItemSafeState(CheckItemType emType,bool bSafeType) { map<CheckItemType,TCheckNode>::iterator itFind = m_mapSCTable.find(emType); if (itFind == m_mapSCTable.end()) { return; } TCheckNode* pCheckNode = &itFind->second; pCheckNode->bOperated = bSafeType; CButtonUI* pBntCtrl = static_cast<CButtonUI*>(m_pm.FindControl(pCheckNode->bntName.c_str())); if (pBntCtrl) { if (!bSafeType) { pBntCtrl->SetText(pCheckNode->opText.c_str()); //pBntCtrl->SetEnabled(true); } else { pBntCtrl->SetText(pCheckNode->norText.c_str()); //pBntCtrl->SetEnabled(false); } } return; }
//点击选择表情 void CRightFrame::OnBnExpression() { CLoveSendClassInExe* pGameFrame = static_cast<CLoveSendClassInExe*>(m_pRoom); CGameTalkText* pExpressWnd = &pGameFrame->m_ExpressWnd; //建立表情窗口 if (pExpressWnd->GetSafeHwnd() == NULL) { pExpressWnd->CreateExpressionWnd(pGameFrame); } //移动窗口 CButtonUI* pFaceBtn = static_cast<CButtonUI*>(m_pm.FindControl("Talk_Btn_Face")); RECT rcFaceBtn = pFaceBtn->GetPos(); RECT rcRightWnd; RECT rcGameWnd; ::GetWindowRect(m_hWnd,&rcRightWnd); ::GetWindowRect(pGameFrame->m_hWnd,&rcGameWnd); ::CSize siExpress; pExpressWnd->GetFixSize(siExpress); pGameFrame->SafeMoveWindow(pExpressWnd, (rcRightWnd.left + rcFaceBtn.right) - siExpress.cx + 176, rcRightWnd.top + rcFaceBtn.top - siExpress.cy - 3, siExpress.cx,siExpress.cy); pExpressWnd->ShowWindow(SW_SHOW); pExpressWnd->SetFocus(); }
void CSearchBussinessPartnerPage::ClearSearchResult() { CButtonUI* pBtnAvatar = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_avatar)); if (NULL != pBtnAvatar) { pBtnAvatar->SetBkImage(_T("")); } CLabelUI* pLabelNickname = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_nick)); if (NULL != pLabelNickname) { pLabelNickname->SetText(_T("")); } CLabelUI* pLabelCompany = static_cast<CLabelUI*>(m_PaintManager.FindControl(label_company)); if (NULL != pLabelCompany) { pLabelCompany->SetText(_T("")); } CButtonUI* pAddFriend = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_add_friend)); if (NULL != pAddFriend) { pAddFriend->SetVisible(false); } if (NULL != m_pCurUserInfo) { delete m_pCurUserInfo; m_pCurUserInfo = NULL; } }
//隐藏加好友的按钮 bool CSearchBussinessPartnerPage::Initialize() { CButtonUI* pBtnAdd = static_cast<CButtonUI*>(m_PaintManager.FindControl(btn_add_friend)); if (NULL != pBtnAdd) { pBtnAdd->SetVisible(false); } return true; }
void CWndAbout::Notify( TNotifyUI &msg ) { __super::Notify(msg); if (msg.sType == DUI_MSGTYPE_CLICK) { if (msg.pSender->GetName() == _T("btn_link")) { CButtonUI *pBtn = static_cast<CButtonUI*>(m_PaintManager.FindControl(_T("btn_link"))); CDuiString strLink = pBtn->GetText(); ::ShellExecute(NULL, _T("open"), strLink.GetData(), NULL, NULL, SW_SHOWNORMAL); } } }
LRESULT CScalableLayout::MessageHandler( UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled ) { if (uMsg == WM_MOUSEWHEEL) { WORD fwKeys = LOWORD(wParam); // key flags if (fwKeys != 0) { return 0; } short zDelta = (short) HIWORD(wParam); // wheel rotation POINT pt; pt.x = (short) LOWORD(lParam); // horizontal position of pointer pt.y = (short) HIWORD(lParam); // vertical position of pointer ::ScreenToClient(m_hParentWnd,&pt); if (zDelta > 0) { // zoom in CControlUI *pHit = GetManager()->FindControl(pt); CButtonUI *pHitButton = dynamic_cast<CButtonUI*>(pHit); if (pHitButton == 0) { return 0; } ZoomIn(pHitButton->GetName()); } else { RECT rc = m_pContainer->GetPos(); if (!::PtInRect(&rc,pt)) { return 0; } ZoomOut(); } bHandled = TRUE; return 0; } return 0; }
void CLoginWindow::Login(const CString& email,const CString& pwd,bool isMD5,bool isKeepLogin) { spUserContextT pContext = theRuntimeState->GetCurrentContext(NULL); spLogonUserInfoT theUser = pContext->GetUser(); if(theUser && 0 == theUser->sLogonEmail.CompareNoCase(email)) { CControlUI *pCtl = GetPaintMgr()->FindControl(_T("login")); CButtonUI *pLoginBtn = static_cast<CButtonUI*>(pCtl); assert(pLoginBtn); if(pLoginBtn) CInfoWindow::ShowInfoWindow(this->m_hWnd,pLoginBtn->GetPos(),_T("Óû§ÒѾµÇ¼!!!")); return; } CControlUI *pEmailEdit = GetPaintMgr()->FindControl(_T("email")); if(pEmailEdit) { pEmailEdit->SetText(email); } std::string sUtf8UserName = em_utility::mci::unicode_2_utf8(email); std::string sUtf8Password = em_utility::mci::unicode_2_utf8(pwd); std::string sUtf8PasswordMD5 = (isMD5 ? sUtf8Password : em_utility::md5_checksum::get_md5((const unsigned char*)sUtf8Password.c_str(),(unsigned int)sUtf8Password.length())); m_sUserName = email; m_sPasswordMd5 = em_utility::mci::utf8_2_CString(sUtf8PasswordMD5.c_str()); //m_isKeepLogin = isKeepLogin; EnableWindow(FALSE); // theWebServiceMgr->AsynSendRequest(m_hWnd,url::Requester::MakeLogin2(sUtf8UserName,sUtf8PasswordMD5)); // CurlData* pData = new CurlData; // pData->SetURL("http://localhost/YMusic/login.php"); // pData->n_type = url::WSRT_LOGIN; // std::string sparam; // sparam = "email="; // sparam += sUtf8UserName; // sparam += "&"; // sparam += "password="; // sparam += sUtf8PasswordMD5; // pData->SetData(sparam.c_str()); // HttpManagerProto::Instance()->DoHttpPost(pData); // CHttpThread* pthread = new CHttpThread(pData,m_hWnd,WM_WEB_SERVICE); // pthread->Start(); CHttpCenter::Instance()->MakeLogin(sUtf8UserName,sUtf8PasswordMD5); }
bool CBookClient::AddNode(BOOK_INFO *item) { if (item == NULL) return false; BOOK_INFO *node = new BOOK_INFO; node->strName = item->strName; node->nImage = item->nImage; node->strPath = item->strPath; node->nBookmark = item->nBookmark; CContainerUI* pDesk = NULL; if( !m_dlgBuilder.GetMarkup()->IsValid() ) { pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create(_T("iBook.xml"), (UINT)0, NULL, &m_pm)); } else { pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create((UINT)0, &m_pm)); } if( pDesk != NULL ) { this->Add(pDesk); CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnBookEx"))); CLabelUI *text = static_cast<CLabelUI*>(m_pm.FindSubControlByName(pDesk, _T("labelBookEx"))); CButtonUI *btnEdit = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnbookdel"))); if (btn == NULL || text == NULL || btnEdit == NULL) return false; CDuiString strImage; strImage.Format(_T("book\\%02d.png"), node->nImage); btn->SetBkImage(strImage); text->SetText(node->strName); btnEdit->SetVisible(m_bEdit); pDesk->SetTag((UINT_PTR)node); } else { delete node; node = NULL; return false; } return true; }
void CreateDiscussionGrpDialog::_updateSearchResultList(IN const std::vector<std::string>& nameList) { if (nameList.empty()) { return; } for (std::string sid : nameList) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo)) { LOG__(ERR, _T("can't find the userInfo:%s"), util::stringToCString(sid)); return; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("CreateDiscussionGrpDialog\\ListGroupMembersItem.xml"), (UINT)0, NULL, &m_PaintManager); if (!pListElement) { LOG__(ERR, _T("群item创建失败")); return; } pListElement->SetName(_T("SearchResultItem")); CControlUI* pLogo = static_cast<CControlUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); if (!pLogo) { return; } pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); if (!pNameLable) { return; } pNameLable->SetText(userInfo.getRealName()); CButtonUI* pRemoveBtn = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("removebtn"))); if (pRemoveBtn) { pRemoveBtn->SetVisible(false); } pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pListSearchResult->Add(pListElement); } }
IMPL_LUA_FUNC(LuaCButtonUI, GetPushedImage) { try { CButtonUI* self; self = static_cast<CButtonUI*>(LuaStatic::CheckUserData(l, 1)); CDuiString pstrText = self->GetPushedImage(); lua_op_t<CDuiString>::push_stack(l, pstrText); return 1; } catch (...) { DuiException(_T("LuaCButtonUI::GetPushedImage")); return 0; } }
IMPL_LUA_FUNC(LuaCButtonUI, SetHotImage) { try { CButtonUI* self; self = static_cast<CButtonUI*>(LuaStatic::CheckUserData(l, 1)); CDuiString pstrText; lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText); self->SetHotImage(pstrText); return 0; } catch (...) { DuiException(_T("LuaCButtonUI::SetHotImage")); return 0; } }
IMPL_LUA_FUNC(LuaCButtonUI, SetFocusedTextColor) { try { CButtonUI* self; self = static_cast<CButtonUI*>(LuaStatic::CheckUserData(l, 1)); DWORD dwBkCor = LuaStatic::ReadRGBAFromLua(l, 2); self->SetFocusedTextColor(dwBkCor); return 0; } catch (...) { DuiException(_T("LuaCButtonUI::SetFocusedTextColor")); return 0; } }
IMPL_LUA_FUNC(LuaCButtonUI, GetFocusedTextColor) { try { CButtonUI* self; self = static_cast<CButtonUI*>(LuaStatic::CheckUserData(l, 1)); DWORD dwBkCor = self->GetFocusedTextColor(); LuaStatic::WriteRGBA2Lua(l, dwBkCor); return 1; } catch (...) { DuiException(_T("LuaCButtonUI::GetFocusedTextColor")); return 0; } }
static DWORD WINAPI Search(LPVOID lpParameter) { try { struct Prama* prama = (struct Prama *)lpParameter; CListUI* pList = prama->pList; CButtonUI* pSearch = prama->pSearch; CStdString tDomain = prama->tDomain; //------------------------------------- /* * 添加数据循环 */ for(int i=0; i<100; i++) { std::stringstream ss; ss << "www." << i << ".com"; domain.push_back(ss.str()); ss.clear(); ss << "it's " << i; desc.push_back(ss.str()); CListTextElementUI* pListElement = new CListTextElementUI; pListElement->SetTag(i); if (pListElement != NULL) { ::PostMessage(prama->hWnd, WM_ADDLISTITEM, 0L, (LPARAM)pListElement); } /* * Sleep 为了展示添加的动态效果,故放慢了添加速度,同时可以看到添加过程中界面仍然可以响应 */ ::Sleep(100); } //------------------------------------------ delete prama; pSearch->SetEnabled(true); return 0; } catch(...) { return 0; } }
LRESULT CAbout::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam); RECT btnRect; CButtonUI* linkbtn; linkbtn = (CButtonUI*)m_PaintManager.FindControl(_T("www.131qz.com")); if (linkbtn != NULL) { btnRect = linkbtn->GetPos(); if(pt.x > btnRect.left && pt.x < btnRect.right && pt.y > btnRect.top && pt.y < btnRect.bottom) { linkbtn->SetTextColor(0xffff0000); linkbtn->NeedUpdate(); }else{ linkbtn->SetTextColor(0xff0000ff); linkbtn->NeedUpdate(); } } bHandled = FALSE; return 0; }
void CQuizWnd::OnClick(TNotifyUI& msg) { AUTO_LOG_FUNCTION; #ifdef _DEBUG std::wstringstream ss; ss << msg.pSender->GetName().GetData() << std::endl << std::ends; OutputDebugString(ss.str().c_str()); #endif CButtonUI* btn = static_cast<CButtonUI*>(msg.pSender); std::wstring btnName = btn->GetName().GetData(); if (btnName.compare(0, ((wstring)BTN_QUESTION_PREFIX).length(), BTN_QUESTION_PREFIX) == 0) { auto name = btnName.substr(((wstring)BTN_QUESTION_PREFIX).length()); // update buttion ui UpdateButtonUi(btn, name); if (name == L"done") { // exam done(); } else { // show quiz int ndx = std::stoi(name); g_prev_clicked_button_option = nullptr; ShowQuiz(ndx); } } else if (btnName.compare(0, ((wstring)BTN_OPTION_PREFIX).length(), BTN_OPTION_PREFIX) == 0) { auto option = btnName.substr(((wstring)BTN_OPTION_PREFIX).length()); // update option ui UpdateButtonUi2(btn, option); // save user answer if (g_cur_quiz_info) { g_cur_quiz_info->set_user_answer(option); } } return __super::OnClick(msg); }
void SessionLayout::_UpdateSearchRsultList(IN const std::vector<std::string>& nameList) { if (nameList.empty()) { return; } for (std::string sid : nameList) { module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo)) { LOG__(ERR, _T("can't find the userInfo:%s,GroupId: %s"),util::stringToCString(sid),util::stringToCString(m_sId)); continue; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("SessionDialog\\groupMembersListItem.xml"), (UINT)0, NULL, &m_paint_manager); if (!pListElement) { LOG__(ERR, _T("creat group item failed")); return; } CButtonUI* pLogo = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); if (!pLogo) { return; } pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); if (!pNameLable) { return; } pNameLable->SetText(userInfo.getRealName()); pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pSearchResultList->Add(pListElement); } }
void CToolbarBottom::UpdateButtonImage(void* pbutton, wchar_t* strImage, int& nImageRight, int nImageWidth) { CButtonUI* pButton = static_cast<CButtonUI*>(pbutton); if (NULL == pButton || NULL == strImage) return; int nWidth = max(pButton->GetFixedWidth(), pButton->GetMinWidth()); wchar_t strDest[128] = {0}; int nLeft = (nWidth - nImageWidth) / 2; nImageRight = nLeft + nImageWidth; wsprintf(strDest,_T("dest='%d,4,%d,34'"), nLeft, nImageRight); wchar_t strImagePath[128] = {0}; wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='0,0,%d,30' %s", strImage, nImageWidth, strDest); pButton->SetForeImage(strImagePath); wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='%d,0,%d,30' %s", strImage, nImageWidth * 2, nImageWidth * 3, strDest); pButton->SetHotForeImage(strImagePath); wsprintf(strImagePath, L"res='%s' restype='ZPIMGRES' source='%d,0,%d,30' %s", strImage, nImageWidth, nImageWidth * 2, strDest); pButton->SetPushedImage(strImagePath); }
void CVisitor::SetPageBtn() { CButtonUI* pLast = static_cast<CButtonUI*>(m_pManager->FindControl(_T("Visitor_LastPage"))); CButtonUI* pNext = static_cast<CButtonUI*>(m_pManager->FindControl(_T("Visitor_NextPage"))); if (m_iCurrentPage == 1) { pLast->SetEnabled(false); } else { pLast->SetEnabled(true); } if (m_iCurrentPage >= m_iPage) { pNext->SetEnabled(false); } else { pNext->SetEnabled(true); } }
CContainerUI * CScalableLayout::CreateLayout( CScalableNode::Ptr pNode,int nLevel ) { CContainerUI *pLayout = pNode->IsHor ? static_cast<CContainerUI*>(new CHorizontalLayoutUI) : static_cast<CContainerUI*>(new CVerticalLayoutUI); pLayout->SetBkColor(pNode->BkColor); for (CScalableNode::Iter i = pNode->ChildBegin(); i != pNode->ChildEnd(); i++) { bool bLeaf = true; for (CScalableNode::Iter j = (*i)->ChildBegin(); j != (*i)->ChildEnd(); j++) { if ((*j)->Level == nLevel) { bLeaf = false; break; } } if (bLeaf) { CContainerUI *pItemContainer = new CContainerUI; CButtonUI *pItem = new CButtonUI; pItem->SetName((*i)->Name); pItem->SetBkColor((*i)->BkColor); pItem->SetShowHtml(); pItem->SetTextStyle(DT_CENTER|DT_VCENTER); CDuiString sText; if ((*i)->Text.IsEmpty()) { sText.Format(_T("{p}{c #FFCCCCCC}%s{/c}{/p}"), (LPCTSTR)(*i)->Description); } else { sText.Format(_T("{p}%s{n}{c #FFCCCCCC}%s{/c}{/p}"), (LPCTSTR)(*i)->Text,(LPCTSTR)(*i)->Description); } pItem->SetText(sText); pItemContainer->Add(pItem); pLayout->Add(pItemContainer); } else { pLayout->Add(CreateLayout(*i,nLevel)); } } if (!pNode->Description.IsEmpty()) { CVerticalLayoutUI *pWrapper = new CVerticalLayoutUI; pWrapper->Add(pLayout); pLayout->SetInset(CDuiRect(5,5,5,0)); CLabelUI *pDescription = new CLabelUI; pDescription->SetFixedHeight(20); pDescription->SetTextStyle(DT_CENTER); pDescription->SetBkColor(pNode->BkColor); pDescription->SetText(pNode->Description); pWrapper->Add(pDescription); return pWrapper; } return pLayout; }
void CSafeCenterWnd::Init() { LoadNormalCtrlSkin(); //加载名项目及状态 if (!m_pUserInfo) { return; } TCheckNode tagChkNode; tagChkNode.name = "没有进行主机绑定(绑定后帐号只能在绑定的主机登录)。"; tagChkNode.opText = "<b><u><c #0000FF>点击绑定</c></u></b>"; tagChkNode.norText = "<c #008000>已绑定</c>"; tagChkNode.OpFun = &CSafeCenterWnd::OnOperateLockMachine; tagChkNode.bOperated = (m_pUserInfo->iLockMathine == 1); m_mapSCTable.insert(pair<CheckItemType,TCheckNode>(CIT_LockMachine,tagChkNode)); //身份验证模块 if (CGamePlaceApp::GetModuleStatus("UserSecurity","IDCardVerify",0) == 1) { tagChkNode.name = "没有设置登陆身份验证(登陆时输入身份证码号码)。"; tagChkNode.opText = "<b><u><c #0000FF>点击设置</c></u></b>"; tagChkNode.norText = "<c #008000>已设置</c>"; tagChkNode.OpFun = &CSafeCenterWnd::OnOperateSetIDVerify; tagChkNode.bOperated = (strlen(m_pUserInfo->szIDCardNo) > 0); m_mapSCTable.insert(pair<CheckItemType,TCheckNode>(CIT_IDVerify,tagChkNode)); } //手机验证模块 if (CGamePlaceApp::GetModuleStatus("UserSecurity","MobileVerify",0) == 1) { tagChkNode.name = "没有绑定手机号码(需要通过短信验证码登陆)。"; tagChkNode.opText = "<b><u><c #0000FF>点击绑定</c></u></b>"; tagChkNode.norText = "<c #008000>已绑定</c>"; tagChkNode.OpFun = &CSafeCenterWnd::OnOperateBindMobileVerify; tagChkNode.bOperated = (m_pUserInfo->iBindMobile == 1); m_mapSCTable.insert(pair<CheckItemType,TCheckNode>(CIT_BindMobile,tagChkNode)); } //加载显示文本 CLabelUI* pLabCtrl = NULL; CButtonUI* pBntCtrl = NULL; TCHAR szName[32]; TCHAR szLab[128]; int iConuter = 0; if (!m_mapSCTable.empty()) { map<CheckItemType,TCheckNode>::iterator itMap = m_mapSCTable.begin(); while(itMap != m_mapSCTable.end()) { iConuter++; TCheckNode* pCheckNode = &itMap->second; if (pCheckNode) { //左则文本 ::sprintf_s(szName,sizeof(szName),"Lab_Item%d",iConuter); pLabCtrl = static_cast<CLabelUI*>(m_pm.FindControl(szName)); ::sprintf_s(szLab,sizeof(szLab),"%d.%s",iConuter,pCheckNode->name.c_str()); pLabCtrl->SetText(szLab); //右则操作按钮 ::sprintf_s(szName,sizeof(szName),"Bnt_Item%d",iConuter); pBntCtrl = static_cast<CButtonUI*>(m_pm.FindControl(szName)); pCheckNode->bntName = szName; pBntCtrl->SetShowHtml(true); if (!pCheckNode->bOperated) { pBntCtrl->SetText(pCheckNode->opText.c_str()); //pBntCtrl->SetEnabled(true); } else { pBntCtrl->SetText(pCheckNode->norText.c_str()); //pBntCtrl->SetEnabled(false); } } itMap++; } } }
void CToolbarBottom::UpdateButton(ToolbarButtonType btnNeedUpdate, buttonStatusType btnStatus) { CButtonUI* button = GetButton(btnNeedUpdate); if(NULL == button) return; switch(btnNeedUpdate) { case Toolbar_Button_Audio: { if(Button_UnMuted==btnStatus) { wchar_t* strText = L"Mute Audio"; button->SetText(strText); int nWidth = max(button->GetFixedWidth(), button->GetMinWidth()); button->SetFixedWidth(nWidth); int nImageRight = 0; UpdateButtonImage((void*)button, _T("toolbar_btn_mute.png"), nImageRight); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Unmute Audio"; button->SetText(strText); int nWidth = max(button->GetFixedWidth(), button->GetMinWidth()); button->SetFixedWidth(nWidth); int nImageRight = 0; UpdateButtonImage((void*)button, _T("toolbar_btn_unmute.png"), nImageRight); } else if(Button_Enabled == btnStatus) { button->SetEnabled(true); } else if(Button_Disabled == btnStatus) { button->SetEnabled(false); } } break; case Toolbar_Button_Video: { if(Button_UnMuted == btnStatus) { wchar_t* strText = L"Hide Video"; button->SetText(strText); int nWidth = max(button->GetFixedWidth(), button->GetMinWidth()); button->SetFixedWidth(nWidth); int nImageRight = 0; UpdateButtonImage((void*)button, _T("toolbar_btn_stopVideo.png"), nImageRight); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Start Video"; button->SetText(strText); int nWidth = max(button->GetFixedWidth(), button->GetMinWidth()); button->SetFixedWidth(nWidth); int nImageRight = 0; UpdateButtonImage((void*)button, _T("toolbar_btn_startVideo.png"), nImageRight); } else if(Button_Enabled == btnStatus) { button->SetEnabled(true); } else if(Button_Disabled == btnStatus) { button->SetEnabled(false); } } break; case Toolbar_Button_Invite: break; case Toolbar_Button_Chat: { if(Button_UnMuted == btnStatus) { wchar_t* strText = L"Show Chat"; button->SetText(strText); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Hide Chat"; button->SetText(strText); } } break; case Toolbar_Button_Participant: { if(Button_UnMuted == btnStatus) { wchar_t* strText = L"Show Participant"; button->SetText(strText); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Hide Participant"; button->SetText(strText); } } break; case Toolbar_Button_ThumbnailVideo: { if(Button_UnMuted == btnStatus) { wchar_t* strText = L"Show Gallery"; button->SetText(strText); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Hide Gallery"; button->SetText(strText); } } break; case Toolbar_Button_Share: { if(Button_UnMuted == btnStatus) { wchar_t* strText = L"Share"; button->SetText(strText); } else if(Button_Muted == btnStatus) { wchar_t* strText = L"Stop Share"; button->SetText(strText); } } break; case Toolbar_Button_Leave: break; default: break; } }
void CreateDiscussionGrpDialog::_AddToGroupMemberList(std::string sid) { if (sid.empty()) { return; } //确认没有重复的项 for (int n = 0; n < m_pListGroupMembers->GetCount();n++) { CControlUI* pItem = m_pListGroupMembers->GetItemAt(n); if (pItem) { CString strId = pItem->GetUserData(); if (!strId.IsEmpty()) { std::string sId = util::cStringToString(strId); if (sId == sid) { return; } } } } //插入ITEM module::UserInfoEntity userInfo; if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo)) { LOG__(DEBG, _T("can't find the userInfo:%s"), util::stringToCString(sid)); return; } CDialogBuilder dlgBuilder; CListContainerElementUI* pListElement = (CListContainerElementUI*)dlgBuilder.Create(_T("CreateDiscussionGrpDialog\\ListGroupMembersItem.xml"), (UINT)0, NULL, &m_PaintManager); if (!pListElement) { LOG__(ERR, _T("群item创建失败")); return; } CControlUI* pLogo = static_cast<CControlUI*>(pListElement->FindSubControl(_T("AvatarInfo"))); if (!pLogo) { return; } pLogo->SetBkImage(util::stringToCString(userInfo.getAvatarPath())); CLabelUI* pNameLable = static_cast<CLabelUI*>(pListElement->FindSubControl(_T("nickname"))); if (!pNameLable) { return; } pNameLable->SetText(userInfo.getRealName()); CButtonUI* pRemoveBtn = static_cast<CButtonUI*>(pListElement->FindSubControl(_T("removebtn"))); if (pRemoveBtn) { //点击删除按钮的时候根据这个来判断是哪个项 pRemoveBtn->SetTag(UINT_PTR(pListElement)); } if (module::getSysConfigModule()->userID() == userInfo.sId)//自己不能删除 { pRemoveBtn->SetVisible(false); } pListElement->SetUserData(util::stringToCString(userInfo.sId)); m_pListGroupMembers->Add(pListElement); }