Exemple #1
0
//更新信息
bool CUserCompanionList::UpdateCompanionInfo(HTREEITEM hTreeItem, tagCompanionItem * pCompanionInfo)
{
	//效验参数
	ASSERT(hTreeItem!=NULL);
	if (hTreeItem==NULL) return false;

	//更新处理
	if (GetTreeItemCompanion(hTreeItem)==pCompanionInfo->Companion)
	{
		//生成标题
		TCHAR szTreeTitle[128]=TEXT("");
		_sntprintf_s(szTreeTitle,CountArray(szTreeTitle),TEXT("%s [ %ld ]"),pCompanionInfo->szAccounts,pCompanionInfo->dwGameID);

		//更新树项
		SetItemText(hTreeItem,szTreeTitle);
	}
	else
	{
		//删除树项
		DeleteItem(hTreeItem);
		InsertCompanionInfo(pCompanionInfo);
	}
	
	return true;
}
Exemple #2
0
void MainWindow::on_mainAir_clicked()
{
    menu = 4;
    int j=0;
    DeleteItem();
    get_devlist(devfd,dev_list);
    ui->mainList->setColumnCount(2);

    for(i=0; i<254; i++)
    {
        if(dev_list[i].addr==255)
            break;
        printf("dev_list[%d].addr=%d\n",i,dev_list[i].addr);
        printf("dev_list[%d].devicetype=%d\n",i,dev_list[i].devicetype);


        if(dev_list[i].devicetype == 4)
        {
            QString str = "TV";

            str.toStdString().c_str();

            ui->mainList->insertRow(j);
            QTableWidgetItem *item = new QTableWidgetItem( QString("Air Controller"), 0);
            ui->mainList->setItem(j, 0, item);
            QTableWidgetItem *item2 = new QTableWidgetItem( str.setNum(dev_list[i].addr), 0);
            ui->mainList->setItem(j, 1, item2);
            j++;
        }

    }
}
Exemple #3
0
	bool Trie::DeleteItem(NodeFrm::POINTER node, const Location& location){

		Location location1 = node->location_;
		if (location1.length() > location.length()){
			return false;
		}

		if (location == location1){
			node->MarkRemove();
			return true;
		}

		Location common = CommonPrefix(location1, location);

		int branch = NextBranch(common, location);
		NodeFrm::POINTER node2 = ChildMayFromDB(node, branch);
		if (node2 == nullptr){
			return false;
		}

		Location location2 = node2->location_;
		Location common2 = CommonPrefix(location2, location);
		if (location2 != common2){
			return false;
		}
		bool ret = DeleteItem(node2, location);
		node->modified_ |= ret;
		return ret;
	}
Exemple #4
0
//==============================================================================
// Brief  : デストラクタ
// Return :								: なし
// Arg    :								: なし
//==============================================================================
CManagerObjectImage::~CManagerObjectImage( void )
{
	// ステートテーブルの破棄
	if( m_ppTableState != nullptr )
	{
		for( int cntState = 0; cntState < CObjectImage::STATE_MAX; ++cntState )
		{
			delete m_ppTableState[ cntState ];
			m_ppTableState[ cntState ] = nullptr;
		}
	}
	delete[] m_ppTableState;
	m_ppTableState = nullptr;

	// 生成した要素の破棄
	for( auto pItemCurrent = m_pImage->m_pItemTop; pItemCurrent != nullptr; pItemCurrent = pItemCurrent->m_pNext )
	{
		DeleteItem( pItemCurrent );
	}

	// ポリゴン描画設定の破棄
	delete m_pRenderParameterPolygon;
	m_pRenderParameterPolygon = nullptr;

	// リストの破棄
	delete m_pImage;
	m_pImage = nullptr;
}
Exemple #5
0
//==============================================================================
// Brief  : 破棄する要素の指定処理
// Return : void							: なし
// Arg    : unsigned int id				: 破棄するオブジェクトのID
//==============================================================================
void CManagerObjectImage::Delete( unsigned int id )
{
	// 要素の破棄
	auto	pItem = m_pImage->GetItem( id );
	DeleteItem( pItem );
	m_pImage->Delete( id );
}
void CDirectoryTreeCtrl::OnTvnItemexpanding(NMHDR *pNMHDR, LRESULT *pResult)
{
	CWaitCursor curWait;
	SetRedraw(FALSE);

	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
	HTREEITEM hItem = pNMTreeView->itemNew.hItem;
	// remove all subitems
	HTREEITEM hRemove = GetChildItem(hItem);
	while(hRemove)
	{
		DeleteItem(hRemove);
		hRemove = GetChildItem(hItem);
	}

	// get the directory
	CString strDir = GetFullPath(hItem);

	// fetch all subdirectories and add them to the node
	AddSubdirectories(hItem, strDir);

	SetRedraw(TRUE);
	Invalidate();
	*pResult = 0;
}
Exemple #7
0
// Frees the memory allocated for the item and removes it from the list. 
BOOL MyListCtrl::FreeItem(int Index)
{
	ITEMINFO* pItem=(ITEMINFO*)GetItemData(Index);
	if(pItem)
		delete pItem;
	return DeleteItem(Index);
}
Exemple #8
0
BOOL CTabCtrlSSL::RemoveSSLPage (int nIndex) {
	if (nIndex >= GetItemCount ())
		return FALSE;

	// Notify derived classes that the page is being destroyed.
	OnDestroyPage (nIndex, m_nPageIDs[nIndex]);

	// Switch pages if the page being deleted is the current page and it's
	// not the only remaining page.
	int nCount = GetItemCount ();
	if (nCount > 1 && nIndex == GetCurSel ()) {
		int nPage = nIndex + 1;
		if (nPage >= nCount)
			nPage = nCount - 2;
		ActivateSSLPage (nPage);
	}

	// Remove the page from the tab control.
	DeleteItem (nIndex);

	// Destroy the dialog (if any) that represents the page.
    TabDelete tabDelete = m_tabs[nIndex];
    CTabPageSSL* pDialog = tabDelete.pTabPage;
	if (pDialog != NULL) {
		pDialog->DestroyWindow ();	
		delete pDialog;
	}

	// Clean up, repaint, and return.
	m_tabs.RemoveAt (nIndex);
	m_hFocusWnd.RemoveAt (nIndex);
	m_nPageIDs.RemoveAt (nIndex);
	Invalidate ();
	return TRUE;
}
Exemple #9
0
int main()
{
	HashList hl;
	char choose;

	InitHashList(hl);
	while((choose = Menu()) != 'd')
	{
		switch(choose)
		{
		case 'a'://插入数据
			InsertItem(hl);
			break;
		case 'b'://查询数据
			SearchItem(hl);
			break;
		case 'c'://删除数据
			DeleteItem(hl);
			break;
		default:
			puts("请输入a、b、c来进行选择操作");
			break;
		}
	}
	ClearHashList(hl);
	return 0;
}
void CLibraryFolderCtrl::Update(DWORD nUpdateCookie)
{
	CPtrList pAlready;

	for ( HTREEITEM hItem = GetChildItem( m_hRoot ) ; hItem ; )
	{
		HTREEITEM hNext = GetNextSiblingItem( hItem );

		CLibraryFolder* pFolder = (CLibraryFolder*)GetItemData( hItem );

		if ( LibraryFolders.CheckFolder( pFolder ) )
		{
			Update( pFolder, hItem, NULL, nUpdateCookie, FALSE );
			pAlready.AddTail( pFolder );
		}
		else
		{
			DeleteItem( hItem );
		}

		hItem = hNext;
	}

	for ( POSITION pos = LibraryFolders.GetFolderIterator() ; pos ; )
	{
		CLibraryFolder* pFolder = LibraryFolders.GetNextFolder( pos );

		if ( pAlready.Find( pFolder ) == NULL )
		{
			Update( pFolder, NULL, m_hRoot, nUpdateCookie, FALSE );
		}
	}
}
Exemple #11
0
static void PurgeOldConnections(Item **list, time_t now)
   /* Some connections might not terminate properly. These should be cleaned
      every couple of hours. That should be enough to prevent spamming. */
{
    assert(list != NULL);

    Log(LOG_LEVEL_DEBUG, "Purging Old Connections...");

    if (ThreadLock(cft_count))
    {
        Item *ip, *next;
        for (ip = *list; ip != NULL; ip = next)
        {
            int then = 0;
            sscanf(ip->classes, "%d", &then);

            next = ip->next;

            if (now > then + 7200)
            {
                Log(LOG_LEVEL_VERBOSE,
                    "IP address '%s' has been more than two hours in connection list, purging",
                    ip->name);
                DeleteItem(list, ip);
            }
        }
        ThreadUnlock(cft_count);
    }

    Log(LOG_LEVEL_DEBUG, "Done purging old connections");
}
Exemple #12
0
LRESULT KGTreeCtrl::OnDel(WPARAM wParam, LPARAM lParam)
{
	int nResult  = false;
	int nRetCode = false;

	HTREEITEM hDelItem  = NULL;
	HTREEITEM hNextItem = NULL;

	int nItemDate = 0;

	hDelItem = (HTREEITEM)wParam;;
	KG_PROCESS_ERROR(hDelItem);

	hNextItem = GetNextSiblingItem(hDelItem);

	nRetCode = BeginDelItem(hDelItem);
	KG_PROCESS_ERROR(nRetCode);

	nRetCode = DeleteItem(hDelItem);
	KG_PROCESS_ERROR(nRetCode);

	nRetCode = AfterDelItem(hNextItem);
	KG_PROCESS_ERROR(nRetCode);

	nResult = true;
Exit0:
	return nResult;
}
Exemple #13
0
int CReportCtrl::DeleteAllItems(DWORD dwStates)
{
	EndEdit(FALSE);
	int nItemCount = CListCtrl::GetItemCount();
	if (dwStates & RC_ITEM_ALL)
	{
		LockWindowUpdate();
		for (int i = 0; i < nItemCount; i++)
			_FreeItemMemory(i);
		CListCtrl::DeleteAllItems();
		UnlockWindowUpdate();
		return nItemCount;		
	}
	
	int nDelCount = 0;
	LockWindowUpdate();

	for (int i = 0; i < nItemCount; i++)
	{
		if (ExamItemStates(i, dwStates))
		{
			DeleteItem(i--);
			nItemCount--;
			nDelCount++;
		}
	}	
	UnlockWindowUpdate();
	return nDelCount;
}
void CInstrumentList::RemoveInstrument(int Index)
{
	// Remove an instrument from the list (Index = instrument number)
	int Selection = FindInstrument(Index);
	if (Selection != -1)
		DeleteItem(Selection);
}
void CXTPMDIWndTab::OnMDIDestroy(HWND hWnd)
{
	// Loop through all of the tabs to find the view that has closed.
	int iItem;
	for (iItem = 0; iItem < GetItemCount(); ++iItem)
	{
		// Get the item data for this tab.
		TC_ITEM tci;
		tci.mask = TCIF_PARAM;

		if (GetItem(iItem, &tci))
		{
			MDICHILD* pMDIChild = (MDICHILD*)tci.lParam;
			ASSERT(pMDIChild != NULL);

			// If it is the closed window remove it and exit loop.
			if (pMDIChild && (hWnd == pMDIChild->hWnd))
			{
				POSITION pos = m_arMDIChildern.Find(pMDIChild);
				if (pos)
				{
					m_arMDIChildern.RemoveAt(pos);
					SAFE_DELETE(pMDIChild);
				}

				DeleteItem(iItem);
				break;
			}
		}
	}

	RefreshIndexes();
	RecalcLayout(TRUE);
}
// Moves the tab from the old position to the new position
void COXDockTabCtrl::RepositionTabs(int iOldIndex, int iNewIndex, CPoint point)
{
	// To avoid flashing only reposition if the mouse cursor is behind the midpoint
	// of the next or previous item
	
	CRect rectNew;
	GetItemRect(iNewIndex, rectNew);
	ScreenToClient(&point);
	if (iOldIndex < iNewIndex)
	{
		// The new tab is to the right
		if (point.x < rectNew.CenterPoint().x)
			return; // the mouse cursor is not far enough to the right
	}
	else
	{
		// The new tab is to the left
		if (point.x > rectNew.CenterPoint().x)
			return; // the mouse cursor is not far enough to the left
	}

	TCHAR szBuffer[256];

	TCITEM tci;
	tci.mask = TCIF_TEXT | TCIF_PARAM;
	tci.pszText = szBuffer;
	tci.cchTextMax = 256;
	GetItem(iOldIndex, &tci);

	DeleteItem(iOldIndex);
	InsertItem(iNewIndex, &tci);
}
Exemple #17
0
//*****************************************************************************
//*
//*		ListDeleteItem
//*
//*****************************************************************************
//	Deletes an item in a Tree-List-Control which is used as List-Control
//	iRow	: Is the row of the item
//	Returns TRUE if the item was deleted or FALSE if an error occurs
BOOL CTreeListCtrl::ListDeleteItem(int iRow) {

	ASSERT(::IsWindow(m_hWnd));


	return DeleteItem(GetItemOfRow(iRow));
}
bool SCH_SCREEN::SchematicCleanUp()
{
    bool      modified = false;

    for( SCH_ITEM* item = m_drawList.begin() ; item; item = item->Next() )
    {
        if( ( item->Type() != SCH_LINE_T ) && ( item->Type() != SCH_JUNCTION_T ) )
            continue;

        bool restart;

        for( SCH_ITEM* testItem = item->Next(); testItem; testItem = restart ? m_drawList.begin() : testItem->Next() )
        {
            restart = false;

            if( ( item->Type() == SCH_LINE_T ) && ( testItem->Type() == SCH_LINE_T ) )
            {
                SCH_LINE* line = (SCH_LINE*) item;

                if( line->MergeOverlap( (SCH_LINE*) testItem ) )
                {
                    // Keep the current flags, because the deleted segment can be flagged.
                    item->SetFlags( testItem->GetFlags() );
                    DeleteItem( testItem );
                    restart = true;
                    modified = true;
                }
            }
            else if ( ( ( item->Type() == SCH_JUNCTION_T )
                      && ( testItem->Type() == SCH_JUNCTION_T ) ) && ( testItem != item ) )
            {
                if ( testItem->HitTest( item->GetPosition() ) )
                {
                    // Keep the current flags, because the deleted segment can be flagged.
                    item->SetFlags( testItem->GetFlags() );
                    DeleteItem( testItem );
                    restart = true;
                    modified = true;
                }
            }
        }
    }

    TestDanglingEnds();

    return modified;
}
void CCtlPendingOrders::DeleteOrder( const char* szID ) {
  LVFINDINFO info;
  info.psz = szID;
  int ix = FindItem( &info );
  if ( -1 != ix ) {
    DeleteItem( ix );
  }
}
Exemple #20
0
// delete selection set from tree and selection set
void CMultiSelTreeCtrl::DeleteSelectedItems()	
{
	for(int i= m_SelectionSet.GetSize()-1; i >= 0; i++)
	{
		DeleteItem((HTREEITEM) m_SelectionSet.GetAt(i));	
	}
	ClearSelection();
}
void wxGISToolExecuteView::OnObjectDeleted(wxGxCatalogEvent& event)
{
    for(long i = 0; i < GetItemCount(); ++i)
    {
        if(GetItemData(i) == event.GetObjectID())
            DeleteItem(i);
    }
}
Exemple #22
0
void CCycleMonitor::OnDeleteall() 
{
	int dotimes = m_cyclechild[m_curChild].GetCurRow();
	for (int i = 0; i < dotimes; i++)
	{
		DeleteItem(0);
	}
}
Exemple #23
0
//==============================================================================
// Brief  : 破棄する要素の指定処理
// Return : void							: なし
// Arg    : unsigned int id				: 破棄するオブジェクトのID
//==============================================================================
void CManagerObjectHuman::Delete( unsigned int id )
{
	// 要素の破棄
	auto	pItem = m_pHuman->GetItem( id );

	// 要素の破棄
	DeleteItem( pItem );
}
Exemple #24
0
void CDownloads_History::DeleteRecord(fsDLHistoryRecord *rec)
{
	m_mxAddDel.Lock ();
	int iItem = FindRecord (rec);
	if (iItem != -1)
		DeleteItem (iItem);
	m_mxAddDel.Unlock ();
}
Exemple #25
0
void EQEmu::ItemInstance::PutItem(uint8 index, const ItemInstance& inst)
{
	// Clean up item already in slot (if exists)
	DeleteItem(index);

	// Delegate to internal method
	_PutItem(index, inst.Clone());
}
Exemple #26
0
void CSharedDirsTreeCtrl::DeleteChildItems(CDirectoryItem* pParent){
	while(!pParent->liSubDirectories.IsEmpty()){
		CDirectoryItem* pToDelete = pParent->liSubDirectories.RemoveHead();
		DeleteItem(pToDelete->m_htItem);
		DeleteChildItems(pToDelete);
		delete pToDelete;
	}
}
Exemple #27
0
//deletes the entire tree
void CLTWinTreeMgr::DeleteTree()
{
	//just delete every single item
	while(m_pRoot)
	{
		DeleteItem(ItemToKey(m_pRoot));
	}
}
Exemple #28
0
int main()
{
	DoublyList *list;
	Element temp;

	list = CreateDoublyList();

	temp.key = 1;
	AddFirstItem(list, temp);
	PrintList(list);

	temp.key = 2;
	AddFirstItem(list, temp);
	PrintList(list);

	temp.key = 3;
	AddFirstItem(list, temp);
	PrintList(list);

	temp.key = 50;
	AddFirstItem(list, temp);
	PrintList(list);

	temp.key = 40;
	AddLastItem(list, temp);
	PrintList(list);

	temp.key = 30;
	AddLastItem(list, temp);
	PrintList(list);

	DeleteItem(list, 3);
	PrintList(list);

	DeleteItem(list, 30);
	PrintList(list);

	DeleteItem(list, 50);
	PrintList(list);

	DeleteItem(list, 11);
	PrintList(list);

	return 0;

}
Exemple #29
0
void StreamTable::removeSelectedStream() {
    // TODO: code this.
    long item = -1;
    item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
    if (item >= 0) {
        DeleteItem(item);
    }
}
Exemple #30
0
void CReportCtrl::DeleteGroupsClient( int nIndex , ClientList& list )
{
	for (UINT i = 0 ; i < list.size() ; i ++)
	{
		delete (void*)GetItemData(nIndex+1);
		DeleteItem(nIndex+1);
	}
}