void CUITreeViewItem::MarkArticleAsRead(bool value) { // Если элемент рутовый, то мы его маркаем его, и все чилды if (IsRoot()) { m_bArticleRead = value; if(!m_bManualSetColor) SetItemColor(); for (SubItems_it it = vSubItems.begin(); it != vSubItems.end(); ++it) { (*it)->m_bArticleRead = value; (*it)->SetItemColor(); if ((*it)->IsRoot()) (*it)->MarkArticleAsRead(value); } } else { // Если же нет, то маркаем себя и говорим проверить свой парентовый элемент m_bArticleRead = value; if(!m_bManualSetColor) SetItemColor(); CheckParentMark(GetOwner()); } }
void CImageTreeCtrl::SetSelectItem(HTREEITEM hItem) { if(old_hItem != hItem) { if(old_hItem!=NULL) { SetItemBold(old_hItem,0); SetItemColor( old_hItem, RGB(0,0,0)); } old_hItem = hItem; } SetItemBold(hItem,1); SetItemColor( hItem, RGB(255,0,0)); }
void CHostList::InsertGroupsClient( int nIndex , ClientList& list ) { ClientList::iterator it = list.begin(); for ( ; it != list.end(); it ++) { int i = AddClientInfo(it->second); if (IsAlive(it->second->clientid)) SetItemColor((int)it->second,RGB(255,0,0)); else SetItemColor((int)it->second,RGB(96,96,96)); Update(i); } }
void wxBasePlayerGameListCtrl::OnUpdatePlayers(const GamePtr &game) { sPlayers.clear(); Lock(); // First, clear all of the current names. for(size_t i = 0; i < GetItemCount(); ++i) { SetItemText(i, swPlayer, swEmpty); } // Then, set all of the players in the game. for(wxInt32 i = 0; i < game->numPlayers(); ++i) { const PlayerGame &playerGame = game->playerGame(i); // Read the player's name and color. ColorType color = playerGame.color(); const Player &player = playerGame.player(); // Set it in the map and the control. sPlayers[color] = player; SetItemText(color, swPlayer, player.Name()); // Allow derived classes to set text colors. SetItemColor(playerGame, color); } // Clear any current selection. SetSelectedItem(-1); Unlock(); }
void CHostList::DeleteClientInfo(CLIENT_INFO* pInfo) { int nCount = GetItemCount(); // GroupMap::iterator it = m_GroupsMap.find(pInfo->groups); // if (it != m_GroupsMap.end()) // { // ClientList::iterator cit = it->second.find(pInfo->clientid); // // if (cit != it->second.end()) // { // it->second.erase(cit); // } // } for (int i = 0 ; i < nCount ; i++) { DWORD dwData = GetItemData(i); if (dwData > 1) { CLIENT_INFO *itemInfo = (CLIENT_INFO*)dwData; if (CString(itemInfo->clientid) == CString(pInfo->clientid)) { SetItemColor((int)pInfo,RGB(96,96,96)); Update(i); } } } }
//---------------------------- PRIVATE -----------------------------// void wxNetworkRestartListCtrl::OnUpdatePlayers(const GamePtr &game) { Lock(); DeleteAllItems(); // Then, set all of the players in the game. for(wxInt32 i = 0; i < game->numPlayers(); ++i) { const PlayerGame &playerGame = game->playerGame(i); // Read the player's name and color. ColorType color = playerGame.color(); const Player &player = playerGame.player(); // Create the image used to represent them. wxImage image = ColorInfoData::UIImage(color, wxSize(32, 32)); // Set it in the map and the control. wxString name; if(NullPlayer == player) { name = stWaiting; } else { name = player.Name(); } size_t index = AppendItem(name, image); // Set their color based on their presence or absence. SetItemColor(index, SKIN.Element(NullPlayer == player ? shNetworkRestartAbsent : shNetworkRestartPresent)); // Get the sorted original list. PlayerGame::TurnPlayerMap originals; playerGame.originalPlayers(originals); // Now add them in string form. wxString str; PlayerGame::TurnPlayerMap::const_iterator itMap, itMapEnd = originals.end(); for(itMap = originals.begin(); itMap != itMapEnd; ++itMap) { if(originals.begin() != itMap) { str += swCommaSpace; } str += wxString::Format(swStringInt.c_str(), itMap->second.Name().c_str(), itMap->first); } SetItemText(index, swOriginalPlayer, str); } Unlock(); }