示例#1
0
void BattleDataViewCtrl::RemoveBattle(IBattle& battle) {
	if (ContainsItem(battle)) {
		RemoveItem(battle);
	} else {
		return;
	}
}
示例#2
0
void BattleDataViewCtrl::UpdateBattle(IBattle& battle) {
	if (ContainsItem(battle)) {
		RefreshItem(battle);
	} else {
		return;
	}
}
示例#3
0
void BattleDataViewCtrl::AddBattle(IBattle& battle) {
	if (ContainsItem(battle)) {
		return;
	} else {
		AddItem(battle);
	}
}
void NickDataViewCtrl::UserUpdated(const User& user)
{

	if (ContainsItem(user)) {
		RefreshItem(user);
	}
	DoUsersFilter();
}
void ChannelListView::FilterChannel(const wxString& partial)
{

	for (auto const item : m_realChannelCollection) {
		if ((partial.IsEmpty()) || (item.second->name.Contains(partial))) {
			if (!ContainsItem(*item.second)) {
				AddItem(*item.second);
			}
		} else {
			if (ContainsItem(*item.second)) {
				RemoveItem(*item.second);
			}
		}
	}

	Resort();
	Refresh();
}
示例#6
0
void DownloadDataViewModel::GetValue(wxVariant& variant,
		const wxDataViewItem& item, unsigned int column) const {

	DownloadInfo * downloadInfo = static_cast<DownloadInfo*>(item.GetID());

	wxASSERT(downloadInfo != nullptr);

    /* In case if wxGTK will try to render invalid item */
    if (downloadInfo == nullptr || ContainsItem(*downloadInfo) == false) {
        variant = wxVariant(wxEmptyString);
        return;
    }

	const int MB = 1024 * 1024;

	switch(column)
	{
	case NAME:
		variant = wxVariant(downloadInfo->GetName());
		break;

	case STATUS:
		if (downloadInfo->IsFinished()) {
			variant = wxVariant(wxString(_("complete")));
		} else {
			variant = wxVariant(wxString(_("downloading")));
		}
		break;

	case P_COMPLETE:
		variant = wxVariant(wxString::Format(wxT("%i%%"), downloadInfo->GetProgressPercent()));
		break;

	case SPEED:
		//TODO: implement
		variant = wxVariant(wxEmptyString);
		break;

	case ETA:
		//TODO: implement
		variant = wxVariant(wxEmptyString);
		break;

	case FILESIZE:
		variant = wxVariant(downloadInfo->GetSize() > 0 ? wxString::Format(wxT("%i"), downloadInfo->GetSize() / MB) : wxString(_T("0")));
		break;

	case DEFAULT_COLUMN:
		//Do nothing
		break;

	default:
		wxASSERT(false);
		break;
	}
}
void NickDataViewCtrl::RemoveUser(const User& user)
{
	if (!RemoveRealUser(user)) {
		return;
	}

	//Only remove added users
	if (ContainsItem(user)) {
		RemoveItem(user);
	}
}
void NickDataViewCtrl::DoUsersFilter()
{

	for (auto const item : m_real_users_list) {
		if (checkFilteringConditions(item.second)) {
			//User passed filter. Add him/her to the list.
			if (!ContainsItem(*item.second)) {
				AddItem(*item.second);
			}
		} else {
			//Remove user from the list.
			if (ContainsItem(*item.second)) {
				RemoveItem(*item.second);
			}
		}
	}

	Resort();
	Refresh();
}
示例#9
0
rOctreeError rOctree<T>::InsertItemWithSphere(const T& item, const sphere_type& s) {
    if (! m_root)
        return rOCTREE_ERROR_NOT_INIT;

    if ( ContainsItem(item))
        return rOCTREE_ERROR_ITEM_ALREADY_IN_TREE;

    if (!rIntersection::AlignedBoxContainsSphere(m_root->m_volume , s))
        return rOCTREE_ERROR_ITEM_DOES_NOT_FIT;

    typename rOctree<T>::node_type* target =InsertItemWithSphereRec(item , s , m_root);
    m_items[item] = target;


    return rOCTREE_ERROR_NONE;
}
示例#10
0
rOctreeError rOctree<T>::InsertItemWithBox(const T& item, const box_type& b) {
    if (! m_root)
        return rOCTREE_ERROR_NOT_INIT;

    if ( ContainsItem(item))
        return rOCTREE_ERROR_ITEM_ALREADY_IN_TREE;

    if (!m_root->m_volume.ContainsBox(b))
        return rOCTREE_ERROR_ITEM_DOES_NOT_FIT;

    typename rOctree<T>::node_type* target = InsertItemWithBoxRec(item , b , m_root);
    m_items[item] = target;


    return rOCTREE_ERROR_NONE;
}
示例#11
0
rOctreeError rOctree<T>::UpdateItemWithBox(T& item, const box_type& b) {
    if (! m_root)
        return rOCTREE_ERROR_NOT_INIT;

    if ( !ContainsItem(item))
        return rOCTREE_ERROR_ITEM_NOT_FOUND;

    if (!m_root->m_volume.ContainsBox(b))
        return rOCTREE_ERROR_ITEM_DOES_NOT_FIT;

    m_items[item]->RemoveItem(item);

    typename rOctree<T>::node_type* target = InsertItemWithBoxRec(item , b , m_root);
    m_items[item] = target;

    return rOCTREE_ERROR_NONE;
}
void ContentSearchResultDataModel::GetValue(wxVariant& variant,
					    const wxDataViewItem& item, unsigned int column) const
{

	ContentSearchResult* searchResult = static_cast<ContentSearchResult*>(item.GetID());

	wxASSERT(searchResult != nullptr);

	/* In case if wxGTK will try to render invalid item */
	if (searchResult == nullptr || !ContainsItem(*searchResult)) {
		variant = wxVariant(wxEmptyString);
		return;
	}

	switch (column) {
		case NAME:
			variant = wxVariant(searchResult->name);
			break;

		case TYPE:
			variant = wxVariant(searchResult->type);
			break;

		case DOWNLOADED:
			variant = wxVariant(searchResult->is_downloaded ? _("Yes") : _("No"));
			break;

		case PREVIEW:
			variant = wxVariant(wxEmptyString);
			break;

		case SIZE:
			variant = wxVariant(wxString::Format(_T("%u"), searchResult->filesize));
			break;

		case DEFAULT_COLUMN:
			variant = wxVariant(wxEmptyString);
			break;

		default:
			wxASSERT(false);
			variant = wxVariant(wxEmptyString);
			break;
	}
}