bool CGroupsUI::SelectItem(int iIndex, bool bTakeFocus) { if( iIndex == m_iCurSel ) return true; // We should first unselect the currently selected item if( m_iCurSel >= 0 ) { CControlUI* pControl = GetItemAt(m_iCurSel); if( pControl != NULL) { IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem"))); if( pListItem != NULL ) { CListContainerElementUI* pFriendListItem = static_cast<CListContainerElementUI*>(pControl); Node* node = (Node*)pControl->GetTag(); if ((pFriendListItem != NULL) && (node != NULL) && !node->folder()) { // pFriendListItem->SetFixedHeight(kFriendListItemNormalHeight); // CContainerUI* pOperatorPannel = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pFriendListItem, kOperatorPannelControlName)); // if (pOperatorPannel != NULL) // { // pOperatorPannel->SetVisible(false); // } } pListItem->Select(false); } } m_iCurSel = -1; } if( iIndex < 0 ) return false; if (!__super::SelectItem(iIndex, bTakeFocus)) return false; CControlUI* pControl = GetItemAt(m_iCurSel); if( pControl != NULL) { CListContainerElementUI* pFriendListItem = static_cast<CListContainerElementUI*>(pControl); Node* node = (Node*)pControl->GetTag(); if ((pFriendListItem != NULL) && (node != NULL) && !node->folder()) { // pFriendListItem->SetFixedHeight(kFriendListItemSelectedHeight); // CContainerUI* pOperatorPannel = static_cast<CContainerUI*>(paint_manager_.FindSubControlByName(pFriendListItem, kOperatorPannelControlName)); // if (pOperatorPannel != NULL) // { // pOperatorPannel->SetVisible(true); // } //pFriendListItem->SetBkImage() } } return true; }
void CGroupsUI::SetChildVisible(Node* node, bool visible) { if (!node || node == root_node_) return; if (node->data().child_visible_ == visible) return; node->data().child_visible_ = visible; TCHAR szBuf[MAX_PATH] = {0}; CDuiString html_text; if (node->data().has_child_) { if (node->data().child_visible_) html_text += level_expand_image_; else html_text += level_collapse_image_; _stprintf_s(szBuf, MAX_PATH - 1, _T("<x %d>"), level_text_start_pos_); html_text += szBuf; html_text += node->data().text_; CLabelUI* nick_name = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(node->data().list_elment_, kNickNameControlName)); if (nick_name != NULL) { nick_name->SetShowHtml(true); nick_name->SetText(html_text); } } if (!node->data().list_elment_->IsVisible()) return; if (!node->has_children()) return; Node* begin = node->child(0); Node* end = node->get_last_child(); for (int i = begin->data().list_elment_->GetIndex(); i <= end->data().list_elment_->GetIndex(); ++i) { CControlUI* control = GetItemAt(i); if (_tcsicmp(control->GetClass(), _T("ListContainerElementUI")) == 0) { if (visible) { Node* local_parent = ((Node*)control->GetTag())->parent(); if (local_parent->data().child_visible_ && local_parent->data().list_elment_->IsVisible()) { control->SetVisible(true); } } else { control->SetVisible(false); } } } }
void CUIDesignerView::OnRemoveUI() { CArray<CControlUI*,CControlUI*> arrSelected; m_MultiTracker.GetSelected(arrSelected); //remove form for (int i=0; i<arrSelected.GetSize(); i++) { CControlUI* pControl = arrSelected[i]; if(pControl == m_LayoutManager.GetForm()) { arrSelected.RemoveAt(i); break;; } } m_UICommandHistory.Begin(arrSelected, actionDelete); for(int i=0; i<arrSelected.GetSize(); i++) { CControlUI* pControl = arrSelected[i]; CControlUI* pParent=pControl->GetParent(); HTREEITEM hDelete=(HTREEITEM)(((ExtendedAttributes*)pControl->GetTag())->hItem); g_pClassView->RemoveUITreeItem(hDelete); RemoveUI(pControl); if(pParent) pParent->NeedUpdate(); } m_UICommandHistory.End(); g_pPropertiesWnd->HideAllProperties(TRUE,TRUE); m_MultiTracker.RemoveAll(); }
void CUIDesignerView::OnDeleteUI() { CArray<CControlUI*,CControlUI*> arrSelected; m_MultiTracker.GetSelected(arrSelected); RemoveForm(arrSelected); if(arrSelected.IsEmpty()) return; m_UICommandHistory.Begin(arrSelected, actionDelete); for(int i=0; i<arrSelected.GetSize(); i++) { CControlUI* pControl = arrSelected[i]; CControlUI* pParent=pControl->GetParent(); HTREEITEM hDelete=(HTREEITEM)(((ExtendedAttributes*)pControl->GetTag())->hItem); g_pClassView->RemoveUITreeItem(hDelete); DeleteUI(pControl); if(pParent) pParent->NeedUpdate(); } m_UICommandHistory.End(); g_pPropertiesWnd->ShowProperty(NULL); m_MultiTracker.RemoveAll(); this->GetDocument()->SetModifiedFlag(); }
static bool OnLogoButtonEvent(void* event) { if( ((TEventUI*)event)->Type == UIEVENT_BUTTONDOWN ) { CControlUI* pButton = ((TEventUI*)event)->pSender; if( pButton != NULL ) { CListContainerElementUI* pListElement = (CListContainerElementUI*)(pButton->GetTag()); if( pListElement != NULL ) pListElement->DoEvent(*(TEventUI*)event); } } return true; }
static bool OnNorMenuButtonEvent(void* event) { if( ((TEventUI*)event)->Type == UIEVENT_BUTTONDOWN ) { CControlUI* pButton = ((TEventUI*)event)->pSender; if( pButton != NULL ) { YSongListItemUI* pListElement = (YSongListItemUI*)(pButton->GetTag()); if( pListElement != NULL ) pListElement->DoEvent(*(TEventUI*)event); } } return true; }
bool CBookClient::RemoveAt(int nIndex) { CControlUI* pCtrl = this->GetItemAt(nIndex); BOOK_INFO *node = (BOOK_INFO*)pCtrl->GetTag(); ASSERT(node != NULL); delete node; return CTileLayoutUI::RemoveAt(nIndex); }
void CALLBACK CUICommandHistory::UIDelete(TiXmlNode* pNode) { TiXmlElement* pElement = pNode->ToElement(); CStringA strName = pElement->Attribute("myname"); if(strName.IsEmpty()) return; CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView(); CPaintManagerUI* pManager = pUIView->GetPaintManager(); CControlUI* pControl = pManager->FindControl(StringConvertor::Utf8ToWide(strName)); if(pControl == NULL) return; CControlUI* pParent=pControl->GetParent(); HTREEITEM hDelete=(HTREEITEM)(((ExtendedAttributes*)pControl->GetTag())->hItem); g_pClassView->RemoveUITreeItem(hDelete); pUIView->DeleteUI(pControl); if(pParent) pParent->NeedUpdate(); }
static bool OnLogoButtonEvent(void* event) { if (((TEventUI*)event)->Type == UIEVENT_BUTTONDOWN) { CControlUI* pButton = ((TEventUI*)event)->pSender; if (pButton != NULL) { CListContainerElementUI* pListElement = (CListContainerElementUI*)(pButton->GetTag()); if (pListElement != NULL) { pListElement->DoEvent(*(TEventUI*)event); std::string sid = util::cStringToString(CString(pListElement->GetUserData())); if (!sid.empty()) { //show the detail window. module::getSysConfigModule()->asynNotifyObserver(module::KEY_SYSCONFIG_SHOW_USERDETAILDIALOG, sid); } } } } return true; }
static bool OnButtonEvent(void* event) { if (((TEventUI*)event)->Type == UIEVENT_BUTTONDOWN) { CControlUI* pButton = ((TEventUI*)event)->pSender; if (pButton != NULL) { CListContainerElementUI* pListElement = (CListContainerElementUI*)(pButton->GetTag()); if (pButton->GetName() == kcreatGroupControlName) { //创建讨论组 std::string sid; module::getGroupListModule()->onCreateDiscussionGrpDialog(sid); } else { if (pListElement != NULL) pListElement->DoEvent(*(TEventUI*)event); } } } return true; }
void CGroupsTreelistUI::ClearItemMsgCount(IN const std::string& sId) { int nPos = 0; BOOL bFind = FALSE; CControlUI* pListElement = nullptr; for (; nPos < GetCount(); ++nPos) { pListElement = GetItemAt(nPos); if (pListElement) { UINT_PTR data = pListElement->GetTag(); Node* node = (Node*)data; if (!node) { continue; } CString strID = node->data().sId; if (util::cStringToString(strID) == sId) { bFind = TRUE; break; } } } if (!bFind) { APP_LOG(LOG_DEBUG, _T("CUISessionList::ClearItemMsgCount,can't find the item")); return; } //清除未读计数 CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName)); if (!Unreadcnt_button) { APP_LOG(LOG_DEBUG, _T("CUISessionList::ClearItemMsgCount,can't find the Unreadcnt_button")); return; } Unreadcnt_button->SetText(_T("")); Unreadcnt_button->SetVisible(false); }
BOOL CGroupsTreelistUI::UpdateItemBySId(const std::string& sId) { if (sId.empty()) { return FALSE; } int nPos = 0; BOOL bFind = FALSE; CControlUI* pListElement = nullptr; Node* node = nullptr; for (; nPos < GetCount(); ++nPos) { pListElement = GetItemAt(nPos); if (pListElement) { UINT_PTR data = pListElement->GetTag(); node = (Node*)data; if (!node) { continue; } CString strID = node->data().sId; if (util::cStringToString(strID) == sId) { bFind = TRUE; break; } } } if (!bFind) { return FALSE; } PTR_FALSE(pListElement); if (!SessionDialogManager::getInstance()->findSessionDialogBySId(sId))//窗口不存在的时候更新计数 { //更新未读计数 CLabelUI* Unreadcnt_button = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(pListElement, kUnreadcntControlName)); if (!Unreadcnt_button) { return FALSE; } UInt32 nCnt = ReceiveMsgManage::getInstance()->getUnReadMsgCountBySId(sId); if (0 == nCnt) { Unreadcnt_button->SetVisible(false); //没有消息不用更新 return FALSE; } else if (nCnt <= 99) { Unreadcnt_button->SetText(util::int32ToCString(nCnt)); Unreadcnt_button->SetVisible(true); } else if (nCnt > 99) { Unreadcnt_button->SetText(_T("99+")); Unreadcnt_button->SetVisible(true); } } return TRUE; }